From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Radu Nicolau <radu.nicolau@intel.com>,
Akhil Goyal <gakhil@marvell.com>
Subject: [PATCH 09/23] examples/ipsec-secgw: fix shadowed variables
Date: Mon, 6 Apr 2026 20:49:35 -0700 [thread overview]
Message-ID: <20260407035209.650419-10-stephen@networkplumber.org> (raw)
In-Reply-To: <20260407035209.650419-1-stephen@networkplumber.org>
Rename variables where local variable shadows a global declaration.
Remove unused lcore_conf parameter from sa_init().
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/ipsec-secgw/ipsec-secgw.c | 3 +--
examples/ipsec-secgw/ipsec.c | 3 +--
examples/ipsec-secgw/ipsec.h | 1 -
examples/ipsec-secgw/ipsec_worker.c | 30 ++++++++++++-------------
examples/ipsec-secgw/ipsec_worker.h | 4 ++--
examples/ipsec-secgw/meson.build | 1 -
examples/ipsec-secgw/sa.c | 34 +++++++++++++----------------
7 files changed, 34 insertions(+), 42 deletions(-)
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index fe489f9a56..e10c359226 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -3123,8 +3123,7 @@ main(int32_t argc, char **argv)
if ((socket_ctx[socket_id].session_pool != NULL) &&
(socket_ctx[socket_id].sa_in == NULL) &&
(socket_ctx[socket_id].sa_out == NULL)) {
- sa_init(&socket_ctx[socket_id], socket_id, lcore_conf,
- eh_conf->mode_params);
+ sa_init(&socket_ctx[socket_id], socket_id, eh_conf->mode_params);
sp4_init(&socket_ctx[socket_id], socket_id);
sp6_init(&socket_ctx[socket_id], socket_id);
rt_init(&socket_ctx[socket_id], socket_id);
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index c65efd1c16..c3e37f76d1 100644
--- a/examples/ipsec-secgw/ipsec.c
+++ b/examples/ipsec-secgw/ipsec.c
@@ -415,7 +415,7 @@ int
create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa,
struct rte_ipsec_session *ips)
{
- int32_t ret = 0;
+ int ret = 0;
void *sec_ctx;
struct rte_security_session_conf sess_conf = {
.action_type = ips->type,
@@ -489,7 +489,6 @@ create_inline_session(struct socket_ctx *skt_ctx, struct ipsec_sa *sa,
if (ips->type == RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO) {
struct rte_flow_error err;
- int ret = 0;
sec_ctx = rte_eth_dev_get_sec_ctx(sa->portid);
if (sec_ctx == NULL) {
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index e3cc43ef3b..20757eeba1 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -439,7 +439,6 @@ sa_spi_present(struct sa_ctx *sa_ctx, uint32_t spi, int inbound);
void
sa_init(struct socket_ctx *ctx, int32_t socket_id,
- struct lcore_conf *lcore_conf,
const struct eventmode_conf *em_conf);
void
diff --git a/examples/ipsec-secgw/ipsec_worker.c b/examples/ipsec-secgw/ipsec_worker.c
index 04609964cd..612f78f2dc 100644
--- a/examples/ipsec-secgw/ipsec_worker.c
+++ b/examples/ipsec-secgw/ipsec_worker.c
@@ -94,7 +94,7 @@ ev_vector_attr_update(struct rte_event_vector *vec, struct rte_mbuf *pkt)
}
static inline void
-prepare_out_sessions_tbl(struct sa_ctx *sa_out,
+prepare_out_sessions_tbl(struct sa_ctx *out_ctx,
struct port_drv_mode_data *data,
uint16_t size)
{
@@ -102,12 +102,12 @@ prepare_out_sessions_tbl(struct sa_ctx *sa_out,
struct ipsec_sa *sa;
uint32_t i;
- if (!sa_out)
+ if (!out_ctx)
return;
- for (i = 0; i < sa_out->nb_sa; i++) {
+ for (i = 0; i < out_ctx->nb_sa; i++) {
- sa = &sa_out->sa[i];
+ sa = &out_ctx->sa[i];
if (!sa)
continue;
@@ -1597,7 +1597,7 @@ ipsec_poll_mode_wrkr_inl_pr(void)
uint64_t prev_tsc, diff_tsc, cur_tsc;
struct ipsec_core_statistics *stats;
struct rt_ctx *rt4_ctx, *rt6_ctx;
- struct sa_ctx *sa_in, *sa_out;
+ struct sa_ctx *in_ctx, *out_ctx;
struct traffic_type ip4, ip6;
struct lcore_rx_queue *rxql;
struct rte_mbuf **v4, **v6;
@@ -1621,11 +1621,11 @@ ipsec_poll_mode_wrkr_inl_pr(void)
sp4_in = socket_ctx[socket_id].sp_ip4_in;
sp6_in = socket_ctx[socket_id].sp_ip6_in;
- sa_in = socket_ctx[socket_id].sa_in;
+ in_ctx = socket_ctx[socket_id].sa_in;
sp4_out = socket_ctx[socket_id].sp_ip4_out;
sp6_out = socket_ctx[socket_id].sp_ip6_out;
- sa_out = socket_ctx[socket_id].sa_out;
+ out_ctx = socket_ctx[socket_id].sa_out;
qconf->frag.pool_indir = socket_ctx[socket_id].mbuf_pool_indir;
@@ -1676,11 +1676,11 @@ ipsec_poll_mode_wrkr_inl_pr(void)
free_pkts(trf.ipsec.pkts, trf.ipsec.num);
if (is_unprotected_port(portid)) {
- inbound_sp_sa(sp4_in, sa_in, &trf.ip4,
+ inbound_sp_sa(sp4_in, in_ctx, &trf.ip4,
trf.ip4.num,
&stats->inbound.spd4);
- inbound_sp_sa(sp6_in, sa_in, &trf.ip6,
+ inbound_sp_sa(sp6_in, in_ctx, &trf.ip6,
trf.ip6.num,
&stats->inbound.spd6);
@@ -1692,12 +1692,12 @@ ipsec_poll_mode_wrkr_inl_pr(void)
ip4.num = 0;
ip6.num = 0;
- outb_inl_pro_spd_process(sp4_out, sa_out,
+ outb_inl_pro_spd_process(sp4_out, out_ctx,
&trf.ip4, &ip4, &ip6,
true,
&stats->outbound.spd4);
- outb_inl_pro_spd_process(sp6_out, sa_out,
+ outb_inl_pro_spd_process(sp6_out, out_ctx,
&trf.ip6, &ip6, &ip4,
false,
&stats->outbound.spd6);
@@ -1733,7 +1733,7 @@ ipsec_poll_mode_wrkr_inl_pr_ss(void)
struct lcore_rx_queue *rxql;
struct ipsec_sa *sa = NULL;
struct lcore_conf *qconf;
- struct sa_ctx *sa_out;
+ struct sa_ctx *out_ctx;
uint32_t i, nb_rx, j;
int32_t socket_id;
uint32_t lcore_id;
@@ -1746,9 +1746,9 @@ ipsec_poll_mode_wrkr_inl_pr_ss(void)
socket_id = rte_lcore_to_socket_id(lcore_id);
/* Get SA info */
- sa_out = socket_ctx[socket_id].sa_out;
- if (sa_out && single_sa_idx < sa_out->nb_sa) {
- sa = &sa_out->sa[single_sa_idx];
+ out_ctx = socket_ctx[socket_id].sa_out;
+ if (out_ctx && single_sa_idx < out_ctx->nb_sa) {
+ sa = &out_ctx->sa[single_sa_idx];
ips = ipsec_get_primary_session(sa);
sa_out_portid = sa->portid;
if (sa->flags & IP6_TUNNEL)
diff --git a/examples/ipsec-secgw/ipsec_worker.h b/examples/ipsec-secgw/ipsec_worker.h
index 8f96161293..6db5951b9b 100644
--- a/examples/ipsec-secgw/ipsec_worker.h
+++ b/examples/ipsec-secgw/ipsec_worker.h
@@ -469,7 +469,7 @@ get_hop_for_offload_pkt(struct rte_mbuf *pkt, int is_ipv6)
static __rte_always_inline void
route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
- uint32_t nb_pkts, uint64_t tx_offloads, bool ip_cksum)
+ uint32_t nb_pkts, uint64_t ol_flags, bool ip_cksum)
{
uint32_t hop[MAX_PKT_BURST * 2];
uint32_t dst_ip[MAX_PKT_BURST * 2];
@@ -536,7 +536,7 @@ route4_pkts(struct rt_ctx *rt_ctx, struct rte_mbuf *pkts[],
if (ip_cksum) {
struct rte_ipv4_hdr *ip;
- pkt->ol_flags |= tx_offloads;
+ pkt->ol_flags |= ol_flags;
ip = (struct rte_ipv4_hdr *)(ethhdr + 1);
ip->hdr_checksum = 0;
diff --git a/examples/ipsec-secgw/meson.build b/examples/ipsec-secgw/meson.build
index 20fd7c6c5f..e6a0e18a73 100644
--- a/examples/ipsec-secgw/meson.build
+++ b/examples/ipsec-secgw/meson.build
@@ -25,7 +25,6 @@ sources = files(
)
cflags += no_wvla_cflag
-cflags += no_shadow_cflag
app_cflags = ['-Wno-address-of-packed-member']
foreach flag:app_cflags
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index a1a996dee8..866ba04b86 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -1696,7 +1696,6 @@ sa_spi_present(struct sa_ctx *sa_ctx, uint32_t spi, int inbound)
void
sa_init(struct socket_ctx *ctx, int32_t socket_id,
- struct lcore_conf *lcore_conf,
const struct eventmode_conf *em_conf)
{
int32_t rc;
@@ -1828,8 +1827,8 @@ outbound_sa_lookup(struct sa_ctx *sa_ctx, uint32_t sa_idx[],
* Select HW offloads to be used.
*/
int
-sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
- uint64_t *tx_offloads, uint8_t *hw_reassembly)
+sa_check_offloads(uint16_t port_id, uint64_t *rx_flags,
+ uint64_t *tx_flags, uint8_t *hw_reassembly)
{
struct ipsec_sa *rule;
uint32_t idx_sa;
@@ -1837,8 +1836,8 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
struct rte_eth_dev_info dev_info;
int ret;
- *rx_offloads = 0;
- *tx_offloads = 0;
+ *rx_flags = 0;
+ *tx_flags = 0;
*hw_reassembly = 0;
ret = rte_eth_dev_info_get(port_id, &dev_info);
@@ -1855,9 +1854,9 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
rule_type ==
RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL)
&& rule->portid == port_id)
- *rx_offloads |= RTE_ETH_RX_OFFLOAD_SECURITY;
+ *rx_flags |= RTE_ETH_RX_OFFLOAD_SECURITY;
if (IS_HW_REASSEMBLY_EN(rule->flags)) {
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_MULTI_SEGS;
*hw_reassembly = 1;
}
}
@@ -1875,20 +1874,17 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
* non-IPSec packets, there is no need of
* IPv4 Checksum offload.
*/
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_SECURITY;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_SECURITY;
if (rule->mss)
- *tx_offloads |= (RTE_ETH_TX_OFFLOAD_TCP_TSO |
- RTE_ETH_TX_OFFLOAD_IPV4_CKSUM);
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_TCP_TSO |
+ RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
break;
case RTE_SECURITY_ACTION_TYPE_INLINE_CRYPTO:
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_SECURITY;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_SECURITY;
if (rule->mss)
- *tx_offloads |=
- RTE_ETH_TX_OFFLOAD_TCP_TSO;
- if (dev_info.tx_offload_capa &
- RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
- *tx_offloads |=
- RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_TCP_TSO;
+ if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
break;
default:
/* Enable IPv4 checksum offload even if
@@ -1896,13 +1892,13 @@ sa_check_offloads(uint16_t port_id, uint64_t *rx_offloads,
*/
if (dev_info.tx_offload_capa &
RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
break;
}
} else {
if (dev_info.tx_offload_capa &
RTE_ETH_TX_OFFLOAD_IPV4_CKSUM)
- *tx_offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
+ *tx_flags |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM;
}
}
return 0;
--
2.53.0
next prev parent reply other threads:[~2026-04-07 3:53 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 3:49 [PATCH 00/23] examples: enable -Wshadow across all examples Stephen Hemminger
2026-04-07 3:49 ` [PATCH 01/23] examples/ethtool: fix shadow variable warning Stephen Hemminger
2026-04-07 3:49 ` [PATCH 02/23] examples/eventdev_pipeline: " Stephen Hemminger
2026-04-07 3:49 ` [PATCH 03/23] examples/dma: fix shadow variable warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 04/23] examples/packet_ordering: fix shadow variable warning Stephen Hemminger
2026-04-07 3:49 ` [PATCH 05/23] examples/bond: fix shadow variable warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 06/23] examples/vmdq: fix shadow variable warning Stephen Hemminger
2026-04-07 3:49 ` [PATCH 07/23] examples/server_node_efd: fix shadowed variable Stephen Hemminger
2026-04-07 3:49 ` [PATCH 08/23] examples/flow_filtering: fix shadowed variables Stephen Hemminger
2026-04-07 3:49 ` Stephen Hemminger [this message]
2026-04-07 3:49 ` [PATCH 10/23] examples/ip_pipeline: fix shadow variable Stephen Hemminger
2026-04-07 3:49 ` [PATCH 11/23] examples/multi_process: fix shadowed variable Stephen Hemminger
2026-04-07 3:49 ` [PATCH 12/23] examples/vm_power_manage: enable shadow warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 13/23] examples/bbdev_app: " Stephen Hemminger
2026-04-07 3:49 ` [PATCH 14/23] examples/ptpclient: fix shadow variable warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 15/23] examples/vhost: fix shadow warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 16/23] examples/qos_sched: eliminate shadowed variables Stephen Hemminger
2026-04-07 3:49 ` [PATCH 17/23] examples/l2fwd-jobstats: fix shadowed variable Stephen Hemminger
2026-04-07 3:49 ` [PATCH 18/23] examples/l2fwd-crypto: remove no shadow flag Stephen Hemminger
2026-04-07 3:49 ` [PATCH 19/23] examples/l2fwd-event: " Stephen Hemminger
2026-04-07 3:49 ` [PATCH 20/23] examples/l2fwd-keepalive: fix shadow variable warning Stephen Hemminger
2026-04-07 3:49 ` [PATCH 21/23] examples/l3fwd-graph: remove no shadow flag Stephen Hemminger
2026-04-07 3:49 ` [PATCH 22/23] examples/l3fwd: fix shadow variable warnings Stephen Hemminger
2026-04-07 3:49 ` [PATCH 23/23] examples/l3fwd-power: " Stephen Hemminger
2026-04-07 9:22 ` [PATCH 00/23] examples: enable -Wshadow across all examples Bruce Richardson
2026-04-07 15:15 ` [PATCH v2 00/23] examples: fix -Wshadow warnings Stephen Hemminger
2026-04-07 15:15 ` [PATCH v2 01/23] examples/ethtool: resolve shadow variable warnings Stephen Hemminger
2026-04-08 0:32 ` fengchengwen
2026-04-07 15:15 ` [PATCH v2 02/23] examples/eventdev_pipeline: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:15 ` [PATCH v2 03/23] examples/dma: resolve shadow variable warnings Stephen Hemminger
2026-04-08 0:30 ` fengchengwen
2026-04-07 15:16 ` [PATCH v2 04/23] examples/packet_ordering: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 05/23] examples/bond: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 06/23] examples/vmdq: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 07/23] examples/server_node_efd: " Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 08/23] examples/flow_filtering: resolve shadowed variable warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 09/23] examples/ipsec-secgw: " Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 10/23] examples/ip_pipeline: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 11/23] examples/multi_process: resolve shadowed variable warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 12/23] examples/vm_power_manage: enable shadow warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 13/23] examples/bbdev_app: " Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 14/23] examples/ptpclient: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 15/23] examples/vhost: resolve shadow warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 16/23] examples/qos_sched: eliminate shadowed variables Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 17/23] examples/l2fwd-jobstats: resolve shadowed variable Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 18/23] examples/l2fwd-crypto: resolve shadow variable Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 19/23] examples/l2fwd-event: resolve shadowed variable Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 20/23] examples/l2fwd-keepalive: resolve shadow variable warning Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 21/23] examples/l3fwd-graph: " Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 22/23] examples/l3fwd: resolve shadow variable warnings Stephen Hemminger
2026-04-07 15:16 ` [PATCH v2 23/23] examples/l3fwd-power: " Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260407035209.650419-10-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=gakhil@marvell.com \
--cc=radu.nicolau@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox