提交 c1d2bbe1 编写于 作者: A Arnaldo Carvalho de Melo 提交者: David S. Miller

[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: NArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 57effc70
...@@ -28,7 +28,7 @@ new_skb(ulong len) ...@@ -28,7 +28,7 @@ new_skb(ulong len)
skb = alloc_skb(len, GFP_ATOMIC); skb = alloc_skb(len, GFP_ATOMIC);
if (skb) { if (skb) {
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->protocol = __constant_htons(ETH_P_AOE); skb->protocol = __constant_htons(ETH_P_AOE);
skb->priority = 0; skb->priority = 0;
skb->next = skb->prev = NULL; skb->next = skb->prev = NULL;
......
...@@ -1621,7 +1621,8 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq, ...@@ -1621,7 +1621,8 @@ static inline int rx_offload(struct t3cdev *tdev, struct sge_rspq *rq,
{ {
rq->offload_pkts++; rq->offload_pkts++;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->h.raw = skb->data; skb_reset_network_header(skb);
skb->h.raw = skb->data;
if (rq->polling) { if (rq->polling) {
rx_gather[gather_idx++] = skb; rx_gather[gather_idx++] = skb;
......
...@@ -282,7 +282,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -282,7 +282,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
} }
skb->protocol = ax25_type_trans(skb, dev); skb->protocol = ax25_type_trans(skb, dev);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0); dev->hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
bpq->stats.tx_packets++; bpq->stats.tx_packets++;
bpq->stats.tx_bytes+=skb->len; bpq->stats.tx_bytes+=skb->len;
......
...@@ -91,7 +91,7 @@ static void emulate_large_send_offload(struct sk_buff *skb) ...@@ -91,7 +91,7 @@ static void emulate_large_send_offload(struct sk_buff *skb)
break; break;
skb_reserve(nskb, 32); skb_reserve(nskb, 32);
skb_set_mac_header(nskb, -ETH_HLEN); skb_set_mac_header(nskb, -ETH_HLEN);
nskb->nh.raw = nskb->data; skb_reset_network_header(nskb);
iph = nskb->nh.iph; iph = nskb->nh.iph;
memcpy(nskb->data, skb->nh.raw, doffset); memcpy(nskb->data, skb->nh.raw, doffset);
if (skb_copy_bits(skb, if (skb_copy_bits(skb,
......
...@@ -799,7 +799,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -799,7 +799,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
/* Reserve space for headers. */ /* Reserve space for headers. */
skb_reserve(skb, dev->hard_header_len); skb_reserve(skb, dev->hard_header_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->dev = dev; skb->dev = dev;
...@@ -884,7 +884,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb) ...@@ -884,7 +884,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
memcpy(ph, &hdr, sizeof(struct pppoe_hdr)); memcpy(ph, &hdr, sizeof(struct pppoe_hdr));
skb2->protocol = __constant_htons(ETH_P_PPP_SES); skb2->protocol = __constant_htons(ETH_P_PPP_SES);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
skb2->dev = dev; skb2->dev = dev;
......
...@@ -124,7 +124,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type, ...@@ -124,7 +124,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
skb_put(skb, sizeof(struct cisco_packet)); skb_put(skb, sizeof(struct cisco_packet));
skb->priority = TC_PRIO_CONTROL; skb->priority = TC_PRIO_CONTROL;
skb->dev = dev; skb->dev = dev;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }
......
...@@ -590,7 +590,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep) ...@@ -590,7 +590,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
skb_put(skb, i); skb_put(skb, i);
skb->priority = TC_PRIO_CONTROL; skb->priority = TC_PRIO_CONTROL;
skb->dev = dev; skb->dev = dev;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }
......
...@@ -1668,7 +1668,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ ...@@ -1668,7 +1668,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
skb->protocol = lmc_proto_type(sc, skb); skb->protocol = lmc_proto_type(sc, skb);
skb->protocol = htons(ETH_P_WAN_PPP); skb->protocol = htons(ETH_P_WAN_PPP);
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
// skb->nh.raw = skb->data; /* skb_reset_network_header(skb); */
skb->dev = dev; skb->dev = dev;
lmc_proto_netif(sc, skb); lmc_proto_netif(sc, skb);
...@@ -1706,7 +1706,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/ ...@@ -1706,7 +1706,7 @@ static int lmc_rx (struct net_device *dev) /*fold00*/
nsb->protocol = lmc_proto_type(sc, skb); nsb->protocol = lmc_proto_type(sc, skb);
skb_reset_mac_header(nsb); skb_reset_mac_header(nsb);
// nsb->nh.raw = nsb->data; /* skb_reset_network_header(nsb); */
nsb->dev = dev; nsb->dev = dev;
lmc_proto_netif(sc, nsb); lmc_proto_netif(sc, nsb);
} }
......
...@@ -1076,8 +1076,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb, ...@@ -1076,8 +1076,8 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
skb2->dev = dev; skb2->dev = dev;
skb2->protocol = __constant_htons(ETH_P_802_3); skb2->protocol = __constant_htons(ETH_P_802_3);
skb_reset_mac_header(skb2); skb_reset_mac_header(skb2);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* skb2->nh.raw = skb2->data + ETH_HLEN; */ /* skb2->nh.raw += ETH_HLEN; */
dev_queue_xmit(skb2); dev_queue_xmit(skb2);
} }
......
...@@ -983,7 +983,7 @@ static void prism2_send_mgmt(struct net_device *dev, ...@@ -983,7 +983,7 @@ static void prism2_send_mgmt(struct net_device *dev,
skb->dev = dev; skb->dev = dev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dev_queue_xmit(skb); dev_queue_xmit(skb);
} }
#endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */ #endif /* PRISM2_NO_KERNEL_IEEE80211_MGMT */
......
...@@ -1064,7 +1064,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype, ...@@ -1064,7 +1064,7 @@ int prism2_sta_send_mgmt(local_info_t *local, u8 *dst, u16 stype,
skb->dev = dev; skb->dev = dev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dev_queue_xmit(skb); dev_queue_xmit(skb);
return 0; return 0;
......
...@@ -960,6 +960,11 @@ static inline void skb_reserve(struct sk_buff *skb, int len) ...@@ -960,6 +960,11 @@ static inline void skb_reserve(struct sk_buff *skb, int len)
skb->tail += len; skb->tail += len;
} }
static inline void skb_reset_network_header(struct sk_buff *skb)
{
skb->nh.raw = skb->data;
}
static inline unsigned char *skb_mac_header(const struct sk_buff *skb) static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
{ {
return skb->mac.raw; return skb->mac.raw;
......
...@@ -235,7 +235,7 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type, ...@@ -235,7 +235,7 @@ static inline void llc_pdu_header_init(struct sk_buff *skb, u8 type,
struct llc_pdu_un *pdu; struct llc_pdu_un *pdu;
skb_push(skb, hlen); skb_push(skb, hlen);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
pdu = llc_pdu_un_hdr(skb); pdu = llc_pdu_un_hdr(skb);
pdu->dsap = dsap; pdu->dsap = dsap;
pdu->ssap = ssap; pdu->ssap = ssap;
......
...@@ -539,7 +539,7 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb, ...@@ -539,7 +539,7 @@ int aarp_send_ddp(struct net_device *dev, struct sk_buff *skb,
int hash; int hash;
struct aarp_entry *a; struct aarp_entry *a;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* Check for LocalTalk first */ /* Check for LocalTalk first */
if (dev->type == ARPHRD_LOCALTLK) { if (dev->type == ARPHRD_LOCALTLK) {
......
...@@ -713,7 +713,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb) ...@@ -713,7 +713,7 @@ static void mpc_push(struct atm_vcc *vcc, struct sk_buff *skb)
skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */ skb_push(new_skb, eg->ctrl_info.DH_length); /* add MAC header */
memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length); memcpy(new_skb->data, eg->ctrl_info.DLL_header, eg->ctrl_info.DH_length);
new_skb->protocol = eth_type_trans(new_skb, dev); new_skb->protocol = eth_type_trans(new_skb, dev);
new_skb->nh.raw = new_skb->data; skb_reset_network_header(new_skb);
eg->latest_ip_addr = new_skb->nh.iph->saddr; eg->latest_ip_addr = new_skb->nh.iph->saddr;
eg->packets_rcvd++; eg->packets_rcvd++;
......
...@@ -1548,7 +1548,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1548,7 +1548,7 @@ static int ax25_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out; goto out;
} }
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* Add the PID if one is not supplied by the user in the skb */ /* Add the PID if one is not supplied by the user in the skb */
if (!ax25->pidincl) { if (!ax25->pidincl) {
......
...@@ -136,7 +136,7 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p ...@@ -136,7 +136,7 @@ static void ax25_kiss_cmd(ax25_dev *ax25_dev, unsigned char cmd, unsigned char p
if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL) if ((skb = alloc_skb(2, GFP_ATOMIC)) == NULL)
return; return;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
p = skb_put(skb, 2); p = skb_put(skb, 2);
*p++ = cmd; *p++ = cmd;
......
...@@ -61,8 +61,8 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb) ...@@ -61,8 +61,8 @@ static int ax25_rx_fragment(ax25_cb *ax25, struct sk_buff *skb)
skb_reserve(skbn, AX25_MAX_HEADER_LEN); skb_reserve(skbn, AX25_MAX_HEADER_LEN);
skbn->dev = ax25->ax25_dev->dev; skbn->dev = ax25->ax25_dev->dev;
skb_reset_network_header(skbn);
skbn->h.raw = skbn->data; skbn->h.raw = skbn->data;
skbn->nh.raw = skbn->data;
/* Copy data from the fragments */ /* Copy data from the fragments */
while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) { while ((skbo = skb_dequeue(&ax25->frag_queue)) != NULL) {
...@@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb) ...@@ -123,7 +123,7 @@ int ax25_rx_iframe(ax25_cb *ax25, struct sk_buff *skb)
skb_pull(skb, 1); /* Remove PID */ skb_pull(skb, 1); /* Remove PID */
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->dev = ax25->ax25_dev->dev; skb->dev = ax25->ax25_dev->dev;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
...@@ -247,7 +247,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -247,7 +247,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
case AX25_P_IP: case AX25_P_IP:
skb_pull(skb,2); /* drop PID/CTRL */ skb_pull(skb,2); /* drop PID/CTRL */
skb->h.raw = skb->data; skb->h.raw = skb->data;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->dev = dev; skb->dev = dev;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
...@@ -257,7 +257,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -257,7 +257,7 @@ static int ax25_rcv(struct sk_buff *skb, struct net_device *dev,
case AX25_P_ARP: case AX25_P_ARP:
skb_pull(skb,2); skb_pull(skb,2);
skb->h.raw = skb->data; skb->h.raw = skb->data;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->dev = dev; skb->dev = dev;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
skb->protocol = htons(ETH_P_ARP); skb->protocol = htons(ETH_P_ARP);
......
...@@ -171,7 +171,7 @@ int ax25_rebuild_header(struct sk_buff *skb) ...@@ -171,7 +171,7 @@ int ax25_rebuild_header(struct sk_buff *skb)
src_c = *(ax25_address *)(bp + 8); src_c = *(ax25_address *)(bp + 8);
skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */ skb_pull(ourskb, AX25_HEADER_LEN - 1); /* Keep PID */
ourskb->nh.raw = ourskb->data; skb_reset_network_header(ourskb);
ax25=ax25_send_frame( ax25=ax25_send_frame(
ourskb, ourskb,
......
...@@ -205,7 +205,7 @@ static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit) ...@@ -205,7 +205,7 @@ static void ax25_send_iframe(ax25_cb *ax25, struct sk_buff *skb, int poll_bit)
if (skb == NULL) if (skb == NULL)
return; return;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
if (ax25->modulus == AX25_MODULUS) { if (ax25->modulus == AX25_MODULUS) {
frame = skb_push(skb, 1); frame = skb_push(skb, 1);
......
...@@ -162,7 +162,7 @@ void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type) ...@@ -162,7 +162,7 @@ void ax25_send_control(ax25_cb *ax25, int frametype, int poll_bit, int type)
skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len); skb_reserve(skb, ax25->ax25_dev->dev->hard_header_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* Assume a response - address structure for DTE */ /* Assume a response - address structure for DTE */
if (ax25->modulus == AX25_MODULUS) { if (ax25->modulus == AX25_MODULUS) {
...@@ -205,7 +205,7 @@ void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *des ...@@ -205,7 +205,7 @@ void ax25_return_dm(struct net_device *dev, ax25_address *src, ax25_address *des
return; /* Next SABM will get DM'd */ return; /* Next SABM will get DM'd */
skb_reserve(skb, dev->hard_header_len); skb_reserve(skb, dev->hard_header_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
ax25_digi_invert(digi, &retdigi); ax25_digi_invert(digi, &retdigi);
......
...@@ -1074,7 +1074,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) ...@@ -1074,7 +1074,7 @@ static void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev)
printk(KERN_CRIT "protocol %04x is " printk(KERN_CRIT "protocol %04x is "
"buggy, dev %s\n", "buggy, dev %s\n",
skb2->protocol, dev->name); skb2->protocol, dev->name);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
} }
skb2->h.raw = skb2->nh.raw; skb2->h.raw = skb2->nh.raw;
...@@ -1771,7 +1771,8 @@ int netif_receive_skb(struct sk_buff *skb) ...@@ -1771,7 +1771,8 @@ int netif_receive_skb(struct sk_buff *skb)
__get_cpu_var(netdev_rx_stat).total++; __get_cpu_var(netdev_rx_stat).total++;
skb->h.raw = skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->h.raw = skb->data;
skb->mac_len = skb->nh.raw - skb->mac.raw; skb->mac_len = skb->nh.raw - skb->mac.raw;
pt_prev = NULL; pt_prev = NULL;
......
...@@ -359,7 +359,8 @@ static void arp_reply(struct sk_buff *skb) ...@@ -359,7 +359,8 @@ static void arp_reply(struct sk_buff *skb)
(2 * sizeof(u32))))) (2 * sizeof(u32)))))
return; return;
skb->h.raw = skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->h.raw = skb->data;
arp = skb->nh.arph; arp = skb->nh.arph;
if ((arp->ar_hrd != htons(ARPHRD_ETHER) && if ((arp->ar_hrd != htons(ARPHRD_ETHER) &&
...@@ -389,7 +390,7 @@ static void arp_reply(struct sk_buff *skb) ...@@ -389,7 +390,7 @@ static void arp_reply(struct sk_buff *skb)
if (!send_skb) if (!send_skb)
return; return;
send_skb->nh.raw = send_skb->data; skb_reset_network_header(send_skb);
arp = (struct arphdr *) skb_put(send_skb, size); arp = (struct arphdr *) skb_put(send_skb, size);
send_skb->dev = skb->dev; send_skb->dev = skb->dev;
send_skb->protocol = htons(ETH_P_ARP); send_skb->protocol = htons(ETH_P_ARP);
......
...@@ -913,7 +913,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa) ...@@ -913,7 +913,7 @@ static void dn_send_endnode_hello(struct net_device *dev, struct dn_ifaddr *ifa)
pktlen = (__le16 *)skb_push(skb,2); pktlen = (__le16 *)skb_push(skb,2);
*pktlen = dn_htons(skb->len - 2); *pktlen = dn_htons(skb->len - 2);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
dn_rt_finish_output(skb, dn_rt_all_rt_mcast, msg->id); dn_rt_finish_output(skb, dn_rt_all_rt_mcast, msg->id);
} }
...@@ -1005,7 +1005,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa) ...@@ -1005,7 +1005,7 @@ static void dn_send_router_hello(struct net_device *dev, struct dn_ifaddr *ifa)
pktlen = (__le16 *)skb_push(skb, 2); pktlen = (__le16 *)skb_push(skb, 2);
*pktlen = dn_htons(skb->len - 2); *pktlen = dn_htons(skb->len - 2);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
if (dn_am_i_a_router(dn, dn_db, ifa)) { if (dn_am_i_a_router(dn, dn_db, ifa)) {
struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC); struct sk_buff *skb2 = skb_copy(skb, GFP_ATOMIC);
......
...@@ -261,7 +261,7 @@ static int dn_long_output(struct sk_buff *skb) ...@@ -261,7 +261,7 @@ static int dn_long_output(struct sk_buff *skb)
lp->s_class = 0; lp->s_class = 0;
lp->pt = 0; lp->pt = 0;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
} }
...@@ -300,7 +300,7 @@ static int dn_short_output(struct sk_buff *skb) ...@@ -300,7 +300,7 @@ static int dn_short_output(struct sk_buff *skb)
sp->srcnode = cb->src; sp->srcnode = cb->src;
sp->forward = cb->hops & 0x3f; sp->forward = cb->hops & 0x3f;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
} }
...@@ -342,7 +342,7 @@ static int dn_phase3_output(struct sk_buff *skb) ...@@ -342,7 +342,7 @@ static int dn_phase3_output(struct sk_buff *skb)
sp->srcnode = cb->src & dn_htons(0x03ff); sp->srcnode = cb->src & dn_htons(0x03ff);
sp->forward = cb->hops & 0x3f; sp->forward = cb->hops & 0x3f;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet); return NF_HOOK(PF_DECnet, NF_DN_POST_ROUTING, skb, NULL, neigh->dev, dn_neigh_output_packet);
} }
......
...@@ -615,7 +615,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type ...@@ -615,7 +615,7 @@ int dn_route_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type
flags = *skb->data; flags = *skb->data;
} }
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* /*
* Weed out future version DECnet * Weed out future version DECnet
......
...@@ -345,7 +345,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -345,7 +345,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out_unlock; goto out_unlock;
skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb_reset_network_header(skb);
eb = (struct ec_cb *)&skb->cb; eb = (struct ec_cb *)&skb->cb;
......
...@@ -792,7 +792,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, ...@@ -792,7 +792,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
skb2->dev = dev; skb2->dev = dev;
skb2->protocol = __constant_htons(ETH_P_802_3); skb2->protocol = __constant_htons(ETH_P_802_3);
skb_reset_mac_header(skb2); skb_reset_mac_header(skb2);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* skb2->nh.raw = skb2->data + ETH_HLEN; */ /* skb2->nh.raw = skb2->data + ETH_HLEN; */
dev_queue_xmit(skb2); dev_queue_xmit(skb2);
} }
......
...@@ -578,7 +578,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, ...@@ -578,7 +578,7 @@ struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
return NULL; return NULL;
skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb_reset_network_header(skb);
arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4)); arp = (struct arphdr *) skb_put(skb,sizeof(struct arphdr) + 2*(dev->addr_len+4));
skb->dev = dev; skb->dev = dev;
skb->protocol = htons(ETH_P_ARP); skb->protocol = htons(ETH_P_ARP);
......
...@@ -474,7 +474,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info) ...@@ -474,7 +474,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
dst_release(skb2->dst); dst_release(skb2->dst);
skb2->dst = NULL; skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)eiph); skb_pull(skb2, skb->data - (u8*)eiph);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* Try to guess incoming interface */ /* Try to guess incoming interface */
memset(&fl, 0, sizeof(fl)); memset(&fl, 0, sizeof(fl));
......
...@@ -593,7 +593,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*)) ...@@ -593,7 +593,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff*))
ip_copy_metadata(skb2, skb); ip_copy_metadata(skb2, skb);
skb_reserve(skb2, ll_rs); skb_reserve(skb2, ll_rs);
skb_put(skb2, len + hlen); skb_put(skb2, len + hlen);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
skb2->h.raw = skb2->data + hlen; skb2->h.raw = skb2->data + hlen;
/* /*
...@@ -722,7 +722,7 @@ static inline int ip_ufo_append_data(struct sock *sk, ...@@ -722,7 +722,7 @@ static inline int ip_ufo_append_data(struct sock *sk,
skb_put(skb,fragheaderlen + transhdrlen); skb_put(skb,fragheaderlen + transhdrlen);
/* initialize network header pointer */ /* initialize network header pointer */
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* initialize protocol header pointer */ /* initialize protocol header pointer */
skb->h.raw = skb->data + fragheaderlen; skb->h.raw = skb->data + fragheaderlen;
......
...@@ -405,7 +405,7 @@ static int ipip_err(struct sk_buff *skb, u32 info) ...@@ -405,7 +405,7 @@ static int ipip_err(struct sk_buff *skb, u32 info)
dst_release(skb2->dst); dst_release(skb2->dst);
skb2->dst = NULL; skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)eiph); skb_pull(skb2, skb->data - (u8*)eiph);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* Try to guess incoming interface */ /* Try to guess incoming interface */
memset(&fl, 0, sizeof(fl)); memset(&fl, 0, sizeof(fl));
...@@ -487,7 +487,7 @@ static int ipip_rcv(struct sk_buff *skb) ...@@ -487,7 +487,7 @@ static int ipip_rcv(struct sk_buff *skb)
secpath_reset(skb); secpath_reset(skb);
skb->mac.raw = skb->nh.raw; skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->protocol = htons(ETH_P_IP); skb->protocol = htons(ETH_P_IP);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
......
...@@ -2748,7 +2748,7 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg) ...@@ -2748,7 +2748,7 @@ int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
through good chunk of routing engine. through good chunk of routing engine.
*/ */
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */ /* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
skb->nh.iph->protocol = IPPROTO_ICMP; skb->nh.iph->protocol = IPPROTO_ICMP;
......
...@@ -129,7 +129,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -129,7 +129,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
old_mac = skb_mac_header(skb); old_mac = skb_mac_header(skb);
skb_set_mac_header(skb, -skb->mac_len); skb_set_mac_header(skb, -skb->mac_len);
memmove(skb_mac_header(skb), old_mac, skb->mac_len); memmove(skb_mac_header(skb), old_mac, skb->mac_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
err = 0; err = 0;
out: out:
......
...@@ -735,7 +735,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) ...@@ -735,7 +735,7 @@ static int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
ip6_copy_metadata(frag, skb); ip6_copy_metadata(frag, skb);
skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev)); skb_reserve(frag, LL_RESERVED_SPACE(rt->u.dst.dev));
skb_put(frag, len + hlen + sizeof(struct frag_hdr)); skb_put(frag, len + hlen + sizeof(struct frag_hdr));
frag->nh.raw = frag->data; skb_reset_network_header(frag);
fh = (struct frag_hdr*)(frag->data + hlen); fh = (struct frag_hdr*)(frag->data + hlen);
frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr); frag->h.raw = frag->data + hlen + sizeof(struct frag_hdr);
...@@ -976,7 +976,7 @@ static inline int ip6_ufo_append_data(struct sock *sk, ...@@ -976,7 +976,7 @@ static inline int ip6_ufo_append_data(struct sock *sk,
skb_put(skb,fragheaderlen + transhdrlen); skb_put(skb,fragheaderlen + transhdrlen);
/* initialize network header pointer */ /* initialize network header pointer */
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* initialize protocol header pointer */ /* initialize protocol header pointer */
skb->h.raw = skb->data + fragheaderlen; skb->h.raw = skb->data + fragheaderlen;
......
...@@ -525,7 +525,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -525,7 +525,7 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
dst_release(skb2->dst); dst_release(skb2->dst);
skb2->dst = NULL; skb2->dst = NULL;
skb_pull(skb2, offset); skb_pull(skb2, offset);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
eiph = skb2->nh.iph; eiph = skb2->nh.iph;
/* Try to guess incoming interface */ /* Try to guess incoming interface */
...@@ -599,7 +599,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, ...@@ -599,7 +599,7 @@ ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
dst_release(skb2->dst); dst_release(skb2->dst);
skb2->dst = NULL; skb2->dst = NULL;
skb_pull(skb2, offset); skb_pull(skb2, offset);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* Try to guess incoming interface */ /* Try to guess incoming interface */
rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0); rt = rt6_lookup(&skb2->nh.ipv6h->saddr, NULL, 0, 0);
...@@ -704,7 +704,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol, ...@@ -704,7 +704,7 @@ static int ip6_tnl_rcv(struct sk_buff *skb, __u16 protocol,
} }
secpath_reset(skb); secpath_reset(skb);
skb->mac.raw = skb->nh.raw; skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->protocol = htons(protocol); skb->protocol = htons(protocol);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
memset(skb->cb, 0, sizeof(struct inet6_skb_parm)); memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
......
...@@ -340,7 +340,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info) ...@@ -340,7 +340,7 @@ static int ipip6_err(struct sk_buff *skb, u32 info)
dst_release(skb2->dst); dst_release(skb2->dst);
skb2->dst = NULL; skb2->dst = NULL;
skb_pull(skb2, skb->data - (u8*)iph6); skb_pull(skb2, skb->data - (u8*)iph6);
skb2->nh.raw = skb2->data; skb_reset_network_header(skb2);
/* Try to guess incoming interface */ /* Try to guess incoming interface */
rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0); rt6i = rt6_lookup(&iph6->saddr, NULL, NULL, 0);
...@@ -383,7 +383,7 @@ static int ipip6_rcv(struct sk_buff *skb) ...@@ -383,7 +383,7 @@ static int ipip6_rcv(struct sk_buff *skb)
if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) { if ((tunnel = ipip6_tunnel_lookup(iph->saddr, iph->daddr)) != NULL) {
secpath_reset(skb); secpath_reset(skb);
skb->mac.raw = skb->nh.raw; skb->mac.raw = skb->nh.raw;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
IPCB(skb)->flags = 0; IPCB(skb)->flags = 0;
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
......
...@@ -45,7 +45,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -45,7 +45,7 @@ static int xfrm6_beet_output(struct xfrm_state *x, struct sk_buff *skb)
skb->h.raw = skb->data + hdr_len; skb->h.raw = skb->data + hdr_len;
memmove(skb->data, iph, hdr_len); memmove(skb->data, iph, hdr_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
top_iph = skb->nh.ipv6h; top_iph = skb->nh.ipv6h;
skb->nh.raw = &top_iph->nexthdr; skb->nh.raw = &top_iph->nexthdr;
skb->h.ipv6h = top_iph + 1; skb->h.ipv6h = top_iph + 1;
...@@ -68,7 +68,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -68,7 +68,7 @@ static int xfrm6_beet_input(struct xfrm_state *x, struct sk_buff *skb)
skb_push(skb, size); skb_push(skb, size);
memmove(skb->data, skb->nh.raw, size); memmove(skb->data, skb->nh.raw, size);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
old_mac = skb_mac_header(skb); old_mac = skb_mac_header(skb);
skb_set_mac_header(skb, -skb->mac_len); skb_set_mac_header(skb, -skb->mac_len);
......
...@@ -53,7 +53,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) ...@@ -53,7 +53,7 @@ static int xfrm6_tunnel_output(struct xfrm_state *x, struct sk_buff *skb)
skb_push(skb, x->props.header_len); skb_push(skb, x->props.header_len);
iph = skb->nh.ipv6h; iph = skb->nh.ipv6h;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
top_iph = skb->nh.ipv6h; top_iph = skb->nh.ipv6h;
skb->nh.raw = &top_iph->nexthdr; skb->nh.raw = &top_iph->nexthdr;
skb->h.ipv6h = top_iph + 1; skb->h.ipv6h = top_iph + 1;
...@@ -111,7 +111,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) ...@@ -111,7 +111,7 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct sk_buff *skb)
old_mac = skb_mac_header(skb); old_mac = skb_mac_header(skb);
skb_set_mac_header(skb, -skb->mac_len); skb_set_mac_header(skb, -skb->mac_len);
memmove(skb_mac_header(skb), old_mac, skb->mac_len); memmove(skb_mac_header(skb), old_mac, skb->mac_len);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
err = 0; err = 0;
out: out:
......
...@@ -82,7 +82,7 @@ static int xfrm6_output_one(struct sk_buff *skb) ...@@ -82,7 +82,7 @@ static int xfrm6_output_one(struct sk_buff *skb)
spin_unlock_bh(&x->lock); spin_unlock_bh(&x->lock);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
if (!(skb->dst = dst_pop(dst))) { if (!(skb->dst = dst_pop(dst))) {
err = -EHOSTUNREACH; err = -EHOSTUNREACH;
......
...@@ -94,7 +94,8 @@ void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb) ...@@ -94,7 +94,8 @@ void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb)
/* Some common init stuff */ /* Some common init stuff */
skb->dev = self->netdev; skb->dev = self->netdev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->h.raw = skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->h.raw = skb->data;
skb->protocol = htons(ETH_P_IRDA); skb->protocol = htons(ETH_P_IRDA);
skb->priority = TC_PRIO_BESTEFFORT; skb->priority = TC_PRIO_BESTEFFORT;
......
...@@ -954,7 +954,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg) ...@@ -954,7 +954,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg)
} }
skb->h.raw = skb->data; skb->h.raw = skb->data;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->len = msg->length; skb->len = msg->length;
} }
......
...@@ -38,7 +38,8 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev) ...@@ -38,7 +38,8 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev)
if (skb) { if (skb) {
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb_reserve(skb, 50); skb_reserve(skb, 50);
skb->nh.raw = skb->h.raw = skb->data; skb_reset_network_header(skb);
skb->h.raw = skb->data;
skb->protocol = htons(ETH_P_802_2); skb->protocol = htons(ETH_P_802_2);
skb->dev = dev; skb->dev = dev;
if (sk != NULL) if (sk != NULL)
......
...@@ -57,7 +57,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev) ...@@ -57,7 +57,7 @@ int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
/* Spoof incoming device */ /* Spoof incoming device */
skb->dev = dev; skb->dev = dev;
skb_reset_mac_header(skb); skb_reset_mac_header(skb);
skb->nh.raw = skb->data; skb_reset_network_header(skb);
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
netif_rx(skb); netif_rx(skb);
......
...@@ -401,14 +401,14 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, ...@@ -401,14 +401,14 @@ static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock,
* notable one here. This should really be fixed at the driver level. * notable one here. This should really be fixed at the driver level.
*/ */
skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb_reset_network_header(skb);
/* Try to align data part correctly */ /* Try to align data part correctly */
if (dev->hard_header) { if (dev->hard_header) {
skb->data -= dev->hard_header_len; skb->data -= dev->hard_header_len;
skb->tail -= dev->hard_header_len; skb->tail -= dev->hard_header_len;
if (len < dev->hard_header_len) if (len < dev->hard_header_len)
skb->nh.raw = skb->data; skb_reset_network_header(skb);
} }
/* Returns -EFAULT on error */ /* Returns -EFAULT on error */
...@@ -768,7 +768,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock, ...@@ -768,7 +768,7 @@ static int packet_sendmsg(struct kiocb *iocb, struct socket *sock,
goto out_unlock; goto out_unlock;
skb_reserve(skb, LL_RESERVED_SPACE(dev)); skb_reserve(skb, LL_RESERVED_SPACE(dev));
skb->nh.raw = skb->data; skb_reset_network_header(skb);
if (dev->hard_header) { if (dev->hard_header) {
int res; int res;
......
...@@ -73,7 +73,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr, ...@@ -73,7 +73,7 @@ static int send_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr,
clone = skb_clone(buf, GFP_ATOMIC); clone = skb_clone(buf, GFP_ATOMIC);
if (clone) { if (clone) {
clone->nh.raw = clone->data; skb_reset_network_header(clone);
dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev; dev = ((struct eth_bearer *)(tb_ptr->usr_handle))->dev;
clone->dev = dev; clone->dev = dev;
dev->hard_header(clone, dev, ETH_P_TIPC, dev->hard_header(clone, dev, ETH_P_TIPC,
......
...@@ -191,7 +191,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb) ...@@ -191,7 +191,7 @@ void x25_send_frame(struct sk_buff *skb, struct x25_neigh *nb)
{ {
unsigned char *dptr; unsigned char *dptr;
skb->nh.raw = skb->data; skb_reset_network_header(skb);
switch (nb->dev->type) { switch (nb->dev->type) {
case ARPHRD_X25: case ARPHRD_X25:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册