From 3025a772a1ab6cc364a87b481b6e66b703d7bd46 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Mon, 26 Aug 2013 13:27:02 -0700 Subject: [PATCH] datapath: Remove skb->mark compat code. Signed-off-by: Pravin B Shelar Acked-by: Jesse Gross --- datapath/actions.c | 2 +- datapath/compat.h | 39 --------------------------------------- datapath/datapath.c | 10 ++-------- datapath/flow.c | 9 ++------- datapath/vport-gre.c | 2 +- datapath/vport-lisp.c | 2 +- datapath/vport-vxlan.c | 2 +- 7 files changed, 8 insertions(+), 58 deletions(-) diff --git a/datapath/actions.c b/datapath/actions.c index fa4b9045f..33633df07 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -478,7 +478,7 @@ static int execute_set_action(struct sk_buff *skb, break; case OVS_KEY_ATTR_SKB_MARK: - skb_set_mark(skb, nla_get_u32(nested_attr)); + skb->mark = nla_get_u32(nested_attr); break; case OVS_KEY_ATTR_IPV4_TUNNEL: diff --git a/datapath/compat.h b/datapath/compat.h index 8457dbf31..c786b9739 100644 --- a/datapath/compat.h +++ b/datapath/compat.h @@ -72,40 +72,6 @@ static inline void skb_clear_rxhash(struct sk_buff *skb) #define SET_PARALLEL_OPS #endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -#ifdef CONFIG_NETFILTER -static inline u32 skb_get_mark(struct sk_buff *skb) -{ - return skb->nfmark; -} - -static inline void skb_set_mark(struct sk_buff *skb, u32 mark) -{ - skb->nfmark = mark; -} -#else /* CONFIG_NETFILTER */ -static inline u32 skb_get_mark(struct sk_buff *skb) -{ - return 0; -} - -static inline void skb_set_mark(struct sk_buff *skb, u32 mark) -{ -} -#endif -#else /* before 2.6.20 */ -static inline u32 skb_get_mark(struct sk_buff *skb) -{ - return skb->mark; -} - -static inline void skb_set_mark(struct sk_buff *skb, u32 mark) -{ - skb->mark = mark; -} -#endif /* after 2.6.20 */ - #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36) #define rt_dst(rt) (rt->dst) #else @@ -130,13 +96,8 @@ static inline struct rtable *find_route(struct net *net, struct flowi fl = { .nl_u = { .ip4_u = { .daddr = daddr, .saddr = *saddr, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) - .fwmark = skb_mark, -#endif .tos = RT_TOS(tos) } }, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) .mark = skb_mark, -#endif .proto = ipproto }; if (unlikely(ip_route_output_key(net, &rt, &fl))) diff --git a/datapath/datapath.c b/datapath/datapath.c index b6410c4e4..1f7560a32 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -657,14 +657,8 @@ static int validate_set(const struct nlattr *a, int err; case OVS_KEY_ATTR_PRIORITY: - case OVS_KEY_ATTR_ETHERNET: - break; - case OVS_KEY_ATTR_SKB_MARK: -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) && !defined(CONFIG_NETFILTER) - if (nla_get_u32(ovs_key) != 0) - return -EINVAL; -#endif + case OVS_KEY_ATTR_ETHERNET: break; case OVS_KEY_ATTR_TUNNEL: @@ -927,7 +921,7 @@ static int ovs_packet_cmd_execute(struct sk_buff *skb, struct genl_info *info) OVS_CB(packet)->flow = flow; OVS_CB(packet)->pkt_key = &flow->key; packet->priority = flow->key.phy.priority; - skb_set_mark(packet, flow->key.phy.skb_mark); + packet->mark = flow->key.phy.skb_mark; rcu_read_lock(); dp = get_dp(sock_net(skb->sk), ovs_header->dp_ifindex); diff --git a/datapath/flow.c b/datapath/flow.c index 34e4443c9..449e645a1 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -853,7 +853,7 @@ int ovs_flow_extract(struct sk_buff *skb, u16 in_port, struct sw_flow_key *key) if (OVS_CB(skb)->tun_key) memcpy(&key->tun_key, OVS_CB(skb)->tun_key, sizeof(key->tun_key)); key->phy.in_port = in_port; - key->phy.skb_mark = skb_get_mark(skb); + key->phy.skb_mark = skb->mark; skb_reset_mac_header(skb); @@ -1377,12 +1377,7 @@ static int metadata_from_nlattrs(struct sw_flow_match *match, u64 *attrs, if (*attrs & (1ULL << OVS_KEY_ATTR_SKB_MARK)) { uint32_t mark = nla_get_u32(a[OVS_KEY_ATTR_SKB_MARK]); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) && !defined(CONFIG_NETFILTER) - if (!is_mask && mark != 0) { - OVS_NLERR("skb->mark must be zero on this kernel (mark=%d).\n", mark); - return -EINVAL; - } -#endif + SW_FLOW_KEY_PUT(match, phy.skb_mark, mark, is_mask); *attrs &= ~(1ULL << OVS_KEY_ATTR_SKB_MARK); } diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c index 5af6dbec7..b9fff8a86 100644 --- a/datapath/vport-gre.c +++ b/datapath/vport-gre.c @@ -138,7 +138,7 @@ static int __send(struct vport *vport, struct sk_buff *skb, OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_GRE, OVS_CB(skb)->tun_key->ipv4_tos, - skb_get_mark(skb)); + skb->mark); if (IS_ERR(rt)) { err = PTR_ERR(rt); goto error; diff --git a/datapath/vport-lisp.c b/datapath/vport-lisp.c index 3c6e78469..818a471cb 100644 --- a/datapath/vport-lisp.c +++ b/datapath/vport-lisp.c @@ -507,7 +507,7 @@ static int ovs_tnl_send(struct vport *vport, struct sk_buff *skb, OVS_CB(skb)->tun_key->ipv4_dst, ipproto, OVS_CB(skb)->tun_key->ipv4_tos, - skb_get_mark(skb)); + skb->mark); if (IS_ERR(rt)) { err = PTR_ERR(rt); goto error; diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c index d7dd6b8f4..007e4ac6d 100644 --- a/datapath/vport-vxlan.c +++ b/datapath/vport-vxlan.c @@ -165,7 +165,7 @@ static int vxlan_tnl_send(struct vport *vport, struct sk_buff *skb) OVS_CB(skb)->tun_key->ipv4_dst, IPPROTO_UDP, OVS_CB(skb)->tun_key->ipv4_tos, - skb_get_mark(skb)); + skb->mark); if (IS_ERR(rt)) { err = PTR_ERR(rt); goto error; -- 2.43.0