Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
On Tue, Jul 27, 2021 at 7:11 PM Han Zhou wrote: > > On Tue, Jul 27, 2021 at 3:03 PM Numan Siddique wrote: > > > > On Tue, Jul 27, 2021 at 4:00 PM Han Zhou wrote: > > > > > > On Tue, Jul 27, 2021 at 11:43 AM Numan Siddique wrote: > > > > > > > > On Tue, Jul 27, 2021 at 3:36 AM Han Zhou wrote: > > > > > > > > > > Thanks Numan. The commit title has a typo: s/plow/pflow. > > > > > > > > > > On Fri, Jul 16, 2021 at 4:55 AM wrote: > > > > > > > > > > > > From: Numan Siddique > > > > > > > > > > > > physical_run() maintains a local copy of local vif to ofports > > > > > > in a simap along with the chassis tunnel information. This patch > > > > > > removes this from the physical module and now stores it in the > > > > > > runtime_data engine node. This makes it easier to handle runtime > > > > > > data changes in pflow_output engine. > > > > > > > > > > > > The newly added handler pflow_output_runtime_data_handler() > returns > > > > > > false if a datapath is added or removed from the local_datapaths > > > > > > and handles the logical port claims and releases incrementally. > > > > > > > > > > > > Signed-off-by: Numan Siddique > > > > > > --- > > > > > > controller/binding.c| 39 ++-- > > > > > > controller/binding.h| 23 +++ > > > > > > controller/ldata.c | 169 > > > > > > controller/ldata.h | 44 + > > > > > > controller/lflow.c | 5 +- > > > > > > controller/lflow.h | 1 + > > > > > > controller/ovn-controller.c | 68 ++- > > > > > > controller/ovn-controller.h | 8 - > > > > > > controller/physical.c | 382 > > > +--- > > > > > > controller/physical.h | 13 +- > > > > > > 10 files changed, 422 insertions(+), 330 deletions(-) > > > > > > > > > > > > diff --git a/controller/binding.c b/controller/binding.c > > > > > > index 0fd951ad7..b50139726 100644 > > > > > > --- a/controller/binding.c > > > > > > +++ b/controller/binding.c > > > > > > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct > > > > > sbrec_port_binding *pb, > > > > > > } > > > > > > } > > > > > > > > > > > > -/* Corresponds to each Port_Binding.type. */ > > > > > > -enum en_lport_type { > > > > > > -LP_UNKNOWN, > > > > > > -LP_VIF, > > > > > > -LP_CONTAINER, > > > > > > -LP_PATCH, > > > > > > -LP_L3GATEWAY, > > > > > > -LP_LOCALNET, > > > > > > -LP_LOCALPORT, > > > > > > -LP_L2GATEWAY, > > > > > > -LP_VTEP, > > > > > > -LP_CHASSISREDIRECT, > > > > > > -LP_VIRTUAL, > > > > > > -LP_EXTERNAL, > > > > > > -LP_REMOTE > > > > > > -}; > > > > > > - > > > > > > /* 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 > > > > > > @@ -616,7 +599,7 @@ static struct local_binding > *local_binding_create( > > > > > > static void local_binding_add(struct shash *local_bindings, > > > > > >struct local_binding *); > > > > > > static struct local_binding *local_binding_find( > > > > > > -struct shash *local_bindings, const char *name); > > > > > > +const struct shash *local_bindings, const char *name); > > > > > > static void local_binding_destroy(struct local_binding *, > > > > > >struct shash *binding_lports); > > > > > > static void local_binding_delete(struct local_binding *, > > > > > > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct > > > local_binding_data > > > > > *lbinding_data) > > > > > > } > > > > > > > > > > > > const struct sbrec_port_binding * > > > > > > -local_binding_get_primary_pb(struct shash *local_bindings, const > char > > > > > *pb_name) > > > > > > +local_binding_get_primary_pb(struct shash *local_bindings, > > > > > > + const char *pb_name) > > > > > > { > > > > > > struct local_binding *lbinding = > > > > > > local_binding_find(local_bindings, pb_name); > > > > > > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash > > > > > *local_bindings, const char *pb_name) > > > > > > return b_lport ? b_lport->pb : NULL; > > > > > > } > > > > > > > > > > > > +ofp_port_t > > > > > > +local_binding_get_lport_ofport(const struct shash > *local_bindings, > > > > > > + const char *pb_name) > > > > > > +{ > > > > > > +struct local_binding *lbinding = > > > > > > +local_binding_find(local_bindings, pb_name); > > > > > > +struct binding_lport *b_lport = > > > > > > +local_binding_get_primary_or_localport_lport(lbinding); > > > > > > + > > > > > > +return (b_lport && lbinding->iface && > lbinding->iface->n_ofport) > > > ? > > > > > > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > > > > > > +} > > > > > > + > > > > > > bool > > > > > >
Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
On Tue, Jul 27, 2021 at 3:03 PM Numan Siddique wrote: > > On Tue, Jul 27, 2021 at 4:00 PM Han Zhou wrote: > > > > On Tue, Jul 27, 2021 at 11:43 AM Numan Siddique wrote: > > > > > > On Tue, Jul 27, 2021 at 3:36 AM Han Zhou wrote: > > > > > > > > Thanks Numan. The commit title has a typo: s/plow/pflow. > > > > > > > > On Fri, Jul 16, 2021 at 4:55 AM wrote: > > > > > > > > > > From: Numan Siddique > > > > > > > > > > physical_run() maintains a local copy of local vif to ofports > > > > > in a simap along with the chassis tunnel information. This patch > > > > > removes this from the physical module and now stores it in the > > > > > runtime_data engine node. This makes it easier to handle runtime > > > > > data changes in pflow_output engine. > > > > > > > > > > The newly added handler pflow_output_runtime_data_handler() returns > > > > > false if a datapath is added or removed from the local_datapaths > > > > > and handles the logical port claims and releases incrementally. > > > > > > > > > > Signed-off-by: Numan Siddique > > > > > --- > > > > > controller/binding.c| 39 ++-- > > > > > controller/binding.h| 23 +++ > > > > > controller/ldata.c | 169 > > > > > controller/ldata.h | 44 + > > > > > controller/lflow.c | 5 +- > > > > > controller/lflow.h | 1 + > > > > > controller/ovn-controller.c | 68 ++- > > > > > controller/ovn-controller.h | 8 - > > > > > controller/physical.c | 382 > > +--- > > > > > controller/physical.h | 13 +- > > > > > 10 files changed, 422 insertions(+), 330 deletions(-) > > > > > > > > > > diff --git a/controller/binding.c b/controller/binding.c > > > > > index 0fd951ad7..b50139726 100644 > > > > > --- a/controller/binding.c > > > > > +++ b/controller/binding.c > > > > > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct > > > > sbrec_port_binding *pb, > > > > > } > > > > > } > > > > > > > > > > -/* Corresponds to each Port_Binding.type. */ > > > > > -enum en_lport_type { > > > > > -LP_UNKNOWN, > > > > > -LP_VIF, > > > > > -LP_CONTAINER, > > > > > -LP_PATCH, > > > > > -LP_L3GATEWAY, > > > > > -LP_LOCALNET, > > > > > -LP_LOCALPORT, > > > > > -LP_L2GATEWAY, > > > > > -LP_VTEP, > > > > > -LP_CHASSISREDIRECT, > > > > > -LP_VIRTUAL, > > > > > -LP_EXTERNAL, > > > > > -LP_REMOTE > > > > > -}; > > > > > - > > > > > /* 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 > > > > > @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( > > > > > static void local_binding_add(struct shash *local_bindings, > > > > >struct local_binding *); > > > > > static struct local_binding *local_binding_find( > > > > > -struct shash *local_bindings, const char *name); > > > > > +const struct shash *local_bindings, const char *name); > > > > > static void local_binding_destroy(struct local_binding *, > > > > >struct shash *binding_lports); > > > > > static void local_binding_delete(struct local_binding *, > > > > > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct > > local_binding_data > > > > *lbinding_data) > > > > > } > > > > > > > > > > const struct sbrec_port_binding * > > > > > -local_binding_get_primary_pb(struct shash *local_bindings, const char > > > > *pb_name) > > > > > +local_binding_get_primary_pb(struct shash *local_bindings, > > > > > + const char *pb_name) > > > > > { > > > > > struct local_binding *lbinding = > > > > > local_binding_find(local_bindings, pb_name); > > > > > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash > > > > *local_bindings, const char *pb_name) > > > > > return b_lport ? b_lport->pb : NULL; > > > > > } > > > > > > > > > > +ofp_port_t > > > > > +local_binding_get_lport_ofport(const struct shash *local_bindings, > > > > > + const char *pb_name) > > > > > +{ > > > > > +struct local_binding *lbinding = > > > > > +local_binding_find(local_bindings, pb_name); > > > > > +struct binding_lport *b_lport = > > > > > +local_binding_get_primary_or_localport_lport(lbinding); > > > > > + > > > > > +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) > > ? > > > > > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > > > > > +} > > > > > + > > > > > bool > > > > > local_binding_is_up(struct shash *local_bindings, const char > > *pb_name) > > > > > { > > > > > @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) > > > > > return !pb->type[0]; > > > > > } > > > > > > > > > > -static enum en_lport_type > > > > > +enum en_lport_type > > >
Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
On Tue, Jul 27, 2021 at 4:00 PM Han Zhou wrote: > > On Tue, Jul 27, 2021 at 11:43 AM Numan Siddique wrote: > > > > On Tue, Jul 27, 2021 at 3:36 AM Han Zhou wrote: > > > > > > Thanks Numan. The commit title has a typo: s/plow/pflow. > > > > > > On Fri, Jul 16, 2021 at 4:55 AM wrote: > > > > > > > > From: Numan Siddique > > > > > > > > physical_run() maintains a local copy of local vif to ofports > > > > in a simap along with the chassis tunnel information. This patch > > > > removes this from the physical module and now stores it in the > > > > runtime_data engine node. This makes it easier to handle runtime > > > > data changes in pflow_output engine. > > > > > > > > The newly added handler pflow_output_runtime_data_handler() returns > > > > false if a datapath is added or removed from the local_datapaths > > > > and handles the logical port claims and releases incrementally. > > > > > > > > Signed-off-by: Numan Siddique > > > > --- > > > > controller/binding.c| 39 ++-- > > > > controller/binding.h| 23 +++ > > > > controller/ldata.c | 169 > > > > controller/ldata.h | 44 + > > > > controller/lflow.c | 5 +- > > > > controller/lflow.h | 1 + > > > > controller/ovn-controller.c | 68 ++- > > > > controller/ovn-controller.h | 8 - > > > > controller/physical.c | 382 > +--- > > > > controller/physical.h | 13 +- > > > > 10 files changed, 422 insertions(+), 330 deletions(-) > > > > > > > > diff --git a/controller/binding.c b/controller/binding.c > > > > index 0fd951ad7..b50139726 100644 > > > > --- a/controller/binding.c > > > > +++ b/controller/binding.c > > > > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct > > > sbrec_port_binding *pb, > > > > } > > > > } > > > > > > > > -/* Corresponds to each Port_Binding.type. */ > > > > -enum en_lport_type { > > > > -LP_UNKNOWN, > > > > -LP_VIF, > > > > -LP_CONTAINER, > > > > -LP_PATCH, > > > > -LP_L3GATEWAY, > > > > -LP_LOCALNET, > > > > -LP_LOCALPORT, > > > > -LP_L2GATEWAY, > > > > -LP_VTEP, > > > > -LP_CHASSISREDIRECT, > > > > -LP_VIRTUAL, > > > > -LP_EXTERNAL, > > > > -LP_REMOTE > > > > -}; > > > > - > > > > /* 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 > > > > @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( > > > > static void local_binding_add(struct shash *local_bindings, > > > >struct local_binding *); > > > > static struct local_binding *local_binding_find( > > > > -struct shash *local_bindings, const char *name); > > > > +const struct shash *local_bindings, const char *name); > > > > static void local_binding_destroy(struct local_binding *, > > > >struct shash *binding_lports); > > > > static void local_binding_delete(struct local_binding *, > > > > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct > local_binding_data > > > *lbinding_data) > > > > } > > > > > > > > const struct sbrec_port_binding * > > > > -local_binding_get_primary_pb(struct shash *local_bindings, const char > > > *pb_name) > > > > +local_binding_get_primary_pb(struct shash *local_bindings, > > > > + const char *pb_name) > > > > { > > > > struct local_binding *lbinding = > > > > local_binding_find(local_bindings, pb_name); > > > > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash > > > *local_bindings, const char *pb_name) > > > > return b_lport ? b_lport->pb : NULL; > > > > } > > > > > > > > +ofp_port_t > > > > +local_binding_get_lport_ofport(const struct shash *local_bindings, > > > > + const char *pb_name) > > > > +{ > > > > +struct local_binding *lbinding = > > > > +local_binding_find(local_bindings, pb_name); > > > > +struct binding_lport *b_lport = > > > > +local_binding_get_primary_or_localport_lport(lbinding); > > > > + > > > > +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) > ? > > > > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > > > > +} > > > > + > > > > bool > > > > local_binding_is_up(struct shash *local_bindings, const char > *pb_name) > > > > { > > > > @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) > > > > return !pb->type[0]; > > > > } > > > > > > > > -static enum en_lport_type > > > > +enum en_lport_type > > > > get_lport_type(const struct sbrec_port_binding *pb) > > > > { > > > > if (is_lport_vif(pb)) { > > > > @@ -2555,7 +2552,7 @@ local_binding_create(const char *name, const > struct > > > ovsrec_interface *iface) > > > > } > > > > > > > > static struct local_binding * > > > >
Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
On Tue, Jul 27, 2021 at 11:43 AM Numan Siddique wrote: > > On Tue, Jul 27, 2021 at 3:36 AM Han Zhou wrote: > > > > Thanks Numan. The commit title has a typo: s/plow/pflow. > > > > On Fri, Jul 16, 2021 at 4:55 AM wrote: > > > > > > From: Numan Siddique > > > > > > physical_run() maintains a local copy of local vif to ofports > > > in a simap along with the chassis tunnel information. This patch > > > removes this from the physical module and now stores it in the > > > runtime_data engine node. This makes it easier to handle runtime > > > data changes in pflow_output engine. > > > > > > The newly added handler pflow_output_runtime_data_handler() returns > > > false if a datapath is added or removed from the local_datapaths > > > and handles the logical port claims and releases incrementally. > > > > > > Signed-off-by: Numan Siddique > > > --- > > > controller/binding.c| 39 ++-- > > > controller/binding.h| 23 +++ > > > controller/ldata.c | 169 > > > controller/ldata.h | 44 + > > > controller/lflow.c | 5 +- > > > controller/lflow.h | 1 + > > > controller/ovn-controller.c | 68 ++- > > > controller/ovn-controller.h | 8 - > > > controller/physical.c | 382 +--- > > > controller/physical.h | 13 +- > > > 10 files changed, 422 insertions(+), 330 deletions(-) > > > > > > diff --git a/controller/binding.c b/controller/binding.c > > > index 0fd951ad7..b50139726 100644 > > > --- a/controller/binding.c > > > +++ b/controller/binding.c > > > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct > > sbrec_port_binding *pb, > > > } > > > } > > > > > > -/* Corresponds to each Port_Binding.type. */ > > > -enum en_lport_type { > > > -LP_UNKNOWN, > > > -LP_VIF, > > > -LP_CONTAINER, > > > -LP_PATCH, > > > -LP_L3GATEWAY, > > > -LP_LOCALNET, > > > -LP_LOCALPORT, > > > -LP_L2GATEWAY, > > > -LP_VTEP, > > > -LP_CHASSISREDIRECT, > > > -LP_VIRTUAL, > > > -LP_EXTERNAL, > > > -LP_REMOTE > > > -}; > > > - > > > /* 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 > > > @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( > > > static void local_binding_add(struct shash *local_bindings, > > >struct local_binding *); > > > static struct local_binding *local_binding_find( > > > -struct shash *local_bindings, const char *name); > > > +const struct shash *local_bindings, const char *name); > > > static void local_binding_destroy(struct local_binding *, > > >struct shash *binding_lports); > > > static void local_binding_delete(struct local_binding *, > > > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct local_binding_data > > *lbinding_data) > > > } > > > > > > const struct sbrec_port_binding * > > > -local_binding_get_primary_pb(struct shash *local_bindings, const char > > *pb_name) > > > +local_binding_get_primary_pb(struct shash *local_bindings, > > > + const char *pb_name) > > > { > > > struct local_binding *lbinding = > > > local_binding_find(local_bindings, pb_name); > > > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash > > *local_bindings, const char *pb_name) > > > return b_lport ? b_lport->pb : NULL; > > > } > > > > > > +ofp_port_t > > > +local_binding_get_lport_ofport(const struct shash *local_bindings, > > > + const char *pb_name) > > > +{ > > > +struct local_binding *lbinding = > > > +local_binding_find(local_bindings, pb_name); > > > +struct binding_lport *b_lport = > > > +local_binding_get_primary_or_localport_lport(lbinding); > > > + > > > +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) ? > > > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > > > +} > > > + > > > bool > > > local_binding_is_up(struct shash *local_bindings, const char *pb_name) > > > { > > > @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) > > > return !pb->type[0]; > > > } > > > > > > -static enum en_lport_type > > > +enum en_lport_type > > > get_lport_type(const struct sbrec_port_binding *pb) > > > { > > > if (is_lport_vif(pb)) { > > > @@ -2555,7 +2552,7 @@ local_binding_create(const char *name, const struct > > ovsrec_interface *iface) > > > } > > > > > > static struct local_binding * > > > -local_binding_find(struct shash *local_bindings, const char *name) > > > +local_binding_find(const struct shash *local_bindings, const char *name) > > > { > > > return shash_find_data(local_bindings, name); > > > } > > > diff --git a/controller/binding.h b/controller/binding.h > > > index
Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
On Tue, Jul 27, 2021 at 3:36 AM Han Zhou wrote: > > Thanks Numan. The commit title has a typo: s/plow/pflow. > > On Fri, Jul 16, 2021 at 4:55 AM wrote: > > > > From: Numan Siddique > > > > physical_run() maintains a local copy of local vif to ofports > > in a simap along with the chassis tunnel information. This patch > > removes this from the physical module and now stores it in the > > runtime_data engine node. This makes it easier to handle runtime > > data changes in pflow_output engine. > > > > The newly added handler pflow_output_runtime_data_handler() returns > > false if a datapath is added or removed from the local_datapaths > > and handles the logical port claims and releases incrementally. > > > > Signed-off-by: Numan Siddique > > --- > > controller/binding.c| 39 ++-- > > controller/binding.h| 23 +++ > > controller/ldata.c | 169 > > controller/ldata.h | 44 + > > controller/lflow.c | 5 +- > > controller/lflow.h | 1 + > > controller/ovn-controller.c | 68 ++- > > controller/ovn-controller.h | 8 - > > controller/physical.c | 382 +--- > > controller/physical.h | 13 +- > > 10 files changed, 422 insertions(+), 330 deletions(-) > > > > diff --git a/controller/binding.c b/controller/binding.c > > index 0fd951ad7..b50139726 100644 > > --- a/controller/binding.c > > +++ b/controller/binding.c > > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct > sbrec_port_binding *pb, > > } > > } > > > > -/* Corresponds to each Port_Binding.type. */ > > -enum en_lport_type { > > -LP_UNKNOWN, > > -LP_VIF, > > -LP_CONTAINER, > > -LP_PATCH, > > -LP_L3GATEWAY, > > -LP_LOCALNET, > > -LP_LOCALPORT, > > -LP_L2GATEWAY, > > -LP_VTEP, > > -LP_CHASSISREDIRECT, > > -LP_VIRTUAL, > > -LP_EXTERNAL, > > -LP_REMOTE > > -}; > > - > > /* 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 > > @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( > > static void local_binding_add(struct shash *local_bindings, > >struct local_binding *); > > static struct local_binding *local_binding_find( > > -struct shash *local_bindings, const char *name); > > +const struct shash *local_bindings, const char *name); > > static void local_binding_destroy(struct local_binding *, > >struct shash *binding_lports); > > static void local_binding_delete(struct local_binding *, > > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct local_binding_data > *lbinding_data) > > } > > > > const struct sbrec_port_binding * > > -local_binding_get_primary_pb(struct shash *local_bindings, const char > *pb_name) > > +local_binding_get_primary_pb(struct shash *local_bindings, > > + const char *pb_name) > > { > > struct local_binding *lbinding = > > local_binding_find(local_bindings, pb_name); > > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash > *local_bindings, const char *pb_name) > > return b_lport ? b_lport->pb : NULL; > > } > > > > +ofp_port_t > > +local_binding_get_lport_ofport(const struct shash *local_bindings, > > + const char *pb_name) > > +{ > > +struct local_binding *lbinding = > > +local_binding_find(local_bindings, pb_name); > > +struct binding_lport *b_lport = > > +local_binding_get_primary_or_localport_lport(lbinding); > > + > > +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) ? > > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > > +} > > + > > bool > > local_binding_is_up(struct shash *local_bindings, const char *pb_name) > > { > > @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) > > return !pb->type[0]; > > } > > > > -static enum en_lport_type > > +enum en_lport_type > > get_lport_type(const struct sbrec_port_binding *pb) > > { > > if (is_lport_vif(pb)) { > > @@ -2555,7 +2552,7 @@ local_binding_create(const char *name, const struct > ovsrec_interface *iface) > > } > > > > static struct local_binding * > > -local_binding_find(struct shash *local_bindings, const char *name) > > +local_binding_find(const struct shash *local_bindings, const char *name) > > { > > return shash_find_data(local_bindings, name); > > } > > diff --git a/controller/binding.h b/controller/binding.h > > index b1717bd2b..f1abc4b9c 100644 > > --- a/controller/binding.h > > +++ b/controller/binding.h > > @@ -114,6 +114,9 @@ void local_binding_data_destroy(struct > local_binding_data *); > > > > const struct sbrec_port_binding *local_binding_get_primary_pb( > > struct shash *local_bindings, const char *pb_name); > >
Re: [ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
Thanks Numan. The commit title has a typo: s/plow/pflow. On Fri, Jul 16, 2021 at 4:55 AM wrote: > > From: Numan Siddique > > physical_run() maintains a local copy of local vif to ofports > in a simap along with the chassis tunnel information. This patch > removes this from the physical module and now stores it in the > runtime_data engine node. This makes it easier to handle runtime > data changes in pflow_output engine. > > The newly added handler pflow_output_runtime_data_handler() returns > false if a datapath is added or removed from the local_datapaths > and handles the logical port claims and releases incrementally. > > Signed-off-by: Numan Siddique > --- > controller/binding.c| 39 ++-- > controller/binding.h| 23 +++ > controller/ldata.c | 169 > controller/ldata.h | 44 + > controller/lflow.c | 5 +- > controller/lflow.h | 1 + > controller/ovn-controller.c | 68 ++- > controller/ovn-controller.h | 8 - > controller/physical.c | 382 +--- > controller/physical.h | 13 +- > 10 files changed, 422 insertions(+), 330 deletions(-) > > diff --git a/controller/binding.c b/controller/binding.c > index 0fd951ad7..b50139726 100644 > --- a/controller/binding.c > +++ b/controller/binding.c > @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct sbrec_port_binding *pb, > } > } > > -/* Corresponds to each Port_Binding.type. */ > -enum en_lport_type { > -LP_UNKNOWN, > -LP_VIF, > -LP_CONTAINER, > -LP_PATCH, > -LP_L3GATEWAY, > -LP_LOCALNET, > -LP_LOCALPORT, > -LP_L2GATEWAY, > -LP_VTEP, > -LP_CHASSISREDIRECT, > -LP_VIRTUAL, > -LP_EXTERNAL, > -LP_REMOTE > -}; > - > /* 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 > @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( > static void local_binding_add(struct shash *local_bindings, >struct local_binding *); > static struct local_binding *local_binding_find( > -struct shash *local_bindings, const char *name); > +const struct shash *local_bindings, const char *name); > static void local_binding_destroy(struct local_binding *, >struct shash *binding_lports); > static void local_binding_delete(struct local_binding *, > @@ -701,7 +684,8 @@ local_binding_data_destroy(struct local_binding_data *lbinding_data) > } > > const struct sbrec_port_binding * > -local_binding_get_primary_pb(struct shash *local_bindings, const char *pb_name) > +local_binding_get_primary_pb(struct shash *local_bindings, > + const char *pb_name) > { > struct local_binding *lbinding = > local_binding_find(local_bindings, pb_name); > @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash *local_bindings, const char *pb_name) > return b_lport ? b_lport->pb : NULL; > } > > +ofp_port_t > +local_binding_get_lport_ofport(const struct shash *local_bindings, > + const char *pb_name) > +{ > +struct local_binding *lbinding = > +local_binding_find(local_bindings, pb_name); > +struct binding_lport *b_lport = > +local_binding_get_primary_or_localport_lport(lbinding); > + > +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) ? > +u16_to_ofp(lbinding->iface->ofport[0]) : 0; > +} > + > bool > local_binding_is_up(struct shash *local_bindings, const char *pb_name) > { > @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) > return !pb->type[0]; > } > > -static enum en_lport_type > +enum en_lport_type > get_lport_type(const struct sbrec_port_binding *pb) > { > if (is_lport_vif(pb)) { > @@ -2555,7 +2552,7 @@ local_binding_create(const char *name, const struct ovsrec_interface *iface) > } > > static struct local_binding * > -local_binding_find(struct shash *local_bindings, const char *name) > +local_binding_find(const struct shash *local_bindings, const char *name) > { > return shash_find_data(local_bindings, name); > } > diff --git a/controller/binding.h b/controller/binding.h > index b1717bd2b..f1abc4b9c 100644 > --- a/controller/binding.h > +++ b/controller/binding.h > @@ -114,6 +114,9 @@ void local_binding_data_destroy(struct local_binding_data *); > > const struct sbrec_port_binding *local_binding_get_primary_pb( > struct shash *local_bindings, const char *pb_name); > +ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, > + const char *pb_name); > + > bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); > bool local_binding_is_down(struct shash *local_bindings, const char *pb_name); > void
[ovs-dev] [PATCH ovn v2 4/5] I-P: Handle runtime data changes for plow_output engine.
From: Numan Siddique physical_run() maintains a local copy of local vif to ofports in a simap along with the chassis tunnel information. This patch removes this from the physical module and now stores it in the runtime_data engine node. This makes it easier to handle runtime data changes in pflow_output engine. The newly added handler pflow_output_runtime_data_handler() returns false if a datapath is added or removed from the local_datapaths and handles the logical port claims and releases incrementally. Signed-off-by: Numan Siddique --- controller/binding.c| 39 ++-- controller/binding.h| 23 +++ controller/ldata.c | 169 controller/ldata.h | 44 + controller/lflow.c | 5 +- controller/lflow.h | 1 + controller/ovn-controller.c | 68 ++- controller/ovn-controller.h | 8 - controller/physical.c | 382 +--- controller/physical.h | 13 +- 10 files changed, 422 insertions(+), 330 deletions(-) diff --git a/controller/binding.c b/controller/binding.c index 0fd951ad7..b50139726 100644 --- a/controller/binding.c +++ b/controller/binding.c @@ -546,23 +546,6 @@ update_active_pb_ras_pd(const struct sbrec_port_binding *pb, } } -/* Corresponds to each Port_Binding.type. */ -enum en_lport_type { -LP_UNKNOWN, -LP_VIF, -LP_CONTAINER, -LP_PATCH, -LP_L3GATEWAY, -LP_LOCALNET, -LP_LOCALPORT, -LP_L2GATEWAY, -LP_VTEP, -LP_CHASSISREDIRECT, -LP_VIRTUAL, -LP_EXTERNAL, -LP_REMOTE -}; - /* 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 @@ -616,7 +599,7 @@ static struct local_binding *local_binding_create( static void local_binding_add(struct shash *local_bindings, struct local_binding *); static struct local_binding *local_binding_find( -struct shash *local_bindings, const char *name); +const struct shash *local_bindings, const char *name); static void local_binding_destroy(struct local_binding *, struct shash *binding_lports); static void local_binding_delete(struct local_binding *, @@ -701,7 +684,8 @@ local_binding_data_destroy(struct local_binding_data *lbinding_data) } const struct sbrec_port_binding * -local_binding_get_primary_pb(struct shash *local_bindings, const char *pb_name) +local_binding_get_primary_pb(struct shash *local_bindings, + const char *pb_name) { struct local_binding *lbinding = local_binding_find(local_bindings, pb_name); @@ -710,6 +694,19 @@ local_binding_get_primary_pb(struct shash *local_bindings, const char *pb_name) return b_lport ? b_lport->pb : NULL; } +ofp_port_t +local_binding_get_lport_ofport(const struct shash *local_bindings, + const char *pb_name) +{ +struct local_binding *lbinding = +local_binding_find(local_bindings, pb_name); +struct binding_lport *b_lport = +local_binding_get_primary_or_localport_lport(lbinding); + +return (b_lport && lbinding->iface && lbinding->iface->n_ofport) ? +u16_to_ofp(lbinding->iface->ofport[0]) : 0; +} + bool local_binding_is_up(struct shash *local_bindings, const char *pb_name) { @@ -871,7 +868,7 @@ is_lport_vif(const struct sbrec_port_binding *pb) return !pb->type[0]; } -static enum en_lport_type +enum en_lport_type get_lport_type(const struct sbrec_port_binding *pb) { if (is_lport_vif(pb)) { @@ -2555,7 +2552,7 @@ local_binding_create(const char *name, const struct ovsrec_interface *iface) } static struct local_binding * -local_binding_find(struct shash *local_bindings, const char *name) +local_binding_find(const struct shash *local_bindings, const char *name) { return shash_find_data(local_bindings, name); } diff --git a/controller/binding.h b/controller/binding.h index b1717bd2b..f1abc4b9c 100644 --- a/controller/binding.h +++ b/controller/binding.h @@ -114,6 +114,9 @@ void local_binding_data_destroy(struct local_binding_data *); const struct sbrec_port_binding *local_binding_get_primary_pb( struct shash *local_bindings, const char *pb_name); +ofp_port_t local_binding_get_lport_ofport(const struct shash *local_bindings, + const char *pb_name); + bool local_binding_is_up(struct shash *local_bindings, const char *pb_name); bool local_binding_is_down(struct shash *local_bindings, const char *pb_name); void local_binding_set_up(struct shash *local_bindings, const char *pb_name, @@ -134,4 +137,24 @@ bool binding_handle_port_binding_changes(struct binding_ctx_in *, void binding_tracked_dp_destroy(struct hmap *tracked_datapaths); void binding_dump_local_bindings(struct local_binding_data *, struct ds *); + +/* Corresponds to each