On Thu, Jan 8, 2026 at 9:47 PM Mark Michelson via dev <
[email protected]> wrote:

> This changes lflow_table_add_lflow() to take an ovn_synced_datapath
> instead of ovn_datapath.
>
> Signed-off-by: Mark Michelson <[email protected]>
> ---
>  northd/lflow-mgr.c | 35 +++++++++++++++++++----------------
>  northd/lflow-mgr.h | 38 ++++++++++++++++++++------------------
>  2 files changed, 39 insertions(+), 34 deletions(-)
>
> diff --git a/northd/lflow-mgr.c b/northd/lflow-mgr.c
> index 36f903ce3..3360ad6ed 100644
> --- a/northd/lflow-mgr.c
> +++ b/northd/lflow-mgr.c
> @@ -76,10 +76,11 @@ static void ovn_dp_group_use(struct ovn_dp_group *);
>  static void ovn_dp_group_release(struct hmap *dp_groups,
>                                   struct ovn_dp_group *);
>  static void ovn_dp_group_destroy(struct ovn_dp_group *dpg);
> -static void ovn_dp_group_add_with_reference(struct ovn_lflow *,
> -                                            const struct ovn_datapath *od,
> -                                            const unsigned long
> *dp_bitmap,
> -                                            size_t bitmap_len);
> +static void ovn_dp_group_add_with_reference(
> +    struct ovn_lflow *,
> +    const struct ovn_synced_datapath *sdp,
> +    const unsigned long *dp_bitmap,
> +    size_t bitmap_len);
>
>  static bool lflow_ref_sync_lflows__(
>      struct lflow_ref  *, struct lflow_table *,
> @@ -737,7 +738,7 @@ lflow_ref_sync_lflows(struct lflow_ref *lflow_ref,
>   */
>  void
>  lflow_table_add_lflow(struct lflow_table *lflow_table,
> -                      const struct ovn_datapath *od,
> +                      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,
> @@ -750,8 +751,9 @@ lflow_table_add_lflow(struct lflow_table *lflow_table,
>      struct ovs_mutex *hash_lock;
>      uint32_t hash;
>
> -    ovs_assert(!od ||
> -               ovn_stage_to_datapath_type(stage) ==
> ovn_datapath_get_type(od));
> +    ovs_assert(!sdp ||
> +        ovn_stage_to_datapath_type(stage) ==
> +        ovn_datapath_type_from_string(datapath_get_nb_type(sdp->sb_dp)));
>
>      hash = ovn_logical_flow_hash(ovn_stage_get_table(stage),
>                                   ovn_stage_get_pipeline(stage),
> @@ -761,7 +763,8 @@ lflow_table_add_lflow(struct lflow_table *lflow_table,
>      hash_lock = lflow_hash_lock(&lflow_table->entries, hash);
>      struct ovn_lflow *lflow =
>          do_ovn_lflow_add(lflow_table,
> -                         od ? ods_size(od->datapaths) : dp_bitmap_len,
> +                         sdp ? sparse_array_len(&sdp->dps->dps_array)
> +                             : dp_bitmap_len,
>                           hash, stage, priority, match, actions,
>                           io_port, ctrl_meter, stage_hint, where,
> flow_desc);
>
> @@ -772,12 +775,12 @@ lflow_table_add_lflow(struct lflow_table
> *lflow_table,
>              lrn = xzalloc(sizeof *lrn);
>              lrn->lflow = lflow;
>              lrn->lflow_ref = lflow_ref;
> -            lrn->dpgrp_lflow = !od;
> +            lrn->dpgrp_lflow = !sdp;
>              if (lrn->dpgrp_lflow) {
>                  lrn->dpgrp_bitmap = bitmap_clone(dp_bitmap,
> dp_bitmap_len);
>                  lrn->dpgrp_bitmap_len = dp_bitmap_len;
>              } else {
> -                lrn->dp_index = od->sdp->index;
> +                lrn->dp_index = sdp->index;
>              }
>              ovs_list_insert(&lflow->referenced_by, &lrn->ref_list_node);
>              hmap_insert(&lflow_ref->lflow_ref_nodes, &lrn->ref_node,
> hash);
> @@ -803,19 +806,19 @@ lflow_table_add_lflow(struct lflow_table
> *lflow_table,
>          lrn->linked = true;
>      }
>
> -    ovn_dp_group_add_with_reference(lflow, od, dp_bitmap, dp_bitmap_len);
> +    ovn_dp_group_add_with_reference(lflow, sdp, dp_bitmap, dp_bitmap_len);
>
>      lflow_hash_unlock(hash_lock);
>  }
>
>  void
>  lflow_table_add_lflow_default_drop(struct lflow_table *lflow_table,
> -                                   const struct ovn_datapath *od,
> +                                   const struct ovn_synced_datapath *sdp,
>                                     const struct ovn_stage *stage,
>                                     const char *where,
>                                     struct lflow_ref *lflow_ref)
>  {
> -    lflow_table_add_lflow(lflow_table, od, NULL, 0, stage, 0, "1",
> +    lflow_table_add_lflow(lflow_table, sdp, NULL, 0, stage, 0, "1",
>                            debug_drop_action(), NULL, NULL, NULL,
>                            where, NULL, lflow_ref);
>  }
> @@ -1329,13 +1332,13 @@ ovn_sb_insert_or_update_logical_dp_group(
>   * hash lock is already taken. */
>  static void
>  ovn_dp_group_add_with_reference(struct ovn_lflow *lflow_ref,
> -                                const struct ovn_datapath *od,
> +                                const struct ovn_synced_datapath *sdp,
>                                  const unsigned long *dp_bitmap,
>                                  size_t bitmap_len)
>      OVS_REQUIRES(fake_hash_mutex)
>  {
> -    if (od) {
> -        dynamic_bitmap_set1(&lflow_ref->dpg_bitmap, od->sdp->index);
> +    if (sdp) {
> +        dynamic_bitmap_set1(&lflow_ref->dpg_bitmap, sdp->index);
>      }
>      if (dp_bitmap) {
>          dynamic_bitmap_or(&lflow_ref->dpg_bitmap, dp_bitmap, bitmap_len);
> diff --git a/northd/lflow-mgr.h b/northd/lflow-mgr.h
> index cbd9f9e03..9d9904c1e 100644
> --- a/northd/lflow-mgr.h
> +++ b/northd/lflow-mgr.h
> @@ -76,7 +76,8 @@ bool lflow_ref_sync_lflows(struct lflow_ref *,
>                             const struct sbrec_logical_dp_group_table *);
>
>
> -void lflow_table_add_lflow(struct lflow_table *, const struct
> ovn_datapath *,
> +void lflow_table_add_lflow(struct lflow_table *,
> +                           const struct ovn_synced_datapath *,
>                             const unsigned long *dp_bitmap,
>                             size_t dp_bitmap_len, const struct ovn_stage
> *stage,
>                             uint16_t priority, const char *match,
> @@ -86,7 +87,7 @@ void lflow_table_add_lflow(struct lflow_table *, const
> struct ovn_datapath *,
>                             const char *where, const char *flow_desc,
>                             struct lflow_ref *);
>  void lflow_table_add_lflow_default_drop(struct lflow_table *,
> -                                        const struct ovn_datapath *,
> +                                        const struct ovn_synced_datapath
> *,
>                                          const struct ovn_stage *stage,
>                                          const char *where,
>                                          struct lflow_ref *);
> @@ -95,14 +96,14 @@ void lflow_table_add_lflow_default_drop(struct
> lflow_table *,
>  #define ovn_lflow_add_with_hint__(LFLOW_TABLE, OD, STAGE, PRIORITY,
> MATCH, \
>                                    ACTIONS, IN_OUT_PORT, CTRL_METER, \
>                                    STAGE_HINT, LFLOW_REF) \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          ACTIONS, IN_OUT_PORT, CTRL_METER, STAGE_HINT, \
> -                          OVS_SOURCE_LOCATOR, NULL, LFLOW_REF)
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY,
> \
> +                          MATCH, ACTIONS, IN_OUT_PORT, CTRL_METER, \
> +                          STAGE_HINT, OVS_SOURCE_LOCATOR, NULL, LFLOW_REF)
>
>  #define ovn_lflow_add_with_hint(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH, \
>                                  ACTIONS, STAGE_HINT, LFLOW_REF) \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          ACTIONS, NULL, NULL, STAGE_HINT,  \
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY,
> \
> +                          MATCH, ACTIONS, NULL, NULL, STAGE_HINT,  \
>                            OVS_SOURCE_LOCATOR, NULL, LFLOW_REF)
>
>  #define ovn_lflow_add_with_dp_group(LFLOW_TABLE, DP_BITMAP,
> DP_BITMAP_LEN, \
> @@ -113,7 +114,7 @@ void lflow_table_add_lflow_default_drop(struct
> lflow_table *,
>                            OVS_SOURCE_LOCATOR, NULL, LFLOW_REF)
>
>  #define ovn_lflow_add_default_drop(LFLOW_TABLE, OD, STAGE, LFLOW_REF)   \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, 0, "1", \
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, 0, "1", \
>                            debug_drop_action(), NULL, NULL, NULL,  \
>                            OVS_SOURCE_LOCATOR, NULL, LFLOW_REF)
>
> @@ -131,29 +132,30 @@ void lflow_table_add_lflow_default_drop(struct
> lflow_table *,
>  #define ovn_lflow_add_with_lport_and_hint(LFLOW_TABLE, OD, STAGE,
> PRIORITY, \
>                                            MATCH, ACTIONS, IN_OUT_PORT, \
>                                            STAGE_HINT, LFLOW_REF) \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          ACTIONS, IN_OUT_PORT, NULL, STAGE_HINT, \
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY,
> \
> +                          MATCH, ACTIONS, IN_OUT_PORT, NULL, STAGE_HINT, \
>                            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, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          ACTIONS, NULL, NULL, NULL, OVS_SOURCE_LOCATOR, \
> -                          NULL, 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)
>
>  #define ovn_lflow_add_drop_with_desc(LFLOW_TABLE, OD, STAGE, PRIORITY,
> MATCH, \
>                                       DESCRIPTION, LFLOW_REF) \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          debug_drop_action(), NULL, NULL, NULL,  \
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY,
> \
> +                          MATCH, debug_drop_action(), NULL, NULL, NULL,  \
>                            OVS_SOURCE_LOCATOR, DESCRIPTION, LFLOW_REF)
>
>  #define ovn_lflow_add_drop_with_lport_hint_and_desc(LFLOW_TABLE, OD,
> STAGE, \
>                                                      PRIORITY, MATCH,  \
>                                                      IN_OUT_PORT,
> STAGE_HINT, \
>                                                      DESCRIPTION,
> LFLOW_REF) \
> -    lflow_table_add_lflow(LFLOW_TABLE, OD, NULL, 0, STAGE, PRIORITY,
> MATCH, \
> -                          debug_drop_action(), IN_OUT_PORT, NULL,
> STAGE_HINT, \
> -                          OVS_SOURCE_LOCATOR, DESCRIPTION, LFLOW_REF)
> +    lflow_table_add_lflow(LFLOW_TABLE, OD->sdp, NULL, 0, STAGE, PRIORITY,
> \
> +                          MATCH, debug_drop_action(), IN_OUT_PORT, NULL, \
> +                          STAGE_HINT, OVS_SOURCE_LOCATOR, DESCRIPTION, \
> +                          LFLOW_REF)
>
>  #define ovn_lflow_metered(LFLOW_TABLE, OD, STAGE, PRIORITY, MATCH,
> ACTIONS, \
>                            CTRL_METER, LFLOW_REF) \
> --
> 2.51.1
>
> _______________________________________________
> dev mailing list
> [email protected]
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks,
Acked-by: Ales Musil <[email protected]>
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to