The lflow_table_add_lflow() function takes 13 arguments. Many helper
macros exist to facilitate filling in those 13 arguments without having
to spell them all out every time. Unfortunately, the amount of different
macros has gotten a bit out of hand. Some macros, like
ovn_lflow_add_with_hint__() have misleading names. Some macros, like
ovn_lflow_add_drop_with_lport_hint_and_desc() have horribly unwieldy
names. Trying to add a new macro to the list is a minefield since you
need to cherry-pick exactly which arguments the new macro should require
and which ones the macro should fill in automatically.

This series seeks to simplify things by getting rid of all helper macros
except for:
* ovn_lflow_add()
* ovn_lflow_add_with_dp_group()
* ovn_lflow_add_default_drop()

We accomplish this by using variadic macros. A base set of required
arguments is used with each macro. Helper macros can then be used to
add additional arguments beyond the base. This allows for flexible
use of additional arguments without the need to define a bunch of
different macros for every possible case.

Differences between v3 and v4 of this series:
* The lflow refactor has been committed to main, so this is rebased on
  top of those changes. This mainly affects patch 1.
* Patch 6 of this series is quite different now. Instead of adding a
  WITH_DP_GROUP() helper macro, we now retain the
  ovn_lflow_add_with_dp_group() macro, but redefine it. This is because
  passing a NULL ovn_datapath to ovn_lflow_add() does not work properly.
  This is because ovn_lflow_add() dereferences the OD argument, and if
  that argument is NULL, then that results in a compiler error. I
  decided that the best way to handle this was to keep the
  ovn_lflow_add_with_dp_group() macro, since that ensures that passing
  a single ovn_datapath and passing a datapath bitmap are mutually
  exclusive operations. We still maintain a safety check in 
  lflow_table_add_lflow() to ensure that we pass valid arguments to
  lflow_table_add_lflow__().

Mark Michelson (9):
  lflow-mgr: Use struct argument for lflow addition.
  lflows: Create new ovn_lflow_add_default_drop().
  lflows: Remove ovn_lflow_add_with_hint().
  lflows: Remove ovn_lflow_add_with_lport_and_hint().
  lflows: Remove ovn_lflow_metered() and ovn_lflow_add_with_hint__().
  lflows: Redefine ovn_lflow_add_with_dp_group().
  lflows: Remove ovn_lflow_add_drop_with_desc().
  lflows: Remove ovn_lflow_add_drop_with_lport_hint_and_desc().
  lflows: Make non-struct version of lflow_table_add_lflow() private.

 northd/lflow-mgr.c |   51 +-
 northd/lflow-mgr.h |  137 ++--
 northd/northd.c    | 1571 ++++++++++++++++++++------------------------
 3 files changed, 786 insertions(+), 973 deletions(-)

-- 
2.51.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to