This creates an alternative to lflow_table_add_lflow(). This alternative, lflow_table_add_lflow_(), takes its arguments in a structure, rather than as individual function parameters.
This provides the basis for redefining the many ovn_lflow_add() macro variations. In this commit, we define ovn_lflow_add() as taking seven mandatory parameters, plus some variadic number of additional parameters. We do not touch northd.c in this commit, but this implicitly converts all pre-existing calls to ovn_lflow_add() to the new version which uses the struct argument. Upcoming commits will convert the other ovn_lflow_add()-related macros to use ovn_lflow_add(), where the __VA_ARGS__ will help to fill in additional structure elements.. Signed-off-by: Mark Michelson <[email protected]> --- northd/lflow-mgr.c | 14 ++++++-------- northd/lflow-mgr.h | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c index 17d1394d8..9ce267158 100644 --- a/northd/lflow-mgr.c +++ b/northd/lflow-mgr.c @@ -794,15 +794,13 @@ lflow_table_add_lflow(struct lflow_table *lflow_table, } void -lflow_table_add_lflow_default_drop(struct lflow_table *lflow_table, - const struct ovn_synced_datapath *sdp, - const struct ovn_stage *stage, - const char *where, - struct lflow_ref *lflow_ref) +lflow_table_add_lflow__(struct lflow_table_add_args *args) { - lflow_table_add_lflow(lflow_table, sdp, NULL, 0, stage, 0, "1", - debug_drop_action(), NULL, NULL, NULL, - where, NULL, lflow_ref); + lflow_table_add_lflow(args->table, args->sdp, args->dp_bitmap, + args->dp_bitmap_len, args->stage, args->priority, + args->match, args->actions, args->io_port, + args->ctrl_meter, args->stage_hint, args->where, + args->flow_desc, args->lflow_ref); } struct ovn_dp_group * diff --git a/northd/lflow-mgr.h b/northd/lflow-mgr.h index 53ee3c31f..f73fa410e 100644 --- a/northd/lflow-mgr.h +++ b/northd/lflow-mgr.h @@ -72,6 +72,24 @@ bool lflow_ref_sync_lflows(struct lflow_ref *, const struct sbrec_logical_flow_table *, const struct sbrec_logical_dp_group_table *); +struct lflow_table_add_args { + struct lflow_table *table; + const struct ovn_synced_datapath *sdp; + const unsigned long *dp_bitmap; + size_t dp_bitmap_len; + const struct ovn_stage *stage; + uint16_t priority; + const char *match; + const char *actions; + const char *io_port; + const char *ctrl_meter; + const struct ovsdb_idl_row *stage_hint; + const char *flow_desc; + struct lflow_ref *lflow_ref; + const char *where; +}; + +void lflow_table_add_lflow__(struct lflow_table_add_args *args); void lflow_table_add_lflow(struct lflow_table *, const struct ovn_synced_datapath *, @@ -134,10 +152,20 @@ void lflow_table_add_lflow_default_drop(struct lflow_table *, OVS_SOURCE_LOCATOR, NULL, LFLOW_REF) #define ovn_lflow_add(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, ACTIONS, \ - LFLOW_REF) \ - lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY, \ - MATCH, ACTIONS, NULL, NULL, NULL, \ - OVS_SOURCE_LOCATOR, NULL, LFLOW_REF) + LFLOW_REF, ...) \ + lflow_table_add_lflow__( \ + &(struct lflow_table_add_args) { \ + .table = LFLOW_TABLE, \ + .sdp = (OD)->sdp, \ + .stage = STAGE, \ + .priority = PRIORITY, \ + .match = MATCH, \ + .actions = ACTIONS, \ + .lflow_ref = LFLOW_REF, \ + .where = OVS_SOURCE_LOCATOR, \ + __VA_ARGS__ \ + } \ + ) #define ovn_lflow_add_drop_with_desc(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, \ DESCRIPTION, LFLOW_REF) \ -- 2.51.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
