Add the offload support of decap action for IPv4 GENEVE tunnel.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
doc/guides/nics/features/nfp.ini | 1 +
drivers/net/nfp/nfp_flow.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
@@ -47,6 +47,7 @@ of_pop_vlan = Y
of_push_vlan = Y
of_set_vlan_pcp = Y
of_set_vlan_vid = Y
+raw_decap = Y
raw_encap = Y
port_id = Y
set_ipv4_dscp = Y
@@ -973,6 +973,9 @@ struct nfp_pre_tun_entry {
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_VXLAN_DECAP detected");
break;
+ case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
+ PMD_DRV_LOG(DEBUG, "RTE_FLOW_ACTION_TYPE_RAW_DECAP detected");
+ break;
default:
PMD_DRV_LOG(ERR, "Action type %d not supported.", action->type);
return -ENOTSUP;
@@ -1444,7 +1447,7 @@ struct nfp_pre_tun_entry {
}
static int
-nfp_flow_merge_geneve(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
+nfp_flow_merge_geneve(struct nfp_app_fw_flower *app_fw_flower,
struct rte_flow *nfp_flow,
char **mbuf_off,
const struct rte_flow_item *item,
@@ -1452,6 +1455,7 @@ struct nfp_pre_tun_entry {
bool is_mask,
__rte_unused bool is_outer_layer)
{
+ int ret = 0;
struct nfp_flower_ipv4_udp_tun *tun4;
struct nfp_flower_ipv6_udp_tun *tun6;
struct nfp_flower_meta_tci *meta_tci;
@@ -1482,6 +1486,8 @@ struct nfp_pre_tun_entry {
tun4 = (struct nfp_flower_ipv4_udp_tun *)*mbuf_off;
tun4->tun_id = rte_cpu_to_be_32((geneve->vni[0] << 16) |
(geneve->vni[1] << 8) | (geneve->vni[2]));
+ if (!is_mask)
+ ret = nfp_tun_add_ipv4_off(app_fw_flower, tun4->ipv4.dst);
}
geneve_end:
@@ -1492,7 +1498,7 @@ struct nfp_pre_tun_entry {
*mbuf_off += sizeof(struct nfp_flower_ipv4_udp_tun);
}
- return 0;
+ return ret;
}
/* Graph of supported items and associated process function */
@@ -3080,6 +3086,7 @@ struct nfp_pre_tun_entry {
nfp_flow->type = NFP_FLOW_ENCAP;
break;
case RTE_FLOW_ACTION_TYPE_VXLAN_DECAP:
+ case RTE_FLOW_ACTION_TYPE_RAW_DECAP:
PMD_DRV_LOG(DEBUG, "process RTE_FLOW_ACTION_TYPE_TUNNEL_DECAP");
ret = nfp_flow_action_tunnel_decap(representor, action,
nfp_flow_meta, nfp_flow);
@@ -3550,6 +3557,11 @@ struct nfp_pre_tun_entry {
*pmd_actions = nfp_action;
*num_of_actions = 1;
break;
+ case RTE_FLOW_ITEM_TYPE_GENEVE:
+ nfp_action->type = RTE_FLOW_ACTION_TYPE_RAW_DECAP;
+ *pmd_actions = nfp_action;
+ *num_of_actions = 1;
+ break;
default:
*pmd_actions = NULL;
*num_of_actions = 0;