diff options
-rw-r--r-- | drivers/net/benet/be_main.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 5f17d80300ae..347d002fa425 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -337,13 +337,10 @@ static void be_tx_stats_update(struct be_adapter *adapter, | |||
337 | /* Determine number of WRB entries needed to xmit data in an skb */ | 337 | /* Determine number of WRB entries needed to xmit data in an skb */ |
338 | static u32 wrb_cnt_for_skb(struct sk_buff *skb, bool *dummy) | 338 | static u32 wrb_cnt_for_skb(struct sk_buff *skb, bool *dummy) |
339 | { | 339 | { |
340 | int cnt = 0; | 340 | int cnt = (skb->len > skb->data_len); |
341 | while (skb) { | 341 | |
342 | if (skb->len > skb->data_len) | 342 | cnt += skb_shinfo(skb)->nr_frags; |
343 | cnt++; | 343 | |
344 | cnt += skb_shinfo(skb)->nr_frags; | ||
345 | skb = skb_shinfo(skb)->frag_list; | ||
346 | } | ||
347 | /* to account for hdr wrb */ | 344 | /* to account for hdr wrb */ |
348 | cnt++; | 345 | cnt++; |
349 | if (cnt & 1) { | 346 | if (cnt & 1) { |
@@ -409,31 +406,28 @@ static int make_tx_wrbs(struct be_adapter *adapter, | |||
409 | hdr = queue_head_node(txq); | 406 | hdr = queue_head_node(txq); |
410 | queue_head_inc(txq); | 407 | queue_head_inc(txq); |
411 | 408 | ||
412 | while (skb) { | 409 | if (skb->len > skb->data_len) { |
413 | if (skb->len > skb->data_len) { | 410 | int len = skb->len - skb->data_len; |
414 | int len = skb->len - skb->data_len; | 411 | busaddr = pci_map_single(pdev, skb->data, len, |
415 | busaddr = pci_map_single(pdev, skb->data, len, | 412 | PCI_DMA_TODEVICE); |
416 | PCI_DMA_TODEVICE); | 413 | wrb = queue_head_node(txq); |
417 | wrb = queue_head_node(txq); | 414 | wrb_fill(wrb, busaddr, len); |
418 | wrb_fill(wrb, busaddr, len); | 415 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); |
419 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); | 416 | queue_head_inc(txq); |
420 | queue_head_inc(txq); | 417 | copied += len; |
421 | copied += len; | 418 | } |
422 | } | ||
423 | 419 | ||
424 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 420 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
425 | struct skb_frag_struct *frag = | 421 | struct skb_frag_struct *frag = |
426 | &skb_shinfo(skb)->frags[i]; | 422 | &skb_shinfo(skb)->frags[i]; |
427 | busaddr = pci_map_page(pdev, frag->page, | 423 | busaddr = pci_map_page(pdev, frag->page, |
428 | frag->page_offset, | 424 | frag->page_offset, |
429 | frag->size, PCI_DMA_TODEVICE); | 425 | frag->size, PCI_DMA_TODEVICE); |
430 | wrb = queue_head_node(txq); | 426 | wrb = queue_head_node(txq); |
431 | wrb_fill(wrb, busaddr, frag->size); | 427 | wrb_fill(wrb, busaddr, frag->size); |
432 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); | 428 | be_dws_cpu_to_le(wrb, sizeof(*wrb)); |
433 | queue_head_inc(txq); | 429 | queue_head_inc(txq); |
434 | copied += frag->size; | 430 | copied += frag->size; |
435 | } | ||
436 | skb = skb_shinfo(skb)->frag_list; | ||
437 | } | 431 | } |
438 | 432 | ||
439 | if (dummy_wrb) { | 433 | if (dummy_wrb) { |