[ovs-dev] [PATCH upstream] openvswitch: Reduce Netlink attribute mask to u32.

Jesse Gross jesse at nicira.com
Thu Nov 17 22:51:51 UTC 2011


In the OVS tree, the Netlink attributes for flow key types spans
64-bits but in the upstream version it only needs 32-bits so this
reduces it.

Signed-off-by: Jesse Gross <jesse at nicira.com>
---
 net/openvswitch/flow.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index 5893198..bab1336 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -871,7 +871,7 @@ const int ovs_key_lens[OVS_KEY_ATTR_MAX + 1] = {
 };
 
 static int ipv4_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_len,
-				  const struct nlattr *a[], u64 *attrs)
+				  const struct nlattr *a[], u32 *attrs)
 {
 	const struct ovs_key_icmp *icmp_key;
 	const struct ovs_key_tcp *tcp_key;
@@ -916,7 +916,7 @@ static int ipv4_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_len,
 }
 
 static int ipv6_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_len,
-				  const struct nlattr *a[], u64 *attrs)
+				  const struct nlattr *a[], u32 *attrs)
 {
 	const struct ovs_key_icmpv6 *icmpv6_key;
 	const struct ovs_key_tcp *tcp_key;
@@ -977,10 +977,10 @@ static int ipv6_flow_from_nlattrs(struct sw_flow_key *swkey, int *key_len,
 }
 
 static int parse_flow_nlattrs(const struct nlattr *attr,
-			      const struct nlattr *a[], u64 *attrsp)
+			      const struct nlattr *a[], u32 *attrsp)
 {
 	const struct nlattr *nla;
-	u64 attrs;
+	u32 attrs;
 	int rem;
 
 	attrs = 0;
@@ -988,14 +988,14 @@ static int parse_flow_nlattrs(const struct nlattr *attr,
 		u16 type = nla_type(nla);
 		int expected_len;
 
-		if (type > OVS_KEY_ATTR_MAX || attrs & (1ULL << type))
+		if (type > OVS_KEY_ATTR_MAX || attrs & (1 << type))
 			return -EINVAL;
 
 		expected_len = ovs_key_lens[type];
 		if (nla_len(nla) != expected_len && expected_len != -1)
 			return -EINVAL;
 
-		attrs |= 1ULL << type;
+		attrs |= 1 << type;
 		a[type] = nla;
 	}
 	if (rem)
@@ -1018,7 +1018,7 @@ int flow_from_nlattrs(struct sw_flow_key *swkey, int *key_lenp,
 	const struct nlattr *a[OVS_KEY_ATTR_MAX + 1];
 	const struct ovs_key_ethernet *eth_key;
 	int key_len;
-	u64 attrs;
+	u32 attrs;
 	int err;
 
 	memset(swkey, 0, sizeof(struct sw_flow_key));
-- 
1.7.5.4




More information about the dev mailing list