diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-04-10 23:50:43 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:24:59 -0400 |
commit | d56f90a7c96da5187f0cdf07ee7434fe6aa78bbc (patch) | |
tree | 3b9073cecfbb3b6a1e25ab2b5dd2a22a43aef238 /drivers | |
parent | bbe735e4247dba32568a305553b010081c8dea99 (diff) |
[SK_BUFF]: Introduce skb_network_header()
For the places where we need a pointer to the network header, it is still legal
to touch skb->nh.raw directly if just adding to, subtracting from or setting it
to another layer header.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/isdn/i4l/isdn_net.c | 5 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 2 | ||||
-rw-r--r-- | drivers/net/loopback.c | 7 | ||||
-rw-r--r-- | drivers/net/pasemi_mac.c | 6 | ||||
-rw-r--r-- | drivers/s390/net/qeth_main.c | 6 |
5 files changed, 16 insertions, 10 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 0c2b3752e46e..cd3b1fa4a414 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -872,7 +872,8 @@ typedef struct { | |||
872 | static void | 872 | static void |
873 | isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | 873 | isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) |
874 | { | 874 | { |
875 | u_char *p = skb->nh.raw; /* hopefully, this was set correctly */ | 875 | /* hopefully, this was set correctly */ |
876 | const u_char *p = skb_network_header(skb); | ||
876 | unsigned short proto = ntohs(skb->protocol); | 877 | unsigned short proto = ntohs(skb->protocol); |
877 | int data_ofs; | 878 | int data_ofs; |
878 | ip_ports *ipp; | 879 | ip_ports *ipp; |
@@ -880,7 +881,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp) | |||
880 | 881 | ||
881 | addinfo[0] = '\0'; | 882 | addinfo[0] = '\0'; |
882 | /* This check stolen from 2.1.72 dev_queue_xmit_nit() */ | 883 | /* This check stolen from 2.1.72 dev_queue_xmit_nit() */ |
883 | if (skb->nh.raw < skb->data || skb->nh.raw >= skb->tail) { | 884 | if (p < skb->data || p >= skb->tail) { |
884 | /* fall back to old isdn_net_log_packet method() */ | 885 | /* fall back to old isdn_net_log_packet method() */ |
885 | char * buf = skb->data; | 886 | char * buf = skb->data; |
886 | 887 | ||
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 5c2a12c2b997..86cfcb3f8131 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -106,7 +106,7 @@ struct arp_pkt { | |||
106 | 106 | ||
107 | static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb) | 107 | static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb) |
108 | { | 108 | { |
109 | return (struct arp_pkt *)skb->nh.raw; | 109 | return (struct arp_pkt *)skb_network_header(skb); |
110 | } | 110 | } |
111 | 111 | ||
112 | /* Forward declaration */ | 112 | /* Forward declaration */ |
diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index af476d2a513d..9265c27b13b2 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c | |||
@@ -76,7 +76,8 @@ static DEFINE_PER_CPU(struct pcpu_lstats, pcpu_lstats); | |||
76 | static void emulate_large_send_offload(struct sk_buff *skb) | 76 | static void emulate_large_send_offload(struct sk_buff *skb) |
77 | { | 77 | { |
78 | struct iphdr *iph = skb->nh.iph; | 78 | struct iphdr *iph = skb->nh.iph; |
79 | struct tcphdr *th = (struct tcphdr*)(skb->nh.raw + (iph->ihl * 4)); | 79 | struct tcphdr *th = (struct tcphdr *)(skb_network_header(skb) + |
80 | (iph->ihl * 4)); | ||
80 | unsigned int doffset = (iph->ihl + th->doff) * 4; | 81 | unsigned int doffset = (iph->ihl + th->doff) * 4; |
81 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; | 82 | unsigned int mtu = skb_shinfo(skb)->gso_size + doffset; |
82 | unsigned int offset = 0; | 83 | unsigned int offset = 0; |
@@ -93,7 +94,7 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
93 | skb_set_mac_header(nskb, -ETH_HLEN); | 94 | skb_set_mac_header(nskb, -ETH_HLEN); |
94 | skb_reset_network_header(nskb); | 95 | skb_reset_network_header(nskb); |
95 | iph = nskb->nh.iph; | 96 | iph = nskb->nh.iph; |
96 | memcpy(nskb->data, skb->nh.raw, doffset); | 97 | memcpy(nskb->data, skb_network_header(skb), doffset); |
97 | if (skb_copy_bits(skb, | 98 | if (skb_copy_bits(skb, |
98 | doffset + offset, | 99 | doffset + offset, |
99 | nskb->data + doffset, | 100 | nskb->data + doffset, |
@@ -108,7 +109,7 @@ static void emulate_large_send_offload(struct sk_buff *skb) | |||
108 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); | 109 | memcpy(nskb->cb, skb->cb, sizeof(skb->cb)); |
109 | nskb->pkt_type = skb->pkt_type; | 110 | nskb->pkt_type = skb->pkt_type; |
110 | 111 | ||
111 | th = (struct tcphdr*)(nskb->nh.raw + iph->ihl*4); | 112 | th = (struct tcphdr *)(skb_network_header(nskb) + iph->ihl * 4); |
112 | iph->tot_len = htons(frag_size + doffset); | 113 | iph->tot_len = htons(frag_size + doffset); |
113 | iph->id = htons(id); | 114 | iph->id = htons(id); |
114 | iph->check = 0; | 115 | iph->check = 0; |
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c index 3f4213f3d5de..82218720bc3e 100644 --- a/drivers/net/pasemi_mac.c +++ b/drivers/net/pasemi_mac.c | |||
@@ -729,16 +729,18 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev) | |||
729 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; | 729 | dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD; |
730 | 730 | ||
731 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 731 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
732 | const unsigned char *nh = skb_network_header(skb); | ||
733 | |||
732 | switch (skb->nh.iph->protocol) { | 734 | switch (skb->nh.iph->protocol) { |
733 | case IPPROTO_TCP: | 735 | case IPPROTO_TCP: |
734 | dflags |= XCT_MACTX_CSUM_TCP; | 736 | dflags |= XCT_MACTX_CSUM_TCP; |
735 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); | 737 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); |
736 | dflags |= XCT_MACTX_IPO(skb->nh.raw - skb->data); | 738 | dflags |= XCT_MACTX_IPO(nh - skb->data); |
737 | break; | 739 | break; |
738 | case IPPROTO_UDP: | 740 | case IPPROTO_UDP: |
739 | dflags |= XCT_MACTX_CSUM_UDP; | 741 | dflags |= XCT_MACTX_CSUM_UDP; |
740 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); | 742 | dflags |= XCT_MACTX_IPH((skb->h.raw - skb->nh.raw) >> 2); |
741 | dflags |= XCT_MACTX_IPO(skb->nh.raw - skb->data); | 743 | dflags |= XCT_MACTX_IPO(nh - skb->data); |
742 | break; | 744 | break; |
743 | } | 745 | } |
744 | } | 746 | } |
diff --git a/drivers/s390/net/qeth_main.c b/drivers/s390/net/qeth_main.c index c0ee6d94ea38..0ff29e0628b5 100644 --- a/drivers/s390/net/qeth_main.c +++ b/drivers/s390/net/qeth_main.c | |||
@@ -3778,9 +3778,11 @@ qeth_get_cast_type(struct qeth_card *card, struct sk_buff *skb) | |||
3778 | } | 3778 | } |
3779 | /* try something else */ | 3779 | /* try something else */ |
3780 | if (skb->protocol == ETH_P_IPV6) | 3780 | if (skb->protocol == ETH_P_IPV6) |
3781 | return (skb->nh.raw[24] == 0xff) ? RTN_MULTICAST : 0; | 3781 | return (skb_network_header(skb)[24] == 0xff) ? |
3782 | RTN_MULTICAST : 0; | ||
3782 | else if (skb->protocol == ETH_P_IP) | 3783 | else if (skb->protocol == ETH_P_IP) |
3783 | return ((skb->nh.raw[16] & 0xf0) == 0xe0) ? RTN_MULTICAST : 0; | 3784 | return ((skb_network_header(skb)[16] & 0xf0) == 0xe0) ? |
3785 | RTN_MULTICAST : 0; | ||
3784 | /* ... */ | 3786 | /* ... */ |
3785 | if (!memcmp(skb->data, skb->dev->broadcast, 6)) | 3787 | if (!memcmp(skb->data, skb->dev->broadcast, 6)) |
3786 | return RTN_BROADCAST; | 3788 | return RTN_BROADCAST; |