Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-08-04 Thread Ales Musil
On Thu, Aug 4, 2022 at 5:23 PM Numan Siddique  wrote:

> On Tue, Jul 26, 2022 at 10:13 AM Ihar Hrachyshka 
> wrote:
> >
> > Acked-By: Ihar Hrachyshka 
> >
> > On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
> > >
>
> Hi Ales,
>
> I couldn't get a chance to thoroughly review the entire series, but
> overall it looks fine to me.
>
> I've a few comments in this patch.
>
>
Hi Numan,

thank you for the review, please see my reply below.


>
>
>
> > > Add MAC binding aging mechanism, that utilizes
> > > the timestamp column of MAC_Binding table.
> > > When the MAC binding exceeds the threshold it is
> > > removed from SB DB, this is postponed only in case
> > > we receive update ARP with update to MAC address.
> > >
> > > The threshold is configurable via option
> > > "mac_binding_age_threshold" that can be specified
> > > for each logical router. The option is defaulting to
> > > 0 which means that by default the aging is disabled
> > > and the MAC binding rows will be persisted the same
> > > way as before.
> > >
> > > Reported-at: https://bugzilla.redhat.com/2084668
> > > Signed-off-by: Ales Musil 
> > > ---
> > > v3: Rebase on top of current main.
> > > Update according to the final conclusion.
> > > ---
> > >  northd/automake.mk |   2 +
> > >  northd/inc-proc-northd.c   |  13 
> > >  northd/mac-binding-aging.c | 151 +
> > >  northd/mac-binding-aging.h |  33 
> > >  ovn-nb.xml |   7 ++
> > >  5 files changed, 206 insertions(+)
> > >  create mode 100644 northd/mac-binding-aging.c
> > >  create mode 100644 northd/mac-binding-aging.h
> > >
> > > diff --git a/northd/automake.mk b/northd/automake.mk
> > > index 4862ec7b7..81582867d 100644
> > > --- a/northd/automake.mk
> > > +++ b/northd/automake.mk
> > > @@ -1,6 +1,8 @@
> > >  # ovn-northd
> > >  bin_PROGRAMS += northd/ovn-northd
> > >  northd_ovn_northd_SOURCES = \
> > > +   northd/mac-binding-aging.c \
> > > +   northd/mac-binding-aging.h \
> > > northd/northd.c \
> > > northd/northd.h \
> > > northd/ovn-northd.c \
> > > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > > index 43093cb5a..4a3699106 100644
> > > --- a/northd/inc-proc-northd.c
> > > +++ b/northd/inc-proc-northd.c
> > > @@ -22,9 +22,11 @@
> > >  #include "ip-mcast-index.h"
> > >  #include "static-mac-binding-index.h"
> > >  #include "lib/inc-proc-eng.h"
> > > +#include "lib/mac-binding-index.h"
> > >  #include "lib/ovn-nb-idl.h"
> > >  #include "lib/ovn-sb-idl.h"
> > >  #include "mcast-group-index.h"
> > > +#include "northd/mac-binding-aging.h"
> > >  #include "openvswitch/poll-loop.h"
> > >  #include "openvswitch/vlog.h"
> > >  #include "inc-proc-northd.h"
> > > @@ -149,6 +151,8 @@ enum sb_engine_node {
> > >   * avoid sparse errors. */
> > >  static ENGINE_NODE(northd, "northd");
> > >  static ENGINE_NODE(lflow, "lflow");
> > > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
> > > +static ENGINE_NODE(mac_binding_aging_waker,
> "mac_binding_aging_waker");
> > >
> > >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> > >struct ovsdb_idl_loop *sb)
> > > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
> *nb,
> > >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
> > >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
> > >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
> > > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
> > > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
> > > +engine_add_input(&en_mac_binding_aging,
> &en_mac_binding_aging_waker, NULL);
> > >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
> > >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
> > >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
> > >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
> > >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
> > >  engine_add_input(&en_lflow, &en_northd, NULL);
> > > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
> > >
> > >  struct engine_arg engine_arg = {
> > >  .nb_idl = nb->idl,
> > > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
> *nb,
> > >  chassis_hostname_index_create(sb->idl);
> > >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
> > >  = static_mac_binding_index_create(sb->idl);
> > > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
> > > += mac_binding_by_datapath_index_create(sb->idl);
> > >
> > >  engine_init(&en_lflow, &engine_arg);
> > >
> > > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
> *nb,
> > >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
> > >
> "sbrec_static_mac_binding_by_lport_ip",
> > >  sbrec_static_mac_binding_by_lport_ip);
> > > +engine_ovsdb_node_ad

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-08-04 Thread Numan Siddique
On Tue, Jul 26, 2022 at 10:13 AM Ihar Hrachyshka  wrote:
>
> Acked-By: Ihar Hrachyshka 
>
> On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
> >

Hi Ales,

I couldn't get a chance to thoroughly review the entire series, but
overall it looks fine to me.

I've a few comments in this patch.




> > Add MAC binding aging mechanism, that utilizes
> > the timestamp column of MAC_Binding table.
> > When the MAC binding exceeds the threshold it is
> > removed from SB DB, this is postponed only in case
> > we receive update ARP with update to MAC address.
> >
> > The threshold is configurable via option
> > "mac_binding_age_threshold" that can be specified
> > for each logical router. The option is defaulting to
> > 0 which means that by default the aging is disabled
> > and the MAC binding rows will be persisted the same
> > way as before.
> >
> > Reported-at: https://bugzilla.redhat.com/2084668
> > Signed-off-by: Ales Musil 
> > ---
> > v3: Rebase on top of current main.
> > Update according to the final conclusion.
> > ---
> >  northd/automake.mk |   2 +
> >  northd/inc-proc-northd.c   |  13 
> >  northd/mac-binding-aging.c | 151 +
> >  northd/mac-binding-aging.h |  33 
> >  ovn-nb.xml |   7 ++
> >  5 files changed, 206 insertions(+)
> >  create mode 100644 northd/mac-binding-aging.c
> >  create mode 100644 northd/mac-binding-aging.h
> >
> > diff --git a/northd/automake.mk b/northd/automake.mk
> > index 4862ec7b7..81582867d 100644
> > --- a/northd/automake.mk
> > +++ b/northd/automake.mk
> > @@ -1,6 +1,8 @@
> >  # ovn-northd
> >  bin_PROGRAMS += northd/ovn-northd
> >  northd_ovn_northd_SOURCES = \
> > +   northd/mac-binding-aging.c \
> > +   northd/mac-binding-aging.h \
> > northd/northd.c \
> > northd/northd.h \
> > northd/ovn-northd.c \
> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > index 43093cb5a..4a3699106 100644
> > --- a/northd/inc-proc-northd.c
> > +++ b/northd/inc-proc-northd.c
> > @@ -22,9 +22,11 @@
> >  #include "ip-mcast-index.h"
> >  #include "static-mac-binding-index.h"
> >  #include "lib/inc-proc-eng.h"
> > +#include "lib/mac-binding-index.h"
> >  #include "lib/ovn-nb-idl.h"
> >  #include "lib/ovn-sb-idl.h"
> >  #include "mcast-group-index.h"
> > +#include "northd/mac-binding-aging.h"
> >  #include "openvswitch/poll-loop.h"
> >  #include "openvswitch/vlog.h"
> >  #include "inc-proc-northd.h"
> > @@ -149,6 +151,8 @@ enum sb_engine_node {
> >   * avoid sparse errors. */
> >  static ENGINE_NODE(northd, "northd");
> >  static ENGINE_NODE(lflow, "lflow");
> > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
> > +static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
> >
> >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >struct ovsdb_idl_loop *sb)
> > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
> >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
> >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
> > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
> > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
> > +engine_add_input(&en_mac_binding_aging, &en_mac_binding_aging_waker, 
> > NULL);
> >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
> >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
> >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
> >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
> >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
> >  engine_add_input(&en_lflow, &en_northd, NULL);
> > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
> >
> >  struct engine_arg engine_arg = {
> >  .nb_idl = nb->idl,
> > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  chassis_hostname_index_create(sb->idl);
> >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
> >  = static_mac_binding_index_create(sb->idl);
> > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
> > += mac_binding_by_datapath_index_create(sb->idl);
> >
> >  engine_init(&en_lflow, &engine_arg);
> >
> > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
> >  "sbrec_static_mac_binding_by_lport_ip",
> >  sbrec_static_mac_binding_by_lport_ip);
> > +engine_ovsdb_node_add_index(&en_sb_mac_binding,
> > +"sbrec_mac_binding_by_datapath",
> > +sbrec_mac_binding_by_datapath);
> >  }
> >
> >  void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
> > diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
> > ne

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-26 Thread Ihar Hrachyshka
Acked-By: Ihar Hrachyshka 

On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
>
> Add MAC binding aging mechanism, that utilizes
> the timestamp column of MAC_Binding table.
> When the MAC binding exceeds the threshold it is
> removed from SB DB, this is postponed only in case
> we receive update ARP with update to MAC address.
>
> The threshold is configurable via option
> "mac_binding_age_threshold" that can be specified
> for each logical router. The option is defaulting to
> 0 which means that by default the aging is disabled
> and the MAC binding rows will be persisted the same
> way as before.
>
> Reported-at: https://bugzilla.redhat.com/2084668
> Signed-off-by: Ales Musil 
> ---
> v3: Rebase on top of current main.
> Update according to the final conclusion.
> ---
>  northd/automake.mk |   2 +
>  northd/inc-proc-northd.c   |  13 
>  northd/mac-binding-aging.c | 151 +
>  northd/mac-binding-aging.h |  33 
>  ovn-nb.xml |   7 ++
>  5 files changed, 206 insertions(+)
>  create mode 100644 northd/mac-binding-aging.c
>  create mode 100644 northd/mac-binding-aging.h
>
> diff --git a/northd/automake.mk b/northd/automake.mk
> index 4862ec7b7..81582867d 100644
> --- a/northd/automake.mk
> +++ b/northd/automake.mk
> @@ -1,6 +1,8 @@
>  # ovn-northd
>  bin_PROGRAMS += northd/ovn-northd
>  northd_ovn_northd_SOURCES = \
> +   northd/mac-binding-aging.c \
> +   northd/mac-binding-aging.h \
> northd/northd.c \
> northd/northd.h \
> northd/ovn-northd.c \
> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> index 43093cb5a..4a3699106 100644
> --- a/northd/inc-proc-northd.c
> +++ b/northd/inc-proc-northd.c
> @@ -22,9 +22,11 @@
>  #include "ip-mcast-index.h"
>  #include "static-mac-binding-index.h"
>  #include "lib/inc-proc-eng.h"
> +#include "lib/mac-binding-index.h"
>  #include "lib/ovn-nb-idl.h"
>  #include "lib/ovn-sb-idl.h"
>  #include "mcast-group-index.h"
> +#include "northd/mac-binding-aging.h"
>  #include "openvswitch/poll-loop.h"
>  #include "openvswitch/vlog.h"
>  #include "inc-proc-northd.h"
> @@ -149,6 +151,8 @@ enum sb_engine_node {
>   * avoid sparse errors. */
>  static ENGINE_NODE(northd, "northd");
>  static ENGINE_NODE(lflow, "lflow");
> +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
> +static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
>
>  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>struct ovsdb_idl_loop *sb)
> @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
>  engine_add_input(&en_northd, &en_sb_fdb, NULL);
>  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_mac_binding_aging_waker, 
> NULL);
>  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
>  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
>  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
>  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
>  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
>  engine_add_input(&en_lflow, &en_northd, NULL);
> +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
>
>  struct engine_arg engine_arg = {
>  .nb_idl = nb->idl,
> @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  chassis_hostname_index_create(sb->idl);
>  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
>  = static_mac_binding_index_create(sb->idl);
> +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
> += mac_binding_by_datapath_index_create(sb->idl);
>
>  engine_init(&en_lflow, &engine_arg);
>
> @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
>  "sbrec_static_mac_binding_by_lport_ip",
>  sbrec_static_mac_binding_by_lport_ip);
> +engine_ovsdb_node_add_index(&en_sb_mac_binding,
> +"sbrec_mac_binding_by_datapath",
> +sbrec_mac_binding_by_datapath);
>  }
>
>  void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
> diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
> new file mode 100644
> index 0..8af477ff1
> --- /dev/null
> +++ b/northd/mac-binding-aging.c
> @@ -0,0 +1,151 @@
> +/* Copyright (c) 2022, Red Hat, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * 

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-26 Thread Ihar Hrachyshka
On Tue, Jul 26, 2022 at 1:37 AM Ales Musil  wrote:

>
>
>
> On Mon, Jul 25, 2022 at 5:53 PM Ihar Hrachyshka 
> wrote:
>
>> On Mon, Jul 25, 2022 at 1:23 AM Ales Musil  wrote:
>>
>>> Hi Ihar,
>>>
>>>
>>> On Fri, Jul 22, 2022 at 8:38 PM Ihar Hrachyshka 
>>> wrote:
>>>
 On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
 >
 > Add MAC binding aging mechanism, that utilizes
 > the timestamp column of MAC_Binding table.
 > When the MAC binding exceeds the threshold it is
 > removed from SB DB, this is postponed only in case
 > we receive update ARP with update to MAC address.
 >
 > The threshold is configurable via option
 > "mac_binding_age_threshold" that can be specified
 > for each logical router. The option is defaulting to
 > 0 which means that by default the aging is disabled
 > and the MAC binding rows will be persisted the same
 > way as before.
 >
 > Reported-at: https://bugzilla.redhat.com/2084668
 > Signed-off-by: Ales Musil 
 > ---
 > v3: Rebase on top of current main.
 > Update according to the final conclusion.
 > ---
 >  northd/automake.mk |   2 +
 >  northd/inc-proc-northd.c   |  13 
 >  northd/mac-binding-aging.c | 151
 +
 >  northd/mac-binding-aging.h |  33 
 >  ovn-nb.xml |   7 ++
 >  5 files changed, 206 insertions(+)
 >  create mode 100644 northd/mac-binding-aging.c
 >  create mode 100644 northd/mac-binding-aging.h
 >
 > diff --git a/northd/automake.mk b/northd/automake.mk
 > index 4862ec7b7..81582867d 100644
 > --- a/northd/automake.mk
 > +++ b/northd/automake.mk
 > @@ -1,6 +1,8 @@
 >  # ovn-northd
 >  bin_PROGRAMS += northd/ovn-northd
 >  northd_ovn_northd_SOURCES = \
 > +   northd/mac-binding-aging.c \
 > +   northd/mac-binding-aging.h \
 > northd/northd.c \
 > northd/northd.h \
 > northd/ovn-northd.c \
 > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
 > index 43093cb5a..4a3699106 100644
 > --- a/northd/inc-proc-northd.c
 > +++ b/northd/inc-proc-northd.c
 > @@ -22,9 +22,11 @@
 >  #include "ip-mcast-index.h"
 >  #include "static-mac-binding-index.h"
 >  #include "lib/inc-proc-eng.h"
 > +#include "lib/mac-binding-index.h"
 >  #include "lib/ovn-nb-idl.h"
 >  #include "lib/ovn-sb-idl.h"
 >  #include "mcast-group-index.h"
 > +#include "northd/mac-binding-aging.h"
 >  #include "openvswitch/poll-loop.h"
 >  #include "openvswitch/vlog.h"
 >  #include "inc-proc-northd.h"
 > @@ -149,6 +151,8 @@ enum sb_engine_node {
 >   * avoid sparse errors. */
 >  static ENGINE_NODE(northd, "northd");
 >  static ENGINE_NODE(lflow, "lflow");
 > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
 > +static ENGINE_NODE(mac_binding_aging_waker,
 "mac_binding_aging_waker");
 >
 >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 >struct ovsdb_idl_loop *sb)
 > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
 *nb,
 >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
 >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
 >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
 > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding,
 NULL);
 > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
 > +engine_add_input(&en_mac_binding_aging,
 &en_mac_binding_aging_waker, NULL);
 >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
 >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
 >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
 >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
 >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
 >  engine_add_input(&en_lflow, &en_northd, NULL);
 > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
 >
 >  struct engine_arg engine_arg = {
 >  .nb_idl = nb->idl,
 > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
 *nb,
 >  chassis_hostname_index_create(sb->idl);
 >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
 >  = static_mac_binding_index_create(sb->idl);
 > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
 > += mac_binding_by_datapath_index_create(sb->idl);
 >
 >  engine_init(&en_lflow, &engine_arg);
 >
 > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
 *nb,
 >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
 >
 "sbrec_static_mac_binding_by_lport_ip",
 >
 sbrec_static_mac_binding_by_lport_ip);
 > +engine_ovsdb_node_add_index(&en_sb_mac_bi

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-25 Thread Ales Musil
On Mon, Jul 25, 2022 at 5:53 PM Ihar Hrachyshka  wrote:

> On Mon, Jul 25, 2022 at 1:23 AM Ales Musil  wrote:
>
>> Hi Ihar,
>>
>>
>> On Fri, Jul 22, 2022 at 8:38 PM Ihar Hrachyshka 
>> wrote:
>>
>>> On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
>>> >
>>> > Add MAC binding aging mechanism, that utilizes
>>> > the timestamp column of MAC_Binding table.
>>> > When the MAC binding exceeds the threshold it is
>>> > removed from SB DB, this is postponed only in case
>>> > we receive update ARP with update to MAC address.
>>> >
>>> > The threshold is configurable via option
>>> > "mac_binding_age_threshold" that can be specified
>>> > for each logical router. The option is defaulting to
>>> > 0 which means that by default the aging is disabled
>>> > and the MAC binding rows will be persisted the same
>>> > way as before.
>>> >
>>> > Reported-at: https://bugzilla.redhat.com/2084668
>>> > Signed-off-by: Ales Musil 
>>> > ---
>>> > v3: Rebase on top of current main.
>>> > Update according to the final conclusion.
>>> > ---
>>> >  northd/automake.mk |   2 +
>>> >  northd/inc-proc-northd.c   |  13 
>>> >  northd/mac-binding-aging.c | 151 +
>>> >  northd/mac-binding-aging.h |  33 
>>> >  ovn-nb.xml |   7 ++
>>> >  5 files changed, 206 insertions(+)
>>> >  create mode 100644 northd/mac-binding-aging.c
>>> >  create mode 100644 northd/mac-binding-aging.h
>>> >
>>> > diff --git a/northd/automake.mk b/northd/automake.mk
>>> > index 4862ec7b7..81582867d 100644
>>> > --- a/northd/automake.mk
>>> > +++ b/northd/automake.mk
>>> > @@ -1,6 +1,8 @@
>>> >  # ovn-northd
>>> >  bin_PROGRAMS += northd/ovn-northd
>>> >  northd_ovn_northd_SOURCES = \
>>> > +   northd/mac-binding-aging.c \
>>> > +   northd/mac-binding-aging.h \
>>> > northd/northd.c \
>>> > northd/northd.h \
>>> > northd/ovn-northd.c \
>>> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
>>> > index 43093cb5a..4a3699106 100644
>>> > --- a/northd/inc-proc-northd.c
>>> > +++ b/northd/inc-proc-northd.c
>>> > @@ -22,9 +22,11 @@
>>> >  #include "ip-mcast-index.h"
>>> >  #include "static-mac-binding-index.h"
>>> >  #include "lib/inc-proc-eng.h"
>>> > +#include "lib/mac-binding-index.h"
>>> >  #include "lib/ovn-nb-idl.h"
>>> >  #include "lib/ovn-sb-idl.h"
>>> >  #include "mcast-group-index.h"
>>> > +#include "northd/mac-binding-aging.h"
>>> >  #include "openvswitch/poll-loop.h"
>>> >  #include "openvswitch/vlog.h"
>>> >  #include "inc-proc-northd.h"
>>> > @@ -149,6 +151,8 @@ enum sb_engine_node {
>>> >   * avoid sparse errors. */
>>> >  static ENGINE_NODE(northd, "northd");
>>> >  static ENGINE_NODE(lflow, "lflow");
>>> > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
>>> > +static ENGINE_NODE(mac_binding_aging_waker,
>>> "mac_binding_aging_waker");
>>> >
>>> >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>>> >struct ovsdb_idl_loop *sb)
>>> > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
>>> *nb,
>>> >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
>>> >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
>>> >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
>>> > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
>>> > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
>>> > +engine_add_input(&en_mac_binding_aging,
>>> &en_mac_binding_aging_waker, NULL);
>>> >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
>>> >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
>>> >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
>>> >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
>>> >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
>>> >  engine_add_input(&en_lflow, &en_northd, NULL);
>>> > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
>>> >
>>> >  struct engine_arg engine_arg = {
>>> >  .nb_idl = nb->idl,
>>> > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
>>> *nb,
>>> >  chassis_hostname_index_create(sb->idl);
>>> >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
>>> >  = static_mac_binding_index_create(sb->idl);
>>> > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
>>> > += mac_binding_by_datapath_index_create(sb->idl);
>>> >
>>> >  engine_init(&en_lflow, &engine_arg);
>>> >
>>> > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
>>> *nb,
>>> >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
>>> >
>>> "sbrec_static_mac_binding_by_lport_ip",
>>> >  sbrec_static_mac_binding_by_lport_ip);
>>> > +engine_ovsdb_node_add_index(&en_sb_mac_binding,
>>> > +"sbrec_mac_binding_by_datapath",
>>> > +sbrec_mac_binding_by_datapath);
>>> >  }

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-25 Thread Ihar Hrachyshka
On Mon, Jul 25, 2022 at 1:23 AM Ales Musil  wrote:

> Hi Ihar,
>
>
> On Fri, Jul 22, 2022 at 8:38 PM Ihar Hrachyshka 
> wrote:
>
>> On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
>> >
>> > Add MAC binding aging mechanism, that utilizes
>> > the timestamp column of MAC_Binding table.
>> > When the MAC binding exceeds the threshold it is
>> > removed from SB DB, this is postponed only in case
>> > we receive update ARP with update to MAC address.
>> >
>> > The threshold is configurable via option
>> > "mac_binding_age_threshold" that can be specified
>> > for each logical router. The option is defaulting to
>> > 0 which means that by default the aging is disabled
>> > and the MAC binding rows will be persisted the same
>> > way as before.
>> >
>> > Reported-at: https://bugzilla.redhat.com/2084668
>> > Signed-off-by: Ales Musil 
>> > ---
>> > v3: Rebase on top of current main.
>> > Update according to the final conclusion.
>> > ---
>> >  northd/automake.mk |   2 +
>> >  northd/inc-proc-northd.c   |  13 
>> >  northd/mac-binding-aging.c | 151 +
>> >  northd/mac-binding-aging.h |  33 
>> >  ovn-nb.xml |   7 ++
>> >  5 files changed, 206 insertions(+)
>> >  create mode 100644 northd/mac-binding-aging.c
>> >  create mode 100644 northd/mac-binding-aging.h
>> >
>> > diff --git a/northd/automake.mk b/northd/automake.mk
>> > index 4862ec7b7..81582867d 100644
>> > --- a/northd/automake.mk
>> > +++ b/northd/automake.mk
>> > @@ -1,6 +1,8 @@
>> >  # ovn-northd
>> >  bin_PROGRAMS += northd/ovn-northd
>> >  northd_ovn_northd_SOURCES = \
>> > +   northd/mac-binding-aging.c \
>> > +   northd/mac-binding-aging.h \
>> > northd/northd.c \
>> > northd/northd.h \
>> > northd/ovn-northd.c \
>> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
>> > index 43093cb5a..4a3699106 100644
>> > --- a/northd/inc-proc-northd.c
>> > +++ b/northd/inc-proc-northd.c
>> > @@ -22,9 +22,11 @@
>> >  #include "ip-mcast-index.h"
>> >  #include "static-mac-binding-index.h"
>> >  #include "lib/inc-proc-eng.h"
>> > +#include "lib/mac-binding-index.h"
>> >  #include "lib/ovn-nb-idl.h"
>> >  #include "lib/ovn-sb-idl.h"
>> >  #include "mcast-group-index.h"
>> > +#include "northd/mac-binding-aging.h"
>> >  #include "openvswitch/poll-loop.h"
>> >  #include "openvswitch/vlog.h"
>> >  #include "inc-proc-northd.h"
>> > @@ -149,6 +151,8 @@ enum sb_engine_node {
>> >   * avoid sparse errors. */
>> >  static ENGINE_NODE(northd, "northd");
>> >  static ENGINE_NODE(lflow, "lflow");
>> > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
>> > +static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
>> >
>> >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>> >struct ovsdb_idl_loop *sb)
>> > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
>> *nb,
>> >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
>> >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
>> >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
>> > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
>> > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
>> > +engine_add_input(&en_mac_binding_aging,
>> &en_mac_binding_aging_waker, NULL);
>> >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
>> >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
>> >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
>> >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
>> >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
>> >  engine_add_input(&en_lflow, &en_northd, NULL);
>> > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
>> >
>> >  struct engine_arg engine_arg = {
>> >  .nb_idl = nb->idl,
>> > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>> >  chassis_hostname_index_create(sb->idl);
>> >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
>> >  = static_mac_binding_index_create(sb->idl);
>> > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
>> > += mac_binding_by_datapath_index_create(sb->idl);
>> >
>> >  engine_init(&en_lflow, &engine_arg);
>> >
>> > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>> >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
>> >  "sbrec_static_mac_binding_by_lport_ip",
>> >  sbrec_static_mac_binding_by_lport_ip);
>> > +engine_ovsdb_node_add_index(&en_sb_mac_binding,
>> > +"sbrec_mac_binding_by_datapath",
>> > +sbrec_mac_binding_by_datapath);
>> >  }
>> >
>> >  void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
>> > diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
>> > new 

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-24 Thread Ales Musil
Hi Ihar,


On Fri, Jul 22, 2022 at 8:38 PM Ihar Hrachyshka  wrote:

> On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
> >
> > Add MAC binding aging mechanism, that utilizes
> > the timestamp column of MAC_Binding table.
> > When the MAC binding exceeds the threshold it is
> > removed from SB DB, this is postponed only in case
> > we receive update ARP with update to MAC address.
> >
> > The threshold is configurable via option
> > "mac_binding_age_threshold" that can be specified
> > for each logical router. The option is defaulting to
> > 0 which means that by default the aging is disabled
> > and the MAC binding rows will be persisted the same
> > way as before.
> >
> > Reported-at: https://bugzilla.redhat.com/2084668
> > Signed-off-by: Ales Musil 
> > ---
> > v3: Rebase on top of current main.
> > Update according to the final conclusion.
> > ---
> >  northd/automake.mk |   2 +
> >  northd/inc-proc-northd.c   |  13 
> >  northd/mac-binding-aging.c | 151 +
> >  northd/mac-binding-aging.h |  33 
> >  ovn-nb.xml |   7 ++
> >  5 files changed, 206 insertions(+)
> >  create mode 100644 northd/mac-binding-aging.c
> >  create mode 100644 northd/mac-binding-aging.h
> >
> > diff --git a/northd/automake.mk b/northd/automake.mk
> > index 4862ec7b7..81582867d 100644
> > --- a/northd/automake.mk
> > +++ b/northd/automake.mk
> > @@ -1,6 +1,8 @@
> >  # ovn-northd
> >  bin_PROGRAMS += northd/ovn-northd
> >  northd_ovn_northd_SOURCES = \
> > +   northd/mac-binding-aging.c \
> > +   northd/mac-binding-aging.h \
> > northd/northd.c \
> > northd/northd.h \
> > northd/ovn-northd.c \
> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > index 43093cb5a..4a3699106 100644
> > --- a/northd/inc-proc-northd.c
> > +++ b/northd/inc-proc-northd.c
> > @@ -22,9 +22,11 @@
> >  #include "ip-mcast-index.h"
> >  #include "static-mac-binding-index.h"
> >  #include "lib/inc-proc-eng.h"
> > +#include "lib/mac-binding-index.h"
> >  #include "lib/ovn-nb-idl.h"
> >  #include "lib/ovn-sb-idl.h"
> >  #include "mcast-group-index.h"
> > +#include "northd/mac-binding-aging.h"
> >  #include "openvswitch/poll-loop.h"
> >  #include "openvswitch/vlog.h"
> >  #include "inc-proc-northd.h"
> > @@ -149,6 +151,8 @@ enum sb_engine_node {
> >   * avoid sparse errors. */
> >  static ENGINE_NODE(northd, "northd");
> >  static ENGINE_NODE(lflow, "lflow");
> > +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
> > +static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
> >
> >  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >struct ovsdb_idl_loop *sb)
> > @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop
> *nb,
> >  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
> >  engine_add_input(&en_northd, &en_sb_fdb, NULL);
> >  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
> > +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
> > +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
> > +engine_add_input(&en_mac_binding_aging,
> &en_mac_binding_aging_waker, NULL);
> >  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
> >  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
> >  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
> >  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
> >  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
> >  engine_add_input(&en_lflow, &en_northd, NULL);
> > +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
> >
> >  struct engine_arg engine_arg = {
> >  .nb_idl = nb->idl,
> > @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  chassis_hostname_index_create(sb->idl);
> >  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
> >  = static_mac_binding_index_create(sb->idl);
> > +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
> > += mac_binding_by_datapath_index_create(sb->idl);
> >
> >  engine_init(&en_lflow, &engine_arg);
> >
> > @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
> >  "sbrec_static_mac_binding_by_lport_ip",
> >  sbrec_static_mac_binding_by_lport_ip);
> > +engine_ovsdb_node_add_index(&en_sb_mac_binding,
> > +"sbrec_mac_binding_by_datapath",
> > +sbrec_mac_binding_by_datapath);
> >  }
> >
> >  void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
> > diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
> > new file mode 100644
> > index 0..8af477ff1
> > --- /dev/null
> > +++ b/northd/mac-binding-aging.c
> > @@ -0,0 +1,151 @@
> > +/* Copyright (c) 2022, Red Hat, Inc.
> 

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-22 Thread Ihar Hrachyshka
On Wed, Jul 20, 2022 at 4:50 AM Ales Musil  wrote:
>
> Add MAC binding aging mechanism, that utilizes
> the timestamp column of MAC_Binding table.
> When the MAC binding exceeds the threshold it is
> removed from SB DB, this is postponed only in case
> we receive update ARP with update to MAC address.
>
> The threshold is configurable via option
> "mac_binding_age_threshold" that can be specified
> for each logical router. The option is defaulting to
> 0 which means that by default the aging is disabled
> and the MAC binding rows will be persisted the same
> way as before.
>
> Reported-at: https://bugzilla.redhat.com/2084668
> Signed-off-by: Ales Musil 
> ---
> v3: Rebase on top of current main.
> Update according to the final conclusion.
> ---
>  northd/automake.mk |   2 +
>  northd/inc-proc-northd.c   |  13 
>  northd/mac-binding-aging.c | 151 +
>  northd/mac-binding-aging.h |  33 
>  ovn-nb.xml |   7 ++
>  5 files changed, 206 insertions(+)
>  create mode 100644 northd/mac-binding-aging.c
>  create mode 100644 northd/mac-binding-aging.h
>
> diff --git a/northd/automake.mk b/northd/automake.mk
> index 4862ec7b7..81582867d 100644
> --- a/northd/automake.mk
> +++ b/northd/automake.mk
> @@ -1,6 +1,8 @@
>  # ovn-northd
>  bin_PROGRAMS += northd/ovn-northd
>  northd_ovn_northd_SOURCES = \
> +   northd/mac-binding-aging.c \
> +   northd/mac-binding-aging.h \
> northd/northd.c \
> northd/northd.h \
> northd/ovn-northd.c \
> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> index 43093cb5a..4a3699106 100644
> --- a/northd/inc-proc-northd.c
> +++ b/northd/inc-proc-northd.c
> @@ -22,9 +22,11 @@
>  #include "ip-mcast-index.h"
>  #include "static-mac-binding-index.h"
>  #include "lib/inc-proc-eng.h"
> +#include "lib/mac-binding-index.h"
>  #include "lib/ovn-nb-idl.h"
>  #include "lib/ovn-sb-idl.h"
>  #include "mcast-group-index.h"
> +#include "northd/mac-binding-aging.h"
>  #include "openvswitch/poll-loop.h"
>  #include "openvswitch/vlog.h"
>  #include "inc-proc-northd.h"
> @@ -149,6 +151,8 @@ enum sb_engine_node {
>   * avoid sparse errors. */
>  static ENGINE_NODE(northd, "northd");
>  static ENGINE_NODE(lflow, "lflow");
> +static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
> +static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
>
>  void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>struct ovsdb_idl_loop *sb)
> @@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
>  engine_add_input(&en_northd, &en_sb_fdb, NULL);
>  engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
> +engine_add_input(&en_mac_binding_aging, &en_mac_binding_aging_waker, 
> NULL);
>  engine_add_input(&en_lflow, &en_nb_bfd, NULL);
>  engine_add_input(&en_lflow, &en_sb_bfd, NULL);
>  engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
>  engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
>  engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
>  engine_add_input(&en_lflow, &en_northd, NULL);
> +engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
>
>  struct engine_arg engine_arg = {
>  .nb_idl = nb->idl,
> @@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  chassis_hostname_index_create(sb->idl);
>  struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
>  = static_mac_binding_index_create(sb->idl);
> +struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
> += mac_binding_by_datapath_index_create(sb->idl);
>
>  engine_init(&en_lflow, &engine_arg);
>
> @@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
>  "sbrec_static_mac_binding_by_lport_ip",
>  sbrec_static_mac_binding_by_lport_ip);
> +engine_ovsdb_node_add_index(&en_sb_mac_binding,
> +"sbrec_mac_binding_by_datapath",
> +sbrec_mac_binding_by_datapath);
>  }
>
>  void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
> diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
> new file mode 100644
> index 0..8af477ff1
> --- /dev/null
> +++ b/northd/mac-binding-aging.c
> @@ -0,0 +1,151 @@
> +/* Copyright (c) 2022, Red Hat, Inc.
> + *
> + * Licensed under the Apache License, Version 2.0 (the "License");
> + * you may not use this file except in compliance with the License.
> + * You may obtain a copy of the License at:
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicabl

Re: [ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-20 Thread 0-day Robot
Bleep bloop.  Greetings Ales Musil, I am a robot and I have tried out your 
patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 84 characters long (recommended limit is 79)
#311 FILE: ovn-nb.xml:2397:
  type='{"type": "integer", "minInteger": 0, "maxInteger": 
4294967295}'>

Lines checked: 321, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email 
acon...@redhat.com

Thanks,
0-day Robot
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH ovn v3 4/6] northd: Add MAC binding aging mechanism

2022-07-20 Thread Ales Musil
Add MAC binding aging mechanism, that utilizes
the timestamp column of MAC_Binding table.
When the MAC binding exceeds the threshold it is
removed from SB DB, this is postponed only in case
we receive update ARP with update to MAC address.

The threshold is configurable via option
"mac_binding_age_threshold" that can be specified
for each logical router. The option is defaulting to
0 which means that by default the aging is disabled
and the MAC binding rows will be persisted the same
way as before.

Reported-at: https://bugzilla.redhat.com/2084668
Signed-off-by: Ales Musil 
---
v3: Rebase on top of current main.
Update according to the final conclusion.
---
 northd/automake.mk |   2 +
 northd/inc-proc-northd.c   |  13 
 northd/mac-binding-aging.c | 151 +
 northd/mac-binding-aging.h |  33 
 ovn-nb.xml |   7 ++
 5 files changed, 206 insertions(+)
 create mode 100644 northd/mac-binding-aging.c
 create mode 100644 northd/mac-binding-aging.h

diff --git a/northd/automake.mk b/northd/automake.mk
index 4862ec7b7..81582867d 100644
--- a/northd/automake.mk
+++ b/northd/automake.mk
@@ -1,6 +1,8 @@
 # ovn-northd
 bin_PROGRAMS += northd/ovn-northd
 northd_ovn_northd_SOURCES = \
+   northd/mac-binding-aging.c \
+   northd/mac-binding-aging.h \
northd/northd.c \
northd/northd.h \
northd/ovn-northd.c \
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 43093cb5a..4a3699106 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -22,9 +22,11 @@
 #include "ip-mcast-index.h"
 #include "static-mac-binding-index.h"
 #include "lib/inc-proc-eng.h"
+#include "lib/mac-binding-index.h"
 #include "lib/ovn-nb-idl.h"
 #include "lib/ovn-sb-idl.h"
 #include "mcast-group-index.h"
+#include "northd/mac-binding-aging.h"
 #include "openvswitch/poll-loop.h"
 #include "openvswitch/vlog.h"
 #include "inc-proc-northd.h"
@@ -149,6 +151,8 @@ enum sb_engine_node {
  * avoid sparse errors. */
 static ENGINE_NODE(northd, "northd");
 static ENGINE_NODE(lflow, "lflow");
+static ENGINE_NODE(mac_binding_aging, "mac_binding_aging");
+static ENGINE_NODE(mac_binding_aging_waker, "mac_binding_aging_waker");
 
 void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
   struct ovsdb_idl_loop *sb)
@@ -211,12 +215,16 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 engine_add_input(&en_northd, &en_sb_load_balancer, NULL);
 engine_add_input(&en_northd, &en_sb_fdb, NULL);
 engine_add_input(&en_northd, &en_sb_static_mac_binding, NULL);
+engine_add_input(&en_mac_binding_aging, &en_sb_mac_binding, NULL);
+engine_add_input(&en_mac_binding_aging, &en_northd, NULL);
+engine_add_input(&en_mac_binding_aging, &en_mac_binding_aging_waker, NULL);
 engine_add_input(&en_lflow, &en_nb_bfd, NULL);
 engine_add_input(&en_lflow, &en_sb_bfd, NULL);
 engine_add_input(&en_lflow, &en_sb_logical_flow, NULL);
 engine_add_input(&en_lflow, &en_sb_multicast_group, NULL);
 engine_add_input(&en_lflow, &en_sb_igmp_group, NULL);
 engine_add_input(&en_lflow, &en_northd, NULL);
+engine_add_input(&en_lflow, &en_mac_binding_aging, NULL);
 
 struct engine_arg engine_arg = {
 .nb_idl = nb->idl,
@@ -235,6 +243,8 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 chassis_hostname_index_create(sb->idl);
 struct ovsdb_idl_index *sbrec_static_mac_binding_by_lport_ip
 = static_mac_binding_index_create(sb->idl);
+struct ovsdb_idl_index *sbrec_mac_binding_by_datapath
+= mac_binding_by_datapath_index_create(sb->idl);
 
 engine_init(&en_lflow, &engine_arg);
 
@@ -256,6 +266,9 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 engine_ovsdb_node_add_index(&en_sb_static_mac_binding,
 "sbrec_static_mac_binding_by_lport_ip",
 sbrec_static_mac_binding_by_lport_ip);
+engine_ovsdb_node_add_index(&en_sb_mac_binding,
+"sbrec_mac_binding_by_datapath",
+sbrec_mac_binding_by_datapath);
 }
 
 void inc_proc_northd_run(struct ovsdb_idl_txn *ovnnb_txn,
diff --git a/northd/mac-binding-aging.c b/northd/mac-binding-aging.c
new file mode 100644
index 0..8af477ff1
--- /dev/null
+++ b/northd/mac-binding-aging.c
@@ -0,0 +1,151 @@
+/* Copyright (c) 2022, Red Hat, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations un