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/neterion/s2io.c | |
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/neterion/s2io.c')
-rw-r--r-- | drivers/net/ethernet/neterion/s2io.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/net/ethernet/neterion/s2io.c b/drivers/net/ethernet/neterion/s2io.c index bdd3e6a330cd..c27fb3dda9f4 100644 --- a/drivers/net/ethernet/neterion/s2io.c +++ b/drivers/net/ethernet/neterion/s2io.c | |||
@@ -2350,12 +2350,12 @@ static struct sk_buff *s2io_txdl_getskb(struct fifo_info *fifo_data, | |||
2350 | if (frg_cnt) { | 2350 | if (frg_cnt) { |
2351 | txds++; | 2351 | txds++; |
2352 | for (j = 0; j < frg_cnt; j++, txds++) { | 2352 | for (j = 0; j < frg_cnt; j++, txds++) { |
2353 | skb_frag_t *frag = &skb_shinfo(skb)->frags[j]; | 2353 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[j]; |
2354 | if (!txds->Buffer_Pointer) | 2354 | if (!txds->Buffer_Pointer) |
2355 | break; | 2355 | break; |
2356 | pci_unmap_page(nic->pdev, | 2356 | pci_unmap_page(nic->pdev, |
2357 | (dma_addr_t)txds->Buffer_Pointer, | 2357 | (dma_addr_t)txds->Buffer_Pointer, |
2358 | frag->size, PCI_DMA_TODEVICE); | 2358 | skb_frag_size(frag), PCI_DMA_TODEVICE); |
2359 | } | 2359 | } |
2360 | } | 2360 | } |
2361 | memset(txdlp, 0, (sizeof(struct TxD) * fifo_data->max_txds)); | 2361 | memset(txdlp, 0, (sizeof(struct TxD) * fifo_data->max_txds)); |
@@ -4185,16 +4185,16 @@ static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev) | |||
4185 | frg_cnt = skb_shinfo(skb)->nr_frags; | 4185 | frg_cnt = skb_shinfo(skb)->nr_frags; |
4186 | /* For fragmented SKB. */ | 4186 | /* For fragmented SKB. */ |
4187 | for (i = 0; i < frg_cnt; i++) { | 4187 | for (i = 0; i < frg_cnt; i++) { |
4188 | skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; | 4188 | const skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; |
4189 | /* A '0' length fragment will be ignored */ | 4189 | /* A '0' length fragment will be ignored */ |
4190 | if (!frag->size) | 4190 | if (!skb_frag_size(frag)) |
4191 | continue; | 4191 | continue; |
4192 | txdp++; | 4192 | txdp++; |
4193 | txdp->Buffer_Pointer = (u64)skb_frag_dma_map(&sp->pdev->dev, | 4193 | txdp->Buffer_Pointer = (u64)skb_frag_dma_map(&sp->pdev->dev, |
4194 | frag, 0, | 4194 | frag, 0, |
4195 | frag->size, | 4195 | skb_frag_size(frag), |
4196 | DMA_TO_DEVICE); | 4196 | DMA_TO_DEVICE); |
4197 | txdp->Control_1 = TXD_BUFFER0_SIZE(frag->size); | 4197 | txdp->Control_1 = TXD_BUFFER0_SIZE(skb_frag_size(frag)); |
4198 | if (offload_type == SKB_GSO_UDP) | 4198 | if (offload_type == SKB_GSO_UDP) |
4199 | txdp->Control_1 |= TXD_UFO_EN; | 4199 | txdp->Control_1 |= TXD_UFO_EN; |
4200 | } | 4200 | } |