aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2007-04-21 01:47:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:25:10 -0400
commiteddc9ec53be2ecdbf4efe0efd4a83052594f0ac0 (patch)
tree4a38ab4dbd9d61fdf5a5ea6ed61463e0b9e33ba7 /drivers/net
parente023dd643798c4f06c16466af90b4d250e4b8bd7 (diff)
[SK_BUFF]: Introduce ip_hdr(), remove skb->nh.iph
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/8139cp.c4
-rw-r--r--drivers/net/atl1/atl1_main.c15
-rw-r--r--drivers/net/bnx2.c18
-rw-r--r--drivers/net/bonding/bond_alb.c17
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/chelsio/sge.c4
-rw-r--r--drivers/net/cxgb3/sge.c2
-rw-r--r--drivers/net/e1000/e1000_main.c16
-rw-r--r--drivers/net/ehea/ehea_main.c20
-rw-r--r--drivers/net/gianfar.c2
-rw-r--r--drivers/net/ioc3-eth.c4
-rw-r--r--drivers/net/ixgb/ixgb_main.c12
-rw-r--r--drivers/net/loopback.c6
-rw-r--r--drivers/net/mv643xx_eth.c4
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c4
-rw-r--r--drivers/net/ns83820.c4
-rw-r--r--drivers/net/pasemi_mac.c2
-rw-r--r--drivers/net/r8169.c2
-rw-r--r--drivers/net/sky2.c2
-rw-r--r--drivers/net/spider_net.c2
-rw-r--r--drivers/net/tg3.c30
-rw-r--r--drivers/net/via-velocity.c2
22 files changed, 90 insertions, 84 deletions
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index 2f704cb06e7b..e8c9f27817b0 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -806,7 +806,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
806 if (mss) 806 if (mss)
807 flags |= LargeSend | ((mss & MSSMask) << MSSShift); 807 flags |= LargeSend | ((mss & MSSMask) << MSSShift);
808 else if (skb->ip_summed == CHECKSUM_PARTIAL) { 808 else if (skb->ip_summed == CHECKSUM_PARTIAL) {
809 const struct iphdr *ip = skb->nh.iph; 809 const struct iphdr *ip = ip_hdr(skb);
810 if (ip->protocol == IPPROTO_TCP) 810 if (ip->protocol == IPPROTO_TCP)
811 flags |= IPCS | TCPCS; 811 flags |= IPCS | TCPCS;
812 else if (ip->protocol == IPPROTO_UDP) 812 else if (ip->protocol == IPPROTO_UDP)
@@ -825,7 +825,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
825 u32 first_len, first_eor; 825 u32 first_len, first_eor;
826 dma_addr_t first_mapping; 826 dma_addr_t first_mapping;
827 int frag, first_entry = entry; 827 int frag, first_entry = entry;
828 const struct iphdr *ip = skb->nh.iph; 828 const struct iphdr *ip = ip_hdr(skb);
829 829
830 /* We must give this initial chunk to the device last. 830 /* We must give this initial chunk to the device last.
831 * Otherwise we could race with the device. 831 * Otherwise we could race with the device.
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index 793a61b2140f..d2be79a30f8a 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -1294,17 +1294,18 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
1294 } 1294 }
1295 1295
1296 if (skb->protocol == ntohs(ETH_P_IP)) { 1296 if (skb->protocol == ntohs(ETH_P_IP)) {
1297 skb->nh.iph->tot_len = 0; 1297 struct iphdr *iph = ip_hdr(skb);
1298 skb->nh.iph->check = 0; 1298
1299 skb->h.th->check = 1299 iph->tot_len = 0;
1300 ~csum_tcpudp_magic(skb->nh.iph->saddr, 1300 iph->check = 0;
1301 skb->nh.iph->daddr, 0, 1301 skb->h.th->check = ~csum_tcpudp_magic(iph->saddr,
1302 IPPROTO_TCP, 0); 1302 iph->daddr, 0,
1303 IPPROTO_TCP, 0);
1303 ipofst = skb_network_offset(skb); 1304 ipofst = skb_network_offset(skb);
1304 if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */ 1305 if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
1305 tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT; 1306 tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
1306 1307
1307 tso->tsopl |= (skb->nh.iph->ihl & 1308 tso->tsopl |= (iph->ihl &
1308 CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT; 1309 CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT;
1309 tso->tsopl |= ((skb->h.th->doff << 2) & 1310 tso->tsopl |= ((skb->h.th->doff << 2) &
1310 TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT; 1311 TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT;
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index b8091c55d441..eb0c4f1d4483 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -4513,6 +4513,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
4513 if ((mss = skb_shinfo(skb)->gso_size) && 4513 if ((mss = skb_shinfo(skb)->gso_size) &&
4514 (skb->len > (bp->dev->mtu + ETH_HLEN))) { 4514 (skb->len > (bp->dev->mtu + ETH_HLEN))) {
4515 u32 tcp_opt_len, ip_tcp_len; 4515 u32 tcp_opt_len, ip_tcp_len;
4516 struct iphdr *iph;
4516 4517
4517 if (skb_header_cloned(skb) && 4518 if (skb_header_cloned(skb) &&
4518 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) { 4519 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
@@ -4529,16 +4530,15 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
4529 } 4530 }
4530 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); 4531 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
4531 4532
4532 skb->nh.iph->check = 0; 4533 iph = ip_hdr(skb);
4533 skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len); 4534 iph->check = 0;
4534 skb->h.th->check = 4535 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
4535 ~csum_tcpudp_magic(skb->nh.iph->saddr, 4536 skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
4536 skb->nh.iph->daddr, 4537 0, IPPROTO_TCP, 0);
4537 0, IPPROTO_TCP, 0);
4538 4538
4539 if (tcp_opt_len || (skb->nh.iph->ihl > 5)) { 4539 if (tcp_opt_len || (iph->ihl > 5)) {
4540 vlan_tag_flags |= ((skb->nh.iph->ihl - 5) + 4540 vlan_tag_flags |= ((iph->ihl - 5) +
4541 (tcp_opt_len >> 2)) << 8; 4541 (tcp_opt_len >> 2)) << 8;
4542 } 4542 }
4543 } 4543 }
4544 else 4544 else
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 86cfcb3f8131..8555afa574a4 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -112,7 +112,7 @@ static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb)
112/* Forward declaration */ 112/* Forward declaration */
113static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); 113static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
114 114
115static inline u8 _simple_hash(u8 *hash_start, int hash_size) 115static inline u8 _simple_hash(const u8 *hash_start, int hash_size)
116{ 116{
117 int i; 117 int i;
118 u8 hash = 0; 118 u8 hash = 0;
@@ -1268,7 +1268,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1268 int hash_size = 0; 1268 int hash_size = 0;
1269 int do_tx_balance = 1; 1269 int do_tx_balance = 1;
1270 u32 hash_index = 0; 1270 u32 hash_index = 0;
1271 u8 *hash_start = NULL; 1271 const u8 *hash_start = NULL;
1272 int res = 1; 1272 int res = 1;
1273 1273
1274 skb_reset_mac_header(skb); 1274 skb_reset_mac_header(skb);
@@ -1285,15 +1285,18 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1285 } 1285 }
1286 1286
1287 switch (ntohs(skb->protocol)) { 1287 switch (ntohs(skb->protocol)) {
1288 case ETH_P_IP: 1288 case ETH_P_IP: {
1289 const struct iphdr *iph = ip_hdr(skb);
1290
1289 if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) || 1291 if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) ||
1290 (skb->nh.iph->daddr == ip_bcast) || 1292 (iph->daddr == ip_bcast) ||
1291 (skb->nh.iph->protocol == IPPROTO_IGMP)) { 1293 (iph->protocol == IPPROTO_IGMP)) {
1292 do_tx_balance = 0; 1294 do_tx_balance = 0;
1293 break; 1295 break;
1294 } 1296 }
1295 hash_start = (char*)&(skb->nh.iph->daddr); 1297 hash_start = (char *)&(iph->daddr);
1296 hash_size = sizeof(skb->nh.iph->daddr); 1298 hash_size = sizeof(iph->daddr);
1299 }
1297 break; 1300 break;
1298 case ETH_P_IPV6: 1301 case ETH_P_IPV6:
1299 if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) { 1302 if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) {
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e4724d874e7c..7f11388893fc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3476,7 +3476,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
3476 struct net_device *bond_dev, int count) 3476 struct net_device *bond_dev, int count)
3477{ 3477{
3478 struct ethhdr *data = (struct ethhdr *)skb->data; 3478 struct ethhdr *data = (struct ethhdr *)skb->data;
3479 struct iphdr *iph = skb->nh.iph; 3479 struct iphdr *iph = ip_hdr(skb);
3480 u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl); 3480 u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl);
3481 int layer4_xor = 0; 3481 int layer4_xor = 0;
3482 3482
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index 8cdee67d582f..c357f45a16c3 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1871,7 +1871,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1871 hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr)); 1871 hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr));
1872 hdr->opcode = CPL_TX_PKT_LSO; 1872 hdr->opcode = CPL_TX_PKT_LSO;
1873 hdr->ip_csum_dis = hdr->l4_csum_dis = 0; 1873 hdr->ip_csum_dis = hdr->l4_csum_dis = 0;
1874 hdr->ip_hdr_words = skb->nh.iph->ihl; 1874 hdr->ip_hdr_words = ip_hdr(skb)->ihl;
1875 hdr->tcp_hdr_words = skb->h.th->doff; 1875 hdr->tcp_hdr_words = skb->h.th->doff;
1876 hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type, 1876 hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type,
1877 skb_shinfo(skb)->gso_size)); 1877 skb_shinfo(skb)->gso_size));
@@ -1912,7 +1912,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
1912 1912
1913 if (!(adapter->flags & UDP_CSUM_CAPABLE) && 1913 if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
1914 skb->ip_summed == CHECKSUM_PARTIAL && 1914 skb->ip_summed == CHECKSUM_PARTIAL &&
1915 skb->nh.iph->protocol == IPPROTO_UDP) { 1915 ip_hdr(skb)->protocol == IPPROTO_UDP) {
1916 if (unlikely(skb_checksum_help(skb))) { 1916 if (unlikely(skb_checksum_help(skb))) {
1917 pr_debug("%s: unable to do udp checksum\n", dev->name); 1917 pr_debug("%s: unable to do udp checksum\n", dev->name);
1918 dev_kfree_skb_any(skb); 1918 dev_kfree_skb_any(skb);
diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 7e9e9db4fb97..892e5dcafa04 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -900,7 +900,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
900 eth_type = skb_network_offset(skb) == 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(ip_hdr(skb)->ihl) |
904 V_LSO_TCPHDR_WORDS(skb->h.th->doff); 904 V_LSO_TCPHDR_WORDS(skb->h.th->doff);
905 hdr->lso_info = htonl(tso_info); 905 hdr->lso_info = htonl(tso_info);
906 flits = 3; 906 flits = 3;
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 86161011b539..c324866c9789 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -2890,14 +2890,12 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2890 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 2890 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
2891 mss = skb_shinfo(skb)->gso_size; 2891 mss = skb_shinfo(skb)->gso_size;
2892 if (skb->protocol == htons(ETH_P_IP)) { 2892 if (skb->protocol == htons(ETH_P_IP)) {
2893 skb->nh.iph->tot_len = 0; 2893 struct iphdr *iph = ip_hdr(skb);
2894 skb->nh.iph->check = 0; 2894 iph->tot_len = 0;
2895 skb->h.th->check = 2895 iph->check = 0;
2896 ~csum_tcpudp_magic(skb->nh.iph->saddr, 2896 skb->h.th->check = ~csum_tcpudp_magic(iph->saddr,
2897 skb->nh.iph->daddr, 2897 iph->daddr, 0,
2898 0, 2898 IPPROTO_TCP, 0);
2899 IPPROTO_TCP,
2900 0);
2901 cmd_length = E1000_TXD_CMD_IP; 2899 cmd_length = E1000_TXD_CMD_IP;
2902 ipcse = skb->h.raw - skb->data - 1; 2900 ipcse = skb->h.raw - skb->data - 1;
2903 } else if (skb->protocol == htons(ETH_P_IPV6)) { 2901 } else if (skb->protocol == htons(ETH_P_IPV6)) {
@@ -2911,7 +2909,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
2911 ipcse = 0; 2909 ipcse = 0;
2912 } 2910 }
2913 ipcss = skb_network_offset(skb); 2911 ipcss = skb_network_offset(skb);
2914 ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; 2912 ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
2915 tucss = skb->h.raw - skb->data; 2913 tucss = skb->h.raw - skb->data;
2916 tucso = (void *)&(skb->h.th->check) - (void *)skb->data; 2914 tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
2917 tucse = 0; 2915 tucse = 0;
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index b1c90a4fe31e..0dc701e611e5 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -1262,7 +1262,7 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
1262static inline void write_ip_start_end(struct ehea_swqe *swqe, 1262static inline void write_ip_start_end(struct ehea_swqe *swqe,
1263 const struct sk_buff *skb) 1263 const struct sk_buff *skb)
1264{ 1264{
1265 swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data)); 1265 swqe->ip_start = skb_network_offset(skb);
1266 swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1); 1266 swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
1267} 1267}
1268 1268
@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
1688 struct ehea_swqe *swqe, u32 lkey) 1688 struct ehea_swqe *swqe, u32 lkey)
1689{ 1689{
1690 if (skb->protocol == htons(ETH_P_IP)) { 1690 if (skb->protocol == htons(ETH_P_IP)) {
1691 const struct iphdr *iph = ip_hdr(skb);
1691 /* IPv4 */ 1692 /* IPv4 */
1692 swqe->tx_control |= EHEA_SWQE_CRC 1693 swqe->tx_control |= EHEA_SWQE_CRC
1693 | EHEA_SWQE_IP_CHECKSUM 1694 | EHEA_SWQE_IP_CHECKSUM
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
1697 1698
1698 write_ip_start_end(swqe, skb); 1699 write_ip_start_end(swqe, skb);
1699 1700
1700 if (skb->nh.iph->protocol == IPPROTO_UDP) { 1701 if (iph->protocol == IPPROTO_UDP) {
1701 if ((skb->nh.iph->frag_off & IP_MF) || 1702 if ((iph->frag_off & IP_MF) ||
1702 (skb->nh.iph->frag_off & IP_OFFSET)) 1703 (iph->frag_off & IP_OFFSET))
1703 /* IP fragment, so don't change cs */ 1704 /* IP fragment, so don't change cs */
1704 swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM; 1705 swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM;
1705 else 1706 else
1706 write_udp_offset_end(swqe, skb); 1707 write_udp_offset_end(swqe, skb);
1707 1708
1708 } else if (skb->nh.iph->protocol == IPPROTO_TCP) { 1709 } else if (iph->protocol == IPPROTO_TCP) {
1709 write_tcp_offset_end(swqe, skb); 1710 write_tcp_offset_end(swqe, skb);
1710 } 1711 }
1711 1712
@@ -1731,10 +1732,11 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
1731 int i; 1732 int i;
1732 1733
1733 if (skb->protocol == htons(ETH_P_IP)) { 1734 if (skb->protocol == htons(ETH_P_IP)) {
1735 const struct iphdr *iph = ip_hdr(skb);
1734 /* IPv4 */ 1736 /* IPv4 */
1735 write_ip_start_end(swqe, skb); 1737 write_ip_start_end(swqe, skb);
1736 1738
1737 if (skb->nh.iph->protocol == IPPROTO_TCP) { 1739 if (iph->protocol == IPPROTO_TCP) {
1738 swqe->tx_control |= EHEA_SWQE_CRC 1740 swqe->tx_control |= EHEA_SWQE_CRC
1739 | EHEA_SWQE_IP_CHECKSUM 1741 | EHEA_SWQE_IP_CHECKSUM
1740 | EHEA_SWQE_TCP_CHECKSUM 1742 | EHEA_SWQE_TCP_CHECKSUM
@@ -1742,9 +1744,9 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
1742 1744
1743 write_tcp_offset_end(swqe, skb); 1745 write_tcp_offset_end(swqe, skb);
1744 1746
1745 } else if (skb->nh.iph->protocol == IPPROTO_UDP) { 1747 } else if (iph->protocol == IPPROTO_UDP) {
1746 if ((skb->nh.iph->frag_off & IP_MF) || 1748 if ((iph->frag_off & IP_MF) ||
1747 (skb->nh.iph->frag_off & IP_OFFSET)) 1749 (iph->frag_off & IP_OFFSET))
1748 /* IP fragment, so don't change cs */ 1750 /* IP fragment, so don't change cs */
1749 swqe->tx_control |= EHEA_SWQE_CRC 1751 swqe->tx_control |= EHEA_SWQE_CRC
1750 | EHEA_SWQE_IMM_DATA_PRESENT; 1752 | EHEA_SWQE_IMM_DATA_PRESENT;
diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
index c7a70933c759..c9abc96a0919 100644
--- a/drivers/net/gianfar.c
+++ b/drivers/net/gianfar.c
@@ -942,7 +942,7 @@ static inline void gfar_tx_checksum(struct sk_buff *skb, struct txfcb *fcb)
942 942
943 /* Tell the controller what the protocol is */ 943 /* Tell the controller what the protocol is */
944 /* And provide the already calculated phcs */ 944 /* And provide the already calculated phcs */
945 if (skb->nh.iph->protocol == IPPROTO_UDP) { 945 if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
946 flags |= TXFCB_UDP; 946 flags |= TXFCB_UDP;
947 fcb->phcs = skb->h.uh->check; 947 fcb->phcs = skb->h.uh->check;
948 } else 948 } else
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index ea07aa5ba51b..d375e786b4b3 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1393,9 +1393,9 @@ static int ioc3_start_xmit(struct sk_buff *skb, struct net_device *dev)
1393 * manually. 1393 * manually.
1394 */ 1394 */
1395 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1395 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1396 int proto = ntohs(skb->nh.iph->protocol); 1396 const struct iphdr *ih = ip_hdr(skb);
1397 const int proto = ntohs(ih->protocol);
1397 unsigned int csoff; 1398 unsigned int csoff;
1398 struct iphdr *ih = skb->nh.iph;
1399 uint32_t csum, ehsum; 1399 uint32_t csum, ehsum;
1400 uint16_t *eh; 1400 uint16_t *eh;
1401 1401
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index cfb791bb45e2..bba4dcaf92e9 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1182,6 +1182,8 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1182 1182
1183 if (likely(skb_is_gso(skb))) { 1183 if (likely(skb_is_gso(skb))) {
1184 struct ixgb_buffer *buffer_info; 1184 struct ixgb_buffer *buffer_info;
1185 struct iphdr *iph;
1186
1185 if (skb_header_cloned(skb)) { 1187 if (skb_header_cloned(skb)) {
1186 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 1188 err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
1187 if (err) 1189 if (err)
@@ -1190,13 +1192,13 @@ ixgb_tso(struct ixgb_adapter *adapter, struct sk_buff *skb)
1190 1192
1191 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2)); 1193 hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
1192 mss = skb_shinfo(skb)->gso_size; 1194 mss = skb_shinfo(skb)->gso_size;
1193 skb->nh.iph->tot_len = 0; 1195 iph = ip_hdr(skb);
1194 skb->nh.iph->check = 0; 1196 iph->tot_len = 0;
1195 skb->h.th->check = ~csum_tcpudp_magic(skb->nh.iph->saddr, 1197 iph->check = 0;
1196 skb->nh.iph->daddr, 1198 skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
1197 0, IPPROTO_TCP, 0); 1199 0, IPPROTO_TCP, 0);
1198 ipcss = skb_network_offset(skb); 1200 ipcss = skb_network_offset(skb);
1199 ipcso = (void *)&(skb->nh.iph->check) - (void *)skb->data; 1201 ipcso = (void *)&(iph->check) - (void *)skb->data;
1200 ipcse = skb->h.raw - skb->data - 1; 1202 ipcse = skb->h.raw - skb->data - 1;
1201 tucss = skb->h.raw - skb->data; 1203 tucss = skb->h.raw - skb->data;
1202 tucso = (void *)&(skb->h.th->check) - (void *)skb->data; 1204 tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 9265c27b13b2..20b5cb101368 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -75,7 +75,7 @@ static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats);
75#ifdef LOOPBACK_TSO 75#ifdef LOOPBACK_TSO
76static void emulate_large_send_offload(struct sk_buff *skb) 76static void emulate_large_send_offload(struct sk_buff *skb)
77{ 77{
78 struct iphdr *iph = skb->nh.iph; 78 struct iphdr *iph = ip_hdr(skb);
79 struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) + 79 struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) +
80 (iph->ihl * 4)); 80 (iph->ihl * 4));
81 unsigned int doffset = (iph->ihl + th->doff) * 4; 81 unsigned int doffset = (iph->ihl + th->doff) * 4;
@@ -93,7 +93,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
93 skb_reserve(nskb, 32); 93 skb_reserve(nskb, 32);
94 skb_set_mac_header(nskb, -ETH_HLEN); 94 skb_set_mac_header(nskb, -ETH_HLEN);
95 skb_reset_network_header(nskb); 95 skb_reset_network_header(nskb);
96 iph = nskb->nh.iph; 96 iph = ip_hdr(nskb);
97 memcpy(nskb->data, skb_network_header(skb), doffset); 97 memcpy(nskb->data, skb_network_header(skb), doffset);
98 if (skb_copy_bits(skb, 98 if (skb_copy_bits(skb,
99 doffset + offset, 99 doffset + offset,
@@ -145,7 +145,7 @@ static int loopback_xmit(struct sk_buff *skb, struct net_device *dev)
145#ifdef LOOPBACK_TSO 145#ifdef LOOPBACK_TSO
146 if (skb_is_gso(skb)) { 146 if (skb_is_gso(skb)) {
147 BUG_ON(skb->protocol != htons(ETH_P_IP)); 147 BUG_ON(skb->protocol != htons(ETH_P_IP));
148 BUG_ON(skb->nh.iph->protocol != IPPROTO_TCP); 148 BUG_ON(ip_hdr(skb)->protocol != IPPROTO_TCP);
149 149
150 emulate_large_send_offload(skb); 150 emulate_large_send_offload(skb);
151 return 0; 151 return 0;
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index cd9369a285e2..6b39a268ec29 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -1161,9 +1161,9 @@ static void eth_tx_submit_descs_for_skb(struct mv643xx_private *mp,
1161 1161
1162 cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM | 1162 cmd_sts |= ETH_GEN_TCP_UDP_CHECKSUM |
1163 ETH_GEN_IP_V_4_CHECKSUM | 1163 ETH_GEN_IP_V_4_CHECKSUM |
1164 skb->nh.iph->ihl << ETH_TX_IHL_SHIFT; 1164 ip_hdr(skb)->ihl << ETH_TX_IHL_SHIFT;
1165 1165
1166 switch (skb->nh.iph->protocol) { 1166 switch (ip_hdr(skb)->protocol) {
1167 case IPPROTO_UDP: 1167 case IPPROTO_UDP:
1168 cmd_sts |= ETH_UDP_FRAME; 1168 cmd_sts |= ETH_UDP_FRAME;
1169 desc->l4i_chk = skb->h.uh->check; 1169 desc->l4i_chk = skb->h.uh->check;
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index b2f5032937e3..28d68c3550ef 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -378,9 +378,9 @@ void netxen_tso_check(struct netxen_adapter *adapter,
378 skb->h.th->doff * 4); 378 skb->h.th->doff * 4);
379 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO); 379 netxen_set_cmd_desc_opcode(desc, TX_TCP_LSO);
380 } else if (skb->ip_summed == CHECKSUM_PARTIAL) { 380 } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
381 if (skb->nh.iph->protocol == IPPROTO_TCP) { 381 if (ip_hdr(skb)->protocol == IPPROTO_TCP) {
382 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT); 382 netxen_set_cmd_desc_opcode(desc, TX_TCP_PKT);
383 } else if (skb->nh.iph->protocol == IPPROTO_UDP) { 383 } else if (ip_hdr(skb)->protocol == IPPROTO_UDP) {
384 netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT); 384 netxen_set_cmd_desc_opcode(desc, TX_UDP_PKT);
385 } else { 385 } else {
386 return; 386 return;
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 747988b12ecd..6a32338623f1 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -1156,9 +1156,9 @@ again:
1156 extsts = 0; 1156 extsts = 0;
1157 if (skb->ip_summed == CHECKSUM_PARTIAL) { 1157 if (skb->ip_summed == CHECKSUM_PARTIAL) {
1158 extsts |= EXTSTS_IPPKT; 1158 extsts |= EXTSTS_IPPKT;
1159 if (IPPROTO_TCP == skb->nh.iph->protocol) 1159 if (IPPROTO_TCP == ip_hdr(skb)->protocol)
1160 extsts |= EXTSTS_TCPPKT; 1160 extsts |= EXTSTS_TCPPKT;
1161 else if (IPPROTO_UDP == skb->nh.iph->protocol) 1161 else if (IPPROTO_UDP == ip_hdr(skb)->protocol)
1162 extsts |= EXTSTS_UDPPKT; 1162 extsts |= EXTSTS_UDPPKT;
1163 } 1163 }
1164 1164
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 82218720bc3e..1d8129986cc5 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -731,7 +731,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
731 if (skb->ip_summed == CHECKSUM_PARTIAL) { 731 if (skb->ip_summed == CHECKSUM_PARTIAL) {
732 const unsigned char *nh = skb_network_header(skb); 732 const unsigned char *nh = skb_network_header(skb);
733 733
734 switch (skb->nh.iph->protocol) { 734 switch (ip_hdr(skb)->protocol) {
735 case IPPROTO_TCP: 735 case IPPROTO_TCP:
736 dflags |= XCT_MACTX_CSUM_TCP; 736 dflags |= XCT_MACTX_CSUM_TCP;
737 dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); 737 dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2);
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 34280f94e9ff..45876a854f00 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2284,7 +2284,7 @@ static inline u32 rtl8169_tso_csum(struct sk_buff *skb, struct net_device *dev)
2284 return LargeSend | ((mss & MSSMask) << MSSShift); 2284 return LargeSend | ((mss & MSSMask) << MSSShift);
2285 } 2285 }
2286 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2286 if (skb->ip_summed == CHECKSUM_PARTIAL) {
2287 const struct iphdr *ip = skb->nh.iph; 2287 const struct iphdr *ip = ip_hdr(skb);
2288 2288
2289 if (ip->protocol == IPPROTO_TCP) 2289 if (ip->protocol == IPPROTO_TCP)
2290 return IPCS | TCPCS; 2290 return IPCS | TCPCS;
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 51e994f26a84..a37bb205f3d3 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -1428,7 +1428,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
1428 tcpsum |= offset + skb->csum_offset; /* sum write */ 1428 tcpsum |= offset + skb->csum_offset; /* sum write */
1429 1429
1430 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; 1430 ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM;
1431 if (skb->nh.iph->protocol == IPPROTO_UDP) 1431 if (ip_hdr(skb)->protocol == IPPROTO_UDP)
1432 ctrl |= UDPTCP; 1432 ctrl |= UDPTCP;
1433 1433
1434 if (tcpsum != sky2->tx_tcpsum) { 1434 if (tcpsum != sky2->tx_tcpsum) {
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index f7e0ac7f789a..230da14b1b68 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -720,7 +720,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
720 spin_unlock_irqrestore(&chain->lock, flags); 720 spin_unlock_irqrestore(&chain->lock, flags);
721 721
722 if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL) 722 if (skb->protocol == htons(ETH_P_IP) && skb->ip_summed == CHECKSUM_PARTIAL)
723 switch (skb->nh.iph->protocol) { 723 switch (ip_hdr(skb)->protocol) {
724 case IPPROTO_TCP: 724 case IPPROTO_TCP:
725 hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP; 725 hwdescr->dmac_cmd_status |= SPIDER_NET_DMAC_TCP;
726 break; 726 break;
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 62a3bba0097d..76a31afe20de 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -3909,12 +3909,13 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
3909 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) 3909 if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
3910 mss |= (skb_headlen(skb) - ETH_HLEN) << 9; 3910 mss |= (skb_headlen(skb) - ETH_HLEN) << 9;
3911 else { 3911 else {
3912 struct iphdr *iph = ip_hdr(skb);
3913
3912 tcp_opt_len = ((skb->h.th->doff - 5) * 4); 3914 tcp_opt_len = ((skb->h.th->doff - 5) * 4);
3913 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr); 3915 ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
3914 3916
3915 skb->nh.iph->check = 0; 3917 iph->check = 0;
3916 skb->nh.iph->tot_len = htons(mss + ip_tcp_len + 3918 iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
3917 tcp_opt_len);
3918 mss |= (ip_tcp_len + tcp_opt_len) << 9; 3919 mss |= (ip_tcp_len + tcp_opt_len) << 9;
3919 } 3920 }
3920 3921
@@ -4055,6 +4056,7 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4055 mss = 0; 4056 mss = 0;
4056 if (skb->len > (tp->dev->mtu + ETH_HLEN) && 4057 if (skb->len > (tp->dev->mtu + ETH_HLEN) &&
4057 (mss = skb_shinfo(skb)->gso_size) != 0) { 4058 (mss = skb_shinfo(skb)->gso_size) != 0) {
4059 struct iphdr *iph;
4058 int tcp_opt_len, ip_tcp_len, hdr_len; 4060 int tcp_opt_len, ip_tcp_len, hdr_len;
4059 4061
4060 if (skb_header_cloned(skb) && 4062 if (skb_header_cloned(skb) &&
@@ -4074,34 +4076,32 @@ static int tg3_start_xmit_dma_bug(struct sk_buff *skb, struct net_device *dev)
4074 base_flags |= (TXD_FLAG_CPU_PRE_DMA | 4076 base_flags |= (TXD_FLAG_CPU_PRE_DMA |
4075 TXD_FLAG_CPU_POST_DMA); 4077 TXD_FLAG_CPU_POST_DMA);
4076 4078
4077 skb->nh.iph->check = 0; 4079 iph = ip_hdr(skb);
4078 skb->nh.iph->tot_len = htons(mss + hdr_len); 4080 iph->check = 0;
4081 iph->tot_len = htons(mss + hdr_len);
4079 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { 4082 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
4080 skb->h.th->check = 0; 4083 skb->h.th->check = 0;
4081 base_flags &= ~TXD_FLAG_TCPUDP_CSUM; 4084 base_flags &= ~TXD_FLAG_TCPUDP_CSUM;
4082 } 4085 }
4083 else { 4086 else {
4084 skb->h.th->check = 4087 skb->h.th->check = ~csum_tcpudp_magic(iph->saddr,
4085 ~csum_tcpudp_magic(skb->nh.iph->saddr, 4088 iph->daddr, 0,
4086 skb->nh.iph->daddr, 4089 IPPROTO_TCP, 0);
4087 0, IPPROTO_TCP, 0);
4088 } 4090 }
4089 4091
4090 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) || 4092 if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO) ||
4091 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) { 4093 (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)) {
4092 if (tcp_opt_len || skb->nh.iph->ihl > 5) { 4094 if (tcp_opt_len || iph->ihl > 5) {
4093 int tsflags; 4095 int tsflags;
4094 4096
4095 tsflags = ((skb->nh.iph->ihl - 5) + 4097 tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2);
4096 (tcp_opt_len >> 2));
4097 mss |= (tsflags << 11); 4098 mss |= (tsflags << 11);
4098 } 4099 }
4099 } else { 4100 } else {
4100 if (tcp_opt_len || skb->nh.iph->ihl > 5) { 4101 if (tcp_opt_len || iph->ihl > 5) {
4101 int tsflags; 4102 int tsflags;
4102 4103
4103 tsflags = ((skb->nh.iph->ihl - 5) + 4104 tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2);
4104 (tcp_opt_len >> 2));
4105 base_flags |= tsflags << 12; 4105 base_flags |= tsflags << 12;
4106 } 4106 }
4107 } 4107 }
diff --git a/drivers/net/via-velocity.c b/drivers/net/via-velocity.c
index 9f6cc1569b3e..422eaf8ea12d 100644
--- a/drivers/net/via-velocity.c
+++ b/drivers/net/via-velocity.c
@@ -2006,7 +2006,7 @@ static int velocity_xmit(struct sk_buff *skb, struct net_device *dev)
2006 */ 2006 */
2007 if ((vptr->flags & VELOCITY_FLAGS_TX_CSUM) 2007 if ((vptr->flags & VELOCITY_FLAGS_TX_CSUM)
2008 && (skb->ip_summed == CHECKSUM_PARTIAL)) { 2008 && (skb->ip_summed == CHECKSUM_PARTIAL)) {
2009 struct iphdr *ip = skb->nh.iph; 2009 const struct iphdr *ip = ip_hdr(skb);
2010 if (ip->protocol == IPPROTO_TCP) 2010 if (ip->protocol == IPPROTO_TCP)
2011 td_ptr->tdesc1.TCR |= TCR0_TCPCK; 2011 td_ptr->tdesc1.TCR |= TCR0_TCPCK;
2012 else if (ip->protocol == IPPROTO_UDP) 2012 else if (ip->protocol == IPPROTO_UDP)