aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-01-10 16:02:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:47 -0500
commit40561b8426c27f187e2ae496ed603e7c4e3ab818 (patch)
tree8aa31c5aca687b58590dfe2ba5a5aae9d44b5217 /drivers/net/wireless
parentdd0d43ea0bbd4c4554b13d4a5d282f9c4d1b5591 (diff)
rt2x00: Data and desc pointer initialization
rt2500usb and rt73usb data and desc pointer initialization was incorrect because it was using uninitialized variables to determine the length. In addition rt2500usb used skb_pull and removed the ieee80211 from each received frame instead of using skb_trim to remove the device descriptor from the frame. Finally this also fixes the descriptor override when 4 byte aligning occured. We still need a completely valid descriptor when using the TX/RX dumping capabilities in debugfs. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c9
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c25
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c11
3 files changed, 22 insertions, 23 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index 1933113d7baf..86ded4066f5b 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1140,15 +1140,12 @@ static void rt2500usb_fill_rxdone(struct data_entry *entry,
1140 desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1140 desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1141 1141
1142 /* 1142 /*
1143 * Trim the skb to clear the descriptor area.
1144 */
1145 skb_pull(entry->skb, entry->ring->desc_size);
1146
1147 /*
1148 * Set descriptor and data pointer. 1143 * Set descriptor and data pointer.
1149 */ 1144 */
1150 skbdesc->desc = entry->skb->data + skbdesc->data_len; 1145 skbdesc->desc = entry->skb->data + desc->size;
1146 skbdesc->desc_len = entry->ring->desc_size;
1151 skbdesc->data = entry->skb->data; 1147 skbdesc->data = entry->skb->data;
1148 skbdesc->data_len = desc->size;
1152} 1149}
1153 1150
1154/* 1151/*
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index d7d3a271b1b0..a52939aa38af 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -257,6 +257,13 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
257 if (urb->actual_length < entry->ring->desc_size || urb->status) 257 if (urb->actual_length < entry->ring->desc_size || urb->status)
258 goto skip_entry; 258 goto skip_entry;
259 259
260 /*
261 * Fill in skb descriptor
262 */
263 skbdesc = get_skb_desc(entry->skb);
264 skbdesc->ring = ring;
265 skbdesc->entry = entry;
266
260 memset(&desc, 0, sizeof(desc)); 267 memset(&desc, 0, sizeof(desc));
261 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 268 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
262 269
@@ -283,9 +290,6 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
283 /* 290 /*
284 * The data behind the ieee80211 header must be 291 * The data behind the ieee80211 header must be
285 * aligned on a 4 byte boundary. 292 * aligned on a 4 byte boundary.
286 * After that trim the entire buffer down to only
287 * contain the valid frame data excluding the device
288 * descriptor.
289 */ 293 */
290 hdr = (struct ieee80211_hdr *)entry->skb->data; 294 hdr = (struct ieee80211_hdr *)entry->skb->data;
291 header_size = 295 header_size =
@@ -295,16 +299,17 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
295 skb_push(entry->skb, 2); 299 skb_push(entry->skb, 2);
296 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2); 300 memmove(entry->skb->data, entry->skb->data + 2, skb->len - 2);
297 } 301 }
298 skb_trim(entry->skb, desc.size);
299 302
300 /* 303 /*
301 * Fill in skb descriptor 304 * Trim the entire buffer down to only contain the valid frame data
305 * excluding the device descriptor. The position of the descriptor
306 * varies. This means that we should check where the descriptor is
307 * and decide if we need to pull the data pointer to exclude the
308 * device descriptor.
302 */ 309 */
303 skbdesc = get_skb_desc(entry->skb); 310 if (skbdesc->data > skbdesc->desc)
304 skbdesc->desc_len = entry->ring->desc_size; 311 skb_pull(entry->skb, skbdesc->desc_len);
305 skbdesc->data_len = entry->skb->len; 312 skb_trim(entry->skb, desc.size);
306 skbdesc->ring = ring;
307 skbdesc->entry = entry;
308 313
309 /* 314 /*
310 * Send the frame to rt2x00lib for further processing. 315 * Send the frame to rt2x00lib for further processing.
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index f9518764aeb0..4d576ab3e7f9 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1398,15 +1398,12 @@ static void rt73usb_fill_rxdone(struct data_entry *entry,
1398 desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS); 1398 desc->my_bss = !!rt2x00_get_field32(word0, RXD_W0_MY_BSS);
1399 1399
1400 /* 1400 /*
1401 * Pull the skb to clear the descriptor area.
1402 */
1403 skb_pull(entry->skb, entry->ring->desc_size);
1404
1405 /*
1406 * Set descriptor and data pointer. 1401 * Set descriptor and data pointer.
1407 */ 1402 */
1408 skbdesc->desc = entry->skb->data - skbdesc->desc_len; 1403 skbdesc->desc = entry->skb->data;
1409 skbdesc->data = entry->skb->data; 1404 skbdesc->desc_len = entry->ring->desc_size;
1405 skbdesc->data = entry->skb->data + entry->ring->desc_size;
1406 skbdesc->data_len = desc->size;
1410} 1407}
1411 1408
1412/* 1409/*