aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2007-10-06 08:15:46 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:55:13 -0400
commitdd9fa2d21aebbb618318954867c5dfe3751328be (patch)
tree5487966881a7c4ca7061d52572d583ec4a9877d6 /drivers/net/wireless/rt2x00/rt2x00usb.c
parent9ee8f57e0adfd929759fee1ec6a7900ae6851bc5 (diff)
[PATCH] rt2x00: Add get_tx_data_len callback function
The TX datalen must always be converted to a value rt73 and rt2500usb understand. Both require to use a different size then skb->len. First off this is required because the descriptor must be added, but the second is because the value must be a multiple of either 2 or 4, and it should not be a multiple of the USB packetmax Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 66e47615f2a6..73cc726c4046 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -157,9 +157,10 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
157{ 157{
158 struct usb_device *usb_dev = 158 struct usb_device *usb_dev =
159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); 159 interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
160 struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
161 struct data_entry *entry = rt2x00_get_data_entry(ring); 160 struct data_entry *entry = rt2x00_get_data_entry(ring);
162 u32 length = skb->len; 161 int pipe = usb_sndbulkpipe(usb_dev, 1);
162 int max_packet = usb_maxpacket(usb_dev, pipe, 1);
163 u32 length;
163 164
164 if (rt2x00_ring_full(ring)) { 165 if (rt2x00_ring_full(ring)) {
165 ieee80211_stop_queue(rt2x00dev->hw, control->queue); 166 ieee80211_stop_queue(rt2x00dev->hw, control->queue);
@@ -178,25 +179,29 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
178 /* 179 /*
179 * Add the descriptor in front of the skb. 180 * Add the descriptor in front of the skb.
180 */ 181 */
181 skb_push(skb, rt2x00dev->hw->extra_tx_headroom); 182 skb_push(skb, ring->desc_size);
182 memset(skb->data, 0x00, rt2x00dev->hw->extra_tx_headroom); 183 memset(skb->data, 0, ring->desc_size);
183 184
184 rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data, 185 rt2x00lib_write_tx_desc(rt2x00dev, (struct data_desc *)skb->data,
185 ieee80211hdr, length, control); 186 (struct ieee80211_hdr *)(skb->data +
187 ring->desc_size),
188 skb->len - ring->desc_size, control);
186 memcpy(&entry->tx_status.control, control, sizeof(*control)); 189 memcpy(&entry->tx_status.control, control, sizeof(*control));
187 entry->skb = skb; 190 entry->skb = skb;
188 191
189 /* 192 /*
190 * Length passed to usb_fill_urb cannot be an odd number, 193 * USB devices cannot blindly pass the skb->len as the
191 * so add 1 byte to make it even. 194 * length of the data to usb_fill_bulk_urb. Pass the skb
195 * to the driver to determine what the length should be.
192 */ 196 */
193 length += rt2x00dev->hw->extra_tx_headroom; 197 length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev,
194 if (length % 2) 198 max_packet, skb);
195 length++;
196 199
200 /*
201 * Initialize URB and send the frame to the device.
202 */
197 __set_bit(ENTRY_OWNER_NIC, &entry->flags); 203 __set_bit(ENTRY_OWNER_NIC, &entry->flags);
198 usb_fill_bulk_urb(entry->priv, usb_dev, 204 usb_fill_bulk_urb(entry->priv, usb_dev, pipe,
199 usb_sndbulkpipe(usb_dev, 1),
200 skb->data, length, rt2x00usb_interrupt_txdone, entry); 205 skb->data, length, rt2x00usb_interrupt_txdone, entry);
201 usb_submit_urb(entry->priv, GFP_ATOMIC); 206 usb_submit_urb(entry->priv, GFP_ATOMIC);
202 207