Skip to contentSkip to conversation

lib/net: Add ICMP support to rte_net_get_ptype()

PATCH In review Eimear Morrissey 2 participants 4 messages Oct 10, 2025 – Jun 8

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/net: Add ICMP support to rte_net_get_ptype()

Set RTE_PTYPE_L4_ICMP for ICMP packets.

---
 lib/net/rte_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/net/rte_net.c +3 -0
index be24690fdf..eb205ca1b1 100644
@@ -10,6 +10,7 @@
 #include <rte_byteorder.h>
 #include <rte_ether.h>
 #include <rte_ip.h>
+#include <rte_icmp.h>
 #include <rte_tcp.h>
 #include <rte_udp.h>
 #include <rte_sctp.h>
@@ -63,6 +64,7 @@ static uint32_t
 ptype_l4(uint8_t proto)
 {
 	static const uint32_t ptype_l4_proto[256] = {
+		[IPPROTO_ICMP] = RTE_PTYPE_L4_ICMP,
 		[IPPROTO_UDP] = RTE_PTYPE_L4_UDP,
 		[IPPROTO_TCP] = RTE_PTYPE_L4_TCP,
 		[IPPROTO_SCTP] = RTE_PTYPE_L4_SCTP,
@@ -120,6 +122,7 @@ static uint32_t
 ptype_inner_l4(uint8_t proto)
 {
 	static const uint32_t ptype_inner_l4_proto[256] = {
+		[IPPROTO_ICMP] = RTE_PTYPE_INNER_L4_ICMP,
 		[IPPROTO_UDP] = RTE_PTYPE_INNER_L4_UDP,
 		[IPPROTO_TCP] = RTE_PTYPE_INNER_L4_TCP,
 		[IPPROTO_SCTP] = RTE_PTYPE_INNER_L4_SCTP,
Signature · 1 line
2.35.3
#2 lore raw
Quoted 7 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Wednesday 15 October 2025 18:30
To: Eimear Morrissey <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] lib/net: Add ICMP support to rte_net_get_ptype()

Quoted 8 lines
Quoted 3 lines · On Thu, 9 Oct 2025 16:27:40 +0100 Eimear Morrissey…

Set RTE_PTYPE_L4_ICMP for ICMP packets.

Would be good to do ICMP6 as well.

Should an ICMPv6 packet be RTE_PTYPE_L4_ICMP/RTE_PTYPE_INNER_L4_ICMP as well?

The comments in rte_mbuf_ptype.h are inconsistent, the top level comment with examples suggests that 'version'=6, 'next header'=0x3A
should be RTE_PYTPE_INNER_L4_ICMP but the comment on RTE_PTYPE_INNER_L4_ICMP itself says 'version'=6, 'next header'=1 ?

-Eimear

#3 lore raw
Quoted 17 lines · On Fri, 31 Oct 2025 12:32:18 +0000 Eimear Morrissey…
Quoted 7 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Wednesday 15 October 2025 18:30
To: Eimear Morrissey <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH] lib/net: Add ICMP support to rte_net_get_ptype()

Quoted 8 lines
Quoted 3 lines · On Thu, 9 Oct 2025 16:27:40 +0100 Eimear Morrissey…

Set RTE_PTYPE_L4_ICMP for ICMP packets.

Would be good to do ICMP6 as well.

Quoted 6 lines

Should an ICMPv6 packet be RTE_PTYPE_L4_ICMP/RTE_PTYPE_INNER_L4_ICMP as well?

The comments in rte_mbuf_ptype.h are inconsistent, the top level comment with examples suggests that 'version'=6, 'next header'=0x3A
should be RTE_PYTPE_INNER_L4_ICMP but the comment on RTE_PTYPE_INNER_L4_ICMP itself says 'version'=6, 'next header'=1 ?

-Eimear

	static const uint32_t ptype_l4_proto[256] = {
		[IPPROTO_ICMP] = RTE_PTYPE_L4_ICMP,
		[IPPROTO_ICMPV6] = RTE_PTYPE_L4_ICMP,
		[IPPROTO_UDP] = RTE_PTYPE_L4_UDP,
		...