aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vmxnet3
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-10-18 17:00:24 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-19 03:10:46 -0400
commit9e903e085262ffbf1fc44a17ac06058aca03524a (patch)
tree4acefc97ba38c1733474d25c0b2053b56af97db1 /drivers/net/vmxnet3
parentdd767856a36e00b631d65ebc4bb81b19915532d6 (diff)
net: add skb frag size accessors
To ease skb->truesize sanitization, its better to be able to localize all references to skb frags size. Define accessors : skb_frag_size() to fetch frag size, and skb_frag_size_{set|add|sub}() to manipulate it. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r--drivers/net/vmxnet3/vmxnet3_drv.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 902f284fd054..b771ebac0f01 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -656,8 +656,8 @@ vmxnet3_append_frag(struct sk_buff *skb, struct Vmxnet3_RxCompDesc *rcd,
656 656
657 __skb_frag_set_page(frag, rbi->page); 657 __skb_frag_set_page(frag, rbi->page);
658 frag->page_offset = 0; 658 frag->page_offset = 0;
659 frag->size = rcd->len; 659 skb_frag_size_set(frag, rcd->len);
660 skb->data_len += frag->size; 660 skb->data_len += rcd->len;
661 skb->truesize += PAGE_SIZE; 661 skb->truesize += PAGE_SIZE;
662 skb_shinfo(skb)->nr_frags++; 662 skb_shinfo(skb)->nr_frags++;
663} 663}
@@ -745,21 +745,21 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
745 } 745 }
746 746
747 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 747 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
748 struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; 748 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
749 749
750 tbi = tq->buf_info + tq->tx_ring.next2fill; 750 tbi = tq->buf_info + tq->tx_ring.next2fill;
751 tbi->map_type = VMXNET3_MAP_PAGE; 751 tbi->map_type = VMXNET3_MAP_PAGE;
752 tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, 752 tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
753 0, frag->size, 753 0, skb_frag_size(frag),
754 DMA_TO_DEVICE); 754 DMA_TO_DEVICE);
755 755
756 tbi->len = frag->size; 756 tbi->len = skb_frag_size(frag);
757 757
758 gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; 758 gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
759 BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); 759 BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
760 760
761 gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); 761 gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
762 gdesc->dword[2] = cpu_to_le32(dw2 | frag->size); 762 gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
763 gdesc->dword[3] = 0; 763 gdesc->dword[3] = 0;
764 764
765 dev_dbg(&adapter->netdev->dev, 765 dev_dbg(&adapter->netdev->dev,