aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/qlogic
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/qlogic
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/qlogic')
-rw-r--r--drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c6
-rw-r--r--drivers/net/ethernet/qlogic/qla3xxx.c6
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c6
-rw-r--r--drivers/net/ethernet/qlogic/qlge/qlge_main.c6
4 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index e2ba78be1c2a..8cf3173ba488 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1905,13 +1905,13 @@ netxen_map_tx_skb(struct pci_dev *pdev,
1905 frag = &skb_shinfo(skb)->frags[i]; 1905 frag = &skb_shinfo(skb)->frags[i];
1906 nf = &pbuf->frag_array[i+1]; 1906 nf = &pbuf->frag_array[i+1];
1907 1907
1908 map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size, 1908 map = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
1909 DMA_TO_DEVICE); 1909 DMA_TO_DEVICE);
1910 if (dma_mapping_error(&pdev->dev, map)) 1910 if (dma_mapping_error(&pdev->dev, map))
1911 goto unwind; 1911 goto unwind;
1912 1912
1913 nf->dma = map; 1913 nf->dma = map;
1914 nf->length = frag->size; 1914 nf->length = skb_frag_size(frag);
1915 } 1915 }
1916 1916
1917 return 0; 1917 return 0;
@@ -1962,7 +1962,7 @@ netxen_nic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1962 1962
1963 for (i = 0; i < (frag_count - NETXEN_MAX_FRAGS_PER_TX); i++) { 1963 for (i = 0; i < (frag_count - NETXEN_MAX_FRAGS_PER_TX); i++) {
1964 frag = &skb_shinfo(skb)->frags[i]; 1964 frag = &skb_shinfo(skb)->frags[i];
1965 delta += frag->size; 1965 delta += skb_frag_size(frag);
1966 } 1966 }
1967 1967
1968 if (!__pskb_pull_tail(skb, delta)) 1968 if (!__pskb_pull_tail(skb, delta))
diff --git a/drivers/net/ethernet/qlogic/qla3xxx.c b/drivers/net/ethernet/qlogic/qla3xxx.c
index 46f9b6499f9b..a4bdff438a5e 100644
--- a/drivers/net/ethernet/qlogic/qla3xxx.c
+++ b/drivers/net/ethernet/qlogic/qla3xxx.c
@@ -2388,7 +2388,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
2388 seg++; 2388 seg++;
2389 } 2389 }
2390 2390
2391 map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size, 2391 map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, skb_frag_size(frag),
2392 DMA_TO_DEVICE); 2392 DMA_TO_DEVICE);
2393 2393
2394 err = dma_mapping_error(&qdev->pdev->dev, map); 2394 err = dma_mapping_error(&qdev->pdev->dev, map);
@@ -2401,9 +2401,9 @@ static int ql_send_map(struct ql3_adapter *qdev,
2401 2401
2402 oal_entry->dma_lo = cpu_to_le32(LS_64BITS(map)); 2402 oal_entry->dma_lo = cpu_to_le32(LS_64BITS(map));
2403 oal_entry->dma_hi = cpu_to_le32(MS_64BITS(map)); 2403 oal_entry->dma_hi = cpu_to_le32(MS_64BITS(map));
2404 oal_entry->len = cpu_to_le32(frag->size); 2404 oal_entry->len = cpu_to_le32(skb_frag_size(frag));
2405 dma_unmap_addr_set(&tx_cb->map[seg], mapaddr, map); 2405 dma_unmap_addr_set(&tx_cb->map[seg], mapaddr, map);
2406 dma_unmap_len_set(&tx_cb->map[seg], maplen, frag->size); 2406 dma_unmap_len_set(&tx_cb->map[seg], maplen, skb_frag_size(frag));
2407 } 2407 }
2408 /* Terminate the last segment. */ 2408 /* Terminate the last segment. */
2409 oal_entry->len |= cpu_to_le32(OAL_LAST_ENTRY); 2409 oal_entry->len |= cpu_to_le32(OAL_LAST_ENTRY);
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index eac19e7d2761..106503f118f6 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -2135,13 +2135,13 @@ qlcnic_map_tx_skb(struct pci_dev *pdev,
2135 frag = &skb_shinfo(skb)->frags[i]; 2135 frag = &skb_shinfo(skb)->frags[i];
2136 nf = &pbuf->frag_array[i+1]; 2136 nf = &pbuf->frag_array[i+1];
2137 2137
2138 map = skb_frag_dma_map(&pdev->dev, frag, 0, frag->size, 2138 map = skb_frag_dma_map(&pdev->dev, frag, 0, skb_frag_size(frag),
2139 DMA_TO_DEVICE); 2139 DMA_TO_DEVICE);
2140 if (dma_mapping_error(&pdev->dev, map)) 2140 if (dma_mapping_error(&pdev->dev, map))
2141 goto unwind; 2141 goto unwind;
2142 2142
2143 nf->dma = map; 2143 nf->dma = map;
2144 nf->length = frag->size; 2144 nf->length = skb_frag_size(frag);
2145 } 2145 }
2146 2146
2147 return 0; 2147 return 0;
@@ -2221,7 +2221,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2221 if (!skb_is_gso(skb) && frag_count > QLCNIC_MAX_FRAGS_PER_TX) { 2221 if (!skb_is_gso(skb) && frag_count > QLCNIC_MAX_FRAGS_PER_TX) {
2222 2222
2223 for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX); i++) 2223 for (i = 0; i < (frag_count - QLCNIC_MAX_FRAGS_PER_TX); i++)
2224 delta += skb_shinfo(skb)->frags[i].size; 2224 delta += skb_frag_size(&skb_shinfo(skb)->frags[i]);
2225 2225
2226 if (!__pskb_pull_tail(skb, delta)) 2226 if (!__pskb_pull_tail(skb, delta))
2227 goto drop_packet; 2227 goto drop_packet;
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index f2d9bb78ec7f..c92afcd912e2 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -1431,7 +1431,7 @@ static int ql_map_send(struct ql_adapter *qdev,
1431 map_idx++; 1431 map_idx++;
1432 } 1432 }
1433 1433
1434 map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, frag->size, 1434 map = skb_frag_dma_map(&qdev->pdev->dev, frag, 0, skb_frag_size(frag),
1435 DMA_TO_DEVICE); 1435 DMA_TO_DEVICE);
1436 1436
1437 err = dma_mapping_error(&qdev->pdev->dev, map); 1437 err = dma_mapping_error(&qdev->pdev->dev, map);
@@ -1443,10 +1443,10 @@ static int ql_map_send(struct ql_adapter *qdev,
1443 } 1443 }
1444 1444
1445 tbd->addr = cpu_to_le64(map); 1445 tbd->addr = cpu_to_le64(map);
1446 tbd->len = cpu_to_le32(frag->size); 1446 tbd->len = cpu_to_le32(skb_frag_size(frag));
1447 dma_unmap_addr_set(&tx_ring_desc->map[map_idx], mapaddr, map); 1447 dma_unmap_addr_set(&tx_ring_desc->map[map_idx], mapaddr, map);
1448 dma_unmap_len_set(&tx_ring_desc->map[map_idx], maplen, 1448 dma_unmap_len_set(&tx_ring_desc->map[map_idx], maplen,
1449 frag->size); 1449 skb_frag_size(frag));
1450 1450
1451 } 1451 }
1452 /* Save the number of segments we've mapped. */ 1452 /* Save the number of segments we've mapped. */