Skip to content

Commit

Permalink
OVN: Do not replace router port mac on gateway chassis.
Browse files Browse the repository at this point in the history
With 795d7f2 we have added
support for E-W routing on vlan backed networks by replacing
router port macs with chassis macs.

This replacement of router port mac need NOT be done on
gateway chassis for following reasons:

a. For N-S traffic, gateway chassis will respond to ARP
for the router port (to which it is attached) and
traffic will be using router port mac as destination mac.

b. Chassis redirect port is a centralized version of distributed
router port, hence we need not replace its mac with chassis mac
on the resident chassis.

This patch addresses the same.

Signed-off-by: Ankur Sharma <ankur.sharma@nutanix.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
ankursharm authored and ovsrobot committed Aug 1, 2019
1 parent f91b123 commit d5efe4b
Show file tree
Hide file tree
Showing 4 changed files with 354 additions and 20 deletions.
19 changes: 17 additions & 2 deletions controller/physical.c
Expand Up @@ -38,6 +38,7 @@
#include "lib/ovn-sb-idl.h"
#include "lib/ovn-util.h"
#include "physical.h"
#include "pinctrl.h"
#include "openvswitch/shash.h"
#include "simap.h"
#include "smap.h"
Expand Down Expand Up @@ -228,9 +229,12 @@ get_zone_ids(const struct sbrec_port_binding *binding,
}

static void
put_replace_router_port_mac_flows(const struct
put_replace_router_port_mac_flows(struct ovsdb_idl_index
*sbrec_port_binding_by_name,
const struct
sbrec_port_binding *localnet_port,
const struct sbrec_chassis *chassis,
const struct sset *active_tunnels,
const struct hmap *local_datapaths,
struct ofpbuf *ofpacts_p,
ofp_port_t ofport,
Expand Down Expand Up @@ -270,6 +274,16 @@ put_replace_router_port_mac_flows(const struct
struct eth_addr router_port_mac;
struct match match;
struct ofpact_mac *replace_mac;
char *cr_peer_name = xasprintf("cr-%s", rport_binding->logical_port);
if (pinctrl_is_chassis_resident(sbrec_port_binding_by_name,
chassis, active_tunnels,
cr_peer_name)) {
/* If a router port's chassisredirect port is
* resident on this chassis, then we need not do mac replace. */
free(cr_peer_name);
continue;
}
free(cr_peer_name);

/* Table 65, priority 150.
* =======================
Expand Down Expand Up @@ -787,7 +801,8 @@ consider_port_binding(struct ovsdb_idl_index *sbrec_port_binding_by_name,
&match, ofpacts_p, &binding->header_.uuid);

if (!strcmp(binding->type, "localnet")) {
put_replace_router_port_mac_flows(binding, chassis,
put_replace_router_port_mac_flows(sbrec_port_binding_by_name,
binding, chassis, active_tunnels,
local_datapaths, ofpacts_p,
ofport, flow_table);
}
Expand Down
37 changes: 19 additions & 18 deletions controller/pinctrl.c
Expand Up @@ -455,6 +455,25 @@ pinctrl_init(void)
&pinctrl);
}

bool
pinctrl_is_chassis_resident(struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_chassis *chassis,
const struct sset *active_tunnels,
const char *port_name)
{
const struct sbrec_port_binding *pb
= lport_lookup_by_name(sbrec_port_binding_by_name, port_name);
if (!pb || !pb->chassis) {
return false;
}
if (strcmp(pb->type, "chassisredirect")) {
return pb->chassis == chassis;
} else {
return ha_chassis_group_is_active(pb->ha_chassis_group,
active_tunnels, chassis);
}
}

static ovs_be32
queue_msg(struct rconn *swconn, struct ofpbuf *msg)
{
Expand Down Expand Up @@ -3755,24 +3774,6 @@ get_localnet_vifs_l3gwports(
sbrec_port_binding_index_destroy_row(target);
}

static bool
pinctrl_is_chassis_resident(struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_chassis *chassis,
const struct sset *active_tunnels,
const char *port_name)
{
const struct sbrec_port_binding *pb
= lport_lookup_by_name(sbrec_port_binding_by_name, port_name);
if (!pb || !pb->chassis) {
return false;
}
if (strcmp(pb->type, "chassisredirect")) {
return pb->chassis == chassis;
} else {
return ha_chassis_group_is_active(pb->ha_chassis_group,
active_tunnels, chassis);
}
}

/* Extracts the mac, IPv4 and IPv6 addresses, and logical port from
* 'addresses' which should be of the format 'MAC [IP1 IP2 ..]
Expand Down
5 changes: 5 additions & 0 deletions controller/pinctrl.h
Expand Up @@ -47,5 +47,10 @@ void pinctrl_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
const struct sset *active_tunnels);
void pinctrl_wait(struct ovsdb_idl_txn *ovnsb_idl_txn);
void pinctrl_destroy(void);
bool
pinctrl_is_chassis_resident(struct ovsdb_idl_index *sbrec_port_binding_by_name,
const struct sbrec_chassis *chassis,
const struct sset *active_tunnels,
const char *port_name);

#endif /* controller/pinctrl.h */

0 comments on commit d5efe4b

Please sign in to comment.