[ovs-dev] [PATCH 14/24] datapath: backport: ovs: use nla_put_u64_64bit()

Pravin B Shelar pshelar at ovn.org
Wed Jul 13 05:26:37 UTC 2016


Upstream commit:

    commit 0238b7204b7ff1bad1d2d4489f010d670cbd89f2
    Author: Nicolas Dichtel <nicolas.dichtel at 6wind.com>

    ovs: use nla_put_u64_64bit()

    Signed-off-by: Nicolas Dichtel <nicolas.dichtel at 6wind.com>
    Signed-off-by: David S. Miller <davem at davemloft.net>

Signed-off-by: Pravin B Shelar <pshelar at ovn.org>
---
 datapath/datapath.c                         | 3 ++-
 datapath/linux/compat/include/net/netlink.h | 7 +++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index bb6d33b..212adb6 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -781,7 +781,8 @@ static int ovs_flow_cmd_fill_stats(const struct sw_flow *flow,
 	ovs_flow_stats_get(flow, &stats, &used, &tcp_flags);
 
 	if (used &&
-	    nla_put_u64(skb, OVS_FLOW_ATTR_USED, ovs_flow_used_time(used)))
+	    nla_put_u64_64bit(skb, OVS_FLOW_ATTR_USED, ovs_flow_used_time(used),
+			      OVS_FLOW_ATTR_PAD))
 		return -EMSGSIZE;
 
 	if (stats.n_packets &&
diff --git a/datapath/linux/compat/include/net/netlink.h b/datapath/linux/compat/include/net/netlink.h
index 59826ba..07bd873 100644
--- a/datapath/linux/compat/include/net/netlink.h
+++ b/datapath/linux/compat/include/net/netlink.h
@@ -142,5 +142,12 @@ void rpl___nla_put_64bit(struct sk_buff *skb, int attrtype, int attrlen,
 #define __nla_reserve_64bit rpl___nla_reserve_64bit
 struct nlattr *rpl___nla_reserve_64bit(struct sk_buff *skb, int attrtype,
 				   int attrlen, int padattr);
+
+static inline int nla_put_u64_64bit(struct sk_buff *skb, int attrtype,
+                                    u64 value, int padattr)
+{
+        return nla_put_64bit(skb, attrtype, sizeof(u64), &value, padattr);
+}
+
 #endif
 #endif /* net/netlink.h */
-- 
1.9.1




More information about the dev mailing list