DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: add parsing for multiple VLAN headers
@ 2020-04-20 15:32 Raslan Darawsheh
  2020-04-21 14:54 ` Iremonger, Bernard
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Raslan Darawsheh @ 2020-04-20 15:32 UTC (permalink / raw)
  To: bernard.iremonger, jingjing.wu, wenzhuo.lu; +Cc: dev, stable

When having multiple VLANs in the packet, parse_ethernet
is cabable of parsing only the first vlan.

add parsing for mutliple VLAN headers in the packet.

Fixes: 51f694dd40f5 ("app/testpmd: rework checksum forward engine")
Cc: stable@dpdk.org

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
---
 app/test-pmd/csumonly.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index fe19615..b0665f7 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -139,22 +139,22 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info)
 
 /*
  * Parse an ethernet header to fill the ethertype, l2_len, l3_len and
- * ipproto. This function is able to recognize IPv4/IPv6 with one optional vlan
- * header. The l4_len argument is only set in case of TCP (useful for TSO).
+ * ipproto. This function is able to recognize IPv4/IPv6 with optional VLAN
+ * headers. The l4_len argument is only set in case of TCP (useful for TSO).
  */
 static void
 parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info)
 {
 	struct rte_ipv4_hdr *ipv4_hdr;
 	struct rte_ipv6_hdr *ipv6_hdr;
+	struct rte_vlan_hdr *vlan_hdr;
 
 	info->l2_len = sizeof(struct rte_ether_hdr);
 	info->ethertype = eth_hdr->ether_type;
 
-	if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) {
-		struct rte_vlan_hdr *vlan_hdr = (
-			struct rte_vlan_hdr *)(eth_hdr + 1);
-
+	while (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) {
+		vlan_hdr = (struct rte_vlan_hdr *)
+			((char *)eth_hdr + info->l2_len);
 		info->l2_len  += sizeof(struct rte_vlan_hdr);
 		info->ethertype = vlan_hdr->eth_proto;
 	}
-- 
2.7.4


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

end of thread, other threads:[~2020-04-24 16:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 15:32 [dpdk-dev] [PATCH] app/testpmd: add parsing for multiple VLAN headers Raslan Darawsheh
2020-04-21 14:54 ` Iremonger, Bernard
2020-04-21 20:47 ` Ferruh Yigit
2020-04-22 11:05   ` Iremonger, Bernard
2020-04-22 11:28     ` Raslan Darawsheh
2020-04-22  7:22 ` Ori Kam
2020-04-23  8:41 ` [dpdk-dev] [PATCH v2] " Raslan Darawsheh
2020-04-23  8:59   ` Iremonger, Bernard
2020-04-23  9:01     ` Raslan Darawsheh
2020-04-23  9:05   ` [dpdk-dev] [PATCH v3] app/testpmd: add parsing for QINQ " Raslan Darawsheh
2020-04-24 16:35     ` Ferruh Yigit

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).