From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8575345BAC; Wed, 23 Oct 2024 08:25:19 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E085C40E2F; Wed, 23 Oct 2024 08:24:44 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 7873F40E03 for ; Wed, 23 Oct 2024 08:24:38 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5D076201B4D; Wed, 23 Oct 2024 08:24:38 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 235A6201B57; Wed, 23 Oct 2024 08:24:38 +0200 (CEST) Received: from lsv03379.swis.in-blr01.nxp.com (lsv03379.swis.in-blr01.nxp.com [92.120.147.188]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 8AC30183DC02; Wed, 23 Oct 2024 14:24:37 +0800 (+08) From: vanshika.shukla@nxp.com To: dev@dpdk.org, Gagandeep Singh , Sachin Saxena , Vanshika Shukla Cc: Apeksha Gupta Subject: [v2 06/12] net/enetc: Add packet type parsing support Date: Wed, 23 Oct 2024 11:54:27 +0530 Message-Id: <20241023062433.851218-7-vanshika.shukla@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241023062433.851218-1-vanshika.shukla@nxp.com> References: <20241018072644.2379012-1-vanshika.shukla@nxp.com> <20241023062433.851218-1-vanshika.shukla@nxp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Apeksha Gupta Introduces packet type parsing for ENETC4 PMD, supporting: - RTE_PTYPE_L2_ETHER (Ethernet II) - RTE_PTYPE_L3_IPV4 (IPv4) - RTE_PTYPE_L3_IPV6 (IPv6) - RTE_PTYPE_L4_TCP (TCP) - RTE_PTYPE_L4_UDP (UDP) - RTE_PTYPE_L4_SCTP (SCTP) - RTE_PTYPE_L4_ICMP (ICMP) - RTE_PTYPE_L4_FRAG (IPv4/IPv6 fragmentation) - RTE_PTYPE_TUNNEL_ESP (ESP tunneling) Signed-off-by: Apeksha Gupta Signed-off-by: Gagandeep Singh --- doc/guides/nics/features/enetc4.ini | 1 + drivers/net/enetc/base/enetc_hw.h | 5 +++++ drivers/net/enetc/enetc.h | 2 ++ drivers/net/enetc/enetc4_ethdev.c | 23 +++++++++++++++++++++++ drivers/net/enetc/enetc4_vf.c | 1 + drivers/net/enetc/enetc_rxtx.c | 10 ++++++++++ 6 files changed, 42 insertions(+) diff --git a/doc/guides/nics/features/enetc4.ini b/doc/guides/nics/features/enetc4.ini index e814852d2d..3356475317 100644 --- a/doc/guides/nics/features/enetc4.ini +++ b/doc/guides/nics/features/enetc4.ini @@ -4,6 +4,7 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +Packet type parsing = Y Basic stats = Y L3 checksum offload = Y L4 checksum offload = Y diff --git a/drivers/net/enetc/base/enetc_hw.h b/drivers/net/enetc/base/enetc_hw.h index 3208d91bc5..10bd3c050c 100644 --- a/drivers/net/enetc/base/enetc_hw.h +++ b/drivers/net/enetc/base/enetc_hw.h @@ -196,6 +196,7 @@ enum enetc_bdr_type {TX, RX}; #define ENETC_PKT_TYPE_ETHER 0x0060 #define ENETC_PKT_TYPE_IPV4 0x0000 #define ENETC_PKT_TYPE_IPV6 0x0020 +#define ENETC_PKT_TYPE_IPV6_EXT 0x0080 #define ENETC_PKT_TYPE_IPV4_TCP \ (0x0010 | ENETC_PKT_TYPE_IPV4) #define ENETC_PKT_TYPE_IPV6_TCP \ @@ -208,6 +209,10 @@ enum enetc_bdr_type {TX, RX}; (0x0013 | ENETC_PKT_TYPE_IPV4) #define ENETC_PKT_TYPE_IPV6_SCTP \ (0x0013 | ENETC_PKT_TYPE_IPV6) +#define ENETC_PKT_TYPE_IPV4_FRAG \ + (0x0001 | ENETC_PKT_TYPE_IPV4) +#define ENETC_PKT_TYPE_IPV6_FRAG \ + (0x0001 | ENETC_PKT_TYPE_IPV6_EXT | ENETC_PKT_TYPE_IPV6) #define ENETC_PKT_TYPE_IPV4_ICMP \ (0x0003 | ENETC_PKT_TYPE_IPV4) #define ENETC_PKT_TYPE_IPV6_ICMP \ diff --git a/drivers/net/enetc/enetc.h b/drivers/net/enetc/enetc.h index c29353a89b..8d4e432426 100644 --- a/drivers/net/enetc/enetc.h +++ b/drivers/net/enetc/enetc.h @@ -117,6 +117,8 @@ int enetc4_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, int enetc4_tx_queue_start(struct rte_eth_dev *dev, uint16_t qidx); int enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx); void enetc4_tx_queue_release(struct rte_eth_dev *dev, uint16_t qid); +const uint32_t *enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused, + size_t *no_of_elements); /* * enetc4_vf function prototype diff --git a/drivers/net/enetc/enetc4_ethdev.c b/drivers/net/enetc/enetc4_ethdev.c index 6a165f2ff2..f920493176 100644 --- a/drivers/net/enetc/enetc4_ethdev.c +++ b/drivers/net/enetc/enetc4_ethdev.c @@ -682,6 +682,28 @@ enetc4_tx_queue_stop(struct rte_eth_dev *dev, uint16_t qidx) return 0; } +const uint32_t * +enetc4_supported_ptypes_get(struct rte_eth_dev *dev __rte_unused, + size_t *no_of_elements) +{ + PMD_INIT_FUNC_TRACE(); + static const uint32_t ptypes[] = { + RTE_PTYPE_L2_ETHER, + RTE_PTYPE_L3_IPV4, + RTE_PTYPE_L3_IPV6, + RTE_PTYPE_L4_TCP, + RTE_PTYPE_L4_UDP, + RTE_PTYPE_L4_SCTP, + RTE_PTYPE_L4_ICMP, + RTE_PTYPE_L4_FRAG, + RTE_PTYPE_TUNNEL_ESP, + RTE_PTYPE_UNKNOWN + }; + + *no_of_elements = RTE_DIM(ptypes); + return ptypes; +} + /* * The set of PCI devices this driver supports */ @@ -707,6 +729,7 @@ static const struct eth_dev_ops enetc4_ops = { .tx_queue_start = enetc4_tx_queue_start, .tx_queue_stop = enetc4_tx_queue_stop, .tx_queue_release = enetc4_tx_queue_release, + .dev_supported_ptypes_get = enetc4_supported_ptypes_get, }; /* diff --git a/drivers/net/enetc/enetc4_vf.c b/drivers/net/enetc/enetc4_vf.c index 0d35fc2e1c..360bb0c710 100644 --- a/drivers/net/enetc/enetc4_vf.c +++ b/drivers/net/enetc/enetc4_vf.c @@ -73,6 +73,7 @@ static const struct eth_dev_ops enetc4_vf_ops = { .tx_queue_start = enetc4_tx_queue_start, .tx_queue_stop = enetc4_tx_queue_stop, .tx_queue_release = enetc4_tx_queue_release, + .dev_supported_ptypes_get = enetc4_supported_ptypes_get, }; static int diff --git a/drivers/net/enetc/enetc_rxtx.c b/drivers/net/enetc/enetc_rxtx.c index 6680b46103..a2b8153085 100644 --- a/drivers/net/enetc/enetc_rxtx.c +++ b/drivers/net/enetc/enetc_rxtx.c @@ -389,6 +389,16 @@ enetc_dev_rx_parse(struct rte_mbuf *m, uint16_t parse_results) RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_ICMP; return; + case ENETC_PKT_TYPE_IPV4_FRAG: + m->packet_type = RTE_PTYPE_L2_ETHER | + RTE_PTYPE_L3_IPV4 | + RTE_PTYPE_L4_FRAG; + return; + case ENETC_PKT_TYPE_IPV6_FRAG: + m->packet_type = RTE_PTYPE_L2_ETHER | + RTE_PTYPE_L3_IPV6 | + RTE_PTYPE_L4_FRAG; + return; /* More switch cases can be added */ default: enetc_slow_parsing(m, parse_results); -- 2.25.1