[ovs-dev] [PATCH ovn] ovn-controller: Remove has_local_l3gateway from struct local_datapath.

Han Zhou hzhou at ovn.org
Mon Aug 2 19:09:06 UTC 2021


On Mon, Aug 2, 2021 at 11:45 AM Numan Siddique <numans at ovn.org> wrote:
>
> On Mon, Aug 2, 2021 at 1:57 PM Han Zhou <hzhou at ovn.org> wrote:
> >
> > Now this field is not really useful. Remove all the related code.
> >
> > Signed-off-by: Han Zhou <hzhou at ovn.org>
>
> Acked-by: Numan Siddique <numans at ovn.org>
>
> Thanks for removing this.  Can you please update the commit message on why
> it is not used anymore ? or what was the reason it was added earlier ?
For more
> clarity in case you can figure it out easily.
>
> I'm fine otherwise.
>

Thanks Numan. I updated the commit message with more details and applied.

> Thanks
> Numan
>
> > ---
> >  controller/binding.c        | 44 ++++++++++++-------------------------
> >  controller/ovn-controller.h |  4 ----
> >  controller/pinctrl.c        |  2 +-
> >  3 files changed, 15 insertions(+), 35 deletions(-)
> >
> > diff --git a/controller/binding.c b/controller/binding.c
> > index d50f3affa..0bf6091f9 100644
> > --- a/controller/binding.c
> > +++ b/controller/binding.c
> > @@ -91,16 +91,12 @@ add_local_datapath__(struct ovsdb_idl_index
*sbrec_datapath_binding_by_key,
> >                       struct ovsdb_idl_index
*sbrec_port_binding_by_datapath,
> >                       struct ovsdb_idl_index
*sbrec_port_binding_by_name,
> >                       const struct sbrec_datapath_binding *datapath,
> > -                     bool has_local_l3gateway, int depth,
> > -                     struct hmap *local_datapaths,
> > +                     int depth, struct hmap *local_datapaths,
> >                       struct hmap *tracked_datapaths)
> >  {
> >      uint32_t dp_key = datapath->tunnel_key;
> >      struct local_datapath *ld = get_local_datapath(local_datapaths,
dp_key);
> >      if (ld) {
> > -        if (has_local_l3gateway) {
> > -            ld->has_local_l3gateway = true;
> > -        }
> >          return;
> >      }
> >
> > @@ -109,7 +105,6 @@ add_local_datapath__(struct ovsdb_idl_index
*sbrec_datapath_binding_by_key,
> >      ld->datapath = datapath;
> >      ld->localnet_port = NULL;
> >      shash_init(&ld->external_ports);
> > -    ld->has_local_l3gateway = has_local_l3gateway;
> >
> >      if (tracked_datapaths) {
> >          struct tracked_binding_datapath *tdp =
> > @@ -158,7 +153,7 @@ add_local_datapath__(struct ovsdb_idl_index
*sbrec_datapath_binding_by_key,
> >
 add_local_datapath__(sbrec_datapath_binding_by_key,
> >
sbrec_port_binding_by_datapath,
> >
sbrec_port_binding_by_name,
> > -                                             peer->datapath, false,
> > +                                             peer->datapath,
> >                                               depth + 1,
local_datapaths,
> >                                               tracked_datapaths);
> >                      }
> > @@ -183,13 +178,13 @@ add_local_datapath(struct ovsdb_idl_index
*sbrec_datapath_binding_by_key,
> >                     struct ovsdb_idl_index
*sbrec_port_binding_by_datapath,
> >                     struct ovsdb_idl_index *sbrec_port_binding_by_name,
> >                     const struct sbrec_datapath_binding *datapath,
> > -                   bool has_local_l3gateway, struct hmap
*local_datapaths,
> > +                   struct hmap *local_datapaths,
> >                     struct hmap *tracked_datapaths)
> >  {
> >      add_local_datapath__(sbrec_datapath_binding_by_key,
> >                           sbrec_port_binding_by_datapath,
> >                           sbrec_port_binding_by_name,
> > -                         datapath, has_local_l3gateway, 0,
local_datapaths,
> > +                         datapath, 0, local_datapaths,
> >                           tracked_datapaths);
> >  }
> >
> > @@ -1267,7 +1262,7 @@ consider_vif_lport_(const struct
sbrec_port_binding *pb,
> >              add_local_datapath(b_ctx_in->sbrec_datapath_binding_by_key,
> >
b_ctx_in->sbrec_port_binding_by_datapath,
> >                                 b_ctx_in->sbrec_port_binding_by_name,
> > -                               pb->datapath, false,
> > +                               pb->datapath,
> >                                 b_ctx_out->local_datapaths,
> >                                 b_ctx_out->tracked_dp_bindings);
> >              update_related_lport(pb, b_ctx_out);
> > @@ -1473,7 +1468,6 @@ consider_virtual_lport(const struct
sbrec_port_binding *pb,
> >  static bool
> >  consider_nonvif_lport_(const struct sbrec_port_binding *pb,
> >                         bool our_chassis,
> > -                       bool has_local_l3gateway,
> >                         struct binding_ctx_in *b_ctx_in,
> >                         struct binding_ctx_out *b_ctx_out)
> >  {
> > @@ -1482,7 +1476,7 @@ consider_nonvif_lport_(const struct
sbrec_port_binding *pb,
> >          add_local_datapath(b_ctx_in->sbrec_datapath_binding_by_key,
> >                             b_ctx_in->sbrec_port_binding_by_datapath,
> >                             b_ctx_in->sbrec_port_binding_by_name,
> > -                           pb->datapath, has_local_l3gateway,
> > +                           pb->datapath,
> >                             b_ctx_out->local_datapaths,
> >                             b_ctx_out->tracked_dp_bindings);
> >
> > @@ -1509,7 +1503,7 @@ consider_l2gw_lport(const struct
sbrec_port_binding *pb,
> >      bool our_chassis = chassis_id && !strcmp(chassis_id,
> >
b_ctx_in->chassis_rec->name);
> >
> > -    return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in,
b_ctx_out);
> > +    return consider_nonvif_lport_(pb, our_chassis, b_ctx_in,
b_ctx_out);
> >  }
> >
> >  static bool
> > @@ -1521,7 +1515,7 @@ consider_l3gw_lport(const struct
sbrec_port_binding *pb,
> >      bool our_chassis = chassis_id && !strcmp(chassis_id,
> >
b_ctx_in->chassis_rec->name);
> >
> > -    return consider_nonvif_lport_(pb, our_chassis, true, b_ctx_in,
b_ctx_out);
> > +    return consider_nonvif_lport_(pb, our_chassis, b_ctx_in,
b_ctx_out);
> >  }
> >
> >  static void
> > @@ -1565,13 +1559,13 @@ consider_ha_lport(const struct
sbrec_port_binding *pb,
> >          add_local_datapath(b_ctx_in->sbrec_datapath_binding_by_key,
> >                             b_ctx_in->sbrec_port_binding_by_datapath,
> >                             b_ctx_in->sbrec_port_binding_by_name,
> > -                           pb->datapath, false,
> > +                           pb->datapath,
> >                             b_ctx_out->local_datapaths,
> >                             b_ctx_out->tracked_dp_bindings);
> >          update_related_lport(pb, b_ctx_out);
> >      }
> >
> > -    return consider_nonvif_lport_(pb, our_chassis, false, b_ctx_in,
b_ctx_out);
> > +    return consider_nonvif_lport_(pb, our_chassis, b_ctx_in,
b_ctx_out);
> >  }
> >
> >  static bool
> > @@ -1907,7 +1901,7 @@ add_local_datapath_peer_port(const struct
sbrec_port_binding *pb,
> >          add_local_datapath__(b_ctx_in->sbrec_datapath_binding_by_key,
> >                               b_ctx_in->sbrec_port_binding_by_datapath,
> >                               b_ctx_in->sbrec_port_binding_by_name,
> > -                             peer->datapath, false,
> > +                             peer->datapath,
> >                               1, b_ctx_out->local_datapaths,
> >                               b_ctx_out->tracked_dp_bindings);
> >          return;
> > @@ -1967,7 +1961,6 @@ remove_local_datapath_peer_port(const struct
sbrec_port_binding *pb,
> >
> >  static void
> >  remove_pb_from_local_datapath(const struct sbrec_port_binding *pb,
> > -                              const struct sbrec_chassis *chassis_rec,
> >                                struct binding_ctx_out *b_ctx_out,
> >                                struct local_datapath *ld)
> >  {
> > @@ -1983,14 +1976,6 @@ remove_pb_from_local_datapath(const struct
sbrec_port_binding *pb,
> >      } else if (!strcmp(pb->type, "external")) {
> >          shash_find_and_delete(&ld->external_ports, pb->logical_port);
> >      }
> > -
> > -    if (!strcmp(pb->type, "l3gateway")) {
> > -        const char *chassis_id = smap_get(&pb->options,
> > -                                          "l3gateway-chassis");
> > -        if (chassis_id && !strcmp(chassis_id, chassis_rec->name)) {
> > -            ld->has_local_l3gateway = false;
> > -        }
> > -    }
> >  }
> >
> >  static void
> > @@ -2100,7 +2085,6 @@ consider_iface_release(const struct
ovsrec_interface *iface_rec,
> >                                 b_lport->pb->datapath->tunnel_key);
> >          if (ld) {
> >              remove_pb_from_local_datapath(b_lport->pb,
> > -                                          b_ctx_in->chassis_rec,
> >                                            b_ctx_out, ld);
> >          }
> >
> > @@ -2307,7 +2291,7 @@ handle_deleted_lport(const struct
sbrec_port_binding *pb,
> >          get_local_datapath(b_ctx_out->local_datapaths,
> >                             pb->datapath->tunnel_key);
> >      if (ld) {
> > -        remove_pb_from_local_datapath(pb, b_ctx_in->chassis_rec,
> > +        remove_pb_from_local_datapath(pb,
> >                                        b_ctx_out, ld);
> >          return;
> >      }
> > @@ -2320,7 +2304,7 @@ handle_deleted_lport(const struct
sbrec_port_binding *pb,
> >          ld = get_local_datapath(b_ctx_out->local_datapaths,
> >                                  pb->datapath->tunnel_key);
> >          if (ld) {
> > -            remove_pb_from_local_datapath(pb, b_ctx_in->chassis_rec,
b_ctx_out,
> > +            remove_pb_from_local_datapath(pb, b_ctx_out,
> >                                            ld);
> >          }
> >      }
> > @@ -2609,7 +2593,7 @@ delete_done:
> >                              b_ctx_in->sbrec_datapath_binding_by_key,
> >                              b_ctx_in->sbrec_port_binding_by_datapath,
> >                              b_ctx_in->sbrec_port_binding_by_name,
> > -                            pb->datapath, false,
> > +                            pb->datapath,
> >                              b_ctx_out->local_datapaths,
> >                              b_ctx_out->tracked_dp_bindings);
> >                      }
> > diff --git a/controller/ovn-controller.h b/controller/ovn-controller.h
> > index b864ed0fa..a3aa6ebd3 100644
> > --- a/controller/ovn-controller.h
> > +++ b/controller/ovn-controller.h
> > @@ -56,10 +56,6 @@ struct local_datapath {
> >      /* The localnet port in this datapath, if any (at most one is
allowed). */
> >      const struct sbrec_port_binding *localnet_port;
> >
> > -    /* True if this datapath contains an l3gateway port located on this
> > -     * hypervisor. */
> > -    bool has_local_l3gateway;
> > -
> >      struct {
> >          const struct sbrec_port_binding *local;
> >          const struct sbrec_port_binding *remote;
> > diff --git a/controller/pinctrl.c b/controller/pinctrl.c
> > index 8e4c4d18c..d7166b0a9 100644
> > --- a/controller/pinctrl.c
> > +++ b/controller/pinctrl.c
> > @@ -5521,7 +5521,7 @@ get_localnet_vifs_l3gwports(
> >          sbrec_port_binding_index_set_datapath(target, ld->datapath);
> >          SBREC_PORT_BINDING_FOR_EACH_EQUAL (pb, target,
> >
sbrec_port_binding_by_datapath) {
> > -            if ((ld->has_local_l3gateway && !strcmp(pb->type,
"l3gateway"))
> > +            if (!strcmp(pb->type, "l3gateway")
> >                  || !strcmp(pb->type, "patch")) {
> >                  sset_add(local_l3gw_ports, pb->logical_port);
> >              }
> > --
> > 2.30.2
> >
> > _______________________________________________
> > dev mailing list
> > dev at openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >


More information about the dev mailing list