diff mbox

[ovs-dev] flow: fix compilation of MINIFLOW_ASSERT

Message ID 1452488425-26453-1-git-send-email-simon.horman@netronome.com
State Accepted
Headers show

Commit Message

Simon Horman Jan. 11, 2016, 5 a.m. UTC
Often MINIFLOW_ASSERT is a no-op and compilation of code that uses
it is optimised out. This patch fixes compilation errors that occur
when that is not the case:

* FLOWMAP_MAX does not exist. Use MAP_MAP instead.
* FLOWMAP_IS_SET does not exist. Use flowmap_is_set instead.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
---
 lib/flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ben Pfaff Jan. 11, 2016, 11:29 p.m. UTC | #1
On Mon, Jan 11, 2016 at 02:00:25PM +0900, Simon Horman wrote:
> Often MINIFLOW_ASSERT is a no-op and compilation of code that uses
> it is optimised out. This patch fixes compilation errors that occur
> when that is not the case:
> 
> * FLOWMAP_MAX does not exist. Use MAP_MAP instead.
> * FLOWMAP_IS_SET does not exist. Use flowmap_is_set instead.
> 
> Signed-off-by: Simon Horman <simon.horman@netronome.com>

Jarno, I guess you're the right person to review this?
Jarno Rajahalme Jan. 12, 2016, 2:03 a.m. UTC | #2
Simon,

Thanks for the fix.

Pushed to master,

  Jarno

> On Jan 10, 2016, at 9:00 PM, Simon Horman <simon.horman@netronome.com> wrote:
> 
> Often MINIFLOW_ASSERT is a no-op and compilation of code that uses
> it is optimised out. This patch fixes compilation errors that occur
> when that is not the case:
> 
> * FLOWMAP_MAX does not exist. Use MAP_MAP instead.
> * FLOWMAP_IS_SET does not exist. Use flowmap_is_set instead.
> 
> Signed-off-by: Simon Horman <simon.horman@netronome.com>
> ---
> lib/flow.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/flow.c b/lib/flow.c
> index 0ea272400164..51ee04221068 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -136,7 +136,7 @@ BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
> #define ASSERT_FLOWMAP_NOT_SET(FM, IDX)                                 \
> {                                                                       \
>     MINIFLOW_ASSERT(!((FM)->bits[(IDX) / MAP_T_BITS] &                  \
> -                      (FLOWMAP_MAX << ((IDX) % MAP_T_BITS))));          \
> +                      (MAP_MAX << ((IDX) % MAP_T_BITS))));          \
>     for (size_t i = (IDX) / MAP_T_BITS + 1; i < FLOWMAP_UNITS; i++) {   \
>         MINIFLOW_ASSERT(!(FM)->bits[i]);                                \
>     }                                                                   \
> @@ -149,7 +149,7 @@ BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
> }
> 
> #define miniflow_assert_in_map(MF, OFS)             \
> -    MINIFLOW_ASSERT(FLOWMAP_IS_SET(MF.map, (OFS))); \
> +    MINIFLOW_ASSERT(flowmap_is_set(&MF.map, (OFS))); \
>     ASSERT_FLOWMAP_NOT_SET(&MF.map, (OFS) + 1)
> 
> #define miniflow_push_uint64_(MF, OFS, VALUE)              \
> -- 
> 2.7.0.rc3.207.g0ac5344
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/lib/flow.c b/lib/flow.c
index 0ea272400164..51ee04221068 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -136,7 +136,7 @@  BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
 #define ASSERT_FLOWMAP_NOT_SET(FM, IDX)                                 \
 {                                                                       \
     MINIFLOW_ASSERT(!((FM)->bits[(IDX) / MAP_T_BITS] &                  \
-                      (FLOWMAP_MAX << ((IDX) % MAP_T_BITS))));          \
+                      (MAP_MAX << ((IDX) % MAP_T_BITS))));          \
     for (size_t i = (IDX) / MAP_T_BITS + 1; i < FLOWMAP_UNITS; i++) {   \
         MINIFLOW_ASSERT(!(FM)->bits[i]);                                \
     }                                                                   \
@@ -149,7 +149,7 @@  BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
 }
 
 #define miniflow_assert_in_map(MF, OFS)             \
-    MINIFLOW_ASSERT(FLOWMAP_IS_SET(MF.map, (OFS))); \
+    MINIFLOW_ASSERT(flowmap_is_set(&MF.map, (OFS))); \
     ASSERT_FLOWMAP_NOT_SET(&MF.map, (OFS) + 1)
 
 #define miniflow_push_uint64_(MF, OFS, VALUE)              \