Because vxlan envelope have no enough fields to carry pipeline information
between ovs, so current ovn version do not support vxlan tunnel.
However, may only vxlan tunnel can be used in some special scenario. so we
think it is necessary to implement the function of vxlan. For this
purpose, we do the modifications as follow:
1. packets received from vxlan jump to table 29 for outport finding
2. add mac-binding information to table 29
---
ovn/controller/lflow.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
ovn/controller/lflow.h | 1 +
ovn/controller/physical.c | 9 +++++----
3 files changed, 57 insertions(+), 4 deletions(-)
mode change 100644 => 100755 ovn/controller/lflow.c
mode change 100644 => 100755 ovn/controller/lflow.h
mode change 100644 => 100755 ovn/controller/physical.c
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
old mode 100644
new mode 100755
index fa00db2..675d406
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -323,6 +323,27 @@ put_load(const uint8_t *data, size_t len,
}
static void
+put_load_int_value(uint64_t value, enum mf_field_id dst, int ofs, int n_bits,
+ struct ofpbuf *ofpacts)
+{
+ struct ofpact_set_field *sf = ofpact_put_set_field(ofpacts,
+ mf_from_id(dst), NULL,
+ NULL);
+ ovs_be64 n_value = htonll(value);
+ bitwise_copy(&n_value, 8, 0, sf->value, sf->field->n_bytes, ofs, n_bits);
+ bitwise_one(ofpact_set_field_mask(sf), sf->field->n_bytes, ofs, n_bits);
+}
+
+
+static void
+put_resubmit(uint8_t table_id, struct ofpbuf *ofpacts)
+{
+ struct ofpact_resubmit *resubmit = ofpact_put_RESUBMIT(ofpacts);
+ resubmit->in_port = OFPP_IN_PORT;
+ resubmit->table_id = table_id;
+}
+
+static void
consider_neighbor_flow(const struct lport_index *lports,
const struct sbrec_mac_binding *b,
struct hmap *flow_table)
@@ -369,6 +390,36 @@ consider_neighbor_flow(const struct lport_index *lports,
put_load(mac.ea, sizeof mac.ea, MFF_ETH_DST, 0, 48, &ofpacts);
ofctrl_add_flow(flow_table, OFTABLE_MAC_BINDING, 100, 0, &match, &ofpacts);
ofpbuf_uninit(&ofpacts);
+
+ /* add eth.dst flow for mac-bind */
+ if(!strcmp(b->mac,"00:00:00:00:00:00"))
+ {
+ VLOG_INFO("the mac of port %s is multicast, no need to add flow",
b->logical_port);
+ return;
+ }
+ const char *crp_name=xasprintf("cr-%s", b->logical_port);
+ const struct sbrec_port_binding *crpb
+ = lport_lookup_by_name(lports, crp_name);
+ if (!crpb) {
+ VLOG_INFO("chassisredirect port of %s is not exist", b->logical_port);
+ return;
+ }
+ VLOG_INFO("chassisredirect port is %s", crp_name);
+
+ struct ofpbuf ofpacts_of_vxlan;
+ ofpbuf_init(&ofpacts_of_vxlan, 0);
+ match_init_catchall(&match);
+ match_set_reg_masked(&match, MFF_LOG_FLAGS - MFF_REG0,
+ MLF_RCV_FROM_VXLAN, MLF_RCV_FROM_VXLAN);
+ match_set_metadata(&match, htonll(crpb->datapath->tunnel_key));
+ match_set_dl_dst(&match, mac);
+
+ put_load_int_value(crpb->tunnel_key, MFF_LOG_OUTPORT, 0, 32,
&ofpacts_of_vxlan);
+
+ put_resubmit(OFTABLE_REMOTE_OUTPUT, &ofpacts_of_vxlan);
+ ofctrl_add_flow(flow_table, OFTABLE_ETH_UCAST, 50, 0, &match,
&ofpacts_of_vxlan);
+
+ ofpbuf_uninit(&ofpacts_of_vxlan);
}
/* Adds an OpenFlow flow to flow tables for each MAC binding in the OVN
diff --git a/ovn/controller/lflow.h b/ovn/controller/lflow.h
old mode 100644
new mode 100755
index 4f284a0..418f59e
--- a/ovn/controller/lflow.h
+++ b/ovn/controller/lflow.h
@@ -50,6 +50,7 @@ struct uuid;
* you make any changes. */
#define OFTABLE_PHY_TO_LOG 0
#define OFTABLE_LOG_INGRESS_PIPELINE 16 /* First of LOG_PIPELINE_LEN tables. */
+#define OFTABLE_ETH_UCAST 29
#define OFTABLE_REMOTE_OUTPUT 32
#define OFTABLE_LOCAL_OUTPUT 33
#define OFTABLE_CHECK_LOOPBACK 34
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
old mode 100644
new mode 100755
index 0f1aa63..b584103
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -963,9 +963,9 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id
mff_ovn_geneve,
SBREC_PORT_BINDING_FOR_EACH (binding, ctx->ovnsb_idl) {
struct match match = MATCH_CATCHALL_INITIALIZER;
-
+ /* here need to optimize to do only once for every datapath */
if (!binding->chassis ||
- strcmp(tun->chassis_id, binding->chassis->name)) {
+ binding->chassis != chassis) {
continue;
}
@@ -974,11 +974,12 @@ physical_run(struct controller_ctx *ctx, enum mf_field_id
mff_ovn_geneve,
ofpbuf_clear(&ofpacts);
put_move(MFF_TUN_ID, 0, MFF_LOG_DATAPATH, 0, 24, &ofpacts);
- put_load(binding->tunnel_key, MFF_LOG_INPORT, 0, 15, &ofpacts);
+ /*put_load(binding->tunnel_key, MFF_LOG_INPORT, 0, 15, &ofpacts);*/
/* For packets received from a vxlan tunnel, set a flag to that
* effect. */
put_load(1, MFF_LOG_FLAGS, MLF_RCV_FROM_VXLAN_BIT, 1, &ofpacts);
- put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, &ofpacts);
+ /*put_resubmit(OFTABLE_LOG_INGRESS_PIPELINE, &ofpacts);*/
+ put_resubmit(OFTABLE_ETH_UCAST, &ofpacts);
ofctrl_add_flow(flow_table, OFTABLE_PHY_TO_LOG, 100, 0, &match,
&ofpacts);
--
2.8.1
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev