DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: add L4 port to verbose output
@ 2024-08-15 14:20 Alex Chapman
  2024-08-15 15:22 ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Chapman @ 2024-08-15 14:20 UTC (permalink / raw)
  To: dev
  Cc: Aman Singh, Jeremy Spewock, Honnappa Nagarahalli,
	Juraj Linkeš,
	Alex Chapman, Luca Vizzarro, Paul Szczepanek

To help distinguish packets we want to add more identifiable
information and print port number for all packets.
This will make packet metadata more uniform as previously it
only printed port number for encapsulated packets.

Bugzilla-ID: 1517

Signed-off-by: Alex Chapman <alex.chapman@arm.com>
Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>
---
 app/test-pmd/util.c | 71 +++++++++++++++++++++++++++------------------
 1 file changed, 42 insertions(+), 29 deletions(-)

diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index bf9b639d95..5fa05fad16 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -81,7 +81,6 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 	char buf[256];
 	struct rte_net_hdr_lens hdr_lens;
 	uint32_t sw_packet_type;
-	uint16_t udp_port;
 	uint32_t vx_vni;
 	const char *reason;
 	int dynf_index;
@@ -234,49 +233,63 @@ dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		if (sw_packet_type & RTE_PTYPE_INNER_L4_MASK)
 			MKDUMPSTR(print_buf, buf_size, cur_len,
 				  " - inner_l4_len=%d", hdr_lens.inner_l4_len);
-		if (is_encapsulation) {
-			struct rte_ipv4_hdr *ipv4_hdr;
-			struct rte_ipv6_hdr *ipv6_hdr;
-			struct rte_udp_hdr *udp_hdr;
-			uint8_t l2_len;
-			uint8_t l3_len;
-			uint8_t l4_len;
-			uint8_t l4_proto;
-			struct  rte_vxlan_hdr *vxlan_hdr;
-
-			l2_len  = sizeof(struct rte_ether_hdr);
-
-			/* Do not support ipv4 option field */
-			if (RTE_ETH_IS_IPV4_HDR(packet_type)) {
-				l3_len = sizeof(struct rte_ipv4_hdr);
-				ipv4_hdr = rte_pktmbuf_mtod_offset(mb,
+
+		struct rte_ipv4_hdr *ipv4_hdr;
+		struct rte_ipv6_hdr *ipv6_hdr;
+		struct rte_udp_hdr *udp_hdr;
+		struct rte_tcp_hdr *tcp_hdr;
+		uint8_t l2_len;
+		uint8_t l3_len;
+		uint8_t l4_len;
+		uint8_t l4_proto;
+		uint16_t l4_port;
+		struct  rte_vxlan_hdr *vxlan_hdr;
+
+		l2_len  = sizeof(struct rte_ether_hdr);
+
+		/* Do not support ipv4 option field */
+		if (RTE_ETH_IS_IPV4_HDR(packet_type)) {
+			l3_len = sizeof(struct rte_ipv4_hdr);
+			ipv4_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_ipv4_hdr *,
 				l2_len);
-				l4_proto = ipv4_hdr->next_proto_id;
-			} else {
-				l3_len = sizeof(struct rte_ipv6_hdr);
-				ipv6_hdr = rte_pktmbuf_mtod_offset(mb,
+			l4_proto = ipv4_hdr->next_proto_id;
+		} else {
+			l3_len = sizeof(struct rte_ipv6_hdr);
+			ipv6_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_ipv6_hdr *,
 				l2_len);
-				l4_proto = ipv6_hdr->proto;
-			}
-			if (l4_proto == IPPROTO_UDP) {
-				udp_hdr = rte_pktmbuf_mtod_offset(mb,
+			l4_proto = ipv6_hdr->proto;
+		}
+		if (l4_proto == IPPROTO_UDP) {
+			udp_hdr = rte_pktmbuf_mtod_offset(mb,
 				struct rte_udp_hdr *,
 				l2_len + l3_len);
+			l4_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
+			if (is_encapsulation) {
 				l4_len = sizeof(struct rte_udp_hdr);
 				vxlan_hdr = rte_pktmbuf_mtod_offset(mb,
-				struct rte_vxlan_hdr *,
-				l2_len + l3_len + l4_len);
-				udp_port = RTE_BE_TO_CPU_16(udp_hdr->dst_port);
+					struct rte_vxlan_hdr *,
+					l2_len + l3_len + l4_len);
 				vx_vni = rte_be_to_cpu_32(vxlan_hdr->vx_vni);
 				MKDUMPSTR(print_buf, buf_size, cur_len,
 					  " - VXLAN packet: packet type =%d, "
 					  "Destination UDP port =%d, VNI = %d, "
 					  "last_rsvd = %d", packet_type,
-					  udp_port, vx_vni >> 8, vx_vni & 0xff);
+					  l4_port, vx_vni >> 8, vx_vni & 0xff);
+			} else {
+				MKDUMPSTR(print_buf, buf_size, cur_len,
+					" - Destination UDP port=%d", l4_port);
 			}
+		} else if (l4_proto == IPPROTO_TCP) {
+			tcp_hdr = rte_pktmbuf_mtod_offset(mb,
+				struct rte_tcp_hdr *,
+				l2_len + l3_len);
+			l4_port = RTE_BE_TO_CPU_16(tcp_hdr->dst_port);
+			MKDUMPSTR(print_buf, buf_size, cur_len,
+				" - Destination TCP port=%d", l4_port);
 		}
+
 		MKDUMPSTR(print_buf, buf_size, cur_len,
 			  " - %s queue=0x%x", is_rx ? "Receive" : "Send",
 			  (unsigned int) queue);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/testpmd: add L4 port to verbose output
  2024-08-15 14:20 [PATCH] app/testpmd: add L4 port to verbose output Alex Chapman
@ 2024-08-15 15:22 ` Stephen Hemminger
  2024-08-16 11:46   ` Luca Vizzarro
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2024-08-15 15:22 UTC (permalink / raw)
  To: Alex Chapman
  Cc: dev, Aman Singh, Jeremy Spewock, Honnappa Nagarahalli,
	Juraj Linkeš,
	Luca Vizzarro, Paul Szczepanek

On Thu, 15 Aug 2024 15:20:51 +0100
Alex Chapman <alex.chapman@arm.com> wrote:

> To help distinguish packets we want to add more identifiable
> information and print port number for all packets.
> This will make packet metadata more uniform as previously it
> only printed port number for encapsulated packets.
> 
> Bugzilla-ID: 1517
> 
> Signed-off-by: Alex Chapman <alex.chapman@arm.com>
> Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>
> Reviewed-by: Paul Szczepanek <paul.szczepanek@arm.com>

The verbose output is already too verbose.
Maybe you would like the simpler format (which does include the port number)
see the network packet dissector patches.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/testpmd: add L4 port to verbose output
  2024-08-15 15:22 ` Stephen Hemminger
@ 2024-08-16 11:46   ` Luca Vizzarro
  2024-09-09  8:32     ` Juraj Linkeš
  0 siblings, 1 reply; 4+ messages in thread
From: Luca Vizzarro @ 2024-08-16 11:46 UTC (permalink / raw)
  To: Stephen Hemminger, Alex Chapman
  Cc: dev, Aman Singh, Jeremy Spewock, Honnappa Nagarahalli,
	Juraj Linkeš,
	Paul Szczepanek

On 15/08/2024 16:22, Stephen Hemminger wrote:
> The verbose output is already too verbose.
> Maybe you would like the simpler format (which does include the port number)
> see the network packet dissector patches.

Hi Stephen,

Thank you for the reply you left to Alex's patch. This is actually quite 
helpful.

I've had a look at your patch series and the hexdump is actually quite 
great for our purpose at DTS, as it will allow us to detect a preset 
packet identifier in the payload.

Unfortunately, your patch doesn't solve the problem that Alex is having. 
He's currently writing up a test suite to test the RSS hash keys and the 
respective queues to which the incoming packets are placed into. To 
correctly match the packets to the queue and hash key, he needs a way to 
identify them. We explored some solutions and the L4 port seemed to be 
the most problem-free with the least effort. Using the payload is 
probably best and you've already posted the required changes too. The 
only problem is that your hexdump output does not print the required RSS 
values.

Would you be be keen to add these to your patch? Otherwise, do you have 
any ideas and/or solutions to tackle this specific problem?

Thank you,
Luca Vizzarro

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] app/testpmd: add L4 port to verbose output
  2024-08-16 11:46   ` Luca Vizzarro
@ 2024-09-09  8:32     ` Juraj Linkeš
  0 siblings, 0 replies; 4+ messages in thread
From: Juraj Linkeš @ 2024-09-09  8:32 UTC (permalink / raw)
  To: Luca Vizzarro, Stephen Hemminger, Alex Chapman
  Cc: dev, Aman Singh, Jeremy Spewock, Honnappa Nagarahalli, Paul Szczepanek



On 16. 8. 2024 13:46, Luca Vizzarro wrote:
> On 15/08/2024 16:22, Stephen Hemminger wrote:
>> The verbose output is already too verbose.
>> Maybe you would like the simpler format (which does include the port 
>> number)
>> see the network packet dissector patches.
> 
> Hi Stephen,
> 
> Thank you for the reply you left to Alex's patch. This is actually quite 
> helpful.
> 
> I've had a look at your patch series and the hexdump is actually quite 
> great for our purpose at DTS, as it will allow us to detect a preset 
> packet identifier in the payload.
> 
> Unfortunately, your patch doesn't solve the problem that Alex is having. 
> He's currently writing up a test suite to test the RSS hash keys and the 
> respective queues to which the incoming packets are placed into. To 
> correctly match the packets to the queue and hash key, he needs a way to 
> identify them. We explored some solutions and the L4 port seemed to be 
> the most problem-free with the least effort. Using the payload is 
> probably best and you've already posted the required changes too. The 
> only problem is that your hexdump output does not print the required RSS 
> values.
> 
> Would you be be keen to add these to your patch? Otherwise, do you have 
> any ideas and/or solutions to tackle this specific problem?
> 

Hi Stephen,

Do you have any advice for us?

Thanks,
Juraj

> Thank you,
> Luca Vizzarro


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-09  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-15 14:20 [PATCH] app/testpmd: add L4 port to verbose output Alex Chapman
2024-08-15 15:22 ` Stephen Hemminger
2024-08-16 11:46   ` Luca Vizzarro
2024-09-09  8:32     ` Juraj Linkeš

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).