Rename variables where local variable shadows a global declaration. Remove unused lcore_conf parameter from sa_init().
Signed-off-by: Stephen Hemminger <[email protected]> --- 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

