Skip to content

Commit 5ec13ae

Browse files
committed
controller: Consolidate the netlink notifiers.
The netlink notifiers used a lot of code that was more or less identical to each other. Extract the common code into separate module which allows the definition of listeners and their specific data. This should make it easier to add any new notifier, which will be the case in the future. It should also make it slightly easier to track individual updates and changes that could be processed incrementally instead of full recompute when there is any change. Acked-by: Dumitru Ceara <dceara@redhat.com> Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Ales Musil <amusil@redhat.com>
1 parent 5cb0bf4 commit 5ec13ae

18 files changed

Lines changed: 504 additions & 765 deletions

controller/automake.mk

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ controller_ovn_controller_SOURCES = \
3232
controller/lport.h \
3333
controller/ofctrl.c \
3434
controller/ofctrl.h \
35+
controller/ovn-netlink-notifier.h \
3536
controller/neighbor.c \
3637
controller/neighbor.h \
3738
controller/neighbor-of.c \
@@ -63,33 +64,29 @@ controller_ovn_controller_SOURCES = \
6364
controller/ecmp-next-hop-monitor.h \
6465
controller/ecmp-next-hop-monitor.c \
6566
controller/route-exchange.h \
66-
controller/route-table-notify.h \
6767
controller/route.h \
6868
controller/route.c \
6969
controller/garp_rarp.h \
7070
controller/garp_rarp.c \
7171
controller/neighbor-exchange.h \
72-
controller/neighbor-table-notify.h \
7372
controller/host-if-monitor.h
7473

7574
if HAVE_NETLINK
7675
controller_ovn_controller_SOURCES += \
7776
controller/host-if-monitor.c \
77+
controller/ovn-netlink-notifier.c \
7878
controller/neighbor-exchange-netlink.h \
7979
controller/neighbor-exchange-netlink.c \
8080
controller/neighbor-exchange.c \
81-
controller/neighbor-table-notify.c \
8281
controller/route-exchange-netlink.h \
8382
controller/route-exchange-netlink.c \
84-
controller/route-exchange.c \
85-
controller/route-table-notify.c
83+
controller/route-exchange.c
8684
else
8785
controller_ovn_controller_SOURCES += \
8886
controller/host-if-monitor-stub.c \
87+
controller/ovn-netlink-notifier-stub.c \
8988
controller/neighbor-exchange-stub.c \
90-
controller/neighbor-table-notify-stub.c \
91-
controller/route-exchange-stub.c \
92-
controller/route-table-notify-stub.c
89+
controller/route-exchange-stub.c
9390
endif
9491

9592
controller_ovn_controller_LDADD = lib/libovn.la $(OVS_LIBDIR)/libopenvswitch.la

controller/neighbor-exchange.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include "neighbor.h"
2222
#include "neighbor-exchange.h"
2323
#include "neighbor-exchange-netlink.h"
24-
#include "neighbor-table-notify.h"
2524
#include "openvswitch/poll-loop.h"
2625
#include "openvswitch/vlog.h"
2726
#include "ovn-util.h"
@@ -136,8 +135,7 @@ neighbor_exchange_run(const struct neighbor_exchange_ctx_in *n_ctx_in,
136135
break;
137136
}
138137

139-
neighbor_table_add_watch_request(&n_ctx_out->neighbor_table_watches,
140-
if_index, nim->if_name);
138+
vector_push(n_ctx_out->neighbor_table_watches, &if_index);
141139
vector_destroy(&received_neighbors);
142140
}
143141
}

controller/neighbor-exchange.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ struct neighbor_exchange_ctx_in {
3030
};
3131

3232
struct neighbor_exchange_ctx_out {
33-
/* Contains struct neighbor_table_watch_request. */
34-
struct hmap neighbor_table_watches;
33+
/* Contains int32_t representing if_index. */
34+
struct vector *neighbor_table_watches;
3535
/* Contains 'struct evpn_remote_vtep'. */
3636
struct hmap *remote_vteps;
3737
/* Contains 'struct evpn_static_entry', remote FDB entries learned through

controller/neighbor-table-notify.c

Lines changed: 0 additions & 244 deletions
This file was deleted.

controller/neighbor-table-notify.h

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)