diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-19 18:33:04 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:41 -0400 |
commit | 98e399f82ab3a6d863d1d4a7ea48925cc91c830e (patch) | |
tree | 5f84043aeec1ec27c2e8e6cc25b5d2e6c3d07343 /drivers/net | |
parent | 31713c333ddbb66d694829082620b69b71c4b09a (diff) |
[SK_BUFF]: Introduce skb_mac_header()
For the places where we need a pointer to the mac header, it is still legal to
touch skb->mac.raw directly if just adding to, subtracting from or setting it
to another layer header.
This one also converts some more cases to skb_reset_mac_header() that my
regex missed as it had no spaces before nor after '=', ugh.
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/arcnet/capmode.c | 4 | ||||
-rw-r--r-- | drivers/net/plip.c | 2 | ||||
-rw-r--r-- | drivers/net/slip.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hostess_sv11.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/sealevel.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/syncppp.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/airo.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/hostap/hostap_main.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/orinoco.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/wavelan_cs.c | 4 |
11 files changed, 21 insertions, 20 deletions
diff --git a/drivers/net/arcnet/capmode.c b/drivers/net/arcnet/capmode.c index 6c764b66e9cc..f6a87bd20ff2 100644 --- a/drivers/net/arcnet/capmode.c +++ b/drivers/net/arcnet/capmode.c | |||
@@ -123,7 +123,7 @@ static void rx(struct net_device *dev, int bufnum, | |||
123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); | 123 | skb_put(skb, length + ARC_HDR_SIZE + sizeof(int)); |
124 | skb->dev = dev; | 124 | skb->dev = dev; |
125 | skb_reset_mac_header(skb); | 125 | skb_reset_mac_header(skb); |
126 | pkt = (struct archdr *)skb->mac.raw; | 126 | pkt = (struct archdr *)skb_mac_header(skb); |
127 | skb_pull(skb, ARC_HDR_SIZE); | 127 | skb_pull(skb, ARC_HDR_SIZE); |
128 | 128 | ||
129 | /* up to sizeof(pkt->soft) has already been copied from the card */ | 129 | /* up to sizeof(pkt->soft) has already been copied from the card */ |
@@ -269,7 +269,7 @@ static int ack_tx(struct net_device *dev, int acked) | |||
269 | ackskb->dev = dev; | 269 | ackskb->dev = dev; |
270 | 270 | ||
271 | skb_reset_mac_header(ackskb); | 271 | skb_reset_mac_header(ackskb); |
272 | ackpkt = (struct archdr *)ackskb->mac.raw; | 272 | ackpkt = (struct archdr *)skb_mac_header(ackskb); |
273 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ | 273 | /* skb_pull(ackskb, ARC_HDR_SIZE); */ |
274 | 274 | ||
275 | 275 | ||
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 6bb085f54437..8754cf3356b0 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -546,7 +546,7 @@ static __be16 plip_type_trans(struct sk_buff *skb, struct net_device *dev) | |||
546 | struct ethhdr *eth; | 546 | struct ethhdr *eth; |
547 | unsigned char *rawp; | 547 | unsigned char *rawp; |
548 | 548 | ||
549 | skb->mac.raw=skb->data; | 549 | skb_reset_mac_header(skb); |
550 | skb_pull(skb,dev->hard_header_len); | 550 | skb_pull(skb,dev->hard_header_len); |
551 | eth = eth_hdr(skb); | 551 | eth = eth_hdr(skb); |
552 | 552 | ||
diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 2f4b1de7a2b4..65bd20fac820 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c | |||
@@ -363,7 +363,7 @@ sl_bump(struct slip *sl) | |||
363 | } | 363 | } |
364 | skb->dev = sl->dev; | 364 | skb->dev = sl->dev; |
365 | memcpy(skb_put(skb,count), sl->rbuff, count); | 365 | memcpy(skb_put(skb,count), sl->rbuff, count); |
366 | skb->mac.raw=skb->data; | 366 | skb_reset_mac_header(skb); |
367 | skb->protocol=htons(ETH_P_IP); | 367 | skb->protocol=htons(ETH_P_IP); |
368 | netif_rx(skb); | 368 | netif_rx(skb); |
369 | sl->dev->last_rx = jiffies; | 369 | sl->dev->last_rx = jiffies; |
diff --git a/drivers/net/wan/hostess_sv11.c b/drivers/net/wan/hostess_sv11.c index a02c5fb40567..9ba3e4ee6ec7 100644 --- a/drivers/net/wan/hostess_sv11.c +++ b/drivers/net/wan/hostess_sv11.c | |||
@@ -59,7 +59,7 @@ static void hostess_input(struct z8530_channel *c, struct sk_buff *skb) | |||
59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 59 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
60 | skb_trim(skb, skb->len-2); | 60 | skb_trim(skb, skb->len-2); |
61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); | 61 | skb->protocol=__constant_htons(ETH_P_WAN_PPP); |
62 | skb->mac.raw=skb->data; | 62 | skb_reset_mac_header(skb); |
63 | skb->dev=c->netdevice; | 63 | skb->dev=c->netdevice; |
64 | /* | 64 | /* |
65 | * Send it to the PPP layer. We don't have time to process | 65 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/sealevel.c b/drivers/net/wan/sealevel.c index 70fb1b98b1dd..131358108c5a 100644 --- a/drivers/net/wan/sealevel.c +++ b/drivers/net/wan/sealevel.c | |||
@@ -61,7 +61,7 @@ static void sealevel_input(struct z8530_channel *c, struct sk_buff *skb) | |||
61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ | 61 | /* Drop the CRC - it's not a good idea to try and negotiate it ;) */ |
62 | skb_trim(skb, skb->len-2); | 62 | skb_trim(skb, skb->len-2); |
63 | skb->protocol=htons(ETH_P_WAN_PPP); | 63 | skb->protocol=htons(ETH_P_WAN_PPP); |
64 | skb->mac.raw=skb->data; | 64 | skb_reset_mac_header(skb); |
65 | skb->dev=c->netdevice; | 65 | skb->dev=c->netdevice; |
66 | /* | 66 | /* |
67 | * Send it to the PPP layer. We don't have time to process | 67 | * Send it to the PPP layer. We don't have time to process |
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c index 218f7b574ab3..67fc67cfd452 100644 --- a/drivers/net/wan/syncppp.c +++ b/drivers/net/wan/syncppp.c | |||
@@ -227,7 +227,7 @@ static void sppp_input (struct net_device *dev, struct sk_buff *skb) | |||
227 | unsigned long flags; | 227 | unsigned long flags; |
228 | 228 | ||
229 | skb->dev=dev; | 229 | skb->dev=dev; |
230 | skb->mac.raw=skb->data; | 230 | skb_reset_mac_header(skb); |
231 | 231 | ||
232 | if (dev->flags & IFF_RUNNING) | 232 | if (dev->flags & IFF_RUNNING) |
233 | { | 233 | { |
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c index 692a23f9834d..7fe0a61091a6 100644 --- a/drivers/net/wireless/airo.c +++ b/drivers/net/wireless/airo.c | |||
@@ -2444,7 +2444,7 @@ static int add_airo_dev( struct net_device *dev ); | |||
2444 | 2444 | ||
2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) | 2445 | static int wll_header_parse(struct sk_buff *skb, unsigned char *haddr) |
2446 | { | 2446 | { |
2447 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); | 2447 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); |
2448 | return ETH_ALEN; | 2448 | return ETH_ALEN; |
2449 | } | 2449 | } |
2450 | 2450 | ||
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c index 0e29ff762879..c2616e7b0059 100644 --- a/drivers/net/wireless/hostap/hostap_main.c +++ b/drivers/net/wireless/hostap/hostap_main.c | |||
@@ -590,20 +590,20 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx) | |||
590 | 590 | ||
591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) | 591 | int hostap_80211_header_parse(struct sk_buff *skb, unsigned char *haddr) |
592 | { | 592 | { |
593 | memcpy(haddr, skb->mac.raw + 10, ETH_ALEN); /* addr2 */ | 593 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ |
594 | return ETH_ALEN; | 594 | return ETH_ALEN; |
595 | } | 595 | } |
596 | 596 | ||
597 | 597 | ||
598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) | 598 | int hostap_80211_prism_header_parse(struct sk_buff *skb, unsigned char *haddr) |
599 | { | 599 | { |
600 | if (*(u32 *)skb->mac.raw == LWNG_CAP_DID_BASE) { | 600 | const unsigned char *mac = skb_mac_header(skb); |
601 | memcpy(haddr, skb->mac.raw + | 601 | |
602 | sizeof(struct linux_wlan_ng_prism_hdr) + 10, | 602 | if (*(u32 *)mac == LWNG_CAP_DID_BASE) { |
603 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_prism_hdr) + 10, | ||
603 | ETH_ALEN); /* addr2 */ | 604 | ETH_ALEN); /* addr2 */ |
604 | } else { /* (*(u32 *)skb->mac.raw == htonl(LWNG_CAPHDR_VERSION)) */ | 605 | } else { /* (*(u32 *)mac == htonl(LWNG_CAPHDR_VERSION)) */ |
605 | memcpy(haddr, skb->mac.raw + | 606 | memcpy(haddr, mac + sizeof(struct linux_wlan_ng_cap_hdr) + 10, |
606 | sizeof(struct linux_wlan_ng_cap_hdr) + 10, | ||
607 | ETH_ALEN); /* addr2 */ | 607 | ETH_ALEN); /* addr2 */ |
608 | } | 608 | } |
609 | return ETH_ALEN; | 609 | return ETH_ALEN; |
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index f1415bff527f..062286dc8e15 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -689,7 +689,7 @@ static void orinoco_stat_gather(struct net_device *dev, | |||
689 | /* Note : gcc will optimise the whole section away if | 689 | /* Note : gcc will optimise the whole section away if |
690 | * WIRELESS_SPY is not defined... - Jean II */ | 690 | * WIRELESS_SPY is not defined... - Jean II */ |
691 | if (SPY_NUMBER(priv)) { | 691 | if (SPY_NUMBER(priv)) { |
692 | orinoco_spy_gather(dev, skb->mac.raw + ETH_ALEN, | 692 | orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN, |
693 | desc->signal, desc->silence); | 693 | desc->signal, desc->silence); |
694 | } | 694 | } |
695 | } | 695 | } |
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c index 69cb1471096b..2bf77b1ee531 100644 --- a/drivers/net/wireless/wavelan.c +++ b/drivers/net/wireless/wavelan.c | |||
@@ -2517,7 +2517,8 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2517 | skb->protocol = eth_type_trans(skb, dev); | 2517 | skb->protocol = eth_type_trans(skb, dev); |
2518 | 2518 | ||
2519 | #ifdef DEBUG_RX_INFO | 2519 | #ifdef DEBUG_RX_INFO |
2520 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2520 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, |
2521 | "wv_packet_read"); | ||
2521 | #endif /* DEBUG_RX_INFO */ | 2522 | #endif /* DEBUG_RX_INFO */ |
2522 | 2523 | ||
2523 | /* Statistics-gathering and associated stuff. | 2524 | /* Statistics-gathering and associated stuff. |
@@ -2553,7 +2554,7 @@ wv_packet_read(struct net_device * dev, u16 buf_off, int sksize) | |||
2553 | 2554 | ||
2554 | /* Spying stuff */ | 2555 | /* Spying stuff */ |
2555 | #ifdef IW_WIRELESS_SPY | 2556 | #ifdef IW_WIRELESS_SPY |
2556 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, | 2557 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, |
2557 | stats); | 2558 | stats); |
2558 | #endif /* IW_WIRELESS_SPY */ | 2559 | #endif /* IW_WIRELESS_SPY */ |
2559 | #ifdef HISTOGRAM | 2560 | #ifdef HISTOGRAM |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 9351ee773314..67b867f837ca 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -2889,7 +2889,7 @@ wv_packet_read(struct net_device * dev, | |||
2889 | skb->protocol = eth_type_trans(skb, dev); | 2889 | skb->protocol = eth_type_trans(skb, dev); |
2890 | 2890 | ||
2891 | #ifdef DEBUG_RX_INFO | 2891 | #ifdef DEBUG_RX_INFO |
2892 | wv_packet_info(skb->mac.raw, sksize, dev->name, "wv_packet_read"); | 2892 | wv_packet_info(skb_mac_header(skb), sksize, dev->name, "wv_packet_read"); |
2893 | #endif /* DEBUG_RX_INFO */ | 2893 | #endif /* DEBUG_RX_INFO */ |
2894 | 2894 | ||
2895 | /* Statistics gathering & stuff associated. | 2895 | /* Statistics gathering & stuff associated. |
@@ -2923,7 +2923,7 @@ wv_packet_read(struct net_device * dev, | |||
2923 | #endif /* WAVELAN_ROAMING */ | 2923 | #endif /* WAVELAN_ROAMING */ |
2924 | 2924 | ||
2925 | #ifdef WIRELESS_SPY | 2925 | #ifdef WIRELESS_SPY |
2926 | wl_spy_gather(dev, skb->mac.raw + WAVELAN_ADDR_SIZE, stats); | 2926 | wl_spy_gather(dev, skb_mac_header(skb) + WAVELAN_ADDR_SIZE, stats); |
2927 | #endif /* WIRELESS_SPY */ | 2927 | #endif /* WIRELESS_SPY */ |
2928 | #ifdef HISTOGRAM | 2928 | #ifdef HISTOGRAM |
2929 | wl_his_gather(dev, stats); | 2929 | wl_his_gather(dev, stats); |