* [PATCH] examples/ipsec-secgw: compilation fix for GCC-12
@ 2022-08-24 13:52 Amit Prakash Shukla
2022-08-25 8:07 ` Akhil Goyal
2022-08-28 11:59 ` Akhil Goyal
0 siblings, 2 replies; 3+ messages in thread
From: Amit Prakash Shukla @ 2022-08-24 13:52 UTC (permalink / raw)
To: Radu Nicolau, Akhil Goyal, Ruifeng Wang
Cc: dev, jerinj, stable, Amit Prakash Shukla
Typecasting uint32_t array to uint16_t and accessing it as max array
size(at time of declaration of uint32_t array) causes gcc-12 to
throw an error.
GCC 12 raises the following warning:
In function 'send_multi_pkts',
inlined from 'route6_pkts_neon' at
../examples/ipsec-secgw/ipsec_lpm_neon.h:170:2,
inlined from 'ipsec_poll_mode_wrkr_inl_pr' at
../examples/ipsec-secgw/ipsec_worker.c:1257:4:
../examples/ipsec-secgw/ipsec_neon.h:261:21: error: 'dst_port' may be used
uninitialized [-Werror=maybe-uninitialized]
261 | dlp = dst_port[i - 1];
| ~~~~^~~~~~~~~~~~~~~~~
In file included from ../examples/ipsec-secgw/ipsec_worker.c:16:
../examples/ipsec-secgw/ipsec_worker.c: In function
'ipsec_poll_mode_wrkr_inl_pr':
../examples/ipsec-secgw/ipsec_lpm_neon.h:118:17:
note: 'dst_port' declared here
118 | int32_t dst_port[MAX_PKT_BURST];
| ^~~~~~~~
Fixes: ce23f7ceec6b ("examples/ipsec-secgw: add support of NEON with poll mode")
Fixes: dcbf9ad5fdf4 ("examples/ipsec-secgw: move fast path helper functions")
Cc: stable@dpdk.org
Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
Change-Id: I083405d2c083cb1228e1a0126240937675a44cd9
---
examples/ipsec-secgw/ipsec.h | 2 ++
examples/ipsec-secgw/ipsec_lpm_neon.h | 8 +++-----
examples/ipsec-secgw/ipsec_neon.h | 1 -
examples/ipsec-secgw/ipsec_worker.h | 12 ++++++------
4 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 2005ae8fec..2c37bb022d 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -43,6 +43,8 @@
(((t) & RTE_IPSEC_SATP_IPV_MASK) == RTE_IPSEC_SATP_IPV4)) || \
((t) & RTE_IPSEC_SATP_MODE_MASK) == RTE_IPSEC_SATP_MODE_TUNLV4)
+#define BAD_PORT ((uint16_t)-1)
+
struct rte_crypto_xform;
struct ipsec_xform;
struct rte_mbuf;
diff --git a/examples/ipsec-secgw/ipsec_lpm_neon.h b/examples/ipsec-secgw/ipsec_lpm_neon.h
index 959a5a8666..6c751b6aab 100644
--- a/examples/ipsec-secgw/ipsec_lpm_neon.h
+++ b/examples/ipsec-secgw/ipsec_lpm_neon.h
@@ -115,7 +115,7 @@ static inline void
route6_pkts_neon(struct rt_ctx *rt_ctx, struct rte_mbuf **pkts, int nb_rx)
{
uint8_t dst_ip6[MAX_PKT_BURST][16];
- int32_t dst_port[MAX_PKT_BURST];
+ uint16_t dst_port[MAX_PKT_BURST];
struct rte_ether_hdr *eth_hdr;
struct rte_ipv6_hdr *ipv6_hdr;
int32_t hop[MAX_PKT_BURST];
@@ -160,14 +160,12 @@ route6_pkts_neon(struct rt_ctx *rt_ctx, struct rte_mbuf **pkts, int nb_rx)
dst_port[i] = get_hop_for_offload_pkt(pkt, 1);
} else {
/* Need to use hop returned by lookup */
- dst_port[i] = hop[lpm_pkts++];
+ dst_port[i] = (uint16_t)hop[lpm_pkts++];
}
- if (dst_port[i] == -1)
- dst_port[i] = BAD_PORT;
}
/* Send packets */
- send_multi_pkts(pkts, (uint16_t *)dst_port, nb_rx, 0, 0, false);
+ send_multi_pkts(pkts, dst_port, nb_rx, 0, 0, false);
}
/*
diff --git a/examples/ipsec-secgw/ipsec_neon.h b/examples/ipsec-secgw/ipsec_neon.h
index 39e70ad275..9c04099a07 100644
--- a/examples/ipsec-secgw/ipsec_neon.h
+++ b/examples/ipsec-secgw/ipsec_neon.h
@@ -9,7 +9,6 @@
#include "neon/port_group.h"
#define MAX_TX_BURST (MAX_PKT_BURST / 2)
-#define BAD_PORT ((uint16_t)-1)
extern xmm_t val_eth[RTE_MAX_ETHPORTS];
diff --git a/examples/ipsec-secgw/ipsec_worker.h b/examples/ipsec-secgw/ipsec_worker.h
index 94f94d2236..107f5fc3e8 100644
--- a/examples/ipsec-secgw/ipsec_worker.h
+++ b/examples/ipsec-secgw/ipsec_worker.h
@@ -438,7 +438,7 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip,
ip->num = j;
}
-static __rte_always_inline int32_t
+static __rte_always_inline uint32_t
get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6)
{
struct ipsec_mbuf_metadata *priv;
@@ -460,7 +460,7 @@ get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6)
fail:
if (is_ipv6)
- return -1;
+ return BAD_PORT;
/* else */
return 0;
@@ -473,7 +473,7 @@ route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
uint32_t hop[MAX_PKT_BURST * 2];
uint32_t dst_ip[MAX_PKT_BURST * 2];
struct rte_ether_hdr *ethhdr;
- int32_t pkt_hop = 0;
+ uint32_t pkt_hop = 0;
uint16_t i, offset;
uint16_t lpm_pkts = 0;
unsigned int lcoreid = rte_lcore_id();
@@ -562,7 +562,7 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)
uint8_t dst_ip[MAX_PKT_BURST * 2][16];
struct rte_ether_hdr *ethhdr;
uint8_t *ip6_dst;
- int32_t pkt_hop = 0;
+ uint32_t pkt_hop = 0;
uint16_t i, offset;
uint16_t lpm_pkts = 0;
unsigned int lcoreid = rte_lcore_id();
@@ -602,10 +602,10 @@ route6_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[], uint8_t nb_pkts)
pkt_hop = get_hop_for_offload_pkt(pkt, 1);
} else {
/* Need to use hop returned by lookup */
- pkt_hop = hop[lpm_pkts++];
+ pkt_hop = (uint16_t)hop[lpm_pkts++];
}
- if (pkt_hop == -1) {
+ if (pkt_hop == BAD_PORT) {
core_statistics[lcoreid].lpm6.miss++;
free_pkts(&pkt, 1);
continue;
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] examples/ipsec-secgw: compilation fix for GCC-12
2022-08-24 13:52 [PATCH] examples/ipsec-secgw: compilation fix for GCC-12 Amit Prakash Shukla
@ 2022-08-25 8:07 ` Akhil Goyal
2022-08-28 11:59 ` Akhil Goyal
1 sibling, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2022-08-25 8:07 UTC (permalink / raw)
To: Amit Prakash Shukla, Radu Nicolau, Ruifeng Wang
Cc: dev, Jerin Jacob Kollanukkaran, stable, Amit Prakash Shukla
> Subject: [PATCH] examples/ipsec-secgw: compilation fix for GCC-12
>
> Typecasting uint32_t array to uint16_t and accessing it as max array
> size(at time of declaration of uint32_t array) causes gcc-12 to
> throw an error.
>
> GCC 12 raises the following warning:
>
> In function 'send_multi_pkts',
> inlined from 'route6_pkts_neon' at
> ../examples/ipsec-secgw/ipsec_lpm_neon.h:170:2,
> inlined from 'ipsec_poll_mode_wrkr_inl_pr' at
> ../examples/ipsec-secgw/ipsec_worker.c:1257:4:
> ../examples/ipsec-secgw/ipsec_neon.h:261:21: error: 'dst_port' may be used
> uninitialized [-Werror=maybe-uninitialized]
> 261 | dlp = dst_port[i - 1];
> | ~~~~^~~~~~~~~~~~~~~~~
> In file included from ../examples/ipsec-secgw/ipsec_worker.c:16:
> ../examples/ipsec-secgw/ipsec_worker.c: In function
> 'ipsec_poll_mode_wrkr_inl_pr':
> ../examples/ipsec-secgw/ipsec_lpm_neon.h:118:17:
> note: 'dst_port' declared here
> 118 | int32_t dst_port[MAX_PKT_BURST];
> | ^~~~~~~~
>
> Fixes: ce23f7ceec6b ("examples/ipsec-secgw: add support of NEON with poll
> mode")
> Fixes: dcbf9ad5fdf4 ("examples/ipsec-secgw: move fast path helper functions")
> Cc: stable@dpdk.org
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> Change-Id: I083405d2c083cb1228e1a0126240937675a44cd9
Change-id need to be removed. Will remove while applying.
Acked-by: Akhil Goyal <gakhil@marvell.com>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] examples/ipsec-secgw: compilation fix for GCC-12
2022-08-24 13:52 [PATCH] examples/ipsec-secgw: compilation fix for GCC-12 Amit Prakash Shukla
2022-08-25 8:07 ` Akhil Goyal
@ 2022-08-28 11:59 ` Akhil Goyal
1 sibling, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2022-08-28 11:59 UTC (permalink / raw)
To: Amit Prakash Shukla, Radu Nicolau, Ruifeng Wang
Cc: dev, Jerin Jacob Kollanukkaran, stable, Amit Prakash Shukla
> Subject: [PATCH] examples/ipsec-secgw: compilation fix for GCC-12
>
> Typecasting uint32_t array to uint16_t and accessing it as max array
> size(at time of declaration of uint32_t array) causes gcc-12 to
> throw an error.
>
> GCC 12 raises the following warning:
>
> In function 'send_multi_pkts',
> inlined from 'route6_pkts_neon' at
> ../examples/ipsec-secgw/ipsec_lpm_neon.h:170:2,
> inlined from 'ipsec_poll_mode_wrkr_inl_pr' at
> ../examples/ipsec-secgw/ipsec_worker.c:1257:4:
> ../examples/ipsec-secgw/ipsec_neon.h:261:21: error: 'dst_port' may be used
> uninitialized [-Werror=maybe-uninitialized]
> 261 | dlp = dst_port[i - 1];
> | ~~~~^~~~~~~~~~~~~~~~~
> In file included from ../examples/ipsec-secgw/ipsec_worker.c:16:
> ../examples/ipsec-secgw/ipsec_worker.c: In function
> 'ipsec_poll_mode_wrkr_inl_pr':
> ../examples/ipsec-secgw/ipsec_lpm_neon.h:118:17:
> note: 'dst_port' declared here
> 118 | int32_t dst_port[MAX_PKT_BURST];
> | ^~~~~~~~
>
> Fixes: ce23f7ceec6b ("examples/ipsec-secgw: add support of NEON with poll
> mode")
> Fixes: dcbf9ad5fdf4 ("examples/ipsec-secgw: move fast path helper functions")
> Cc: stable@dpdk.org
>
> Signed-off-by: Amit Prakash Shukla <amitprakashs@marvell.com>
> Change-Id: I083405d2c083cb1228e1a0126240937675a44cd9
Applied to dpdk-next-crypto
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-28 11:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 13:52 [PATCH] examples/ipsec-secgw: compilation fix for GCC-12 Amit Prakash Shukla
2022-08-25 8:07 ` Akhil Goyal
2022-08-28 11:59 ` Akhil Goyal
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).