[dpdk-stable] patch 'net: avoid cast-align warning in VLAN insert function' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:31:13 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/7f401592f5b617e40a2e858556f9528855954657

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 7f401592f5b617e40a2e858556f9528855954657 Mon Sep 17 00:00:00 2001
From: Eli Britstein <elibr at nvidia.com>
Date: Thu, 21 Oct 2021 11:51:30 +0300
Subject: [PATCH] net: avoid cast-align warning in VLAN insert function
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit a3f8d05871887d257703f6f073da002b6c568519 ]

In rte_vlan_insert there is a casting of rte_pktmbuf_prepend returned
value to (struct rte_ether_hdr *), which causes cast-align warning when
using strict cast align flag with supporting gcc:
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
CFLAGS="-Wcast-align=strict" make V=1 -C examples/l2fwd clean static

In file included from main.c:35:
/dpdk/build/include/rte_ether.h:370:7: warning: cast increases required
alignment of target type [-Wcast-align]
  370 |  nh = (struct rte_ether_hdr *)
      |       ^

As the code assumes correct alignment, add first a (void *) casting, to
avoid the warning.

Fixes: c974021a5949 ("ether: add soft vlan encap/decap")

Signed-off-by: Eli Britstein <elibr at nvidia.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 lib/librte_net/rte_ether.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
index 060b63fc9b..0baceb2c4a 100644
--- a/lib/librte_net/rte_ether.h
+++ b/lib/librte_net/rte_ether.h
@@ -358,7 +358,7 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)
 		return -EINVAL;
 
 	oh = rte_pktmbuf_mtod(*m, struct rte_ether_hdr *);
-	nh = (struct rte_ether_hdr *)
+	nh = (struct rte_ether_hdr *)(void *)
 		rte_pktmbuf_prepend(*m, sizeof(struct rte_vlan_hdr));
 	if (nh == NULL)
 		return -ENOSPC;
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:10.310208257 +0800
+++ 0189-net-avoid-cast-align-warning-in-VLAN-insert-function.patch	2021-11-10 14:17:02.000745027 +0800
@@ -1 +1 @@
-From a3f8d05871887d257703f6f073da002b6c568519 Mon Sep 17 00:00:00 2001
+From 7f401592f5b617e40a2e858556f9528855954657 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit a3f8d05871887d257703f6f073da002b6c568519 ]
@@ -22 +24,0 @@
-Cc: stable at dpdk.org
@@ -27 +29 @@
- lib/net/rte_ether.h | 2 +-
+ lib/librte_net/rte_ether.h | 2 +-
@@ -30,5 +32,5 @@
-diff --git a/lib/net/rte_ether.h b/lib/net/rte_ether.h
-index 2c7da55b6b..1a0dbf0d60 100644
---- a/lib/net/rte_ether.h
-+++ b/lib/net/rte_ether.h
-@@ -367,7 +367,7 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)
+diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h
+index 060b63fc9b..0baceb2c4a 100644
+--- a/lib/librte_net/rte_ether.h
++++ b/lib/librte_net/rte_ether.h
+@@ -358,7 +358,7 @@ static inline int rte_vlan_insert(struct rte_mbuf **m)


More information about the stable mailing list