aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00usb.c
diff options
context:
space:
mode:
authorIvo van Doorn <IvDoorn@gmail.com>2008-01-24 04:56:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:07 -0500
commit08992f7fb139c7dbaf593402312ee5a055352f05 (patch)
treecfa1459e4940cf493438a3db950b5339dae4ca88 /drivers/net/wireless/rt2x00/rt2x00usb.c
parent22c96c28b47ce74d78aad1afbed88b26f43ce24b (diff)
rt2x00: Add skb descriptor
Use the skb->cb field to add a frame description that can be used to transfer information passed each rt2x00 layer. This reduces the required arguments for rt2x00lib_write_tx_desc(). Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00usb.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c
index 9b55f7997ca2..fd6b61c97619 100644
--- a/drivers/net/wireless/rt2x00/rt2x00usb.c
+++ b/drivers/net/wireless/rt2x00/rt2x00usb.c
@@ -176,7 +176,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
176 struct usb_device *usb_dev = 176 struct usb_device *usb_dev =
177 interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); 177 interface_to_usbdev(rt2x00dev_usb(rt2x00dev));
178 struct data_entry *entry = rt2x00_get_data_entry(ring); 178 struct data_entry *entry = rt2x00_get_data_entry(ring);
179 int pipe = usb_sndbulkpipe(usb_dev, 1); 179 struct skb_desc *desc;
180 u32 length; 180 u32 length;
181 181
182 if (rt2x00_ring_full(ring)) { 182 if (rt2x00_ring_full(ring)) {
@@ -199,12 +199,18 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
199 skb_push(skb, ring->desc_size); 199 skb_push(skb, ring->desc_size);
200 memset(skb->data, 0, ring->desc_size); 200 memset(skb->data, 0, ring->desc_size);
201 201
202 rt2x00lib_write_tx_desc(rt2x00dev, (__le32 *)skb->data, 202 /*
203 (struct ieee80211_hdr *)(skb->data + 203 * Fill in skb descriptor
204 ring->desc_size), 204 */
205 skb->len - ring->desc_size, control); 205 desc = get_skb_desc(skb);
206 memcpy(&entry->tx_status.control, control, sizeof(*control)); 206 desc->desc_len = ring->desc_size;
207 entry->skb = skb; 207 desc->data_len = skb->len - ring->desc_size;
208 desc->desc = skb->data;
209 desc->data = skb->data + ring->desc_size;
210 desc->ring = ring;
211 desc->entry = entry;
212
213 rt2x00lib_write_tx_desc(rt2x00dev, skb, control);
208 214
209 /* 215 /*
210 * USB devices cannot blindly pass the skb->len as the 216 * USB devices cannot blindly pass the skb->len as the
@@ -217,7 +223,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev,
217 * Initialize URB and send the frame to the device. 223 * Initialize URB and send the frame to the device.
218 */ 224 */
219 __set_bit(ENTRY_OWNER_NIC, &entry->flags); 225 __set_bit(ENTRY_OWNER_NIC, &entry->flags);
220 usb_fill_bulk_urb(entry->priv, usb_dev, pipe, 226 usb_fill_bulk_urb(entry->priv, usb_dev, usb_sndbulkpipe(usb_dev, 1),
221 skb->data, length, rt2x00usb_interrupt_txdone, entry); 227 skb->data, length, rt2x00usb_interrupt_txdone, entry);
222 usb_submit_urb(entry->priv, GFP_ATOMIC); 228 usb_submit_urb(entry->priv, GFP_ATOMIC);
223 229
@@ -240,6 +246,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
240 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev; 246 struct rt2x00_dev *rt2x00dev = ring->rt2x00dev;
241 struct sk_buff *skb; 247 struct sk_buff *skb;
242 struct ieee80211_hdr *hdr; 248 struct ieee80211_hdr *hdr;
249 struct skb_desc *skbdesc;
243 struct rxdata_entry_desc desc; 250 struct rxdata_entry_desc desc;
244 int header_size; 251 int header_size;
245 int frame_size; 252 int frame_size;
@@ -256,7 +263,7 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
256 if (urb->actual_length < entry->ring->desc_size || urb->status) 263 if (urb->actual_length < entry->ring->desc_size || urb->status)
257 goto skip_entry; 264 goto skip_entry;
258 265
259 memset(&desc, 0x00, sizeof(desc)); 266 memset(&desc, 0, sizeof(desc));
260 rt2x00dev->ops->lib->fill_rxdone(entry, &desc); 267 rt2x00dev->ops->lib->fill_rxdone(entry, &desc);
261 268
262 /* 269 /*
@@ -297,6 +304,17 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
297 skb_trim(entry->skb, desc.size); 304 skb_trim(entry->skb, desc.size);
298 305
299 /* 306 /*
307 * Fill in skb descriptor
308 */
309 skbdesc = get_skb_desc(entry->skb);
310 skbdesc->desc_len = desc.size;
311 skbdesc->data_len = entry->ring->desc_size;
312 skbdesc->desc = entry->skb->data + desc.size;
313 skbdesc->data = entry->skb->data;
314 skbdesc->ring = ring;
315 skbdesc->entry = entry;
316
317 /*
300 * Send the frame to rt2x00lib for further processing. 318 * Send the frame to rt2x00lib for further processing.
301 */ 319 */
302 rt2x00lib_rxdone(entry, entry->skb, &desc); 320 rt2x00lib_rxdone(entry, entry->skb, &desc);