[ovs-dev] [PATCH 4/5] datapath: Shorten flow tunneling flags.

Jesse Gross jesse at nicira.com
Wed Nov 7 00:50:19 UTC 2012


The names for the flags used by flow based tunneling are pretty long.
This shortens them a little by removing the word FLOW, which is a
distinction that won't be meaningful in the near future.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 datapath/flow.c             |   12 ++++++------
 datapath/tunnel.c           |    2 +-
 datapath/vport-capwap.c     |    6 +++---
 datapath/vport-gre.c        |   10 +++++-----
 include/linux/openvswitch.h |    6 +++---
 5 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/datapath/flow.c b/datapath/flow.c
index f33760a..fdfe3e9 100644
--- a/datapath/flow.c
+++ b/datapath/flow.c
@@ -1034,7 +1034,7 @@ int ovs_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
 
 		if (!tun_key->ipv4_dst)
 			return -EINVAL;
-		if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
+		if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
 			return -EINVAL;
 
 		tun_id = nla_get_be64(a[OVS_KEY_ATTR_TUN_ID]);
@@ -1223,23 +1223,23 @@ int ovs_flow_metadata_from_nlattrs(struct sw_flow *flow, int key_len, const stru
 				tun_id = nla_get_be64(nla);
 
 				if (tun_key->ipv4_dst) {
-					if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
+					if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
 						return -EINVAL;
 					if (tun_key->tun_id != tun_id)
 						return -EINVAL;
 					break;
 				}
 				tun_key->tun_id = tun_id;
-				tun_key->tun_flags |= OVS_FLOW_TNL_F_KEY;
+				tun_key->tun_flags |= OVS_TNL_F_KEY;
 
 				break;
 
 			case OVS_KEY_ATTR_IPV4_TUNNEL:
-				if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY) {
+				if (tun_key->tun_flags & OVS_TNL_F_KEY) {
 					tun_id = tun_key->tun_id;
 
 					memcpy(tun_key, nla_data(nla), sizeof(*tun_key));
-					if (!(tun_key->tun_flags & OVS_FLOW_TNL_F_KEY))
+					if (!(tun_key->tun_flags & OVS_TNL_F_KEY))
 						return -EINVAL;
 
 					if (tun_key->tun_id != tun_id)
@@ -1285,7 +1285,7 @@ int ovs_flow_to_nlattrs(const struct sw_flow_key *swkey, struct sk_buff *skb)
 		tun_key = nla_data(nla);
 		memcpy(tun_key, &swkey->phy.tun.tun_key, sizeof(*tun_key));
 	}
-	if ((swkey->phy.tun.tun_key.tun_flags & OVS_FLOW_TNL_F_KEY) &&
+	if ((swkey->phy.tun.tun_key.tun_flags & OVS_TNL_F_KEY) &&
 	    nla_put_be64(skb, OVS_KEY_ATTR_TUN_ID, swkey->phy.tun.tun_key.tun_id))
 		goto nla_put_failure;
 
diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index efc8b1c..fb4854a 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -636,7 +636,7 @@ static bool check_mtu(struct sk_buff *skb,
 	if (OVS_CB(skb)->tun_key->ipv4_dst) {
 		df_inherit = false;
 		pmtud = false;
-		frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_FLOW_TNL_F_DONT_FRAGMENT ?
+		frag_off = OVS_CB(skb)->tun_key->tun_flags & OVS_TNL_F_DONT_FRAGMENT ?
 				  htons(IP_DF) : 0;
 	} else {
 		df_inherit = mutable->flags & TNL_F_DF_INHERIT;
diff --git a/datapath/vport-capwap.c b/datapath/vport-capwap.c
index b4c3b49..f26d3ff 100644
--- a/datapath/vport-capwap.c
+++ b/datapath/vport-capwap.c
@@ -162,9 +162,9 @@ static void get_capwap_param(const struct tnl_mutable_config *mutable,
 	if (tun_key->ipv4_dst) {
 		*flags = 0;
 
-		if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY)
+		if (tun_key->tun_flags & OVS_TNL_F_KEY)
 			*flags = TNL_F_OUT_KEY_ACTION;
-		if (tun_key->tun_flags & OVS_FLOW_TNL_F_CSUM)
+		if (tun_key->tun_flags & OVS_TNL_F_CSUM)
 			*flags |= TNL_F_CSUM;
 		*out_key = tun_key->tun_id;
 	} else {
@@ -359,7 +359,7 @@ static int capwap_rcv(struct sock *sk, struct sk_buff *skb)
 			 !(mutable->flags & TNL_F_IN_KEY_MATCH))
 		key_present = false;
 
-	tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_FLOW_TNL_F_KEY : 0);
+	tnl_tun_key_init(&tun_key, iph, key, key_present ? OVS_TNL_F_KEY : 0);
 	OVS_CB(skb)->tun_key = &tun_key;
 
 	ovs_tnl_rcv(vport, skb);
diff --git a/datapath/vport-gre.c b/datapath/vport-gre.c
index d378ccb..45e38b0 100644
--- a/datapath/vport-gre.c
+++ b/datapath/vport-gre.c
@@ -52,9 +52,9 @@ static void get_gre_param(const struct tnl_mutable_config *mutable,
 	if (tun_key->ipv4_dst) {
 		*flags = 0;
 
-		if (tun_key->tun_flags & OVS_FLOW_TNL_F_KEY)
+		if (tun_key->tun_flags & OVS_TNL_F_KEY)
 			*flags = TNL_F_OUT_KEY_ACTION;
-		if (tun_key->tun_flags & OVS_FLOW_TNL_F_CSUM)
+		if (tun_key->tun_flags & OVS_TNL_F_CSUM)
 			*flags |= TNL_F_CSUM;
 		*tunnel_type = TNL_T_PROTO_GRE;
 		*out_key = tun_key->tun_id;
@@ -384,13 +384,13 @@ static u32 gre_flags_to_tunnel_flags(const struct tnl_mutable_config *mutable,
 
 	if (gre_flags & GRE_KEY) {
 		if (mutable->key.daddr && (mutable->flags & TNL_F_IN_KEY_MATCH))
-			tunnel_flags = OVS_FLOW_TNL_F_KEY;
+			tunnel_flags = OVS_TNL_F_KEY;
 		else if (!mutable->key.daddr)
-			tunnel_flags = OVS_FLOW_TNL_F_KEY;
+			tunnel_flags = OVS_TNL_F_KEY;
 	}
 
 	if (gre_flags & GRE_CSUM)
-		tunnel_flags |= OVS_FLOW_TNL_F_CSUM;
+		tunnel_flags |= OVS_TNL_F_CSUM;
 
 	return tunnel_flags;
 }
diff --git a/include/linux/openvswitch.h b/include/linux/openvswitch.h
index e3e4191..c4823d9 100644
--- a/include/linux/openvswitch.h
+++ b/include/linux/openvswitch.h
@@ -364,9 +364,9 @@ struct ovs_key_nd {
 };
 
 /* Values for ovs_key_ipv4_tunnel->tun_flags */
-#define OVS_FLOW_TNL_F_DONT_FRAGMENT (1 << 0)
-#define OVS_FLOW_TNL_F_CSUM (1 << 1)
-#define OVS_FLOW_TNL_F_KEY (1 << 2)
+#define OVS_TNL_F_DONT_FRAGMENT (1 << 0)
+#define OVS_TNL_F_CSUM (1 << 1)
+#define OVS_TNL_F_KEY (1 << 2)
 
 struct ovs_key_ipv4_tunnel {
 	__be64 tun_id;
-- 
1.7.9.5




More information about the dev mailing list