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:
@@ -289,10 +289,9 @@ odp_set_nsh(struct dp_packet *packet, const struct ovs_key_nsh *key,
|
||||
}
|
||||
break;
|
||||
case NSH_M_TYPE2:
|
||||
/* TODO */
|
||||
break;
|
||||
default:
|
||||
OVS_NOT_REACHED();
|
||||
/* No support for setting any other metadata format yet. */
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
uint8_t flags = (ntohs(nsh->ver_flags_len) & NSH_FLAGS_MASK) >>
|
||||
@@ -314,10 +313,9 @@ odp_set_nsh(struct dp_packet *packet, const struct ovs_key_nsh *key,
|
||||
}
|
||||
break;
|
||||
case NSH_M_TYPE2:
|
||||
/* TODO */
|
||||
break;
|
||||
default:
|
||||
OVS_NOT_REACHED();
|
||||
/* No support for setting any other metadata format yet. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -654,6 +652,8 @@ requires_datapath_assistance(const struct nlattr *a)
|
||||
case OVS_ACTION_ATTR_PUSH_ETH:
|
||||
case OVS_ACTION_ATTR_POP_ETH:
|
||||
case OVS_ACTION_ATTR_CLONE:
|
||||
case OVS_ACTION_ATTR_ENCAP_NSH:
|
||||
case OVS_ACTION_ATTR_DECAP_NSH:
|
||||
return false;
|
||||
|
||||
case OVS_ACTION_ATTR_UNSPEC:
|
||||
@@ -818,6 +818,26 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal,
|
||||
}
|
||||
break;
|
||||
|
||||
case OVS_ACTION_ATTR_ENCAP_NSH: {
|
||||
const struct ovs_action_encap_nsh *enc_nsh = nl_attr_get(a);
|
||||
DP_PACKET_BATCH_FOR_EACH (packet, batch) {
|
||||
encap_nsh(packet, enc_nsh);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case OVS_ACTION_ATTR_DECAP_NSH: {
|
||||
size_t i, num = batch->count;
|
||||
|
||||
DP_PACKET_BATCH_REFILL_FOR_EACH (i, num, packet, batch) {
|
||||
if (decap_nsh(packet)) {
|
||||
dp_packet_batch_refill(batch, packet, i);
|
||||
} else {
|
||||
dp_packet_delete(packet);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OVS_ACTION_ATTR_OUTPUT:
|
||||
case OVS_ACTION_ATTR_TUNNEL_PUSH:
|
||||
case OVS_ACTION_ATTR_TUNNEL_POP:
|
||||
|
Reference in New Issue
Block a user