[PATCH 11/11] net/enetfec: add software packet type parsing and cleanup
Hemant Agrawal
hemant.agrawal at nxp.com
Mon Oct 6 10:04:10 CEST 2025
This patch adds software-based parsing for Ethernet packet types,
specifically identifying IPv4 and IPv6 packets. This is a temporary
solution until hardware-based parsing is implemented.
Additionally, variable declarations in `enetfec_recv_pkts()` are
reordered to follow reverse Christmas tree style for better readability.
Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
drivers/net/enetfec/enet_rxtx.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/enetfec/enet_rxtx.c b/drivers/net/enetfec/enet_rxtx.c
index 95767b561e..91a231af6c 100644
--- a/drivers/net/enetfec/enet_rxtx.c
+++ b/drivers/net/enetfec/enet_rxtx.c
@@ -17,12 +17,13 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts,
uint16_t nb_pkts)
{
struct rte_mempool *pool;
- struct bufdesc *bdp;
struct rte_mbuf *mbuf, *new_mbuf = NULL;
unsigned short status;
unsigned short pkt_len;
int pkt_received = 0, index = 0;
+ struct rte_ether_hdr *eth;
void *data, *mbuf_data;
+ struct bufdesc *bdp;
uint16_t vlan_tag;
struct bufdesc_ex *ebdp = NULL;
bool vlan_packet_rcvd = false;
@@ -92,6 +93,16 @@ enetfec_recv_pkts(void *rxq1, struct rte_mbuf **rx_pkts,
data = rte_pktmbuf_adj(mbuf, 2);
rx_pkts[pkt_received] = mbuf;
+
+ /* Assuming Ethernet packets, doing software packet type parsing.
+ * To be replaced by HW packet parsing
+ */
+ eth = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *);
+ mbuf->packet_type = RTE_PTYPE_L2_ETHER;
+ if (rte_be_to_cpu_16(eth->ether_type) == RTE_ETHER_TYPE_IPV4)
+ mbuf->packet_type |= RTE_PTYPE_L3_IPV4;
+ if (rte_be_to_cpu_16(eth->ether_type) == RTE_ETHER_TYPE_IPV6)
+ mbuf->packet_type |= RTE_PTYPE_L3_IPV6;
pkt_received++;
/* Extract the enhanced buffer descriptor */
--
2.25.1
More information about the dev
mailing list