[ovs-dev] [PATCH 4/4] Update flow generation for localnet and future software gateway to source physical endpoint encapsulation from the OVN SB physical endpoint table
Darrell Ball
dlu998 at gmail.com
Tue Mar 1 18:39:19 UTC 2016
Signed-off-by: Darrell Ball <dball at vmware.com>
---
ovn/controller/physical.c | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index 8b12769..dff9463 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -221,6 +221,8 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
/* Set up flows in table 0 for physical-to-logical translation and in table
* 64 for logical-to-physical translation. */
const struct sbrec_port_binding *binding;
+ const struct sbrec_physical_endpoint * phys_endpt_rec;
+
SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) {
/* Find the OpenFlow port for the logical port, as 'ofport'. This is
* one of:
@@ -256,8 +258,17 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
} else {
ofport = u16_to_ofp(simap_get(&localvif_to_ofport,
binding->logical_port));
- if (!strcmp(binding->type, "localnet") && ofport && binding->tag) {
- tag = *binding->tag;
+
+ if ((!strcmp(binding->type, "localnet") ||
+ (!strcmp(binding->type, "vtep"))) && ofport &&
+ binding->phys_endpt) {
+
+ phys_endpt_rec = binding->phys_endpt;
+ /* only single vlan encap is supported initially */
+ if (phys_endpt_rec && (!strcmp(phys_endpt_rec->type, "vlan"))) {
+ /* valid values verified on configuration */
+ (void) str_to_int(phys_endpt_rec->ingress_encap, 10, &tag);
+ }
}
}
@@ -302,7 +313,9 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
/* Match a VLAN tag and strip it, including stripping priority tags
* (e.g. VLAN ID 0). In the latter case we'll add a second flow
* for frames that lack any 802.1Q header later. */
- if (tag || !strcmp(binding->type, "localnet")) {
+ if (tag ||
+ (!strcmp(binding->type, "localnet")) ||
+ (!strcmp(binding->type, "vtep"))) {
match_set_dl_vlan(&match, htons(tag));
ofpact_put_STRIP_VLAN(&ofpacts);
}
@@ -326,7 +339,9 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id mff_ovn_geneve,
ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG,
tag ? 150 : 100, &match, &ofpacts);
- if (!tag && !strcmp(binding->type, "localnet")) {
+ if (!tag &&
+ ((!strcmp(binding->type, "localnet")) ||
+ (!strcmp(binding->type, "vtep")))) {
/* Add a second flow for frames that lack any 802.1Q
* header. For these, drop the OFPACT_STRIP_VLAN
* action. */
--
1.9.1
More information about the dev
mailing list