diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-10-18 17:00:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-10-19 03:10:46 -0400 |
commit | 9e903e085262ffbf1fc44a17ac06058aca03524a (patch) | |
tree | 4acefc97ba38c1733474d25c0b2053b56af97db1 /drivers/net/ethernet/chelsio/cxgb | |
parent | dd767856a36e00b631d65ebc4bb81b19915532d6 (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/chelsio/cxgb')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb/sge.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb/sge.c b/drivers/net/ethernet/chelsio/cxgb/sge.c index 0a511c4a0472..f9b602300040 100644 --- a/drivers/net/ethernet/chelsio/cxgb/sge.c +++ b/drivers/net/ethernet/chelsio/cxgb/sge.c | |||
@@ -1135,8 +1135,8 @@ static inline unsigned int compute_large_page_tx_descs(struct sk_buff *skb) | |||
1135 | len -= SGE_TX_DESC_MAX_PLEN; | 1135 | len -= SGE_TX_DESC_MAX_PLEN; |
1136 | } | 1136 | } |
1137 | for (i = 0; nfrags--; i++) { | 1137 | for (i = 0; nfrags--; i++) { |
1138 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 1138 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
1139 | len = frag->size; | 1139 | len = skb_frag_size(frag); |
1140 | while (len > SGE_TX_DESC_MAX_PLEN) { | 1140 | while (len > SGE_TX_DESC_MAX_PLEN) { |
1141 | count++; | 1141 | count++; |
1142 | len -= SGE_TX_DESC_MAX_PLEN; | 1142 | len -= SGE_TX_DESC_MAX_PLEN; |
@@ -1278,9 +1278,9 @@ static inline void write_tx_descs(struct adapter *adapter, struct sk_buff *skb, | |||
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | mapping = skb_frag_dma_map(&adapter->pdev->dev, frag, 0, | 1280 | mapping = skb_frag_dma_map(&adapter->pdev->dev, frag, 0, |
1281 | frag->size, DMA_TO_DEVICE); | 1281 | skb_frag_size(frag), DMA_TO_DEVICE); |
1282 | desc_mapping = mapping; | 1282 | desc_mapping = mapping; |
1283 | desc_len = frag->size; | 1283 | desc_len = skb_frag_size(frag); |
1284 | 1284 | ||
1285 | pidx = write_large_page_tx_descs(pidx, &e1, &ce, &gen, | 1285 | pidx = write_large_page_tx_descs(pidx, &e1, &ce, &gen, |
1286 | &desc_mapping, &desc_len, | 1286 | &desc_mapping, &desc_len, |
@@ -1290,7 +1290,7 @@ static inline void write_tx_descs(struct adapter *adapter, struct sk_buff *skb, | |||
1290 | nfrags == 0); | 1290 | nfrags == 0); |
1291 | ce->skb = NULL; | 1291 | ce->skb = NULL; |
1292 | dma_unmap_addr_set(ce, dma_addr, mapping); | 1292 | dma_unmap_addr_set(ce, dma_addr, mapping); |
1293 | dma_unmap_len_set(ce, dma_len, frag->size); | 1293 | dma_unmap_len_set(ce, dma_len, skb_frag_size(frag)); |
1294 | } | 1294 | } |
1295 | ce->skb = skb; | 1295 | ce->skb = skb; |
1296 | wmb(); | 1296 | wmb(); |