Skip to content

Commit c1d2bbe

Browse files
acmelDavid S. Miller
authored andcommitted
[SK_BUFF]: Introduce skb_reset_network_header(skb)
For the common, open coded 'skb->nh.raw = skb->data' operation, so that we can later turn skb->nh.raw into a offset, reducing the size of struct sk_buff in 64bit land while possibly keeping it as a pointer on 32bit. This one touches just the most simple case, next will handle the slightly more "complex" cases. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 57effc7 commit c1d2bbe

47 files changed

Lines changed: 78 additions & 68 deletions

Some content is hidden

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

‎drivers/block/aoe/aoecmd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ new_skb(ulong len)
2828
skb = alloc_skb(len, GFP_ATOMIC);
2929
if (skb) {
3030
skb_reset_mac_header(skb);
31-
skb->nh.raw = skb->data;
31+
skb_reset_network_header(skb);
3232
skb->protocol = __constant_htons(ETH_P_AOE);
3333
skb->priority = 0;
3434
skb->next = skb->prev = NULL;

‎drivers/net/cxgb3/sge.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1621,7 +1621,8 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
16211621
{
16221622
rq->offload_pkts++;
16231623
skb_reset_mac_header(skb);
1624-
skb->nh.raw = skb->h.raw = skb->data;
1624+
skb_reset_network_header(skb);
1625+
skb->h.raw = skb->data;
16251626

16261627
if (rq->polling) {
16271628
rx_gather[gather_idx++] = skb;

‎drivers/net/hamradio/bpqether.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
282282
}
283283

284284
skb->protocol = ax25_type_trans(skb, dev);
285-
skb->nh.raw = skb->data;
285+
skb_reset_network_header(skb);
286286
dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
287287
bpq->stats.tx_packets++;
288288
bpq->stats.tx_bytes+=skb->len;

‎drivers/net/loopback.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
9191
break;
9292
skb_reserve(nskb, 32);
9393
skb_set_mac_header(nskb, -ETH_HLEN);
94-
nskb->nh.raw = nskb->data;
94+
skb_reset_network_header(nskb);
9595
iph = nskb->nh.iph;
9696
memcpy(nskb->data, skb->nh.raw, doffset);
9797
if (skb_copy_bits(skb,

‎drivers/net/pppoe.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
799799

800800
/* Reserve space for headers. */
801801
skb_reserve(skb, dev->hard_header_len);
802-
skb->nh.raw = skb->data;
802+
skb_reset_network_header(skb);
803803

804804
skb->dev = dev;
805805

@@ -884,7 +884,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
884884
memcpy(ph, &hdr, sizeof(struct pppoe_hdr));
885885
skb2->protocol = __constant_htons(ETH_P_PPP_SES);
886886

887-
skb2->nh.raw = skb2->data;
887+
skb_reset_network_header(skb2);
888888

889889
skb2->dev = dev;
890890

‎drivers/net/wan/hdlc_cisco.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
124124
skb_put(skb, sizeof(struct cisco_packet));
125125
skb->priority = TC_PRIO_CONTROL;
126126
skb->dev = dev;
127-
skb->nh.raw = skb->data;
127+
skb_reset_network_header(skb);
128128

129129
dev_queue_xmit(skb);
130130
}

‎drivers/net/wan/hdlc_fr.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
590590
skb_put(skb, i);
591591
skb->priority = TC_PRIO_CONTROL;
592592
skb->dev = dev;
593-
skb->nh.raw = skb->data;
593+
skb_reset_network_header(skb);
594594

595595
dev_queue_xmit(skb);
596596
}

‎drivers/net/wan/lmc/lmc_main.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,7 +1668,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
16681668
skb->protocol = lmc_proto_type(sc, skb);
16691669
skb->protocol = htons(ETH_P_WAN_PPP);
16701670
skb_reset_mac_header(skb);
1671-
// skb->nh.raw = skb->data;
1671+
/* skb_reset_network_header(skb); */
16721672
skb->dev = dev;
16731673
lmc_proto_netif(sc, skb);
16741674

@@ -1706,7 +1706,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
17061706

17071707
nsb->protocol = lmc_proto_type(sc, skb);
17081708
skb_reset_mac_header(nsb);
1709-
// nsb->nh.raw = nsb->data;
1709+
/* skb_reset_network_header(nsb); */
17101710
nsb->dev = dev;
17111711
lmc_proto_netif(sc, nsb);
17121712
}

‎drivers/net/wireless/hostap/hostap_80211_rx.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
10761076
skb2->dev = dev;
10771077
skb2->protocol = __constant_htons(ETH_P_802_3);
10781078
skb_reset_mac_header(skb2);
1079-
skb2->nh.raw = skb2->data;
1080-
/* skb2->nh.raw = skb2->data + ETH_HLEN; */
1079+
skb_reset_network_header(skb2);
1080+
/* skb2->nh.raw += ETH_HLEN; */
10811081
dev_queue_xmit(skb2);
10821082
}
10831083

‎drivers/net/wireless/hostap/hostap_ap.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -983,7 +983,7 @@ static void prism2_send_mgmt(struct net_device *dev,
983983

984984
skb->dev = dev;
985985
skb_reset_mac_header(skb);
986-
skb->nh.raw = skb->data;
986+
skb_reset_network_header(skb);
987987
dev_queue_xmit(skb);
988988
}
989989
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */

0 commit comments

Comments
 (0)