From 752e4c522c547294e8c1bc46f386de5f884e5069 Mon Sep 17 00:00:00 2001 From: Herbert Xu <herbert@gondor.apana.org.au> Date: Wed, 15 Sep 2004 23:10:18 -0700 Subject: [PATCH] [IPV6]: Kill ip6_get_dsfield This patch kills the duplicate implementation of ip6_get_dsfield in inet_ecn.h. It now uses ipv6_get_dsfield from dsfield.h instead. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net> --- include/net/inet_ecn.h | 4 +--- net/ipv4/ip_gre.c | 3 ++- net/ipv6/sit.c | 3 ++- net/ipv6/tcp_ipv6.c | 3 ++- net/ipv6/xfrm6_input.c | 3 ++- net/sched/sch_red.c | 3 ++- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index e04db26f4d84..0bde1b6d5ced 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h @@ -78,13 +78,11 @@ static inline void IP_ECN_clear(struct iphdr *iph) iph->tos &= ~INET_ECN_MASK; } -#define ip6_get_dsfield(iph) ((ntohs(*(u16*)(iph)) >> 4) & 0xFF) - struct ipv6hdr; static inline void IP6_ECN_set_ce(struct ipv6hdr *iph) { - if (INET_ECN_is_not_ect(ip6_get_dsfield(iph))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph))) return; *(u32*)iph |= htonl(INET_ECN_CE << 20); } diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6f6250e5d9e1..97e8595a5b86 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c @@ -36,6 +36,7 @@ #include <net/ipip.h> #include <net/arp.h> #include <net/checksum.h> +#include <net/dsfield.h> #include <net/inet_ecn.h> #include <net/xfrm.h> @@ -547,7 +548,7 @@ ipgre_ecn_encapsulate(u8 tos, struct iphdr *old_iph, struct sk_buff *skb) if (skb->protocol == htons(ETH_P_IP)) inner = old_iph->tos; else if (skb->protocol == htons(ETH_P_IPV6)) - inner = ip6_get_dsfield((struct ipv6hdr*)old_iph); + inner = ipv6_get_dsfield((struct ipv6hdr *)old_iph); return INET_ECN_encapsulate(tos, inner); } diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 6ce7719d43a9..2f89e1a41178 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c @@ -50,6 +50,7 @@ #include <net/ipip.h> #include <net/inet_ecn.h> #include <net/xfrm.h> +#include <net/dsfield.h> /* This version of net/ipv6/sit.c is cloned of net/ipv4/ip_gre.c @@ -566,7 +567,7 @@ static int ipip6_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) iph->frag_off = 0; iph->protocol = IPPROTO_IPV6; - iph->tos = INET_ECN_encapsulate(tos, ip6_get_dsfield(iph6)); + iph->tos = INET_ECN_encapsulate(tos, ipv6_get_dsfield(iph6)); iph->daddr = rt->rt_dst; iph->saddr = rt->rt_src; diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 66a56080c202..1410650e38b8 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -57,6 +57,7 @@ #include <net/xfrm.h> #include <net/addrconf.h> #include <net/snmp.h> +#include <net/dsfield.h> #include <asm/uaccess.h> @@ -1646,7 +1647,7 @@ static int tcp_v6_rcv(struct sk_buff **pskb, unsigned int *nhoffp) skb->len - th->doff*4); TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq); TCP_SKB_CB(skb)->when = 0; - TCP_SKB_CB(skb)->flags = ip6_get_dsfield(skb->nh.ipv6h); + TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(skb->nh.ipv6h); TCP_SKB_CB(skb)->sacked = 0; sk = __tcp_v6_lookup(&skb->nh.ipv6h->saddr, th->source, diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c index 89000c7889f8..45702e4d429c 100644 --- a/net/ipv6/xfrm6_input.c +++ b/net/ipv6/xfrm6_input.c @@ -11,6 +11,7 @@ #include <linux/module.h> #include <linux/string.h> +#include <net/dsfield.h> #include <net/inet_ecn.h> #include <net/ip.h> #include <net/ipv6.h> @@ -21,7 +22,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb) struct ipv6hdr *outer_iph = skb->nh.ipv6h; struct ipv6hdr *inner_iph = skb->h.ipv6h; - if (INET_ECN_is_ce(ip6_get_dsfield(outer_iph))) + if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph))) IP6_ECN_set_ce(inner_iph); } diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c index e5899f67ed64..e98f79bdb435 100644 --- a/net/sched/sch_red.c +++ b/net/sched/sch_red.c @@ -40,6 +40,7 @@ #include <net/sock.h> #include <net/pkt_sched.h> #include <net/inet_ecn.h> +#include <net/dsfield.h> /* Random Early Detection (RED) algorithm. @@ -167,7 +168,7 @@ static int red_ecn_mark(struct sk_buff *skb) IP_ECN_set_ce(skb->nh.iph); return 1; case __constant_htons(ETH_P_IPV6): - if (INET_ECN_is_not_ect(ip6_get_dsfield(skb->nh.ipv6h))) + if (INET_ECN_is_not_ect(ipv6_get_dsfield(skb->nh.ipv6h))) return 0; IP6_ECN_set_ce(skb->nh.ipv6h); return 1; -- 2.30.9