Currently only valid value for this option is mc_unknown. If set to mc_unknown, packets destined to the port gets cloned to all unknown ports connected to the same Logical Switch.
Usecase: ========= It is required to reduce packet loss when VM is being migrated to different AZ via VXLAN tunnel. Port is configured in both AZs on different logical switches which are sharing same IP subnet. VTEP device is connected to the same logical switch on both AZs and its port is set to unknown. Signed-off-by: Naveen Yerramneni <naveen.yerramn...@nutanix.com> --- northd/northd.c | 23 +++++++++++++++++++++-- ovn-nb.xml | 6 ++++++ tests/ovn-northd.at | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) diff --git a/northd/northd.c b/northd/northd.c index 952f8200d..98e97fd6b 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -1786,6 +1786,17 @@ ovn_port_find(const struct hmap *ports, const char *name) return ovn_port_find__(ports, name, false); } +static bool +lsp_is_clone_to_unknown(const struct nbrec_logical_switch_port *nbsp) +{ + const char *pkt_clone_type = smap_get( ->options, + "pkt_clone_type"); + if (pkt_clone_type && !strcasecmp(pkt_clone_type, "mc_unknown")) { + return true; + } + return false; +} + static struct ovn_port * ovn_port_find_bound(const struct hmap *ports, const char *name) { @@ -10529,8 +10540,16 @@ build_lswitch_ip_unicast_lookup(struct ovn_port *op, * or IPv6 addresses (or both). */ struct eth_addr mac; bool lsp_enabled = lsp_is_enabled(op->nbsp); - const char *action = lsp_enabled ? "outport = %s; output;" : - debug_drop_action(); + bool lsp_clone_to_unknown = lsp_is_clone_to_unknown(op->nbsp); + const char *action = lsp_enabled ? + ((lsp_clone_to_unknown && op->od->has_unknown + && !strcmp(op->nbsp->type, "")) ? + "clone {outport = %s; output; };" + "outport = \""MC_UNKNOWN "\"; output;" : + "outport = %s; output;") : + debug_drop_action(); + + if (ovs_scan(op->nbsp->addresses[i], ETH_ADDR_SCAN_FMT, ETH_ADDR_SCAN_ARGS(mac))) { ds_clear(match); diff --git a/ovn-nb.xml b/ovn-nb.xml index 765ffcf2e..dc55c8c99 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -1262,6 +1262,12 @@ </p> </column> + <column name="options" key="pkt_clone_type" + type='{"type": "string", "enum": ["set", ["mc_unknown"]]}'> + If set to mc_unknown, packets going to this VIF get cloned to all + unknown ports connected to the same Logical Switch. + </column> + <group title="VIF Plugging Options"> <column name="options" key="vif-plug-type"> If set, OVN will attempt to perform plugging of this VIF. In order diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 9a0d418e4..0ca9f82bb 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -6650,6 +6650,38 @@ wait_row_count Port_binding 1 logical-port=S1-vm2 requested_chassis=$ch2_uuid AT_CLEANUP ]) + +OVN_FOR_EACH_NORTHD_NO_HV([ +AT_SETUP([check options:pkt_clone_type for LSP]) +ovn_start NORTHD_TYPE +ovn-nbctl ls-add S1 +ovn-nbctl --wait=sb lsp-add S1 S1-vm1 +ovn-nbctl --wait=sb lsp-add S1 S1-vm2 +ovn-nbctl --wait=sb lsp-set-addresses S1-vm1 "50:54:00:00:00:01 192.168.0.1" +ovn-nbctl --wait=sb lsp-set-addresses S1-vm2 "unknown" + +ovn-sbctl dump-flows S1 > S1flows +AT_CAPTURE_FILE([S1flows]) + +AT_CHECK([grep -e "ls_in_l2_lkup.*S1-vm1" S1flows | sed 's/table=../table=??/'], [0], [dnl + table=??(ls_in_l2_lkup ), priority=50 , match=(eth.dst == 50:54:00:00:00:01), action=(outport = "S1-vm1"; output;) +]) + +#Set the pkt_clone_type option and verify the flow +ovn-nbctl --wait=sb set logical_switch_port S1-vm1 options:pkt_clone_type=mc_unknown + +ovn-sbctl dump-flows S1 > S1flows +AT_CAPTURE_FILE([S1flows]) + +AT_CHECK([grep -e "ls_in_l2_lkup.*S1-vm1" S1flows | sed 's/table=../table=??/'], [0], [dnl + table=??(ls_in_l2_lkup ), priority=50 , match=(eth.dst == 50:54:00:00:00:01), action=(clone {outport = "S1-vm1"; output; };outport = "_MC_unknown"; output;) +]) + +AT_CLEANUP +]) + + + # Duplicated datapaths shouldn't be created, but in case it is created because # of bug or dirty data, it should be properly deleted instead of causing # permanent failure in northd. -- 2.36.6 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev