[ovs-dev] [PATCH 2/2] ovs-dpctl: Add mega flow support

Ben Pfaff blp at nicira.com
Thu Jun 20 17:34:26 UTC 2013


On Tue, Jun 18, 2013 at 04:15:10PM -0700, Andy Zhou wrote:
> Added support to allow mega flow specified and displayed. ovs-dpctl tool
> is mainly used as debugging tool.
> 
> This patch also implements the low level user space routines to send
> and receive mega flow netlink messages. Those netlink suppor
> routines are required for forthcoming user space mega flow patches.
> 
> Added a unit test to test parsing and display of mega flows.
> 
> Ethan contributed the ovs-dpctl mega flow output function.
> 
> Co-authored-by: Ethan Jackson <ethan at nicira.com>
> Signed-off-by: Ethan Jackson <ethan at nicira.com>
> Signed-off-by: Andy Zhou <azhou at nicira.com>
> 
> ---
> v1->v2
>      Integrated Ethan's patch on ovs-dpctl mega flow output.
>      Add Ethan as a co-author for this patch.
> 
> v2->v3
>      Rebase to head to make review easier.
>      ovs-dpctl: Add mask input for tunnel configurations.
> 
> v3->v4
>      fix a typo
> 
> v4->v5
>      Add ovs-dpctl unit test cases for parsing mega flow.
>      Address Ben's review feedback.
> 
> v5->v6
>      Changes for ethtype
>      Address Ben's 2nd review feedback.

I applied this to master.  I couldn't resist making a few minor
changes before I did:

diff --git a/lib/dpif-provider.h b/lib/dpif-provider.h
index 84b5702..666c224 100644
--- a/lib/dpif-provider.h
+++ b/lib/dpif-provider.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -279,15 +279,22 @@ struct dpif_class {
      * called again once it returns nonzero within a given iteration (but the
      * 'flow_dump_done' function will be called afterward).
      *
-     * On success, if 'key' and 'key_len' are nonnull then '*key' and
-     * '*key_len' must be set to Netlink attributes with types OVS_KEY_ATTR_*
-     * representing the dumped flow's key; if 'mask' and 'mask_len' are
-     * nonnull then '*mask' and '*mask_len' must be set to Netlink attributes
-     * with types of OVS_KEY_ATTR_* representing the dumped flow's mask.
-     * If 'actions' and 'actions_len' are nonnull then they should be set to
-     * Netlink attributes with types OVS_ACTION_ATTR_* representing the dumped
-     * flow's actions.  If 'stats' is nonnull then it should be set to the
-     * dumped flow's statistics.
+     * On success:
+     *
+     *     - If 'key' and 'key_len' are nonnull, then '*key' and '*key_len'
+     *       must be set to Netlink attributes with types OVS_KEY_ATTR_*
+     *       representing the dumped flow's key.
+     *
+     *     - If 'mask' and 'mask_len' are nonnull then '*mask' and '*mask_len'
+     *       must be set to Netlink attributes with types of OVS_KEY_ATTR_*
+     *       representing the dumped flow's mask.
+     *
+     *     - If 'actions' and 'actions_len' are nonnull then they should be set
+     *       to Netlink attributes with types OVS_ACTION_ATTR_* representing
+     *       the dumped flow's actions.
+     *
+     *     - If 'stats' is nonnull then it should be set to the dumped flow's
+     *       statistics.
      *
      * All of the returned data is owned by 'dpif', not by the caller, and the
      * caller must not modify or free it.  'dpif' must guarantee that it
diff --git a/lib/packets.h b/lib/packets.h
index 543a481..cc9ab3d 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc.
+ * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -278,11 +278,11 @@ vlan_tci_to_pcp(ovs_be16 vlan_tci)
 }
 
 /* Given the vlan_tci field from an 802.1Q header, in network byte order,
- * returns the Canonical Format Indicator (CFI) in host byte order. */
+ * returns the Canonical Format Indicator (CFI). */
 static inline int
 vlan_tci_to_cfi(ovs_be16 vlan_tci)
 {
-    return (ntohs(vlan_tci) & VLAN_CFI) >> VLAN_CFI_SHIFT;
+    return (vlan_tci & htons(VLAN_CFI)) != 0;
 }
 
 #define VLAN_HEADER_LEN 4

Thanks!

Ben



More information about the dev mailing list