[23/25] net/nfp: add the offload support of IPv4 NVGRE decap action

Message ID 1666063359-34283-24-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 of IPv4 NVGRE 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       | 8 ++++++--
 2 files changed, 7 insertions(+), 2 deletions(-)
  

Patch

diff --git a/doc/guides/nics/features/nfp.ini b/doc/guides/nics/features/nfp.ini
index 4c6d2d5..9f7a680 100644
--- a/doc/guides/nics/features/nfp.ini
+++ b/doc/guides/nics/features/nfp.ini
@@ -45,6 +45,7 @@  vxlan                = Y
 count                = Y
 dec_ttl              = Y
 drop                 = Y
+nvgre_decap          = Y
 nvgre_encap          = Y
 of_pop_vlan          = Y
 of_push_vlan         = Y
diff --git a/drivers/net/nfp/nfp_flow.c b/drivers/net/nfp/nfp_flow.c
index 9464211..514e221 100644
--- a/drivers/net/nfp/nfp_flow.c
+++ b/drivers/net/nfp/nfp_flow.c
@@ -1627,7 +1627,7 @@  struct nfp_pre_tun_entry {
 }
 
 static int
-nfp_flow_merge_gre_key(__rte_unused struct nfp_app_fw_flower *app_fw_flower,
+nfp_flow_merge_gre_key(struct nfp_app_fw_flower *app_fw_flower,
 		struct rte_flow *nfp_flow,
 		char **mbuf_off,
 		const struct rte_flow_item *item,
@@ -1635,6 +1635,7 @@  struct nfp_pre_tun_entry {
 		bool is_mask,
 		__rte_unused bool is_outer_layer)
 {
+	int ret = 0;
 	rte_be32_t tun_key;
 	const rte_be32_t *spec;
 	const rte_be32_t *mask;
@@ -1664,6 +1665,8 @@  struct nfp_pre_tun_entry {
 		tun4 = (struct nfp_flower_ipv4_gre_tun *)*mbuf_off;
 		tun4->tun_key = tun_key;
 		tun4->tun_flags = rte_cpu_to_be_16(NFP_FL_GRE_FLAG_KEY);
+		if (!is_mask)
+			ret = nfp_tun_add_ipv4_off(app_fw_flower, tun4->ipv4.dst);
 	}
 
 gre_key_end:
@@ -1673,7 +1676,7 @@  struct nfp_pre_tun_entry {
 	else
 		*mbuf_off += sizeof(struct nfp_flower_ipv4_gre_tun);
 
-	return 0;
+	return ret;
 }
 
 const rte_be32_t nfp_flow_item_gre_key = 0xffffffff;
@@ -3835,6 +3838,7 @@  struct nfp_pre_tun_entry {
 		*num_of_actions = 1;
 		break;
 	case RTE_FLOW_ITEM_TYPE_GENEVE:
+	case RTE_FLOW_ITEM_TYPE_GRE:
 		nfp_action->type = RTE_FLOW_ACTION_TYPE_RAW_DECAP;
 		*pmd_actions = nfp_action;
 		*num_of_actions = 1;