net/nfp: update the supported list of packet types

Message ID 20231019061751.2018518-1-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net/nfp: update the supported list of packet types |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Functional success Functional PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS

Commit Message

Chaoyong He Oct. 19, 2023, 6:17 a.m. UTC
  From: Qin Ke <qin.ke@corigine.com>

The NFP PMD supports reporting more packet types then previously
claimed, extend the list of supported types.

While at it add a check to only list supported packet types if the
firmware supports the feature.

Signed-off-by: Qin Ke <qin.ke@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
---
 drivers/net/nfp/nfp_common.c | 39 +++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)
  

Comments

Ferruh Yigit Oct. 27, 2023, 11:43 a.m. UTC | #1
On 10/19/2023 7:17 AM, Chaoyong He wrote:
> From: Qin Ke <qin.ke@corigine.com>
> 
> The NFP PMD supports reporting more packet types then previously
> claimed, extend the list of supported types.
> 
> While at it add a check to only list supported packet types if the
> firmware supports the feature.
> 
> Signed-off-by: Qin Ke <qin.ke@corigine.com>
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
> 

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 2d4a7635ab..10a2941fc9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -1357,18 +1357,47 @@  nfp_net_common_init(struct rte_pci_device *pci_dev,
 const uint32_t *
 nfp_net_supported_ptypes_get(struct rte_eth_dev *dev)
 {
+	struct nfp_net_hw *net_hw;
 	static const uint32_t ptypes[] = {
+		RTE_PTYPE_L2_ETHER,
+		RTE_PTYPE_L3_IPV4,
+		RTE_PTYPE_L3_IPV4_EXT,
+		RTE_PTYPE_L3_IPV6,
+		RTE_PTYPE_L3_IPV6_EXT,
+		RTE_PTYPE_L3_IPV4_EXT_UNKNOWN,
+		RTE_PTYPE_L3_IPV6_EXT_UNKNOWN,
+		RTE_PTYPE_L4_TCP,
+		RTE_PTYPE_L4_UDP,
+		RTE_PTYPE_L4_FRAG,
+		RTE_PTYPE_L4_NONFRAG,
+		RTE_PTYPE_L4_ICMP,
+		RTE_PTYPE_L4_SCTP,
+		RTE_PTYPE_TUNNEL_VXLAN,
+		RTE_PTYPE_TUNNEL_NVGRE,
+		RTE_PTYPE_TUNNEL_GENEVE,
+		RTE_PTYPE_INNER_L2_ETHER,
 		RTE_PTYPE_INNER_L3_IPV4,
+		RTE_PTYPE_INNER_L3_IPV4_EXT,
 		RTE_PTYPE_INNER_L3_IPV6,
 		RTE_PTYPE_INNER_L3_IPV6_EXT,
-		RTE_PTYPE_INNER_L4_MASK,
-		RTE_PTYPE_UNKNOWN
+		RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN,
+		RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN,
+		RTE_PTYPE_INNER_L4_TCP,
+		RTE_PTYPE_INNER_L4_UDP,
+		RTE_PTYPE_INNER_L4_FRAG,
+		RTE_PTYPE_INNER_L4_NONFRAG,
+		RTE_PTYPE_INNER_L4_ICMP,
+		RTE_PTYPE_INNER_L4_SCTP,
 	};
 
-	if (dev->rx_pkt_burst == nfp_net_recv_pkts)
-		return ptypes;
+	if (dev->rx_pkt_burst != nfp_net_recv_pkts)
+		return NULL;
+
+	net_hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	if ((net_hw->cap_ext & NFP_NET_CFG_CTRL_PKT_TYPE) == 0)
+		return NULL;
 
-	return NULL;
+	return ptypes;
 }
 
 int