Skip to content

Commit

Permalink
northd: Add a new engine 'lr-nat' to manage lr NAT data.
Browse files Browse the repository at this point in the history
This new engine now maintains the NAT related data for each
logical router which was earlier maintained by the northd
engine node in the 'struct ovn_datapath'.  Main inputs to
this engine node are:
   - northd
   - NB logical router

A record for each logical router is maintained in the 'lr_nats'
hmap table and this record
  - stores the ovn_nat's

Handlers are also added to handle the changes to both these
inputs.  This engine node becomes an input to 'lflow' node.
This essentially decouples the lr NAT data from the northd
engine node.

Signed-off-by: Numan Siddique <numans@ovn.org>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
numansiddique authored and ovsrobot committed Oct 24, 2023
1 parent 6978647 commit 88d808a
Show file tree
Hide file tree
Showing 12 changed files with 850 additions and 349 deletions.
6 changes: 5 additions & 1 deletion lib/ovn-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ extract_sbrec_binding_first_mac(const struct sbrec_port_binding *binding,
}

bool
lport_addresses_is_empty(struct lport_addresses *laddrs)
lport_addresses_is_empty(const struct lport_addresses *laddrs)
{
return !laddrs->n_ipv4_addrs && !laddrs->n_ipv6_addrs;
}
Expand All @@ -405,6 +405,10 @@ destroy_lport_addresses(struct lport_addresses *laddrs)
{
free(laddrs->ipv4_addrs);
free(laddrs->ipv6_addrs);
laddrs->ipv4_addrs = NULL;
laddrs->ipv6_addrs = NULL;
laddrs->n_ipv4_addrs = 0;
laddrs->n_ipv6_addrs = 0;
}

/* Returns a string of the IP address of 'laddrs' that overlaps with 'ip_s'.
Expand Down
2 changes: 1 addition & 1 deletion lib/ovn-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ bool extract_sbrec_binding_first_mac(const struct sbrec_port_binding *binding,
bool extract_lrp_networks__(char *mac, char **networks, size_t n_networks,
struct lport_addresses *laddrs);

bool lport_addresses_is_empty(struct lport_addresses *);
bool lport_addresses_is_empty(const struct lport_addresses *);
void destroy_lport_addresses(struct lport_addresses *);
const char *find_lport_address(const struct lport_addresses *laddrs,
const char *ip_s);
Expand Down
1 change: 1 addition & 0 deletions lib/stopwatch-names.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
#define LFLOWS_TO_SB_STOPWATCH_NAME "lflows_to_sb"
#define PORT_GROUP_RUN_STOPWATCH_NAME "port_group_run"
#define SYNC_METERS_RUN_STOPWATCH_NAME "sync_meters_run"
#define LR_NAT_RUN_STOPWATCH_NAME "lr_nat_run"

#endif
2 changes: 2 additions & 0 deletions northd/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ northd_ovn_northd_SOURCES = \
northd/en-sync-from-sb.h \
northd/en-lb-data.c \
northd/en-lb-data.h \
northd/en-lr-nat.c \
northd/en-lr-nat.h \
northd/inc-proc-northd.c \
northd/inc-proc-northd.h \
northd/ipam.c \
Expand Down
5 changes: 5 additions & 0 deletions northd/en-lflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <stdio.h>

#include "en-lflow.h"
#include "en-lr-nat.h"
#include "en-northd.h"
#include "en-meters.h"

Expand All @@ -40,6 +41,9 @@ 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);

lflow_input->nbrec_bfd_table =
EN_OVSDB_GET(engine_get_input("NB_bfd", node));
lflow_input->sbrec_bfd_table =
Expand All @@ -61,6 +65,7 @@ lflow_get_input_data(struct engine_node *node,
lflow_input->ls_ports = &northd_data->ls_ports;
lflow_input->lr_ports = &northd_data->lr_ports;
lflow_input->ls_port_groups = &pg_data->ls_port_groups;
lflow_input->lr_nats = &lr_nat_data->lr_nats;
lflow_input->meter_groups = &sync_meters_data->meter_groups;
lflow_input->lb_datapaths_map = &northd_data->lb_datapaths_map;
lflow_input->svc_monitor_map = &northd_data->svc_monitor_map;
Expand Down
Loading

0 comments on commit 88d808a

Please sign in to comment.