[ovs-dev] [PATCH 21/21] datapath: Always use tun_key flags

Simon Horman horms at verge.net.au
Thu May 24 09:09:14 UTC 2012


These flags should always be valid and allows the flags
element of tnl_mutable_config to be removed.

The flags in mutable were actually not being set due to a previous patch in
this series, so all flag-related features, except outgoing ken and csum
which were restored in a previous patch, were disabled.

Cc: Kyle Mestery <kmestery at cisco.com>
Signed-of-by: Simon Horman <horms at verge.net.au>
---
 datapath/tunnel.c | 13 ++++++-------
 datapath/tunnel.h |  4 ----
 2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index 982de25..a91e319 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -482,7 +482,7 @@ bool ovs_tnl_frag_needed(struct vport *vport,
 	 * not symmetric then PMTUD needs to be disabled since we won't have
 	 * any way of synthesizing packets.
 	 */
-	if ((mutable->flags & (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) ==
+	if ((OVS_CB(skb)->tun_key->tun_flags & (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) ==
 	    (TNL_F_IN_KEY_MATCH | TNL_F_OUT_KEY_ACTION)) {
 		ntun_key = *tun_key;
 		OVS_CB(nskb)->tun_key = &ntun_key;
@@ -503,9 +503,9 @@ static bool check_mtu(struct sk_buff *skb,
 		      const struct tnl_mutable_config *mutable, int tun_hlen,
 		      const struct rtable *rt, __be16 *frag_offp)
 {
-	bool df_inherit = mutable->flags & TNL_F_DF_INHERIT;
-	bool pmtud = mutable->flags & TNL_F_PMTUD;
-	__be16 frag_off = mutable->flags & TNL_F_DF_DEFAULT ? htons(IP_DF) : 0;
+	bool df_inherit = OVS_CB(skb)->tun_key->tun_flags & TNL_F_DF_INHERIT;
+	bool pmtud = OVS_CB(skb)->tun_key->tun_flags & TNL_F_PMTUD;
+	__be16 frag_off = OVS_CB(skb)->tun_key->tun_flags & TNL_F_DF_DEFAULT ? htons(IP_DF) : 0;
 	int mtu = 0;
 	unsigned int packet_length = skb->len - ETH_HLEN;
 
@@ -804,7 +804,7 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
 	else
 		inner_tos = 0;
 
-	if (mutable->flags & TNL_F_TOS_INHERIT)
+	if (OVS_CB(skb)->tun_key->tun_flags & TNL_F_TOS_INHERIT)
 		tos = inner_tos;
 	else
 		tos = OVS_CB(skb)->tun_key->ipv4_tos;
@@ -851,7 +851,7 @@ int ovs_tnl_send(struct vport *vport, struct sk_buff *skb)
 	ttl = OVS_CB(skb)->tun_key->ipv4_ttl;
 	if (!ttl)
 		ttl = ip4_dst_hoplimit(&rt_dst(rt));
-	if (mutable->flags & TNL_F_TTL_INHERIT) {
+	if (OVS_CB(skb)->tun_key->tun_flags & TNL_F_TTL_INHERIT) {
 		if (skb->protocol == htons(ETH_P_IP))
 			ttl = ip_hdr(skb)->ttl;
 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
@@ -919,7 +919,6 @@ static int tnl_set_config(struct net *net,
 {
 	const struct vport *old_vport;
 
-	mutable->flags = 0;
 	port_key_set_net(&mutable->key, net);
 	mutable->key.tunnel_type = tnl_ops->tunnel_type;
 
diff --git a/datapath/tunnel.h b/datapath/tunnel.h
index a32241f..4893903 100644
--- a/datapath/tunnel.h
+++ b/datapath/tunnel.h
@@ -86,7 +86,6 @@ static inline void port_key_set_net(struct port_lookup_key *key, struct net *net
  * @seq: Sequence number for distinguishing configuration versions.
  * @eth_addr: Source address for packets generated by tunnel itself
  * (e.g. ICMP fragmentation needed messages).
- * @flags: TNL_F_* flags.
  */
 struct tnl_mutable_config {
 	struct port_lookup_key key;
@@ -95,9 +94,6 @@ struct tnl_mutable_config {
 	unsigned seq;
 
 	unsigned char eth_addr[ETH_ALEN];
-
-	/* Configured via OVS_TUNNEL_ATTR_* attributes. */
-	u32	flags;
 };
 
 struct tnl_ops {
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list