Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-12-21 Thread Numan Siddique
On Thu, Dec 14, 2023 at 3:53 PM Numan Siddique  wrote:
>
> On Thu, Dec 14, 2023 at 12:32 PM Han Zhou  wrote:
> >
> > On Tue, Nov 14, 2023 at 10:42 PM Han Zhou  wrote:
> > >
> > >
> > >
> > > On Thu, Oct 26, 2023 at 11:16 AM  wrote:
> > > >
> > > > From: Numan Siddique 
> > > >
> > > > Previous commits added new engine nodes to store logical router's lb
> > > > and NAT data.  Make use of the data stored by these engine nodes
> > > > to generate logical flows related to router's LBs and NATs.
> > > >
> > > > Signed-off-by: Numan Siddique 
> > > > ---
> > > >  northd/en-lflow.c  |   3 -
> > > >  northd/en-lr-lb-nat-data.h |   4 +
> > > >  northd/inc-proc-northd.c   |   1 -
> > > >  northd/northd.c| 752 -
> > > >  northd/northd.h|   1 -
> > > >  5 files changed, 496 insertions(+), 265 deletions(-)
> > > >
> > > > diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> > > > index 9cb0ead3f0..229f4be1d0 100644
> > > > --- a/northd/en-lflow.c
> > > > +++ b/northd/en-lflow.c
> > > > @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
> > > >  engine_get_input_data("port_group", node);
> > > >  struct sync_meters_data *sync_meters_data =
> > > >  engine_get_input_data("sync_meters", node);
> > > > -struct ed_type_lr_nat_data *lr_nat_data =
> > > > -engine_get_input_data("lr_nat", node);
> > > >  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
> > > >  engine_get_input_data("lr_lb_nat_data", node);
> > > >
> > > > @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
> > > >  lflow_input->ls_ports = _data->ls_ports;
> > > >  lflow_input->lr_ports = _data->lr_ports;
> > > >  lflow_input->ls_port_groups = _data->ls_port_groups;
> > > > -lflow_input->lr_nats = _nat_data->lr_nats;
> > > >  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
> > > >  lflow_input->meter_groups = _meters_data->meter_groups;
> > > >  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> > > > diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> > > > index 9029aee339..ffe41cad73 100644
> > > > --- a/northd/en-lr-lb-nat-data.h
> > > > +++ b/northd/en-lr-lb-nat-data.h
> > > > @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
> > > >  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
> > > >  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
> > > >
> > > > +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID,
> > TABLE) \
> > > > +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> > > > +   &(TABLE)->entries)
> > > > +
> > > >  struct lr_lb_nat_data_tracked_data {
> > > >  /* Created or updated logical router with LB data. */
> > > >  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'.
> > */
> > > > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > > > index 369a151fa3..84627070a8 100644
> > > > --- a/northd/inc-proc-northd.c
> > > > +++ b/northd/inc-proc-northd.c
> > > > @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> > > >  engine_add_input(_lflow, _sb_igmp_group, NULL);
> > > >  engine_add_input(_lflow, _northd, lflow_northd_handler);
> > > >  engine_add_input(_lflow, _port_group,
> > lflow_port_group_handler);
> > > > -engine_add_input(_lflow, _lr_nat, NULL);
> > > >  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
> > > >
> > > >  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> > > > diff --git a/northd/northd.c b/northd/northd.c
> > > > index 24df14c0de..1877cbc7df 100644
> > > > --- a/northd/northd.c
> > > > +++ b/northd/northd.c
> > > > @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports,
> > struct ovs_list *lr_list)
> > > >   */
> > > >  static void
> > > >  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> > > > -   uint32_t priority,
> > > > -   struct ovn_datapath *od,
> > > > -   const struct lr_nat_table
> > *lr_nats,
> > > > -   struct hmap *lflows)
> > > > +uint32_t priority,
> > > > +const struct ovn_datapath *od,
> > > > +const struct lr_nat_record
> > *lrnat_rec,
> > > > +struct hmap *lflows)
> > > >  {
> > > >  struct ds eth_src = DS_EMPTY_INITIALIZER;
> > > >  struct ds match = DS_EMPTY_INITIALIZER;
> > > >
> > > > -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> > > > -lr_nats, op->od->index);
> > > > -ovs_assert(lrnat_rec);
> > > > -
> > > >  /* Self originated ARP requests/RARP/ND need to be flooded to the
> > L2 domain
> > > >   * (except on router 

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-12-14 Thread Numan Siddique
On Thu, Dec 14, 2023 at 12:32 PM Han Zhou  wrote:
>
> On Tue, Nov 14, 2023 at 10:42 PM Han Zhou  wrote:
> >
> >
> >
> > On Thu, Oct 26, 2023 at 11:16 AM  wrote:
> > >
> > > From: Numan Siddique 
> > >
> > > Previous commits added new engine nodes to store logical router's lb
> > > and NAT data.  Make use of the data stored by these engine nodes
> > > to generate logical flows related to router's LBs and NATs.
> > >
> > > Signed-off-by: Numan Siddique 
> > > ---
> > >  northd/en-lflow.c  |   3 -
> > >  northd/en-lr-lb-nat-data.h |   4 +
> > >  northd/inc-proc-northd.c   |   1 -
> > >  northd/northd.c| 752 -
> > >  northd/northd.h|   1 -
> > >  5 files changed, 496 insertions(+), 265 deletions(-)
> > >
> > > diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> > > index 9cb0ead3f0..229f4be1d0 100644
> > > --- a/northd/en-lflow.c
> > > +++ b/northd/en-lflow.c
> > > @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
> > >  engine_get_input_data("port_group", node);
> > >  struct sync_meters_data *sync_meters_data =
> > >  engine_get_input_data("sync_meters", node);
> > > -struct ed_type_lr_nat_data *lr_nat_data =
> > > -engine_get_input_data("lr_nat", node);
> > >  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
> > >  engine_get_input_data("lr_lb_nat_data", node);
> > >
> > > @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
> > >  lflow_input->ls_ports = _data->ls_ports;
> > >  lflow_input->lr_ports = _data->lr_ports;
> > >  lflow_input->ls_port_groups = _data->ls_port_groups;
> > > -lflow_input->lr_nats = _nat_data->lr_nats;
> > >  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
> > >  lflow_input->meter_groups = _meters_data->meter_groups;
> > >  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> > > diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> > > index 9029aee339..ffe41cad73 100644
> > > --- a/northd/en-lr-lb-nat-data.h
> > > +++ b/northd/en-lr-lb-nat-data.h
> > > @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
> > >  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
> > >  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
> > >
> > > +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID,
> TABLE) \
> > > +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> > > +   &(TABLE)->entries)
> > > +
> > >  struct lr_lb_nat_data_tracked_data {
> > >  /* Created or updated logical router with LB data. */
> > >  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'.
> */
> > > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > > index 369a151fa3..84627070a8 100644
> > > --- a/northd/inc-proc-northd.c
> > > +++ b/northd/inc-proc-northd.c
> > > @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> > >  engine_add_input(_lflow, _sb_igmp_group, NULL);
> > >  engine_add_input(_lflow, _northd, lflow_northd_handler);
> > >  engine_add_input(_lflow, _port_group,
> lflow_port_group_handler);
> > > -engine_add_input(_lflow, _lr_nat, NULL);
> > >  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
> > >
> > >  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> > > diff --git a/northd/northd.c b/northd/northd.c
> > > index 24df14c0de..1877cbc7df 100644
> > > --- a/northd/northd.c
> > > +++ b/northd/northd.c
> > > @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports,
> struct ovs_list *lr_list)
> > >   */
> > >  static void
> > >  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> > > -   uint32_t priority,
> > > -   struct ovn_datapath *od,
> > > -   const struct lr_nat_table
> *lr_nats,
> > > -   struct hmap *lflows)
> > > +uint32_t priority,
> > > +const struct ovn_datapath *od,
> > > +const struct lr_nat_record
> *lrnat_rec,
> > > +struct hmap *lflows)
> > >  {
> > >  struct ds eth_src = DS_EMPTY_INITIALIZER;
> > >  struct ds match = DS_EMPTY_INITIALIZER;
> > >
> > > -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> > > -lr_nats, op->od->index);
> > > -ovs_assert(lrnat_rec);
> > > -
> > >  /* Self originated ARP requests/RARP/ND need to be flooded to the
> L2 domain
> > >   * (except on router ports).  Determine that packets are self
> originated
> > >   * by also matching on source MAC. Matching on ingress port is not
> > > @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port
> *op,
> > >   */
> > >  static void
> > >  

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-12-14 Thread Han Zhou
On Tue, Nov 14, 2023 at 10:42 PM Han Zhou  wrote:
>
>
>
> On Thu, Oct 26, 2023 at 11:16 AM  wrote:
> >
> > From: Numan Siddique 
> >
> > Previous commits added new engine nodes to store logical router's lb
> > and NAT data.  Make use of the data stored by these engine nodes
> > to generate logical flows related to router's LBs and NATs.
> >
> > Signed-off-by: Numan Siddique 
> > ---
> >  northd/en-lflow.c  |   3 -
> >  northd/en-lr-lb-nat-data.h |   4 +
> >  northd/inc-proc-northd.c   |   1 -
> >  northd/northd.c| 752 -
> >  northd/northd.h|   1 -
> >  5 files changed, 496 insertions(+), 265 deletions(-)
> >
> > diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> > index 9cb0ead3f0..229f4be1d0 100644
> > --- a/northd/en-lflow.c
> > +++ b/northd/en-lflow.c
> > @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
> >  engine_get_input_data("port_group", node);
> >  struct sync_meters_data *sync_meters_data =
> >  engine_get_input_data("sync_meters", node);
> > -struct ed_type_lr_nat_data *lr_nat_data =
> > -engine_get_input_data("lr_nat", node);
> >  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
> >  engine_get_input_data("lr_lb_nat_data", node);
> >
> > @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
> >  lflow_input->ls_ports = _data->ls_ports;
> >  lflow_input->lr_ports = _data->lr_ports;
> >  lflow_input->ls_port_groups = _data->ls_port_groups;
> > -lflow_input->lr_nats = _nat_data->lr_nats;
> >  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
> >  lflow_input->meter_groups = _meters_data->meter_groups;
> >  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> > diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> > index 9029aee339..ffe41cad73 100644
> > --- a/northd/en-lr-lb-nat-data.h
> > +++ b/northd/en-lr-lb-nat-data.h
> > @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
> >  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
> >  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
> >
> > +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID,
TABLE) \
> > +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> > +   &(TABLE)->entries)
> > +
> >  struct lr_lb_nat_data_tracked_data {
> >  /* Created or updated logical router with LB data. */
> >  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'.
*/
> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > index 369a151fa3..84627070a8 100644
> > --- a/northd/inc-proc-northd.c
> > +++ b/northd/inc-proc-northd.c
> > @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  engine_add_input(_lflow, _sb_igmp_group, NULL);
> >  engine_add_input(_lflow, _northd, lflow_northd_handler);
> >  engine_add_input(_lflow, _port_group,
lflow_port_group_handler);
> > -engine_add_input(_lflow, _lr_nat, NULL);
> >  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
> >
> >  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> > diff --git a/northd/northd.c b/northd/northd.c
> > index 24df14c0de..1877cbc7df 100644
> > --- a/northd/northd.c
> > +++ b/northd/northd.c
> > @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports,
struct ovs_list *lr_list)
> >   */
> >  static void
> >  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> > -   uint32_t priority,
> > -   struct ovn_datapath *od,
> > -   const struct lr_nat_table
*lr_nats,
> > -   struct hmap *lflows)
> > +uint32_t priority,
> > +const struct ovn_datapath *od,
> > +const struct lr_nat_record
*lrnat_rec,
> > +struct hmap *lflows)
> >  {
> >  struct ds eth_src = DS_EMPTY_INITIALIZER;
> >  struct ds match = DS_EMPTY_INITIALIZER;
> >
> > -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> > -lr_nats, op->od->index);
> > -ovs_assert(lrnat_rec);
> > -
> >  /* Self originated ARP requests/RARP/ND need to be flooded to the
L2 domain
> >   * (except on router ports).  Determine that packets are self
originated
> >   * by also matching on source MAC. Matching on ingress port is not
> > @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port
*op,
> >   */
> >  static void
> >  build_lswitch_rport_arp_req_flow(const char *ips,
> > -int addr_family, struct ovn_port *patch_op, struct ovn_datapath
*od,
> > +int addr_family, struct ovn_port *patch_op,
> > +const struct ovn_datapath *od,
> >  uint32_t priority, struct hmap *lflows,
> >  const 

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-12-08 Thread Dumitru Ceara
On 12/6/23 04:38, Numan Siddique wrote:
> On Thu, Nov 23, 2023 at 4:15 PM Dumitru Ceara  wrote:
>>
>> On 10/26/23 20:15, num...@ovn.org wrote:
>>> From: Numan Siddique 
>>>
>>> Previous commits added new engine nodes to store logical router's lb
>>> and NAT data.  Make use of the data stored by these engine nodes
>>> to generate logical flows related to router's LBs and NATs.
>>>
>>> Signed-off-by: Numan Siddique 
>>> ---
>>>  northd/en-lflow.c  |   3 -
>>>  northd/en-lr-lb-nat-data.h |   4 +
>>>  northd/inc-proc-northd.c   |   1 -
>>>  northd/northd.c| 752 -
>>>  northd/northd.h|   1 -
>>>  5 files changed, 496 insertions(+), 265 deletions(-)
>>>
>>> diff --git a/northd/en-lflow.c b/northd/en-lflow.c
>>> index 9cb0ead3f0..229f4be1d0 100644
>>> --- a/northd/en-lflow.c
>>> +++ b/northd/en-lflow.c
>>> @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
>>>  engine_get_input_data("port_group", node);
>>>  struct sync_meters_data *sync_meters_data =
>>>  engine_get_input_data("sync_meters", node);
>>> -struct ed_type_lr_nat_data *lr_nat_data =
>>> -engine_get_input_data("lr_nat", node);
>>>  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
>>>  engine_get_input_data("lr_lb_nat_data", node);
>>>
>>> @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
>>>  lflow_input->ls_ports = _data->ls_ports;
>>>  lflow_input->lr_ports = _data->lr_ports;
>>>  lflow_input->ls_port_groups = _data->ls_port_groups;
>>> -lflow_input->lr_nats = _nat_data->lr_nats;
>>>  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
>>>  lflow_input->meter_groups = _meters_data->meter_groups;
>>>  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
>>> diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
>>> index 9029aee339..ffe41cad73 100644
>>> --- a/northd/en-lr-lb-nat-data.h
>>> +++ b/northd/en-lr-lb-nat-data.h
>>> @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
>>>  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
>>>  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
>>>
>>> +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID, TABLE) \
>>> +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
>>> +   &(TABLE)->entries)
>>> +
>>>  struct lr_lb_nat_data_tracked_data {
>>>  /* Created or updated logical router with LB data. */
>>>  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'. */
>>> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
>>> index 369a151fa3..84627070a8 100644
>>> --- a/northd/inc-proc-northd.c
>>> +++ b/northd/inc-proc-northd.c
>>> @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>>>  engine_add_input(_lflow, _sb_igmp_group, NULL);
>>>  engine_add_input(_lflow, _northd, lflow_northd_handler);
>>>  engine_add_input(_lflow, _port_group, lflow_port_group_handler);
>>> -engine_add_input(_lflow, _lr_nat, NULL);
>>
>> Was this supposed to go in the previous patch, the one that adds
>> en_lr_lb_nat_data?
> 
> Yes.  It should have been.  Addressed in v3.
> 
> Thanks
> 
> 
> 
>>
>>>  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
>>>
>>>  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
>>> diff --git a/northd/northd.c b/northd/northd.c
>>> index 24df14c0de..1877cbc7df 100644
>>> --- a/northd/northd.c
>>> +++ b/northd/northd.c
>>> @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports, struct 
>>> ovs_list *lr_list)
>>>   */
>>>  static void
>>>  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
>>> -   uint32_t priority,
>>> -   struct ovn_datapath *od,
>>> -   const struct lr_nat_table 
>>> *lr_nats,
>>> -   struct hmap *lflows)
>>> +uint32_t priority,
>>> +const struct ovn_datapath *od,
>>> +const struct lr_nat_record 
>>> *lrnat_rec,
>>> +struct hmap *lflows)
>>
>>
>> Nit: indentation.
> 
> I had to do this way to keep under 80.
> 
> 
>>
>>>  {
>>>  struct ds eth_src = DS_EMPTY_INITIALIZER;
>>>  struct ds match = DS_EMPTY_INITIALIZER;
>>>
>>> -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
>>> -lr_nats, op->od->index);
>>> -ovs_assert(lrnat_rec);
>>> -
>>>  /* Self originated ARP requests/RARP/ND need to be flooded to the L2 
>>> domain
>>>   * (except on router ports).  Determine that packets are self 
>>> originated
>>>   * by also matching on source MAC. Matching on ingress port is not
>>> @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port *op,
>>>   

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-12-05 Thread Numan Siddique
On Thu, Nov 23, 2023 at 4:15 PM Dumitru Ceara  wrote:
>
> On 10/26/23 20:15, num...@ovn.org wrote:
> > From: Numan Siddique 
> >
> > Previous commits added new engine nodes to store logical router's lb
> > and NAT data.  Make use of the data stored by these engine nodes
> > to generate logical flows related to router's LBs and NATs.
> >
> > Signed-off-by: Numan Siddique 
> > ---
> >  northd/en-lflow.c  |   3 -
> >  northd/en-lr-lb-nat-data.h |   4 +
> >  northd/inc-proc-northd.c   |   1 -
> >  northd/northd.c| 752 -
> >  northd/northd.h|   1 -
> >  5 files changed, 496 insertions(+), 265 deletions(-)
> >
> > diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> > index 9cb0ead3f0..229f4be1d0 100644
> > --- a/northd/en-lflow.c
> > +++ b/northd/en-lflow.c
> > @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
> >  engine_get_input_data("port_group", node);
> >  struct sync_meters_data *sync_meters_data =
> >  engine_get_input_data("sync_meters", node);
> > -struct ed_type_lr_nat_data *lr_nat_data =
> > -engine_get_input_data("lr_nat", node);
> >  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
> >  engine_get_input_data("lr_lb_nat_data", node);
> >
> > @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
> >  lflow_input->ls_ports = _data->ls_ports;
> >  lflow_input->lr_ports = _data->lr_ports;
> >  lflow_input->ls_port_groups = _data->ls_port_groups;
> > -lflow_input->lr_nats = _nat_data->lr_nats;
> >  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
> >  lflow_input->meter_groups = _meters_data->meter_groups;
> >  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> > diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> > index 9029aee339..ffe41cad73 100644
> > --- a/northd/en-lr-lb-nat-data.h
> > +++ b/northd/en-lr-lb-nat-data.h
> > @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
> >  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
> >  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
> >
> > +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID, TABLE) \
> > +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> > +   &(TABLE)->entries)
> > +
> >  struct lr_lb_nat_data_tracked_data {
> >  /* Created or updated logical router with LB data. */
> >  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'. */
> > diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> > index 369a151fa3..84627070a8 100644
> > --- a/northd/inc-proc-northd.c
> > +++ b/northd/inc-proc-northd.c
> > @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
> >  engine_add_input(_lflow, _sb_igmp_group, NULL);
> >  engine_add_input(_lflow, _northd, lflow_northd_handler);
> >  engine_add_input(_lflow, _port_group, lflow_port_group_handler);
> > -engine_add_input(_lflow, _lr_nat, NULL);
>
> Was this supposed to go in the previous patch, the one that adds
> en_lr_lb_nat_data?

Yes.  It should have been.  Addressed in v3.

Thanks



>
> >  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
> >
> >  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> > diff --git a/northd/northd.c b/northd/northd.c
> > index 24df14c0de..1877cbc7df 100644
> > --- a/northd/northd.c
> > +++ b/northd/northd.c
> > @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports, struct 
> > ovs_list *lr_list)
> >   */
> >  static void
> >  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> > -   uint32_t priority,
> > -   struct ovn_datapath *od,
> > -   const struct lr_nat_table 
> > *lr_nats,
> > -   struct hmap *lflows)
> > +uint32_t priority,
> > +const struct ovn_datapath *od,
> > +const struct lr_nat_record 
> > *lrnat_rec,
> > +struct hmap *lflows)
>
>
> Nit: indentation.

I had to do this way to keep under 80.


>
> >  {
> >  struct ds eth_src = DS_EMPTY_INITIALIZER;
> >  struct ds match = DS_EMPTY_INITIALIZER;
> >
> > -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> > -lr_nats, op->od->index);
> > -ovs_assert(lrnat_rec);
> > -
> >  /* Self originated ARP requests/RARP/ND need to be flooded to the L2 
> > domain
> >   * (except on router ports).  Determine that packets are self 
> > originated
> >   * by also matching on source MAC. Matching on ingress port is not
> > @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port *op,
> >   */
> >  static void
> >  build_lswitch_rport_arp_req_flow(const char *ips,

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-11-23 Thread Dumitru Ceara
On 10/26/23 20:15, num...@ovn.org wrote:
> From: Numan Siddique 
> 
> Previous commits added new engine nodes to store logical router's lb
> and NAT data.  Make use of the data stored by these engine nodes
> to generate logical flows related to router's LBs and NATs.
> 
> Signed-off-by: Numan Siddique 
> ---
>  northd/en-lflow.c  |   3 -
>  northd/en-lr-lb-nat-data.h |   4 +
>  northd/inc-proc-northd.c   |   1 -
>  northd/northd.c| 752 -
>  northd/northd.h|   1 -
>  5 files changed, 496 insertions(+), 265 deletions(-)
> 
> diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> index 9cb0ead3f0..229f4be1d0 100644
> --- a/northd/en-lflow.c
> +++ b/northd/en-lflow.c
> @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
>  engine_get_input_data("port_group", node);
>  struct sync_meters_data *sync_meters_data =
>  engine_get_input_data("sync_meters", node);
> -struct ed_type_lr_nat_data *lr_nat_data =
> -engine_get_input_data("lr_nat", node);
>  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
>  engine_get_input_data("lr_lb_nat_data", node);
>  
> @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
>  lflow_input->ls_ports = _data->ls_ports;
>  lflow_input->lr_ports = _data->lr_ports;
>  lflow_input->ls_port_groups = _data->ls_port_groups;
> -lflow_input->lr_nats = _nat_data->lr_nats;
>  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
>  lflow_input->meter_groups = _meters_data->meter_groups;
>  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> index 9029aee339..ffe41cad73 100644
> --- a/northd/en-lr-lb-nat-data.h
> +++ b/northd/en-lr-lb-nat-data.h
> @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
>  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
>  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
>  
> +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID, TABLE) \
> +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> +   &(TABLE)->entries)
> +
>  struct lr_lb_nat_data_tracked_data {
>  /* Created or updated logical router with LB data. */
>  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'. */
> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> index 369a151fa3..84627070a8 100644
> --- a/northd/inc-proc-northd.c
> +++ b/northd/inc-proc-northd.c
> @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_add_input(_lflow, _sb_igmp_group, NULL);
>  engine_add_input(_lflow, _northd, lflow_northd_handler);
>  engine_add_input(_lflow, _port_group, lflow_port_group_handler);
> -engine_add_input(_lflow, _lr_nat, NULL);

Was this supposed to go in the previous patch, the one that adds
en_lr_lb_nat_data?

>  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
>  
>  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> diff --git a/northd/northd.c b/northd/northd.c
> index 24df14c0de..1877cbc7df 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports, struct 
> ovs_list *lr_list)
>   */
>  static void
>  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> -   uint32_t priority,
> -   struct ovn_datapath *od,
> -   const struct lr_nat_table 
> *lr_nats,
> -   struct hmap *lflows)
> +uint32_t priority,
> +const struct ovn_datapath *od,
> +const struct lr_nat_record 
> *lrnat_rec,
> +struct hmap *lflows)


Nit: indentation.

>  {
>  struct ds eth_src = DS_EMPTY_INITIALIZER;
>  struct ds match = DS_EMPTY_INITIALIZER;
>  
> -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> -lr_nats, op->od->index);
> -ovs_assert(lrnat_rec);
> -
>  /* Self originated ARP requests/RARP/ND need to be flooded to the L2 
> domain
>   * (except on router ports).  Determine that packets are self originated
>   * by also matching on source MAC. Matching on ingress port is not
> @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port *op,
>   */
>  static void
>  build_lswitch_rport_arp_req_flow(const char *ips,
> -int addr_family, struct ovn_port *patch_op, struct ovn_datapath *od,
> +int addr_family, struct ovn_port *patch_op,
> +const struct ovn_datapath *od,
>  uint32_t priority, struct hmap *lflows,
>  const struct ovsdb_idl_row *stage_hint)
>  {
> @@ -8993,8 +8990,6 @@ static void
>  build_lswitch_rport_arp_req_flows(struct ovn_port *op,

Re: [ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-11-14 Thread Han Zhou
On Thu, Oct 26, 2023 at 11:16 AM  wrote:
>
> From: Numan Siddique 
>
> Previous commits added new engine nodes to store logical router's lb
> and NAT data.  Make use of the data stored by these engine nodes
> to generate logical flows related to router's LBs and NATs.
>
> Signed-off-by: Numan Siddique 
> ---
>  northd/en-lflow.c  |   3 -
>  northd/en-lr-lb-nat-data.h |   4 +
>  northd/inc-proc-northd.c   |   1 -
>  northd/northd.c| 752 -
>  northd/northd.h|   1 -
>  5 files changed, 496 insertions(+), 265 deletions(-)
>
> diff --git a/northd/en-lflow.c b/northd/en-lflow.c
> index 9cb0ead3f0..229f4be1d0 100644
> --- a/northd/en-lflow.c
> +++ b/northd/en-lflow.c
> @@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
>  engine_get_input_data("port_group", node);
>  struct sync_meters_data *sync_meters_data =
>  engine_get_input_data("sync_meters", node);
> -struct ed_type_lr_nat_data *lr_nat_data =
> -engine_get_input_data("lr_nat", node);
>  struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
>  engine_get_input_data("lr_lb_nat_data", node);
>
> @@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
>  lflow_input->ls_ports = _data->ls_ports;
>  lflow_input->lr_ports = _data->lr_ports;
>  lflow_input->ls_port_groups = _data->ls_port_groups;
> -lflow_input->lr_nats = _nat_data->lr_nats;
>  lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
>  lflow_input->meter_groups = _meters_data->meter_groups;
>  lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
> diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
> index 9029aee339..ffe41cad73 100644
> --- a/northd/en-lr-lb-nat-data.h
> +++ b/northd/en-lr-lb-nat-data.h
> @@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
>  #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
>  HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
>
> +#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID, TABLE) \
> +HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
> +   &(TABLE)->entries)
> +
>  struct lr_lb_nat_data_tracked_data {
>  /* Created or updated logical router with LB data. */
>  struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'. */
> diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
> index 369a151fa3..84627070a8 100644
> --- a/northd/inc-proc-northd.c
> +++ b/northd/inc-proc-northd.c
> @@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
>  engine_add_input(_lflow, _sb_igmp_group, NULL);
>  engine_add_input(_lflow, _northd, lflow_northd_handler);
>  engine_add_input(_lflow, _port_group,
lflow_port_group_handler);
> -engine_add_input(_lflow, _lr_nat, NULL);
>  engine_add_input(_lflow, _lr_lb_nat_data, NULL);
>
>  engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
> diff --git a/northd/northd.c b/northd/northd.c
> index 24df14c0de..1877cbc7df 100644
> --- a/northd/northd.c
> +++ b/northd/northd.c
> @@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports,
struct ovs_list *lr_list)
>   */
>  static void
>  build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
> -   uint32_t priority,
> -   struct ovn_datapath *od,
> -   const struct lr_nat_table
*lr_nats,
> -   struct hmap *lflows)
> +uint32_t priority,
> +const struct ovn_datapath *od,
> +const struct lr_nat_record
*lrnat_rec,
> +struct hmap *lflows)
>  {
>  struct ds eth_src = DS_EMPTY_INITIALIZER;
>  struct ds match = DS_EMPTY_INITIALIZER;
>
> -const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
> -lr_nats, op->od->index);
> -ovs_assert(lrnat_rec);
> -
>  /* Self originated ARP requests/RARP/ND need to be flooded to the L2
domain
>   * (except on router ports).  Determine that packets are self
originated
>   * by also matching on source MAC. Matching on ingress port is not
> @@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port
*op,
>   */
>  static void
>  build_lswitch_rport_arp_req_flow(const char *ips,
> -int addr_family, struct ovn_port *patch_op, struct ovn_datapath *od,
> +int addr_family, struct ovn_port *patch_op,
> +const struct ovn_datapath *od,
>  uint32_t priority, struct hmap *lflows,
>  const struct ovsdb_idl_row *stage_hint)
>  {
> @@ -8993,8 +8990,6 @@ static void
>  build_lswitch_rport_arp_req_flows(struct ovn_port *op,
>struct ovn_datapath *sw_od,
>struct ovn_port *sw_op,
> 

[ovs-dev] [PATCH ovn v2 07/18] northd: Generate logical router's LB and NAT flows using lr_lbnat_data.

2023-10-26 Thread numans
From: Numan Siddique 

Previous commits added new engine nodes to store logical router's lb
and NAT data.  Make use of the data stored by these engine nodes
to generate logical flows related to router's LBs and NATs.

Signed-off-by: Numan Siddique 
---
 northd/en-lflow.c  |   3 -
 northd/en-lr-lb-nat-data.h |   4 +
 northd/inc-proc-northd.c   |   1 -
 northd/northd.c| 752 -
 northd/northd.h|   1 -
 5 files changed, 496 insertions(+), 265 deletions(-)

diff --git a/northd/en-lflow.c b/northd/en-lflow.c
index 9cb0ead3f0..229f4be1d0 100644
--- a/northd/en-lflow.c
+++ b/northd/en-lflow.c
@@ -42,8 +42,6 @@ lflow_get_input_data(struct engine_node *node,
 engine_get_input_data("port_group", node);
 struct sync_meters_data *sync_meters_data =
 engine_get_input_data("sync_meters", node);
-struct ed_type_lr_nat_data *lr_nat_data =
-engine_get_input_data("lr_nat", node);
 struct ed_type_lr_lb_nat_data *lr_lb_nat_data =
 engine_get_input_data("lr_lb_nat_data", node);
 
@@ -68,7 +66,6 @@ lflow_get_input_data(struct engine_node *node,
 lflow_input->ls_ports = _data->ls_ports;
 lflow_input->lr_ports = _data->lr_ports;
 lflow_input->ls_port_groups = _data->ls_port_groups;
-lflow_input->lr_nats = _nat_data->lr_nats;
 lflow_input->lr_lbnats = _lb_nat_data->lr_lbnats;
 lflow_input->meter_groups = _meters_data->meter_groups;
 lflow_input->lb_datapaths_map = _data->lb_datapaths_map;
diff --git a/northd/en-lr-lb-nat-data.h b/northd/en-lr-lb-nat-data.h
index 9029aee339..ffe41cad73 100644
--- a/northd/en-lr-lb-nat-data.h
+++ b/northd/en-lr-lb-nat-data.h
@@ -56,6 +56,10 @@ struct lr_lb_nat_data_table {
 #define LR_LB_NAT_DATA_TABLE_FOR_EACH(LR_LB_NAT_REC, TABLE) \
 HMAP_FOR_EACH (LR_LB_NAT_REC, key_node, &(TABLE)->entries)
 
+#define LR_LB_NAT_DATA_TABLE_FOR_EACH_IN_P(LR_LB_NAT_REC, JOBID, TABLE) \
+HMAP_FOR_EACH_IN_PARALLEL (LR_LB_NAT_REC, key_node, JOBID, \
+   &(TABLE)->entries)
+
 struct lr_lb_nat_data_tracked_data {
 /* Created or updated logical router with LB data. */
 struct hmapx crupdated; /* Stores 'struct lr_lb_nat_data_record'. */
diff --git a/northd/inc-proc-northd.c b/northd/inc-proc-northd.c
index 369a151fa3..84627070a8 100644
--- a/northd/inc-proc-northd.c
+++ b/northd/inc-proc-northd.c
@@ -228,7 +228,6 @@ void inc_proc_northd_init(struct ovsdb_idl_loop *nb,
 engine_add_input(_lflow, _sb_igmp_group, NULL);
 engine_add_input(_lflow, _northd, lflow_northd_handler);
 engine_add_input(_lflow, _port_group, lflow_port_group_handler);
-engine_add_input(_lflow, _lr_nat, NULL);
 engine_add_input(_lflow, _lr_lb_nat_data, NULL);
 
 engine_add_input(_sync_to_sb_addr_set, _nb_address_set,
diff --git a/northd/northd.c b/northd/northd.c
index 24df14c0de..1877cbc7df 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -8854,18 +8854,14 @@ build_lrouter_groups(struct hmap *lr_ports, struct 
ovs_list *lr_list)
  */
 static void
 build_lswitch_rport_arp_req_self_orig_flow(struct ovn_port *op,
-   uint32_t priority,
-   struct ovn_datapath *od,
-   const struct lr_nat_table *lr_nats,
-   struct hmap *lflows)
+uint32_t priority,
+const struct ovn_datapath *od,
+const struct lr_nat_record *lrnat_rec,
+struct hmap *lflows)
 {
 struct ds eth_src = DS_EMPTY_INITIALIZER;
 struct ds match = DS_EMPTY_INITIALIZER;
 
-const struct lr_nat_record *lrnat_rec = lr_nat_table_find_by_index(
-lr_nats, op->od->index);
-ovs_assert(lrnat_rec);
-
 /* Self originated ARP requests/RARP/ND need to be flooded to the L2 domain
  * (except on router ports).  Determine that packets are self originated
  * by also matching on source MAC. Matching on ingress port is not
@@ -8952,7 +8948,8 @@ lrouter_port_ipv6_reachable(const struct ovn_port *op,
  */
 static void
 build_lswitch_rport_arp_req_flow(const char *ips,
-int addr_family, struct ovn_port *patch_op, struct ovn_datapath *od,
+int addr_family, struct ovn_port *patch_op,
+const struct ovn_datapath *od,
 uint32_t priority, struct hmap *lflows,
 const struct ovsdb_idl_row *stage_hint)
 {
@@ -8993,8 +8990,6 @@ static void
 build_lswitch_rport_arp_req_flows(struct ovn_port *op,
   struct ovn_datapath *sw_od,
   struct ovn_port *sw_op,
-  const struct lr_nat_table *lr_nats,
-  const struct lr_lb_nat_data_table *lr_lbnats,
   struct hmap *lflows,