Commit ced9e087 authored by James Morris's avatar James Morris Committed by David S. Miller

[NET]: skb_headlen() cleanup.

parent 4357947c
...@@ -826,7 +826,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev) ...@@ -826,7 +826,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
* Otherwise we could race with the device. * Otherwise we could race with the device.
*/ */
first_eor = eor; first_eor = eor;
first_len = skb->len - skb->data_len; first_len = skb_headlen(skb);
first_mapping = pci_map_single(cp->pdev, skb->data, first_mapping = pci_map_single(cp->pdev, skb->data,
first_len, PCI_DMA_TODEVICE); first_len, PCI_DMA_TODEVICE);
cp->tx_skb[entry].skb = skb; cp->tx_skb[entry].skb = skb;
......
...@@ -2829,7 +2829,7 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2829,7 +2829,7 @@ static int ace_start_xmit(struct sk_buff *skb, struct net_device *dev)
int i, len = 0; int i, len = 0;
mapping = ace_map_tx_skb(ap, skb, NULL, idx); mapping = ace_map_tx_skb(ap, skb, NULL, idx);
flagsize = ((skb->len - skb->data_len) << 16); flagsize = (skb_headlen(skb) << 16);
if (skb->ip_summed == CHECKSUM_HW) if (skb->ip_summed == CHECKSUM_HW)
flagsize |= BD_FLG_TCP_UDP_SUM; flagsize |= BD_FLG_TCP_UDP_SUM;
#if ACENIC_DO_VLAN #if ACENIC_DO_VLAN
......
...@@ -2199,10 +2199,10 @@ e100_prepare_xmit_buff(struct e100_private *bdp, struct sk_buff *skb) ...@@ -2199,10 +2199,10 @@ e100_prepare_xmit_buff(struct e100_private *bdp, struct sk_buff *skb)
(tcb->tbd_ptr)->tbd_buf_addr = (tcb->tbd_ptr)->tbd_buf_addr =
cpu_to_le32(pci_map_single(bdp->pdev, skb->data, cpu_to_le32(pci_map_single(bdp->pdev, skb->data,
(skb->len - skb->data_len), skb_headlen(skb),
PCI_DMA_TODEVICE)); PCI_DMA_TODEVICE));
(tcb->tbd_ptr)->tbd_buf_cnt = (tcb->tbd_ptr)->tbd_buf_cnt =
cpu_to_le16(skb->len - skb->data_len); cpu_to_le16(skb_headlen(skb));
for (i = 0; i < skb_shinfo(skb)->nr_frags; for (i = 0; i < skb_shinfo(skb)->nr_frags;
i++, tbd_arr_ptr++, frag++) { i++, tbd_arr_ptr++, frag++) {
......
...@@ -894,7 +894,7 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -894,7 +894,7 @@ static int gem_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* We must give this initial chunk to the device last. /* We must give this initial chunk to the device last.
* Otherwise we could race with the device. * Otherwise we could race with the device.
*/ */
first_len = skb->len - skb->data_len; first_len = skb_headlen(skb);
first_mapping = pci_map_page(gp->pdev, virt_to_page(skb->data), first_mapping = pci_map_page(gp->pdev, virt_to_page(skb->data),
((unsigned long) skb->data & ~PAGE_MASK), ((unsigned long) skb->data & ~PAGE_MASK),
first_len, PCI_DMA_TODEVICE); first_len, PCI_DMA_TODEVICE);
......
...@@ -2319,7 +2319,7 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2319,7 +2319,7 @@ static int happy_meal_start_xmit(struct sk_buff *skb, struct net_device *dev)
/* We must give this initial chunk to the device last. /* We must give this initial chunk to the device last.
* Otherwise we could race with the device. * Otherwise we could race with the device.
*/ */
first_len = skb->len - skb->data_len; first_len = skb_headlen(skb);
first_mapping = hme_dma_map(hp, skb->data, first_len, DMA_TODEVICE); first_mapping = hme_dma_map(hp, skb->data, first_len, DMA_TODEVICE);
entry = NEXT_TX(entry); entry = NEXT_TX(entry);
......
...@@ -1751,7 +1751,7 @@ static void tg3_tx(struct tg3 *tp) ...@@ -1751,7 +1751,7 @@ static void tg3_tx(struct tg3 *tp)
pci_unmap_single(tp->pdev, pci_unmap_single(tp->pdev,
pci_unmap_addr(ri, mapping), pci_unmap_addr(ri, mapping),
(skb->len - skb->data_len), skb_headlen(skb),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
ri->skb = NULL; ri->skb = NULL;
...@@ -2316,7 +2316,7 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb, ...@@ -2316,7 +2316,7 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
int len; int len;
if (i == 0) if (i == 0)
len = skb->len - skb->data_len; len = skb_headlen(skb);
else else
len = skb_shinfo(skb)->frags[i-1].size; len = skb_shinfo(skb)->frags[i-1].size;
pci_unmap_single(tp->pdev, pci_unmap_single(tp->pdev,
...@@ -2401,7 +2401,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) ...@@ -2401,7 +2401,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
int would_hit_hwbug; int would_hit_hwbug;
unsigned long flags; unsigned long flags;
len = (skb->len - skb->data_len); len = skb_headlen(skb);
/* No BH disabling for tx_lock here. We are running in BH disabled /* No BH disabling for tx_lock here. We are running in BH disabled
* context and TX reclaim runs via tp->poll inside of a software * context and TX reclaim runs via tp->poll inside of a software
...@@ -2520,7 +2520,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev) ...@@ -2520,7 +2520,7 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
i = 0; i = 0;
while (entry != last_plus_one) { while (entry != last_plus_one) {
if (i == 0) if (i == 0)
len = skb->len - skb->data_len; len = skb_headlen(skb);
else else
len = skb_shinfo(skb)->frags[i-1].size; len = skb_shinfo(skb)->frags[i-1].size;
...@@ -2593,7 +2593,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -2593,7 +2593,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
u32 len, entry, base_flags, mss; u32 len, entry, base_flags, mss;
unsigned long flags; unsigned long flags;
len = (skb->len - skb->data_len); len = skb_headlen(skb);
/* No BH disabling for tx_lock here. We are running in BH disabled /* No BH disabling for tx_lock here. We are running in BH disabled
* context and TX reclaim runs via tp->poll inside of a software * context and TX reclaim runs via tp->poll inside of a software
...@@ -2829,7 +2829,7 @@ static void tg3_free_rings(struct tg3 *tp) ...@@ -2829,7 +2829,7 @@ static void tg3_free_rings(struct tg3 *tp)
pci_unmap_single(tp->pdev, pci_unmap_single(tp->pdev,
pci_unmap_addr(txp, mapping), pci_unmap_addr(txp, mapping),
(skb->len - skb->data_len), skb_headlen(skb),
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txp->skb = NULL; txp->skb = NULL;
......
...@@ -844,7 +844,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev) ...@@ -844,7 +844,7 @@ typhoon_start_tx(struct sk_buff *skb, struct net_device *dev)
} else { } else {
int i, len; int i, len;
len = skb->len - skb->data_len; len = skb_headlen(skb);
skb_dma = pci_map_single(tp->tx_pdev, skb->data, len, skb_dma = pci_map_single(tp->tx_pdev, skb->data, len,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID; txd->flags = TYPHOON_FRAG_DESC | TYPHOON_DESC_VALID;
......
...@@ -220,7 +220,7 @@ int skb_copy_datagram(const struct sk_buff *skb, int offset, char *to, int size) ...@@ -220,7 +220,7 @@ int skb_copy_datagram(const struct sk_buff *skb, int offset, char *to, int size)
int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,
struct iovec *to, int len) struct iovec *to, int len)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
/* Copy header. */ /* Copy header. */
...@@ -295,7 +295,7 @@ int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset, ...@@ -295,7 +295,7 @@ int skb_copy_datagram_iovec(const struct sk_buff *skb, int offset,
int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset, int skb_copy_and_csum_datagram(const struct sk_buff *skb, int offset,
u8 *to, int len, unsigned int *csump) u8 *to, int len, unsigned int *csump)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int pos = 0; int pos = 0;
int i, copy = start - offset; int i, copy = start - offset;
......
...@@ -932,7 +932,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta) ...@@ -932,7 +932,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
{ {
int i, copy; int i, copy;
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
if (offset > (int)skb->len - len) if (offset > (int)skb->len - len)
goto fault; goto fault;
...@@ -1009,7 +1009,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len) ...@@ -1009,7 +1009,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
unsigned int skb_checksum(const struct sk_buff *skb, int offset, unsigned int skb_checksum(const struct sk_buff *skb, int offset,
int len, unsigned int csum) int len, unsigned int csum)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
int pos = 0; int pos = 0;
...@@ -1085,7 +1085,7 @@ unsigned int skb_checksum(const struct sk_buff *skb, int offset, ...@@ -1085,7 +1085,7 @@ unsigned int skb_checksum(const struct sk_buff *skb, int offset,
unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset, unsigned int skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
u8 *to, int len, unsigned int csum) u8 *to, int len, unsigned int csum)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
int pos = 0; int pos = 0;
...@@ -1170,9 +1170,9 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to) ...@@ -1170,9 +1170,9 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
if (skb->ip_summed == CHECKSUM_HW) if (skb->ip_summed == CHECKSUM_HW)
csstart = skb->h.raw - skb->data; csstart = skb->h.raw - skb->data;
else else
csstart = skb->len - skb->data_len; csstart = skb_headlen(skb);
if (csstart > skb->len - skb->data_len) if (csstart > skb_headlen(skb))
BUG(); BUG();
memcpy(to, skb->data, csstart); memcpy(to, skb->data, csstart);
......
...@@ -354,7 +354,7 @@ void tcp_push_one(struct sock *sk, unsigned cur_mss) ...@@ -354,7 +354,7 @@ void tcp_push_one(struct sock *sk, unsigned cur_mss)
static void skb_split(struct sk_buff *skb, struct sk_buff *skb1, u32 len) static void skb_split(struct sk_buff *skb, struct sk_buff *skb1, u32 len)
{ {
int i; int i;
int pos = skb->len - skb->data_len; int pos = skb_headlen(skb);
if (len < pos) { if (len < pos) {
/* Split line is inside header. */ /* Split line is inside header. */
......
...@@ -445,7 +445,7 @@ int xfrm_count_enc_supported(void) ...@@ -445,7 +445,7 @@ int xfrm_count_enc_supported(void)
void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm,
int offset, int len, icv_update_fn_t icv_update) int offset, int len, icv_update_fn_t icv_update)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
struct scatterlist sg; struct scatterlist sg;
...@@ -521,7 +521,7 @@ void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm, ...@@ -521,7 +521,7 @@ void skb_icv_walk(const struct sk_buff *skb, struct crypto_tfm *tfm,
int int
skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len) skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int len)
{ {
int start = skb->len - skb->data_len; int start = skb_headlen(skb);
int i, copy = start - offset; int i, copy = start - offset;
int elt = 0; int elt = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment