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/atheros/atlx | |
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/atheros/atlx')
-rw-r--r-- | drivers/net/ethernet/atheros/atlx/atl1.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c index 7381a49fefb4..0405261efb5c 100644 --- a/drivers/net/ethernet/atheros/atlx/atl1.c +++ b/drivers/net/ethernet/atheros/atlx/atl1.c | |||
@@ -2267,11 +2267,11 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
2267 | } | 2267 | } |
2268 | 2268 | ||
2269 | for (f = 0; f < nr_frags; f++) { | 2269 | for (f = 0; f < nr_frags; f++) { |
2270 | struct skb_frag_struct *frag; | 2270 | const struct skb_frag_struct *frag; |
2271 | u16 i, nseg; | 2271 | u16 i, nseg; |
2272 | 2272 | ||
2273 | frag = &skb_shinfo(skb)->frags[f]; | 2273 | frag = &skb_shinfo(skb)->frags[f]; |
2274 | buf_len = frag->size; | 2274 | buf_len = skb_frag_size(frag); |
2275 | 2275 | ||
2276 | nseg = (buf_len + ATL1_MAX_TX_BUF_LEN - 1) / | 2276 | nseg = (buf_len + ATL1_MAX_TX_BUF_LEN - 1) / |
2277 | ATL1_MAX_TX_BUF_LEN; | 2277 | ATL1_MAX_TX_BUF_LEN; |
@@ -2356,7 +2356,6 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb, | |||
2356 | int count = 1; | 2356 | int count = 1; |
2357 | int ret_val; | 2357 | int ret_val; |
2358 | struct tx_packet_desc *ptpd; | 2358 | struct tx_packet_desc *ptpd; |
2359 | u16 frag_size; | ||
2360 | u16 vlan_tag; | 2359 | u16 vlan_tag; |
2361 | unsigned int nr_frags = 0; | 2360 | unsigned int nr_frags = 0; |
2362 | unsigned int mss = 0; | 2361 | unsigned int mss = 0; |
@@ -2372,10 +2371,9 @@ static netdev_tx_t atl1_xmit_frame(struct sk_buff *skb, | |||
2372 | 2371 | ||
2373 | nr_frags = skb_shinfo(skb)->nr_frags; | 2372 | nr_frags = skb_shinfo(skb)->nr_frags; |
2374 | for (f = 0; f < nr_frags; f++) { | 2373 | for (f = 0; f < nr_frags; f++) { |
2375 | frag_size = skb_shinfo(skb)->frags[f].size; | 2374 | unsigned int f_size = skb_frag_size(&skb_shinfo(skb)->frags[f]); |
2376 | if (frag_size) | 2375 | count += (f_size + ATL1_MAX_TX_BUF_LEN - 1) / |
2377 | count += (frag_size + ATL1_MAX_TX_BUF_LEN - 1) / | 2376 | ATL1_MAX_TX_BUF_LEN; |
2378 | ATL1_MAX_TX_BUF_LEN; | ||
2379 | } | 2377 | } |
2380 | 2378 | ||
2381 | mss = skb_shinfo(skb)->gso_size; | 2379 | mss = skb_shinfo(skb)->gso_size; |