Re: [ovs-dev] [PATCH ovn v9 2/8] ovn-controller: I-P for SB port binding and OVS interface in runtime_data.

2020-06-03 Thread Han Zhou
On Wed, Jun 3, 2020 at 12:42 AM Numan Siddique  wrote:
>
>
>
> On Wed, Jun 3, 2020 at 10:49 AM Han Zhou  wrote:
>>
>> On Thu, May 28, 2020 at 4:05 AM  wrote:
>> >
>> > From: Numan Siddique 
>> >
>> > This patch handles SB port binding changes and OVS interface changes
>> > incrementally in the runtime_data stage which otherwise would have
>> > resulted in calls to binding_run().
>> >
>> > Prior to this patch, port binding changes were handled differently.
>> > The changes were only evaluated to see if they need full recompute
>> > or they can be ignored.
>> >
>> > With this patch, the runtime data is updated with the changes (both
>> > SB port binding and OVS interface) and ports are claimed/released in
>> > the handlers itself, avoiding the need to trigger recompute of runtime
>> > data stage.
>> >
>> > Acked-by: Mark Michelson 
>> > Signed-off-by: Numan Siddique 
>> > ---
>> >  controller/binding.c| 1002 ++-
>> >  controller/binding.h|9 +-
>> >  controller/ovn-controller.c |   61 ++-
>> >  tests/ovn-performance.at|   13 +
>> >  4 files changed, 953 insertions(+), 132 deletions(-)
>> >
>> > diff --git a/controller/binding.c b/controller/binding.c
>> > index 6a13d1a0e..74e0e0710 100644
>> > --- a/controller/binding.c
>> > +++ b/controller/binding.c
>> > @@ -360,16 +360,6 @@ destroy_qos_map(struct hmap *qos_map)
>> >  hmap_destroy(qos_map);
>> >  }
>> >
>> > -static void
>> > -update_local_lport_ids(struct sset *local_lport_ids,
>> > -   const struct sbrec_port_binding *pb)
>> > -{
>> > -char buf[16];
>> > -snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
>> > - pb->datapath->tunnel_key, pb->tunnel_key);
>> > -sset_add(local_lport_ids, buf);
>> > -}
>> > -
>> >  /*
>> >   * Get the encap from the chassis for this port. The interface
>> >   * may have an external_ids:encap-ip= set; if so we
>> > @@ -448,10 +438,10 @@ is_network_plugged(const struct
sbrec_port_binding
>> *binding_rec,
>> >  }
>> >
>> >  static void
>> > -consider_localnet_port(const struct sbrec_port_binding *binding_rec,
>> > -   struct shash *bridge_mappings,
>> > -   struct sset *egress_ifaces,
>> > -   struct hmap *local_datapaths)
>> > +update_ld_localnet_port(const struct sbrec_port_binding *binding_rec,
>> > +struct shash *bridge_mappings,
>> > +struct sset *egress_ifaces,
>> > +struct hmap *local_datapaths)
>> >  {
>> >  /* Ignore localnet ports for unplugged networks. */
>> >  if (!is_network_plugged(binding_rec, bridge_mappings)) {
>> > @@ -481,6 +471,27 @@ consider_localnet_port(const struct
>> sbrec_port_binding *binding_rec,
>> >  ld->localnet_port = binding_rec;
>> >  }
>> >
>> > +static void
>> > +update_local_lport_ids(struct sset *local_lport_ids,
>> > +   const struct sbrec_port_binding *pb)
>> > +{
>> > +char buf[16];
>> > +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
>> > + pb->datapath->tunnel_key, pb->tunnel_key);
>> > +sset_add(local_lport_ids, buf);
>> > +}
>> > +
>> > +static void
>> > +remove_local_lport_ids(const struct sbrec_port_binding *binding_rec,
>> > +   struct sset *local_lport_ids)
>> > +{
>> > +char buf[16];
>> > +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
>> > +binding_rec->datapath->tunnel_key,
>> > +binding_rec->tunnel_key);
>> > +sset_find_and_delete(local_lport_ids, buf);
>> > +}
>> > +
>> >  /* Local bindings. binding.c module binds the logical port
(represented
>> by
>> >   * Port_Binding rows) and sets the 'chassis' column when it sees the
>> >   * OVS interface row (of type "" or "internal") with the
>> > @@ -520,6 +531,10 @@ consider_localnet_port(const struct
>> sbrec_port_binding *binding_rec,
>> >   *  BT_VIF. Its Port_Binding row's 'parent' column is
>> set to
>> >   *  its parent's Port_Binding. It shares the OVS
>> interface row
>> >   *  with the parent.
>> > + *  Each ovn-controller when it sees a container
>> Port_Binding,
>> > + *  it creates 'struct local_binding' for the parent
>> > + *  Port_Binding and for its even if the OVS interface
>> row for
>> > + *  the parent is not present.
>> >   *
>> >   *  BT_VIRTUAL: Represents a local binding which has a parent of type
>> BT_VIF.
>> >   *  Its Port_Binding type is "virtual" and it shares the
OVS
>> > @@ -527,6 +542,17 @@ consider_localnet_port(const struct
>> sbrec_port_binding *binding_rec,
>> >   *  Port_Binding of type "virtual" is claimed by pinctrl
>> module
>> >   *  when it sees the ARP packet from the parent's VIF.
>> >   *
>> > + *
>> > + *  An object of 'struct local_binding' is created:
>> > + *- For each interface 

Re: [ovs-dev] [PATCH ovn v9 2/8] ovn-controller: I-P for SB port binding and OVS interface in runtime_data.

2020-06-03 Thread Numan Siddique
On Wed, Jun 3, 2020 at 10:49 AM Han Zhou  wrote:

> On Thu, May 28, 2020 at 4:05 AM  wrote:
> >
> > From: Numan Siddique 
> >
> > This patch handles SB port binding changes and OVS interface changes
> > incrementally in the runtime_data stage which otherwise would have
> > resulted in calls to binding_run().
> >
> > Prior to this patch, port binding changes were handled differently.
> > The changes were only evaluated to see if they need full recompute
> > or they can be ignored.
> >
> > With this patch, the runtime data is updated with the changes (both
> > SB port binding and OVS interface) and ports are claimed/released in
> > the handlers itself, avoiding the need to trigger recompute of runtime
> > data stage.
> >
> > Acked-by: Mark Michelson 
> > Signed-off-by: Numan Siddique 
> > ---
> >  controller/binding.c| 1002 ++-
> >  controller/binding.h|9 +-
> >  controller/ovn-controller.c |   61 ++-
> >  tests/ovn-performance.at|   13 +
> >  4 files changed, 953 insertions(+), 132 deletions(-)
> >
> > diff --git a/controller/binding.c b/controller/binding.c
> > index 6a13d1a0e..74e0e0710 100644
> > --- a/controller/binding.c
> > +++ b/controller/binding.c
> > @@ -360,16 +360,6 @@ destroy_qos_map(struct hmap *qos_map)
> >  hmap_destroy(qos_map);
> >  }
> >
> > -static void
> > -update_local_lport_ids(struct sset *local_lport_ids,
> > -   const struct sbrec_port_binding *pb)
> > -{
> > -char buf[16];
> > -snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> > - pb->datapath->tunnel_key, pb->tunnel_key);
> > -sset_add(local_lport_ids, buf);
> > -}
> > -
> >  /*
> >   * Get the encap from the chassis for this port. The interface
> >   * may have an external_ids:encap-ip= set; if so we
> > @@ -448,10 +438,10 @@ is_network_plugged(const struct sbrec_port_binding
> *binding_rec,
> >  }
> >
> >  static void
> > -consider_localnet_port(const struct sbrec_port_binding *binding_rec,
> > -   struct shash *bridge_mappings,
> > -   struct sset *egress_ifaces,
> > -   struct hmap *local_datapaths)
> > +update_ld_localnet_port(const struct sbrec_port_binding *binding_rec,
> > +struct shash *bridge_mappings,
> > +struct sset *egress_ifaces,
> > +struct hmap *local_datapaths)
> >  {
> >  /* Ignore localnet ports for unplugged networks. */
> >  if (!is_network_plugged(binding_rec, bridge_mappings)) {
> > @@ -481,6 +471,27 @@ consider_localnet_port(const struct
> sbrec_port_binding *binding_rec,
> >  ld->localnet_port = binding_rec;
> >  }
> >
> > +static void
> > +update_local_lport_ids(struct sset *local_lport_ids,
> > +   const struct sbrec_port_binding *pb)
> > +{
> > +char buf[16];
> > +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> > + pb->datapath->tunnel_key, pb->tunnel_key);
> > +sset_add(local_lport_ids, buf);
> > +}
> > +
> > +static void
> > +remove_local_lport_ids(const struct sbrec_port_binding *binding_rec,
> > +   struct sset *local_lport_ids)
> > +{
> > +char buf[16];
> > +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> > +binding_rec->datapath->tunnel_key,
> > +binding_rec->tunnel_key);
> > +sset_find_and_delete(local_lport_ids, buf);
> > +}
> > +
> >  /* Local bindings. binding.c module binds the logical port (represented
> by
> >   * Port_Binding rows) and sets the 'chassis' column when it sees the
> >   * OVS interface row (of type "" or "internal") with the
> > @@ -520,6 +531,10 @@ consider_localnet_port(const struct
> sbrec_port_binding *binding_rec,
> >   *  BT_VIF. Its Port_Binding row's 'parent' column is
> set to
> >   *  its parent's Port_Binding. It shares the OVS
> interface row
> >   *  with the parent.
> > + *  Each ovn-controller when it sees a container
> Port_Binding,
> > + *  it creates 'struct local_binding' for the parent
> > + *  Port_Binding and for its even if the OVS interface
> row for
> > + *  the parent is not present.
> >   *
> >   *  BT_VIRTUAL: Represents a local binding which has a parent of type
> BT_VIF.
> >   *  Its Port_Binding type is "virtual" and it shares the OVS
> > @@ -527,6 +542,17 @@ consider_localnet_port(const struct
> sbrec_port_binding *binding_rec,
> >   *  Port_Binding of type "virtual" is claimed by pinctrl
> module
> >   *  when it sees the ARP packet from the parent's VIF.
> >   *
> > + *
> > + *  An object of 'struct local_binding' is created:
> > + *- For each interface that has iface-id configured with the type -
> BT_VIF.
> > + *
> > + *- For each container Port Binding (of type BT_CONTAINER) and its
> > + *  parent Port_Binding (of type 

Re: [ovs-dev] [PATCH ovn v9 2/8] ovn-controller: I-P for SB port binding and OVS interface in runtime_data.

2020-06-02 Thread Han Zhou
On Thu, May 28, 2020 at 4:05 AM  wrote:
>
> From: Numan Siddique 
>
> This patch handles SB port binding changes and OVS interface changes
> incrementally in the runtime_data stage which otherwise would have
> resulted in calls to binding_run().
>
> Prior to this patch, port binding changes were handled differently.
> The changes were only evaluated to see if they need full recompute
> or they can be ignored.
>
> With this patch, the runtime data is updated with the changes (both
> SB port binding and OVS interface) and ports are claimed/released in
> the handlers itself, avoiding the need to trigger recompute of runtime
> data stage.
>
> Acked-by: Mark Michelson 
> Signed-off-by: Numan Siddique 
> ---
>  controller/binding.c| 1002 ++-
>  controller/binding.h|9 +-
>  controller/ovn-controller.c |   61 ++-
>  tests/ovn-performance.at|   13 +
>  4 files changed, 953 insertions(+), 132 deletions(-)
>
> diff --git a/controller/binding.c b/controller/binding.c
> index 6a13d1a0e..74e0e0710 100644
> --- a/controller/binding.c
> +++ b/controller/binding.c
> @@ -360,16 +360,6 @@ destroy_qos_map(struct hmap *qos_map)
>  hmap_destroy(qos_map);
>  }
>
> -static void
> -update_local_lport_ids(struct sset *local_lport_ids,
> -   const struct sbrec_port_binding *pb)
> -{
> -char buf[16];
> -snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> - pb->datapath->tunnel_key, pb->tunnel_key);
> -sset_add(local_lport_ids, buf);
> -}
> -
>  /*
>   * Get the encap from the chassis for this port. The interface
>   * may have an external_ids:encap-ip= set; if so we
> @@ -448,10 +438,10 @@ is_network_plugged(const struct sbrec_port_binding
*binding_rec,
>  }
>
>  static void
> -consider_localnet_port(const struct sbrec_port_binding *binding_rec,
> -   struct shash *bridge_mappings,
> -   struct sset *egress_ifaces,
> -   struct hmap *local_datapaths)
> +update_ld_localnet_port(const struct sbrec_port_binding *binding_rec,
> +struct shash *bridge_mappings,
> +struct sset *egress_ifaces,
> +struct hmap *local_datapaths)
>  {
>  /* Ignore localnet ports for unplugged networks. */
>  if (!is_network_plugged(binding_rec, bridge_mappings)) {
> @@ -481,6 +471,27 @@ consider_localnet_port(const struct
sbrec_port_binding *binding_rec,
>  ld->localnet_port = binding_rec;
>  }
>
> +static void
> +update_local_lport_ids(struct sset *local_lport_ids,
> +   const struct sbrec_port_binding *pb)
> +{
> +char buf[16];
> +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> + pb->datapath->tunnel_key, pb->tunnel_key);
> +sset_add(local_lport_ids, buf);
> +}
> +
> +static void
> +remove_local_lport_ids(const struct sbrec_port_binding *binding_rec,
> +   struct sset *local_lport_ids)
> +{
> +char buf[16];
> +snprintf(buf, sizeof(buf), "%"PRId64"_%"PRId64,
> +binding_rec->datapath->tunnel_key,
> +binding_rec->tunnel_key);
> +sset_find_and_delete(local_lport_ids, buf);
> +}
> +
>  /* Local bindings. binding.c module binds the logical port (represented
by
>   * Port_Binding rows) and sets the 'chassis' column when it sees the
>   * OVS interface row (of type "" or "internal") with the
> @@ -520,6 +531,10 @@ consider_localnet_port(const struct
sbrec_port_binding *binding_rec,
>   *  BT_VIF. Its Port_Binding row's 'parent' column is
set to
>   *  its parent's Port_Binding. It shares the OVS
interface row
>   *  with the parent.
> + *  Each ovn-controller when it sees a container
Port_Binding,
> + *  it creates 'struct local_binding' for the parent
> + *  Port_Binding and for its even if the OVS interface
row for
> + *  the parent is not present.
>   *
>   *  BT_VIRTUAL: Represents a local binding which has a parent of type
BT_VIF.
>   *  Its Port_Binding type is "virtual" and it shares the OVS
> @@ -527,6 +542,17 @@ consider_localnet_port(const struct
sbrec_port_binding *binding_rec,
>   *  Port_Binding of type "virtual" is claimed by pinctrl
module
>   *  when it sees the ARP packet from the parent's VIF.
>   *
> + *
> + *  An object of 'struct local_binding' is created:
> + *- For each interface that has iface-id configured with the type -
BT_VIF.
> + *
> + *- For each container Port Binding (of type BT_CONTAINER) and its
> + *  parent Port_Binding (of type BT_VIF), no matter if
> + *  they are bound to this chassis i.e even if OVS interface row for
the
> + *  parent is not present.
> + *
> + *   - For each 'virtual' Port Binding (of type BT_VIRTUAL) provided its
parent
> + * is bound to this chassis.

Numan, thanks for more detailed