mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
Generic encap and decap support for NSH
This commit adds translation and netdev datapath support for generic encap and decap actions for the NSH MD1 header. The generic encap and decap actions are mapped to specific encap_nsh and decap_nsh actions in the datapath. The translation follows that general scheme that decap() of an NSH packet triggers recirculation after decapsulation, while encap(nsh) just modifies struct flow and sets the ctx->pending_encap flag to generate the encap_nsh action at the next commit to be able to include subsequent set_field actions for NSH headers. Support for the flexible MD2 format using TLV properties is foreseen in encap(nsh), but not yet fully implemented. The CLI syntax for encap of NSH is encap(nsh(md_type=1)) encap(nsh(md_type=2[,tlv(<tlv_class>,<tlv_type>,<hex_string>),...])) Signed-off-by: Jan Scheurich <jan.scheurich@ericsson.com> Signed-off-by: Yi Yang <yi.y.yang@intel.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -4055,6 +4055,7 @@ decode_NXAST_RAW_ENCAP(const struct nx_action_encap *nae,
|
||||
encap->ofpact.raw = NXAST_RAW_ENCAP;
|
||||
switch (ntohl(nae->new_pkt_type)) {
|
||||
case PT_ETH:
|
||||
case PT_NSH:
|
||||
/* Add supported encap header types here. */
|
||||
break;
|
||||
default:
|
||||
@@ -4103,6 +4104,8 @@ parse_encap_header(const char *hdr, ovs_be32 *packet_type)
|
||||
{
|
||||
if (strcmp(hdr, "ethernet") == 0) {
|
||||
*packet_type = htonl(PT_ETH);
|
||||
} else if (strcmp(hdr, "nsh") == 0) {
|
||||
*packet_type = htonl(PT_NSH);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -4178,6 +4181,8 @@ format_encap_pkt_type(const ovs_be32 pkt_type)
|
||||
switch (ntohl(pkt_type)) {
|
||||
case PT_ETH:
|
||||
return "ethernet";
|
||||
case PT_NSH:
|
||||
return "nsh";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
Reference in New Issue
Block a user