Commit 752e4c52 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[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: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4d0a304
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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;
......
......@@ -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,
......
......@@ -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);
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment