Lines Matching +full:magic +full:- +full:packet
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * GeneSys GL620USB-A based links
4 * Copyright (C) 2001 by Jiun-Jie Huang <huangjj@genesyslogic.com.tw>
23 * GeneSys GL620USB-A (www.genesyslogic.com.tw)
29 * - GL620USB-A is full duplex; GL620USB is only half duplex for bulk.
30 * (Some cables, like the BAFO-100c, use the half duplex version.)
31 * - For the full duplex model, the low bit of the version code says
33 * - For the half duplex type, a control/interrupt handshake settles
37 * Original code from Jiun-Jie Huang <huangjj@genesyslogic.com.tw>
49 // max transmit packet number per transmit
51 // max packet length
70 struct gl_packet *packet; in genelink_rx_fixup() local
76 if (skb->len < dev->net->hard_header_len) in genelink_rx_fixup()
79 header = (struct gl_header *) skb->data; in genelink_rx_fixup()
81 // get the packet count of the received skb in genelink_rx_fixup()
82 count = le32_to_cpu(header->packet_count); in genelink_rx_fixup()
84 netdev_dbg(dev->net, in genelink_rx_fixup()
85 "genelink: invalid received packet count %u\n", in genelink_rx_fixup()
90 // set the current packet pointer to the first packet in genelink_rx_fixup()
91 packet = &header->packets; in genelink_rx_fixup()
93 // decrement the length for the packet count size 4 bytes in genelink_rx_fixup()
97 // get the packet length in genelink_rx_fixup()
98 size = le32_to_cpu(packet->packet_length); in genelink_rx_fixup()
100 // this may be a broken packet in genelink_rx_fixup()
102 netdev_dbg(dev->net, "genelink: invalid rx length %d\n", in genelink_rx_fixup()
107 // allocate the skb for the individual packet in genelink_rx_fixup()
111 // copy the packet data to the new skb in genelink_rx_fixup()
112 skb_put_data(gl_skb, packet->packet_data, size); in genelink_rx_fixup()
116 // advance to the next packet in genelink_rx_fixup()
117 packet = (struct gl_packet *)&packet->packet_data[size]; in genelink_rx_fixup()
118 count--; in genelink_rx_fixup()
124 // skip the packet length field 4 bytes in genelink_rx_fixup()
127 if (skb->len > GL_MAX_PACKET_LEN) { in genelink_rx_fixup()
128 netdev_dbg(dev->net, "genelink: invalid rx length %d\n", in genelink_rx_fixup()
129 skb->len); in genelink_rx_fixup()
139 int length = skb->len; in genelink_tx_fixup()
145 // FIXME: magic numbers, bleech in genelink_tx_fixup()
146 padlen = ((skb->len + (4 + 4*1)) % 64) ? 0 : 1; in genelink_tx_fixup()
151 skb->data = memmove(skb->head + (4 + 4*1), in genelink_tx_fixup()
152 skb->data, skb->len); in genelink_tx_fixup()
153 skb_set_tail_pointer(skb, skb->len); in genelink_tx_fixup()
164 // attach the packet count to the header in genelink_tx_fixup()
172 if ((skb->len % dev->maxpacket) == 0) in genelink_tx_fixup()
180 dev->hard_mtu = GL_RCV_BUF_SIZE; in genelink_bind()
181 dev->net->hard_header_len += 4; in genelink_bind()
182 dev->in = usb_rcvbulkpipe(dev->udev, dev->driver_info->in); in genelink_bind()
183 dev->out = usb_sndbulkpipe(dev->udev, dev->driver_info->out); in genelink_bind()
204 USB_DEVICE(0x05e3, 0x0502), // GL620USB-A
226 MODULE_AUTHOR("Jiun-Jie Huang");
227 MODULE_DESCRIPTION("GL620-USB-A Host-to-Host Link cables");