From: Vanshika Shukla <vanshika.shukla@nxp.com>
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 <apeksha.gupta@nxp.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
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(+)
@@ -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
@@ -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 \
@@ -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
@@ -693,6 +693,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
*/
@@ -718,6 +740,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,
};
/*
@@ -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
@@ -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);