With this change, only the struct argument version of lflow_table_add_lflow() may be called from outside lflow-mgr.c. Callers have the choice of constructing the struct themselves, or using the flexible ovn_lflow_add() macro.
Reported-at: https://issues.redhat.com/browse/FDP-779 Signed-off-by: Mark Michelson <[email protected]> --- northd/lflow-mgr.c | 33 +++++++++++++++++---------------- northd/lflow-mgr.h | 22 ++++++---------------- 2 files changed, 23 insertions(+), 32 deletions(-) diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c index dfa3c39e9..948ec542a 100644 --- a/northd/lflow-mgr.c +++ b/northd/lflow-mgr.c @@ -394,7 +394,8 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table, * * - For each logical flow L(M, A) generated for the entity 'E' * pass E->lflow_ref when adding L(M, A) to the lflow table. - * Eg. lflow_table_add_lflow(lflow_table, od_of_E, M, A, .., E->lflow_ref); + * Eg. lflow_table_add_lflow_(lflow_table, od_of_E, M, A, .., + * E->lflow_ref); * * If lflows L1, L2 and L3 are generated for 'E', then * E->lflow_ref stores these in its hmap. @@ -438,7 +439,7 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table, * 4. LRN(L1, E1)->linked is set to false when the client calls * lflow_ref_unlink_lflows(E1->lflow_ref). * 5. LRN(L1, E1)->linked is set to true again when the client calls - * lflow_table_add_lflow(L1, ..., E1->lflow_ref) and LRN(L1, E1) + * lflow_table_add_lflow_(L1, ..., E1->lflow_ref) and LRN(L1, E1) * is already present. * 6. LRN(L1, E1) is destroyed if LRN(L1, E1)->linked is false * when the client calls lflow_ref_sync_lflows(). @@ -492,8 +493,8 @@ lflow_table_sync_to_sb(struct lflow_table *lflow_table, * * 2. In step (2), client should generate the logical flows again for 'E1'. * Lets say it calls: - * lflow_table_add_lflow(lflow_table, L3, E1->lflow_ref) - * lflow_table_add_lflow(lflow_table, L5, E1->lflow_ref) + * lflow_table_add_lflow_(lflow_table, L3, E1->lflow_ref) + * lflow_table_add_lflow_(lflow_table, L5, E1->lflow_ref) * * So, E1 generates the flows L3 and L5 and discards L1 and L2. * @@ -700,16 +701,16 @@ lflow_ref_sync_lflows(struct lflow_ref *lflow_ref, * then it may corrupt the hmap. Caller should ensure thread safety * for such scenarios. */ -void -lflow_table_add_lflow(struct lflow_table *lflow_table, - const struct ovn_datapath *od, - const unsigned long *dp_bitmap, size_t dp_bitmap_len, - enum 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 *where, const char *flow_desc, - struct lflow_ref *lflow_ref) +static void +lflow_table_add_lflow_(struct lflow_table *lflow_table, + const struct ovn_datapath *od, + const unsigned long *dp_bitmap, size_t dp_bitmap_len, + enum 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 *where, const char *flow_desc, + struct lflow_ref *lflow_ref) OVS_EXCLUDED(fake_hash_mutex) { struct ovs_mutex *hash_lock; @@ -774,9 +775,9 @@ lflow_table_add_lflow(struct lflow_table *lflow_table, } void -lflow_table_add_lflow_(struct lflow_table_add_args args, const char *where) +lflow_table_add_lflow(struct lflow_table_add_args args, const char *where) { - lflow_table_add_lflow(args.table, args.od, args.dp_bitmap, + lflow_table_add_lflow_(args.table, args.od, args.dp_bitmap, args.dp_bitmap_len, args.stage, args.priority, args.match, args.actions, args.io_port, args.ctrl_meter, args.stage_hint, where, diff --git a/northd/lflow-mgr.h b/northd/lflow-mgr.h index e3c2739dd..1fad13ca6 100644 --- a/northd/lflow-mgr.h +++ b/northd/lflow-mgr.h @@ -92,18 +92,8 @@ struct lflow_table_add_args { struct lflow_ref *lflow_ref; }; -void lflow_table_add_lflow_(struct lflow_table_add_args args, - const char *where); - -void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *, - const unsigned long *dp_bitmap, - size_t dp_bitmap_len, enum 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 *where, const char *flow_desc, - struct lflow_ref *); +void lflow_table_add_lflow(struct lflow_table_add_args args, + const char *where); #define WITH_HINT(HINT) .stage_hint = HINT #define WITH_DP_GROUP(DP_BITMAP, DP_BITMAP_LEN) \ @@ -125,7 +115,7 @@ void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *, #define ovn_lflow_add_10(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, ACTIONS, \ LFLOW_REF, ARG8, ARG9, ARG10) \ - lflow_table_add_lflow_((struct lflow_table_add_args) { \ + lflow_table_add_lflow((struct lflow_table_add_args) { \ .table = LFLOW_TABLE, \ .od = OD, \ .stage = STAGE, \ @@ -140,7 +130,7 @@ void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *, #define ovn_lflow_add_9(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, ACTIONS, \ LFLOW_REF, ARG8, ARG9) \ - lflow_table_add_lflow_((struct lflow_table_add_args) { \ + lflow_table_add_lflow((struct lflow_table_add_args) { \ .table = LFLOW_TABLE, \ .od = OD, \ .stage = STAGE, \ @@ -154,7 +144,7 @@ void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *, #define ovn_lflow_add_8(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, ACTIONS, \ LFLOW_REF, ARG8) \ - lflow_table_add_lflow_((struct lflow_table_add_args) { \ + lflow_table_add_lflow((struct lflow_table_add_args) { \ .table = LFLOW_TABLE, \ .od = OD, \ .stage = STAGE, \ @@ -167,7 +157,7 @@ void lflow_table_add_lflow(struct lflow_table *, const struct ovn_datapath *, #define ovn_lflow_add_7(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, ACTIONS, \ LFLOW_REF) \ - lflow_table_add_lflow_((struct lflow_table_add_args) { \ + lflow_table_add_lflow((struct lflow_table_add_args) { \ .table = LFLOW_TABLE, \ .od = OD, \ .stage = STAGE, \ -- 2.51.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
