aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc
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/ethernet/sfc
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/ethernet/sfc')
-rw-r--r--drivers/net/ethernet/sfc/rx.c2
-rw-r--r--drivers/net/ethernet/sfc/tx.c8
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/ethernet/sfc/rx.c b/drivers/net/ethernet/sfc/rx.c
index 91a6b7123539..adbda182f159 100644
--- a/drivers/net/ethernet/sfc/rx.c
+++ b/drivers/net/ethernet/sfc/rx.c
@@ -481,7 +481,7 @@ static void efx_rx_packet_gro(struct efx_channel *channel,
481 skb_frag_set_page(skb, 0, page); 481 skb_frag_set_page(skb, 0, page);
482 skb_shinfo(skb)->frags[0].page_offset = 482 skb_shinfo(skb)->frags[0].page_offset =
483 efx_rx_buf_offset(efx, rx_buf); 483 efx_rx_buf_offset(efx, rx_buf);
484 skb_shinfo(skb)->frags[0].size = rx_buf->len; 484 skb_frag_size_set(&skb_shinfo(skb)->frags[0], rx_buf->len);
485 skb_shinfo(skb)->nr_frags = 1; 485 skb_shinfo(skb)->nr_frags = 1;
486 486
487 skb->len = rx_buf->len; 487 skb->len = rx_buf->len;
diff --git a/drivers/net/ethernet/sfc/tx.c b/drivers/net/ethernet/sfc/tx.c
index 3964a62dde8b..df88c5430f95 100644
--- a/drivers/net/ethernet/sfc/tx.c
+++ b/drivers/net/ethernet/sfc/tx.c
@@ -238,7 +238,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
238 if (i >= skb_shinfo(skb)->nr_frags) 238 if (i >= skb_shinfo(skb)->nr_frags)
239 break; 239 break;
240 fragment = &skb_shinfo(skb)->frags[i]; 240 fragment = &skb_shinfo(skb)->frags[i];
241 len = fragment->size; 241 len = skb_frag_size(fragment);
242 i++; 242 i++;
243 /* Map for DMA */ 243 /* Map for DMA */
244 unmap_single = false; 244 unmap_single = false;
@@ -926,11 +926,11 @@ static int tso_get_fragment(struct tso_state *st, struct efx_nic *efx,
926 skb_frag_t *frag) 926 skb_frag_t *frag)
927{ 927{
928 st->unmap_addr = skb_frag_dma_map(&efx->pci_dev->dev, frag, 0, 928 st->unmap_addr = skb_frag_dma_map(&efx->pci_dev->dev, frag, 0,
929 frag->size, DMA_TO_DEVICE); 929 skb_frag_size(frag), DMA_TO_DEVICE);
930 if (likely(!dma_mapping_error(&efx->pci_dev->dev, st->unmap_addr))) { 930 if (likely(!dma_mapping_error(&efx->pci_dev->dev, st->unmap_addr))) {
931 st->unmap_single = false; 931 st->unmap_single = false;
932 st->unmap_len = frag->size; 932 st->unmap_len = skb_frag_size(frag);
933 st->in_len = frag->size; 933 st->in_len = skb_frag_size(frag);
934 st->dma_addr = st->unmap_addr; 934 st->dma_addr = st->unmap_addr;
935 return 0; 935 return 0;
936 } 936 }