diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-10 20:16:10 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:58 -0400 |
commit | bbe735e4247dba32568a305553b010081c8dea99 (patch) | |
tree | 95d96619c85785a47ccee48965b68d99cf946854 /drivers | |
parent | e7dd65dafda5737a983c04d652a69ab8da78ee3f (diff) |
[SK_BUFF]: Introduce skb_network_offset()
For the quite common 'skb->nh.raw - skb->data' sequence.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 2 | ||||
-rw-r--r-- | drivers/net/atl1/atl1_main.c | 2 | ||||
-rw-r--r-- | drivers/net/chelsio/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/cxgb3/sge.c | 2 | ||||
-rw-r--r-- | drivers/net/e1000/e1000_main.c | 2 | ||||
-rw-r--r-- | drivers/net/gianfar.c | 2 | ||||
-rw-r--r-- | drivers/net/ixgb/ixgb_main.c | 2 | ||||
-rw-r--r-- | drivers/net/netxen/netxen_nic_hw.c | 2 |
8 files changed, 8 insertions, 8 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index fadb9291bc1b..0c2b3752e46e 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -1121,7 +1121,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) | |||
1121 | if (!skb) | 1121 | if (!skb) |
1122 | return; | 1122 | return; |
1123 | if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { | 1123 | if (lp->p_encap == ISDN_NET_ENCAP_ETHER) { |
1124 | int pullsize = (ulong)skb->nh.raw - (ulong)skb->data - ETH_HLEN; | 1124 | const int pullsize = skb_network_offset(skb) - ETH_HLEN; |
1125 | if (pullsize > 0) { | 1125 | if (pullsize > 0) { |
1126 | printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize); | 1126 | printk(KERN_DEBUG "isdn_net: Pull junk %d\n", pullsize); |
1127 | skb_pull(skb, pullsize); | 1127 | skb_pull(skb, pullsize); |
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c index e3f181602e4f..793a61b2140f 100644 --- a/drivers/net/atl1/atl1_main.c +++ b/drivers/net/atl1/atl1_main.c | |||
@@ -1300,7 +1300,7 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb, | |||
1300 | ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1300 | ~csum_tcpudp_magic(skb->nh.iph->saddr, |
1301 | skb->nh.iph->daddr, 0, | 1301 | skb->nh.iph->daddr, 0, |
1302 | IPPROTO_TCP, 0); | 1302 | IPPROTO_TCP, 0); |
1303 | ipofst = skb->nh.raw - skb->data; | 1303 | ipofst = skb_network_offset(skb); |
1304 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ | 1304 | if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ |
1305 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; | 1305 | tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; |
1306 | 1306 | ||
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c index 47fa8dcf7527..8cdee67d582f 100644 --- a/drivers/net/chelsio/sge.c +++ b/drivers/net/chelsio/sge.c | |||
@@ -1865,7 +1865,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1865 | 1865 | ||
1866 | ++st->tx_tso; | 1866 | ++st->tx_tso; |
1867 | 1867 | ||
1868 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 1868 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
1869 | CPL_ETH_II : CPL_ETH_II_VLAN; | 1869 | CPL_ETH_II : CPL_ETH_II_VLAN; |
1870 | 1870 | ||
1871 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); | 1871 | hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); |
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c index 4dd712088bcf..7e9e9db4fb97 100644 --- a/drivers/net/cxgb3/sge.c +++ b/drivers/net/cxgb3/sge.c | |||
@@ -897,7 +897,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb, | |||
897 | d->flit[2] = 0; | 897 | d->flit[2] = 0; |
898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); | 898 | cntrl |= V_TXPKT_OPCODE(CPL_TX_PKT_LSO); |
899 | hdr->cntrl = htonl(cntrl); | 899 | hdr->cntrl = htonl(cntrl); |
900 | eth_type = skb->nh.raw - skb->data == ETH_HLEN ? | 900 | eth_type = skb_network_offset(skb) == ETH_HLEN ? |
901 | CPL_ETH_II : CPL_ETH_II_VLAN; | 901 | CPL_ETH_II : CPL_ETH_II_VLAN; |
902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | | 902 | tso_info |= V_LSO_ETH_TYPE(eth_type) | |
903 | V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | | 903 | V_LSO_IPHDR_WORDS(skb->nh.iph->ihl) | |
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c index b28a915bd980..86161011b539 100644 --- a/drivers/net/e1000/e1000_main.c +++ b/drivers/net/e1000/e1000_main.c | |||
@@ -2910,7 +2910,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring, | |||
2910 | 0); | 2910 | 0); |
2911 | ipcse = 0; | 2911 | ipcse = 0; |
2912 | } | 2912 | } |
2913 | ipcss = skb->nh.raw - skb->data; | 2913 | ipcss = skb_network_offset(skb); |
2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 2914 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; |
2915 | tucss = skb->h.raw - skb->data; | 2915 | tucss = skb->h.raw - skb->data; |
2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; | 2916 | tucso = (void *)&(skb->h.th->check) - (void *)skb->data; |
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c index 1d019195a391..c7a70933c759 100644 --- a/drivers/net/gianfar.c +++ b/drivers/net/gianfar.c | |||
@@ -952,7 +952,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb) | |||
952 | * frame (skb->data) and the start of the IP hdr. | 952 | * frame (skb->data) and the start of the IP hdr. |
953 | * l4os is the distance between the start of the | 953 | * l4os is the distance between the start of the |
954 | * l3 hdr and the l4 hdr */ | 954 | * l3 hdr and the l4 hdr */ |
955 | fcb->l3os = (u16)(skb->nh.raw - skb->data - GMAC_FCB_LEN); | 955 | fcb->l3os = (u16)(skb_network_offset(skb) - GMAC_FCB_LEN); |
956 | fcb->l4os = (u16)(skb->h.raw - skb->nh.raw); | 956 | fcb->l4os = (u16)(skb->h.raw - skb->nh.raw); |
957 | 957 | ||
958 | fcb->flags = flags; | 958 | fcb->flags = flags; |
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index afc2ec72529e..cfb791bb45e2 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c | |||
@@ -1195,7 +1195,7 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb) | |||
1195 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, | 1195 | skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, |
1196 | skb->nh.iph->daddr, | 1196 | skb->nh.iph->daddr, |
1197 | 0, IPPROTO_TCP, 0); | 1197 | 0, IPPROTO_TCP, 0); |
1198 | ipcss = skb->nh.raw - skb->data; | 1198 | ipcss = skb_network_offset(skb); |
1199 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; | 1199 | ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; |
1200 | ipcse = skb->h.raw - skb->data - 1; | 1200 | ipcse = skb->h.raw - skb->data - 1; |
1201 | tucss = skb->h.raw - skb->data; | 1201 | tucss = skb->h.raw - skb->data; |
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c index 6537574a9cda..625e11ed6aae 100644 --- a/drivers/net/netxen/netxen_nic_hw.c +++ b/drivers/net/netxen/netxen_nic_hw.c | |||
@@ -386,7 +386,7 @@ void netxen_tso_check(struct netxen_adapter *adapter, | |||
386 | } | 386 | } |
387 | adapter->stats.xmitcsummed++; | 387 | adapter->stats.xmitcsummed++; |
388 | desc->tcp_hdr_offset = skb->h.raw - skb->data; | 388 | desc->tcp_hdr_offset = skb->h.raw - skb->data; |
389 | desc->ip_hdr_offset = skb->nh.raw - skb->data; | 389 | desc->ip_hdr_offset = skb_network_offset(skb); |
390 | } | 390 | } |
391 | 391 | ||
392 | int netxen_is_flash_supported(struct netxen_adapter *adapter) | 392 | int netxen_is_flash_supported(struct netxen_adapter *adapter) |