[15/25] net/nfp: add the offload support of IPv4 GENEVE decap action

Message ID 1666063359-34283-16-git-send-email-chaoyong.he@corigine.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series add the extend rte_flow offload support of nfp PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Oct. 18, 2022, 3:22 a.m. UTC
  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(-)
  

Patch

diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini
index 4c0d1ab..7453109 100644
--- a/doc/guides/nics/features/nfp.ini
+++ b/doc/guides/nics/features/nfp.ini
@@ -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
diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 36dbf27..a8287a1 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -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;