app/testpmd: dump TCI when asking for VLAN insertion

Message ID 20240318080237.2170473-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: dump TCI when asking for VLAN insertion |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

David Marchand March 18, 2024, 8:02 a.m. UTC
  I got some report for users that VLAN insertion was not working as the
only thing they could see in verbose mode was a 0x0800 ethertype even
though the RTE_MBUF_F_TX_VLAN flag was shown.

Dump the VLAN TCI from mbuf metadata when VLAN insertion is requested.
This should enhance the situation.

Before:
  src=76:4E:EA:3F:78:1D - dst=50:7C:6F:3C:10:5B - pool=mb_pool_1 -
	type=0x0800 - length=64 - nb_segs=1 -
	sw ptype: L2_ETHER L3_IPV4 L4_UDP  -
	l2_len=14 - l3_len=20 - l4_len=8 - Send queue=0x0
  ol_flags: RTE_MBUF_F_TX_VLAN RTE_MBUF_F_TX_L4_NO_CKSUM

After:
  src=76:4E:EA:3F:78:1D - dst=50:7C:6F:3C:10:5B - pool=mb_pool_1 -
	type=0x0800 - length=64 - nb_segs=1 - VLAN tci=0x2a -
	sw ptype: L2_ETHER L3_IPV4 L4_UDP  -
	l2_len=14 - l3_len=20 - l4_len=8 - Send queue=0x0
  ol_flags: RTE_MBUF_F_TX_VLAN RTE_MBUF_F_TX_L4_NO_CKSUM

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 app/test-pmd/util.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit March 20, 2024, 2:01 p.m. UTC | #1
On 3/18/2024 8:02 AM, David Marchand wrote:
> I got some report for users that VLAN insertion was not working as the
> only thing they could see in verbose mode was a 0x0800 ethertype even
> though the RTE_MBUF_F_TX_VLAN flag was shown.
> 
> Dump the VLAN TCI from mbuf metadata when VLAN insertion is requested.
> This should enhance the situation.
> 
> Before:
>   src=76:4E:EA:3F:78:1D - dst=50:7C:6F:3C:10:5B - pool=mb_pool_1 -
> 	type=0x0800 - length=64 - nb_segs=1 -
> 	sw ptype: L2_ETHER L3_IPV4 L4_UDP  -
> 	l2_len=14 - l3_len=20 - l4_len=8 - Send queue=0x0
>   ol_flags: RTE_MBUF_F_TX_VLAN RTE_MBUF_F_TX_L4_NO_CKSUM
> 
> After:
>   src=76:4E:EA:3F:78:1D - dst=50:7C:6F:3C:10:5B - pool=mb_pool_1 -
> 	type=0x0800 - length=64 - nb_segs=1 - VLAN tci=0x2a -
> 	sw ptype: L2_ETHER L3_IPV4 L4_UDP  -
> 	l2_len=14 - l3_len=20 - l4_len=8 - Send queue=0x0
>   ol_flags: RTE_MBUF_F_TX_VLAN RTE_MBUF_F_TX_L4_NO_CKSUM
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
>

Reviewed-by: Ferruh Yigit <ferruh.yigit@amd.com>

Applied to dpdk-next-net/main, thanks.
  

Patch

diff --git a/app/test-pmd/util.c b/app/test-pmd/util.c
index 5aa69ed545..bf9b639d95 100644
--- a/app/test-pmd/util.c
+++ b/app/test-pmd/util.c
@@ -180,11 +180,13 @@  dump_pkt_burst(uint16_t port_id, uint16_t queue, struct rte_mbuf *pkts[],
 		if (is_timestamp_enabled(mb))
 			MKDUMPSTR(print_buf, buf_size, cur_len,
 				  " - timestamp %"PRIu64" ", get_timestamp(mb));
-		if (ol_flags & RTE_MBUF_F_RX_QINQ)
+		if ((is_rx && (ol_flags & RTE_MBUF_F_RX_QINQ) != 0) ||
+				(!is_rx && (ol_flags & RTE_MBUF_F_TX_QINQ) != 0))
 			MKDUMPSTR(print_buf, buf_size, cur_len,
 				  " - QinQ VLAN tci=0x%x, VLAN tci outer=0x%x",
 				  mb->vlan_tci, mb->vlan_tci_outer);
-		else if (ol_flags & RTE_MBUF_F_RX_VLAN)
+		else if ((is_rx && (ol_flags & RTE_MBUF_F_RX_VLAN) != 0) ||
+				(!is_rx && (ol_flags & RTE_MBUF_F_TX_VLAN) != 0))
 			MKDUMPSTR(print_buf, buf_size, cur_len,
 				  " - VLAN tci=0x%x", mb->vlan_tci);
 		if (!is_rx && (ol_flags & RTE_MBUF_DYNFLAG_TX_METADATA))