aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sun
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/sun
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/sun')
-rw-r--r--drivers/net/ethernet/sun/cassini.c8
-rw-r--r--drivers/net/ethernet/sun/niu.c6
-rw-r--r--drivers/net/ethernet/sun/sungem.c4
-rw-r--r--drivers/net/ethernet/sun/sunhme.c4
4 files changed, 11 insertions, 11 deletions
diff --git a/drivers/net/ethernet/sun/cassini.c b/drivers/net/ethernet/sun/cassini.c
index d9460d81a137..fd40988c19a6 100644
--- a/drivers/net/ethernet/sun/cassini.c
+++ b/drivers/net/ethernet/sun/cassini.c
@@ -2051,7 +2051,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2051 __skb_frag_set_page(frag, page->buffer); 2051 __skb_frag_set_page(frag, page->buffer);
2052 __skb_frag_ref(frag); 2052 __skb_frag_ref(frag);
2053 frag->page_offset = off; 2053 frag->page_offset = off;
2054 frag->size = hlen - swivel; 2054 skb_frag_size_set(frag, hlen - swivel);
2055 2055
2056 /* any more data? */ 2056 /* any more data? */
2057 if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) { 2057 if ((words[0] & RX_COMP1_SPLIT_PKT) && ((dlen -= hlen) > 0)) {
@@ -2075,7 +2075,7 @@ static int cas_rx_process_pkt(struct cas *cp, struct cas_rx_comp *rxc,
2075 __skb_frag_set_page(frag, page->buffer); 2075 __skb_frag_set_page(frag, page->buffer);
2076 __skb_frag_ref(frag); 2076 __skb_frag_ref(frag);
2077 frag->page_offset = 0; 2077 frag->page_offset = 0;
2078 frag->size = hlen; 2078 skb_frag_size_set(frag, hlen);
2079 RX_USED_ADD(page, hlen + cp->crc_size); 2079 RX_USED_ADD(page, hlen + cp->crc_size);
2080 } 2080 }
2081 2081
@@ -2826,9 +2826,9 @@ static inline int cas_xmit_tx_ringN(struct cas *cp, int ring,
2826 entry = TX_DESC_NEXT(ring, entry); 2826 entry = TX_DESC_NEXT(ring, entry);
2827 2827
2828 for (frag = 0; frag < nr_frags; frag++) { 2828 for (frag = 0; frag < nr_frags; frag++) {
2829 skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag]; 2829 const skb_frag_t *fragp = &skb_shinfo(skb)->frags[frag];
2830 2830
2831 len = fragp->size; 2831 len = skb_frag_size(fragp);
2832 mapping = skb_frag_dma_map(&cp->pdev->dev, fragp, 0, len, 2832 mapping = skb_frag_dma_map(&cp->pdev->dev, fragp, 0, len,
2833 DMA_TO_DEVICE); 2833 DMA_TO_DEVICE);
2834 2834
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 23740e848ac9..73c708107a37 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3594,7 +3594,7 @@ static int release_tx_packet(struct niu *np, struct tx_ring_info *rp, int idx)
3594 tb = &rp->tx_buffs[idx]; 3594 tb = &rp->tx_buffs[idx];
3595 BUG_ON(tb->skb != NULL); 3595 BUG_ON(tb->skb != NULL);
3596 np->ops->unmap_page(np->device, tb->mapping, 3596 np->ops->unmap_page(np->device, tb->mapping,
3597 skb_shinfo(skb)->frags[i].size, 3597 skb_frag_size(&skb_shinfo(skb)->frags[i]),
3598 DMA_TO_DEVICE); 3598 DMA_TO_DEVICE);
3599 idx = NEXT_TX(rp, idx); 3599 idx = NEXT_TX(rp, idx);
3600 } 3600 }
@@ -6727,9 +6727,9 @@ static netdev_tx_t niu_start_xmit(struct sk_buff *skb,
6727 } 6727 }
6728 6728
6729 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 6729 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
6730 skb_frag_t *frag = &skb_shinfo(skb)->frags[i]; 6730 const skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
6731 6731
6732 len = frag->size; 6732 len = skb_frag_size(frag);
6733 mapping = np->ops->map_page(np->device, skb_frag_page(frag), 6733 mapping = np->ops->map_page(np->device, skb_frag_page(frag),
6734 frag->page_offset, len, 6734 frag->page_offset, len,
6735 DMA_TO_DEVICE); 6735 DMA_TO_DEVICE);
diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c
index 6b62a73227c2..ceab215bb4a3 100644
--- a/drivers/net/ethernet/sun/sungem.c
+++ b/drivers/net/ethernet/sun/sungem.c
@@ -1065,12 +1065,12 @@ static netdev_tx_t gem_start_xmit(struct sk_buff *skb,
1065 entry = NEXT_TX(entry); 1065 entry = NEXT_TX(entry);
1066 1066
1067 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { 1067 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
1068 skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag]; 1068 const skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag];
1069 u32 len; 1069 u32 len;
1070 dma_addr_t mapping; 1070 dma_addr_t mapping;
1071 u64 this_ctrl; 1071 u64 this_ctrl;
1072 1072
1073 len = this_frag->size; 1073 len = skb_frag_size(this_frag);
1074 mapping = skb_frag_dma_map(&gp->pdev->dev, this_frag, 1074 mapping = skb_frag_dma_map(&gp->pdev->dev, this_frag,
1075 0, len, DMA_TO_DEVICE); 1075 0, len, DMA_TO_DEVICE);
1076 this_ctrl = ctrl; 1076 this_ctrl = ctrl;
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c
index 869d47be54b4..c517dac02ae1 100644
--- a/drivers/net/ethernet/sun/sunhme.c
+++ b/drivers/net/ethernet/sun/sunhme.c
@@ -2305,10 +2305,10 @@ static netdev_tx_t happy_meal_start_xmit(struct sk_buff *skb,
2305 entry = NEXT_TX(entry); 2305 entry = NEXT_TX(entry);
2306 2306
2307 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { 2307 for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
2308 skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag]; 2308 const skb_frag_t *this_frag = &skb_shinfo(skb)->frags[frag];
2309 u32 len, mapping, this_txflags; 2309 u32 len, mapping, this_txflags;
2310 2310
2311 len = this_frag->size; 2311 len = skb_frag_size(this_frag);
2312 mapping = skb_frag_dma_map(hp->dma_dev, this_frag, 2312 mapping = skb_frag_dma_map(hp->dma_dev, this_frag,
2313 0, len, DMA_TO_DEVICE); 2313 0, len, DMA_TO_DEVICE);
2314 this_txflags = tx_flags; 2314 this_txflags = tx_flags;