Skip to content

Commit eddc9ec

Browse files
acmelDavid S. Miller
authored andcommitted
[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>
1 parent e023dd6 commit eddc9ec

132 files changed

Lines changed: 565 additions & 564 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎drivers/ieee1394/eth1394.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ static int ether1394_tx (struct sk_buff *skb, struct net_device *dev)
16681668
if (memcmp(eth->h_dest, dev->broadcast, ETH1394_ALEN) == 0 ||
16691669
proto == htons(ETH_P_ARP) ||
16701670
(proto == htons(ETH_P_IP) &&
1671-
IN_MULTICAST(ntohl(skb->nh.iph->daddr)))) {
1671+
IN_MULTICAST(ntohl(ip_hdr(skb)->daddr)))) {
16721672
tx_type = ETH1394_GASP;
16731673
dest_node = LOCAL_BUS | ALL_NODES;
16741674
max_payload = priv->bc_maxpayload - ETHER1394_GASP_OVERHEAD;

‎drivers/net/8139cp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
806806
if (mss)
807807
flags |= LargeSend | ((mss & MSSMask) << MSSShift);
808808
else if (skb->ip_summed == CHECKSUM_PARTIAL) {
809-
const struct iphdr *ip = skb->nh.iph;
809+
const struct iphdr *ip = ip_hdr(skb);
810810
if (ip->protocol == IPPROTO_TCP)
811811
flags |= IPCS | TCPCS;
812812
else if (ip->protocol == IPPROTO_UDP)
@@ -825,7 +825,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
825825
u32 first_len, first_eor;
826826
dma_addr_t first_mapping;
827827
int frag, first_entry = entry;
828-
const struct iphdr *ip = skb->nh.iph;
828+
const struct iphdr *ip = ip_hdr(skb);
829829

830830
/* We must give this initial chunk to the device last.
831831
* Otherwise we could race with the device.

‎drivers/net/atl1/atl1_main.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,17 +1294,18 @@ static int atl1_tso(struct atl1_adapter *adapter, struct sk_buff *skb,
12941294
}
12951295

12961296
if (skb->protocol == ntohs(ETH_P_IP)) {
1297-
skb->nh.iph->tot_len = 0;
1298-
skb->nh.iph->check = 0;
1299-
skb->h.th->check =
1300-
~csum_tcpudp_magic(skb->nh.iph->saddr,
1301-
skb->nh.iph->daddr, 0,
1302-
IPPROTO_TCP, 0);
1297+
struct iphdr *iph = ip_hdr(skb);
1298+
1299+
iph->tot_len = 0;
1300+
iph->check = 0;
1301+
skb->h.th->check = ~csum_tcpudp_magic(iph->saddr,
1302+
iph->daddr, 0,
1303+
IPPROTO_TCP, 0);
13031304
ipofst = skb_network_offset(skb);
13041305
if (ipofst != ENET_HEADER_SIZE) /* 802.3 frame */
13051306
tso->tsopl |= 1 << TSO_PARAM_ETHTYPE_SHIFT;
13061307

1307-
tso->tsopl |= (skb->nh.iph->ihl &
1308+
tso->tsopl |= (iph->ihl &
13081309
CSUM_PARAM_IPHL_MASK) << CSUM_PARAM_IPHL_SHIFT;
13091310
tso->tsopl |= ((skb->h.th->doff << 2) &
13101311
TSO_PARAM_TCPHDRLEN_MASK) << TSO_PARAM_TCPHDRLEN_SHIFT;

‎drivers/net/bnx2.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4513,6 +4513,7 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
45134513
if ((mss = skb_shinfo(skb)->gso_size) &&
45144514
(skb->len > (bp->dev->mtu + ETH_HLEN))) {
45154515
u32 tcp_opt_len, ip_tcp_len;
4516+
struct iphdr *iph;
45164517

45174518
if (skb_header_cloned(skb) &&
45184519
pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
@@ -4529,16 +4530,15 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
45294530
}
45304531
ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
45314532

4532-
skb->nh.iph->check = 0;
4533-
skb->nh.iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
4534-
skb->h.th->check =
4535-
~csum_tcpudp_magic(skb->nh.iph->saddr,
4536-
skb->nh.iph->daddr,
4537-
0, IPPROTO_TCP, 0);
4533+
iph = ip_hdr(skb);
4534+
iph->check = 0;
4535+
iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
4536+
skb->h.th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
4537+
0, IPPROTO_TCP, 0);
45384538

4539-
if (tcp_opt_len || (skb->nh.iph->ihl > 5)) {
4540-
vlan_tag_flags |= ((skb->nh.iph->ihl - 5) +
4541-
(tcp_opt_len >> 2)) << 8;
4539+
if (tcp_opt_len || (iph->ihl > 5)) {
4540+
vlan_tag_flags |= ((iph->ihl - 5) +
4541+
(tcp_opt_len >> 2)) << 8;
45424542
}
45434543
}
45444544
else

‎drivers/net/bonding/bond_alb.c‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb)
112112
/* Forward declaration */
113113
static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
114114

115-
static inline u8 _simple_hash(u8 *hash_start, int hash_size)
115+
static inline u8 _simple_hash(const u8 *hash_start, int hash_size)
116116
{
117117
int i;
118118
u8 hash = 0;
@@ -1268,7 +1268,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
12681268
int hash_size = 0;
12691269
int do_tx_balance = 1;
12701270
u32 hash_index = 0;
1271-
u8 *hash_start = NULL;
1271+
const u8 *hash_start = NULL;
12721272
int res = 1;
12731273

12741274
skb_reset_mac_header(skb);
@@ -1285,15 +1285,18 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
12851285
}
12861286

12871287
switch (ntohs(skb->protocol)) {
1288-
case ETH_P_IP:
1288+
case ETH_P_IP: {
1289+
const struct iphdr *iph = ip_hdr(skb);
1290+
12891291
if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) ||
1290-
(skb->nh.iph->daddr == ip_bcast) ||
1291-
(skb->nh.iph->protocol == IPPROTO_IGMP)) {
1292+
(iph->daddr == ip_bcast) ||
1293+
(iph->protocol == IPPROTO_IGMP)) {
12921294
do_tx_balance = 0;
12931295
break;
12941296
}
1295-
hash_start = (char*)&(skb->nh.iph->daddr);
1296-
hash_size = sizeof(skb->nh.iph->daddr);
1297+
hash_start = (char *)&(iph->daddr);
1298+
hash_size = sizeof(iph->daddr);
1299+
}
12971300
break;
12981301
case ETH_P_IPV6:
12991302
if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) {

‎drivers/net/bonding/bond_main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
34763476
struct net_device *bond_dev, int count)
34773477
{
34783478
struct ethhdr *data = (struct ethhdr *)skb->data;
3479-
struct iphdr *iph = skb->nh.iph;
3479+
struct iphdr *iph = ip_hdr(skb);
34803480
u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl);
34813481
int layer4_xor = 0;
34823482

‎drivers/net/chelsio/sge.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,7 +1871,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
18711871
hdr = (struct cpl_tx_pkt_lso *)skb_push(skb, sizeof(*hdr));
18721872
hdr->opcode = CPL_TX_PKT_LSO;
18731873
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;
18751875
hdr->tcp_hdr_words = skb->h.th->doff;
18761876
hdr->eth_type_mss = htons(MK_ETH_TYPE_MSS(eth_type,
18771877
skb_shinfo(skb)->gso_size));
@@ -1912,7 +1912,7 @@ int t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
19121912

19131913
if (!(adapter->flags & UDP_CSUM_CAPABLE) &&
19141914
skb->ip_summed == CHECKSUM_PARTIAL &&
1915-
skb->nh.iph->protocol == IPPROTO_UDP) {
1915+
ip_hdr(skb)->protocol == IPPROTO_UDP) {
19161916
if (unlikely(skb_checksum_help(skb))) {
19171917
pr_debug("%s: unable to do udp checksum\n", dev->name);
19181918
dev_kfree_skb_any(skb);

‎drivers/net/cxgb3/sge.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static void write_tx_pkt_wr(struct adapter *adap, struct sk_buff *skb,
900900
eth_type = skb_network_offset(skb) == ETH_HLEN ?
901901
CPL_ETH_II : CPL_ETH_II_VLAN;
902902
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) |
904904
V_LSO_TCPHDR_WORDS(skb->h.th->doff);
905905
hdr->lso_info = htonl(tso_info);
906906
flits = 3;

‎drivers/net/e1000/e1000_main.c‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2890,14 +2890,12 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
28902890
hdr_len = ((skb->h.raw - skb->data) + (skb->h.th->doff << 2));
28912891
mss = skb_shinfo(skb)->gso_size;
28922892
if (skb->protocol == htons(ETH_P_IP)) {
2893-
skb->nh.iph->tot_len = 0;
2894-
skb->nh.iph->check = 0;
2895-
skb->h.th->check =
2896-
~csum_tcpudp_magic(skb->nh.iph->saddr,
2897-
skb->nh.iph->daddr,
2898-
0,
2899-
IPPROTO_TCP,
2900-
0);
2893+
struct iphdr *iph = ip_hdr(skb);
2894+
iph->tot_len = 0;
2895+
iph->check = 0;
2896+
skb->h.th->check = ~csum_tcpudp_magic(iph->saddr,
2897+
iph->daddr, 0,
2898+
IPPROTO_TCP, 0);
29012899
cmd_length = E1000_TXD_CMD_IP;
29022900
ipcse = skb->h.raw - skb->data - 1;
29032901
} else if (skb->protocol == htons(ETH_P_IPV6)) {
@@ -2911,7 +2909,7 @@ e1000_tso(struct e1000_adapter *adapter, struct e1000_tx_ring *tx_ring,
29112909
ipcse = 0;
29122910
}
29132911
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;
29152913
tucss = skb->h.raw - skb->data;
29162914
tucso = (void *)&(skb->h.th->check) - (void *)skb->data;
29172915
tucse = 0;

‎drivers/net/ehea/ehea_main.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ static int ehea_clean_portres(struct ehea_port *port, struct ehea_port_res *pr)
12621262
static inline void write_ip_start_end(struct ehea_swqe *swqe,
12631263
const struct sk_buff *skb)
12641264
{
1265-
swqe->ip_start = (u8)(((u64)skb->nh.iph) - ((u64)skb->data));
1265+
swqe->ip_start = skb_network_offset(skb);
12661266
swqe->ip_end = (u8)(swqe->ip_start + ip_hdrlen(skb) - 1);
12671267
}
12681268

@@ -1688,6 +1688,7 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
16881688
struct ehea_swqe *swqe, u32 lkey)
16891689
{
16901690
if (skb->protocol == htons(ETH_P_IP)) {
1691+
const struct iphdr *iph = ip_hdr(skb);
16911692
/* IPv4 */
16921693
swqe->tx_control |= EHEA_SWQE_CRC
16931694
| EHEA_SWQE_IP_CHECKSUM
@@ -1697,15 +1698,15 @@ static void ehea_xmit2(struct sk_buff *skb, struct net_device *dev,
16971698

16981699
write_ip_start_end(swqe, skb);
16991700

1700-
if (skb->nh.iph->protocol == IPPROTO_UDP) {
1701-
if ((skb->nh.iph->frag_off & IP_MF) ||
1702-
(skb->nh.iph->frag_off & IP_OFFSET))
1701+
if (iph->protocol == IPPROTO_UDP) {
1702+
if ((iph->frag_off & IP_MF) ||
1703+
(iph->frag_off & IP_OFFSET))
17031704
/* IP fragment, so don't change cs */
17041705
swqe->tx_control &= ~EHEA_SWQE_TCP_CHECKSUM;
17051706
else
17061707
write_udp_offset_end(swqe, skb);
17071708

1708-
} else if (skb->nh.iph->protocol == IPPROTO_TCP) {
1709+
} else if (iph->protocol == IPPROTO_TCP) {
17091710
write_tcp_offset_end(swqe, skb);
17101711
}
17111712

@@ -1731,20 +1732,21 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
17311732
int i;
17321733

17331734
if (skb->protocol == htons(ETH_P_IP)) {
1735+
const struct iphdr *iph = ip_hdr(skb);
17341736
/* IPv4 */
17351737
write_ip_start_end(swqe, skb);
17361738

1737-
if (skb->nh.iph->protocol == IPPROTO_TCP) {
1739+
if (iph->protocol == IPPROTO_TCP) {
17381740
swqe->tx_control |= EHEA_SWQE_CRC
17391741
| EHEA_SWQE_IP_CHECKSUM
17401742
| EHEA_SWQE_TCP_CHECKSUM
17411743
| EHEA_SWQE_IMM_DATA_PRESENT;
17421744

17431745
write_tcp_offset_end(swqe, skb);
17441746

1745-
} else if (skb->nh.iph->protocol == IPPROTO_UDP) {
1746-
if ((skb->nh.iph->frag_off & IP_MF) ||
1747-
(skb->nh.iph->frag_off & IP_OFFSET))
1747+
} else if (iph->protocol == IPPROTO_UDP) {
1748+
if ((iph->frag_off & IP_MF) ||
1749+
(iph->frag_off & IP_OFFSET))
17481750
/* IP fragment, so don't change cs */
17491751
swqe->tx_control |= EHEA_SWQE_CRC
17501752
| EHEA_SWQE_IMM_DATA_PRESENT;

0 commit comments

Comments
 (0)