datapath-windows: Upcall NL packet format: Add NL utilities
authorEitan Eliahu <eliahue@vmware.com>
Wed, 15 Oct 2014 09:11:40 +0000 (02:11 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 15 Oct 2014 21:14:40 +0000 (14:14 -0700)
Add NlAttrSize and NlAttrTotalSize

Signed-off-by: Eitan Eliahu <eliahue@vmware.com>
Acked-by: Ankur Sharma <ankursharma@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/ovsext/Netlink/Netlink.h

index cd55647..438d857 100644 (file)
@@ -137,6 +137,28 @@ NlAttrLen(const PNL_ATTR nla)
     return nla->nlaLen;
 }
 
+/*
+ * ---------------------------------------------------------------------------
+ * Default maximum payload size for each type of attribute.
+ * ---------------------------------------------------------------------------
+ */
+UINT32
+static __inline NlAttrSize(UINT32 payloadSize)
+{
+    return NLA_HDRLEN + payloadSize;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ * Total length including padding.
+ * ---------------------------------------------------------------------------
+ */
+UINT32
+static __inline NlAttrTotalSize(UINT32 payloadSize)
+{
+    return NLA_ALIGN(NlAttrSize(payloadSize));
+}
+
 /* Netlink attribute validation */
 BOOLEAN NlAttrValidate(const PNL_ATTR, const PNL_POLICY);