aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorIan Campbell <Ian.Campbell@citrix.com>2011-08-22 19:44:58 -0400
committerDavid S. Miller <davem@davemloft.net>2011-08-24 20:52:11 -0400
commitea2ab69379a941c6f8884e290fdd28c93936a778 (patch)
treec02aa9c5ed66b1640b54bb6b763d131b9419be29 /net/core/dev.c
parent15133fbbb91ae695f153fb48daa6a1a8af4a5032 (diff)
net: convert core to skb paged frag APIs
Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Cc: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index b668a3d9a189..b2e262ed3963 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1949,9 +1949,11 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
1949#ifdef CONFIG_HIGHMEM 1949#ifdef CONFIG_HIGHMEM
1950 int i; 1950 int i;
1951 if (!(dev->features & NETIF_F_HIGHDMA)) { 1951 if (!(dev->features & NETIF_F_HIGHDMA)) {
1952 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) 1952 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1953 if (PageHighMem(skb_shinfo(skb)->frags[i].page)) 1953 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1954 if (PageHighMem(skb_frag_page(frag)))
1954 return 1; 1955 return 1;
1956 }
1955 } 1957 }
1956 1958
1957 if (PCI_DMA_BUS_IS_PHYS) { 1959 if (PCI_DMA_BUS_IS_PHYS) {
@@ -1960,7 +1962,8 @@ static int illegal_highdma(struct net_device *dev, struct sk_buff *skb)
1960 if (!pdev) 1962 if (!pdev)
1961 return 0; 1963 return 0;
1962 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 1964 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
1963 dma_addr_t addr = page_to_phys(skb_shinfo(skb)->frags[i].page); 1965 skb_frag_t *frag = &skb_shinfo(skb)->frags[i];
1966 dma_addr_t addr = page_to_phys(skb_frag_page(frag));
1964 if (!pdev->dma_mask || addr + PAGE_SIZE - 1 > *pdev->dma_mask) 1967 if (!pdev->dma_mask || addr + PAGE_SIZE - 1 > *pdev->dma_mask)
1965 return 1; 1968 return 1;
1966 } 1969 }
@@ -3474,7 +3477,7 @@ pull:
3474 skb_shinfo(skb)->frags[0].size -= grow; 3477 skb_shinfo(skb)->frags[0].size -= grow;
3475 3478
3476 if (unlikely(!skb_shinfo(skb)->frags[0].size)) { 3479 if (unlikely(!skb_shinfo(skb)->frags[0].size)) {
3477 put_page(skb_shinfo(skb)->frags[0].page); 3480 skb_frag_unref(skb, 0);
3478 memmove(skb_shinfo(skb)->frags, 3481 memmove(skb_shinfo(skb)->frags,
3479 skb_shinfo(skb)->frags + 1, 3482 skb_shinfo(skb)->frags + 1,
3480 --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); 3483 --skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
@@ -3538,10 +3541,9 @@ void skb_gro_reset_offset(struct sk_buff *skb)
3538 NAPI_GRO_CB(skb)->frag0_len = 0; 3541 NAPI_GRO_CB(skb)->frag0_len = 0;
3539 3542
3540 if (skb->mac_header == skb->tail && 3543 if (skb->mac_header == skb->tail &&
3541 !PageHighMem(skb_shinfo(skb)->frags[0].page)) { 3544 !PageHighMem(skb_frag_page(&skb_shinfo(skb)->frags[0]))) {
3542 NAPI_GRO_CB(skb)->frag0 = 3545 NAPI_GRO_CB(skb)->frag0 =
3543 page_address(skb_shinfo(skb)->frags[0].page) + 3546 skb_frag_address(&skb_shinfo(skb)->frags[0]);
3544 skb_shinfo(skb)->frags[0].page_offset;
3545 NAPI_GRO_CB(skb)->frag0_len = skb_shinfo(skb)->frags[0].size; 3547 NAPI_GRO_CB(skb)->frag0_len = skb_shinfo(skb)->frags[0].size;
3546 } 3548 }
3547} 3549}