From 13b28cb035592e5bfeb3da05550850b0c825e01e Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 13 Mar 2007 15:52:43 -0300 Subject: [PATCH 11/15] [SK_BUFF]: Introduce ipip_hdr(), remove skb->h.ipiph Signed-off-by: Arnaldo Carvalho de Melo --- drivers/net/sk98lin/skge.c | 4 ++-- drivers/net/skge.c | 2 +- include/linux/ip.h | 5 +++++ include/linux/skbuff.h | 1 - net/ipv4/xfrm4_mode_tunnel.c | 6 +++--- net/ipv6/xfrm6_mode_tunnel.c | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index e4ab7a8..b987a5c 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c @@ -1565,7 +1565,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ u16 hdrlen = skb_transport_offset(pMessage); u16 offset = hdrlen + pMessage->csum_offset; - if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && + if ((ipip_hdr(pMessage)->protocol == IPPROTO_UDP) && (pAC->GIni.GIChipRev == 0) && (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { pTxd->TBControl = BMU_TCP_CHECK; @@ -1691,7 +1691,7 @@ struct sk_buff *pMessage) /* pointer to send-message */ ** opcode for udp is not working in the hardware yet ** (Revision 2.0) */ - if ((pMessage->h.ipiph->protocol == IPPROTO_UDP ) && + if ((ipip_hdr(pMessage)->protocol == IPPROTO_UDP) && (pAC->GIni.GIChipRev == 0) && (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { Control |= BMU_TCP_CHECK; diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 609cdb4..26b0fe0 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c @@ -2626,7 +2626,7 @@ static int skge_xmit_frame(struct sk_buff *skb, struct net_device *dev) /* This seems backwards, but it is what the sk98lin * does. Looks like hardware is wrong? */ - if (skb->h.ipiph->protocol == IPPROTO_UDP + if (ipip_hdr(skb)->protocol == IPPROTO_UDP && hw->chip_rev == 0 && hw->chip_id == CHIP_ID_YUKON) control = BMU_TCP_CHECK; else diff --git a/include/linux/ip.h b/include/linux/ip.h index f2f26db..1957844 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h @@ -111,6 +111,11 @@ static inline struct iphdr *ip_hdr(const struct sk_buff *skb) { return (struct iphdr *)skb_network_header(skb); } + +static inline struct iphdr *ipip_hdr(const struct sk_buff *skb) +{ + return (struct iphdr *)skb->h.raw; +} #endif struct ip_auth_hdr { diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c5407b7..2b1e188 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -239,7 +239,6 @@ struct sk_buff { struct net_device *input_dev; union { - struct iphdr *ipiph; struct ipv6hdr *ipv6h; unsigned char *raw; } h; diff --git a/net/ipv4/xfrm4_mode_tunnel.c b/net/ipv4/xfrm4_mode_tunnel.c index edba756..521e52f 100644 --- a/net/ipv4/xfrm4_mode_tunnel.c +++ b/net/ipv4/xfrm4_mode_tunnel.c @@ -17,7 +17,7 @@ static inline void ipip_ecn_decapsulate(struct sk_buff *skb) { struct iphdr *outer_iph = ip_hdr(skb); - struct iphdr *inner_iph = skb->h.ipiph; + struct iphdr *inner_iph = ipip_hdr(skb); if (INET_ECN_is_ce(outer_iph->tos)) IP_ECN_set_ce(inner_iph); @@ -47,7 +47,7 @@ static int xfrm4_tunnel_output(struct xfrm_state *x, struct sk_buff *skb) int flags; iph = ip_hdr(skb); - skb->h.ipiph = iph; + skb->h.raw = skb->nh.raw; skb_push(skb, x->props.header_len); skb_reset_network_header(skb); @@ -116,7 +116,7 @@ static int xfrm4_tunnel_input(struct xfrm_state *x, struct sk_buff *skb) iph = ip_hdr(skb); if (iph->protocol == IPPROTO_IPIP) { if (x->props.flags & XFRM_STATE_DECAP_DSCP) - ipv4_copy_dscp(iph, skb->h.ipiph); + ipv4_copy_dscp(iph, ipip_hdr(skb)); if (!(x->props.flags & XFRM_STATE_NOECN)) ipip_ecn_decapsulate(skb); } diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c index 28f36b3..9d3bd33 100644 --- a/net/ipv6/xfrm6_mode_tunnel.c +++ b/net/ipv6/xfrm6_mode_tunnel.c @@ -28,7 +28,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) static inline void ip6ip_ecn_decapsulate(struct sk_buff *skb) { if (INET_ECN_is_ce(ipv6_get_dsfield(ipv6_hdr(skb)))) - IP_ECN_set_ce(skb->h.ipiph); + IP_ECN_set_ce(ipip_hdr(skb)); } /* Add encapsulation header. -- 1.5.0.2