diff options
Diffstat (limited to 'drivers/net/wireless/p54/p54usb.c')
-rw-r--r-- | drivers/net/wireless/p54/p54usb.c | 41 |
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 6a6a72f6f82c..5de2ebfb28c7 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -144,11 +144,8 @@ static void p54u_tx_cb(struct urb *urb) | |||
144 | struct sk_buff *skb = urb->context; | 144 | struct sk_buff *skb = urb->context; |
145 | struct ieee80211_hw *dev = (struct ieee80211_hw *) | 145 | struct ieee80211_hw *dev = (struct ieee80211_hw *) |
146 | usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); | 146 | usb_get_intfdata(usb_ifnum_to_if(urb->dev, 0)); |
147 | struct p54u_priv *priv = dev->priv; | ||
148 | 147 | ||
149 | skb_pull(skb, priv->common.tx_hdr_len); | 148 | p54_free_skb(dev, skb); |
150 | if (FREE_AFTER_TX(skb)) | ||
151 | p54_free_skb(dev, skb); | ||
152 | } | 149 | } |
153 | 150 | ||
154 | static void p54u_tx_dummy_cb(struct urb *urb) { } | 151 | static void p54u_tx_dummy_cb(struct urb *urb) { } |
@@ -230,7 +227,10 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
230 | p54u_tx_dummy_cb, dev); | 227 | p54u_tx_dummy_cb, dev); |
231 | usb_fill_bulk_urb(data_urb, priv->udev, | 228 | usb_fill_bulk_urb(data_urb, priv->udev, |
232 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), | 229 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), |
233 | skb->data, skb->len, p54u_tx_cb, skb); | 230 | skb->data, skb->len, FREE_AFTER_TX(skb) ? |
231 | p54u_tx_cb : p54u_tx_dummy_cb, skb); | ||
232 | addr_urb->transfer_flags |= URB_ZERO_PACKET; | ||
233 | data_urb->transfer_flags |= URB_ZERO_PACKET; | ||
234 | 234 | ||
235 | usb_anchor_urb(addr_urb, &priv->submitted); | 235 | usb_anchor_urb(addr_urb, &priv->submitted); |
236 | err = usb_submit_urb(addr_urb, GFP_ATOMIC); | 236 | err = usb_submit_urb(addr_urb, GFP_ATOMIC); |
@@ -239,7 +239,7 @@ static void p54u_tx_3887(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
239 | goto out; | 239 | goto out; |
240 | } | 240 | } |
241 | 241 | ||
242 | usb_anchor_urb(addr_urb, &priv->submitted); | 242 | usb_anchor_urb(data_urb, &priv->submitted); |
243 | err = usb_submit_urb(data_urb, GFP_ATOMIC); | 243 | err = usb_submit_urb(data_urb, GFP_ATOMIC); |
244 | if (err) | 244 | if (err) |
245 | usb_unanchor_urb(data_urb); | 245 | usb_unanchor_urb(data_urb); |
@@ -269,28 +269,24 @@ static void p54u_tx_lm87(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
269 | { | 269 | { |
270 | struct p54u_priv *priv = dev->priv; | 270 | struct p54u_priv *priv = dev->priv; |
271 | struct urb *data_urb; | 271 | struct urb *data_urb; |
272 | struct lm87_tx_hdr *hdr; | 272 | struct lm87_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); |
273 | __le32 checksum; | ||
274 | __le32 addr = ((struct p54_hdr *)skb->data)->req_id; | ||
275 | 273 | ||
276 | data_urb = usb_alloc_urb(0, GFP_ATOMIC); | 274 | data_urb = usb_alloc_urb(0, GFP_ATOMIC); |
277 | if (!data_urb) | 275 | if (!data_urb) |
278 | return; | 276 | return; |
279 | 277 | ||
280 | checksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len); | 278 | hdr->chksum = p54u_lm87_chksum((__le32 *)skb->data, skb->len); |
281 | hdr = (struct lm87_tx_hdr *)skb_push(skb, sizeof(*hdr)); | 279 | hdr->device_addr = ((struct p54_hdr *)skb->data)->req_id; |
282 | hdr->chksum = checksum; | ||
283 | hdr->device_addr = addr; | ||
284 | 280 | ||
285 | usb_fill_bulk_urb(data_urb, priv->udev, | 281 | usb_fill_bulk_urb(data_urb, priv->udev, |
286 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), | 282 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), |
287 | skb->data, skb->len, p54u_tx_cb, skb); | 283 | hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ? |
284 | p54u_tx_cb : p54u_tx_dummy_cb, skb); | ||
288 | data_urb->transfer_flags |= URB_ZERO_PACKET; | 285 | data_urb->transfer_flags |= URB_ZERO_PACKET; |
289 | 286 | ||
290 | usb_anchor_urb(data_urb, &priv->submitted); | 287 | usb_anchor_urb(data_urb, &priv->submitted); |
291 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { | 288 | if (usb_submit_urb(data_urb, GFP_ATOMIC)) { |
292 | usb_unanchor_urb(data_urb); | 289 | usb_unanchor_urb(data_urb); |
293 | skb_pull(skb, sizeof(*hdr)); | ||
294 | p54_free_skb(dev, skb); | 290 | p54_free_skb(dev, skb); |
295 | } | 291 | } |
296 | usb_free_urb(data_urb); | 292 | usb_free_urb(data_urb); |
@@ -300,11 +296,9 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
300 | { | 296 | { |
301 | struct p54u_priv *priv = dev->priv; | 297 | struct p54u_priv *priv = dev->priv; |
302 | struct urb *int_urb, *data_urb; | 298 | struct urb *int_urb, *data_urb; |
303 | struct net2280_tx_hdr *hdr; | 299 | struct net2280_tx_hdr *hdr = (void *)skb->data - sizeof(*hdr); |
304 | struct net2280_reg_write *reg; | 300 | struct net2280_reg_write *reg; |
305 | int err = 0; | 301 | int err = 0; |
306 | __le32 addr = ((struct p54_hdr *) skb->data)->req_id; | ||
307 | __le16 len = cpu_to_le16(skb->len); | ||
308 | 302 | ||
309 | reg = kmalloc(sizeof(*reg), GFP_ATOMIC); | 303 | reg = kmalloc(sizeof(*reg), GFP_ATOMIC); |
310 | if (!reg) | 304 | if (!reg) |
@@ -327,10 +321,9 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
327 | reg->addr = cpu_to_le32(P54U_DEV_BASE); | 321 | reg->addr = cpu_to_le32(P54U_DEV_BASE); |
328 | reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA); | 322 | reg->val = cpu_to_le32(ISL38XX_DEV_INT_DATA); |
329 | 323 | ||
330 | hdr = (void *)skb_push(skb, sizeof(*hdr)); | ||
331 | memset(hdr, 0, sizeof(*hdr)); | 324 | memset(hdr, 0, sizeof(*hdr)); |
332 | hdr->len = len; | 325 | hdr->len = cpu_to_le16(skb->len); |
333 | hdr->device_addr = addr; | 326 | hdr->device_addr = ((struct p54_hdr *) skb->data)->req_id; |
334 | 327 | ||
335 | usb_fill_bulk_urb(int_urb, priv->udev, | 328 | usb_fill_bulk_urb(int_urb, priv->udev, |
336 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), | 329 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DEV), reg, sizeof(*reg), |
@@ -341,11 +334,13 @@ static void p54u_tx_net2280(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
341 | * free what's inside the transfer_buffer after the callback routine | 334 | * free what's inside the transfer_buffer after the callback routine |
342 | * has completed. | 335 | * has completed. |
343 | */ | 336 | */ |
344 | int_urb->transfer_flags |= URB_FREE_BUFFER; | 337 | int_urb->transfer_flags |= URB_FREE_BUFFER | URB_ZERO_PACKET; |
345 | 338 | ||
346 | usb_fill_bulk_urb(data_urb, priv->udev, | 339 | usb_fill_bulk_urb(data_urb, priv->udev, |
347 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), | 340 | usb_sndbulkpipe(priv->udev, P54U_PIPE_DATA), |
348 | skb->data, skb->len, p54u_tx_cb, skb); | 341 | hdr, skb->len + sizeof(*hdr), FREE_AFTER_TX(skb) ? |
342 | p54u_tx_cb : p54u_tx_dummy_cb, skb); | ||
343 | data_urb->transfer_flags |= URB_ZERO_PACKET; | ||
349 | 344 | ||
350 | usb_anchor_urb(int_urb, &priv->submitted); | 345 | usb_anchor_urb(int_urb, &priv->submitted); |
351 | err = usb_submit_urb(int_urb, GFP_ATOMIC); | 346 | err = usb_submit_urb(int_urb, GFP_ATOMIC); |