@@ -146,7 +146,7 @@ add_local_datapath__(struct ovsdb_idl_index *sbrec_datapath_binding_by_key,
const struct sbrec_port_binding *pb;
SBREC_PORT_BINDING_FOR_EACH_EQUAL (pb, target,
sbrec_port_binding_by_datapath) {
- if (!strcmp(pb->type, "patch")) {
+ if (!strcmp(pb->type, "patch") || !strcmp(pb->type, "l3gateway")) {
const char *peer_name = smap_get(&pb->options, "peer");
if (peer_name) {
const struct sbrec_port_binding *peer;
@@ -172,13 +172,6 @@ add_local_datapath__(struct ovsdb_idl_index *sbrec_datapath_binding_by_key,
}
}
}
-
- ld->n_ports++;
- if (ld->n_ports > ld->n_allocated_ports) {
- ld->ports = x2nrealloc(ld->ports, &ld->n_allocated_ports,
- sizeof *ld->ports);
- }
- ld->ports[ld->n_ports - 1] = pb;
}
sbrec_port_binding_index_destroy_row(target);
}
@@ -965,7 +965,6 @@ en_runtime_data_cleanup(void *data)
HMAP_FOR_EACH_SAFE (cur_node, next_node, hmap_node,
&rt_data->local_datapaths) {
free(cur_node->peer_ports);
- free(cur_node->ports);
hmap_remove(&rt_data->local_datapaths, &cur_node->hmap_node);
free(cur_node);
}
@@ -989,7 +988,6 @@ en_runtime_data_run(struct engine_node *node, void *data)
struct local_datapath *cur_node, *next_node;
HMAP_FOR_EACH_SAFE (cur_node, next_node, hmap_node, local_datapaths) {
free(cur_node->peer_ports);
- free(cur_node->ports);
hmap_remove(local_datapaths, &cur_node->hmap_node);
free(cur_node);
}
@@ -60,10 +60,6 @@ struct local_datapath {
* hypervisor. */
bool has_local_l3gateway;
- const struct sbrec_port_binding **ports;
- size_t n_ports;
- size_t n_allocated_ports;
-
struct {
const struct sbrec_port_binding *local;
const struct sbrec_port_binding *remote;
@@ -2957,10 +2957,17 @@ run_buffered_binding(struct ovsdb_idl_index *sbrec_mac_binding_by_lport_ip,
bool notify = false;
HMAP_FOR_EACH (ld, hmap_node, local_datapaths) {
+ /* MAC_Binding.logical_port will always belong to a
+ * a router datapath. Hence we can skip logical switch
+ * datapaths.
+ * */
+ if (datapath_is_switch(ld->datapath)) {
+ continue;
+ }
- for (size_t i = 0; i < ld->n_ports; i++) {
+ for (size_t i = 0; i < ld->n_peer_ports; i++) {
- const struct sbrec_port_binding *pb = ld->ports[i];
+ const struct sbrec_port_binding *pb = ld->peer_ports[i].local;
struct buffered_packets *cur_qp, *next_qp;
HMAP_FOR_EACH_SAFE (cur_qp, next_qp, hmap_node,
&buffered_packets_map) {