examples/ipsec-secgw: fix Tx offloads initialization

Fix uninitialized variable access of outbound offloads flags.

Coverity issue: 381669
Fixes: 6938fc92c4 ("examples/ipsec-secgw: add lookaside event mode")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
This commit is contained in:
Volodymyr Fialko 2022-11-09 10:52:37 +01:00 committed by Akhil Goyal
parent e77d682aad
commit b1a6b1e909
3 changed files with 20 additions and 8 deletions

View File

@ -105,6 +105,8 @@ struct ethaddr_info ethaddr_tbl[RTE_MAX_ETHPORTS] = {
{ 0, ETHADDR(0x00, 0x16, 0x3e, 0x49, 0x9e, 0xdd) }
};
struct offloads tx_offloads;
/*
* To hold ethernet header per port, which will be applied
* to outgoing packets.
@ -3017,16 +3019,17 @@ main(int32_t argc, char **argv)
ipv4_cksum_port_mask |= 1U << portid;
}
for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) {
if (rte_lcore_is_enabled(lcore_id) == 0)
continue;
tx_offloads.ipv4_offloads = RTE_MBUF_F_TX_IPV4;
tx_offloads.ipv6_offloads = RTE_MBUF_F_TX_IPV6;
/* Update per lcore checksum offload support only if all ports support it */
if (ipv4_cksum_port_mask == enabled_port_mask)
tx_offloads.ipv4_offloads |= RTE_MBUF_F_TX_IP_CKSUM;
lcore_id = 0;
RTE_LCORE_FOREACH(lcore_id) {
/* Pre-populate pkt offloads based on capabilities */
lcore_conf[lcore_id].outbound.ipv4_offloads = RTE_MBUF_F_TX_IPV4;
lcore_conf[lcore_id].outbound.ipv6_offloads = RTE_MBUF_F_TX_IPV6;
/* Update per lcore checksum offload support only if all ports support it */
if (ipv4_cksum_port_mask == enabled_port_mask)
lcore_conf[lcore_id].outbound.ipv4_offloads |= RTE_MBUF_F_TX_IP_CKSUM;
lcore_conf[lcore_id].outbound.ipv4_offloads = tx_offloads.ipv4_offloads;
lcore_conf[lcore_id].outbound.ipv6_offloads = tx_offloads.ipv6_offloads;
}
/*

View File

@ -242,6 +242,13 @@ struct ipsec_ctx {
uint32_t lcore_id;
};
struct offloads {
uint64_t ipv4_offloads;
uint64_t ipv6_offloads;
};
extern struct offloads tx_offloads;
struct cdev_key {
uint16_t lcore_id;
uint8_t cipher_algo;

View File

@ -1342,6 +1342,8 @@ ipsec_wrkr_non_burst_int_port_app_mode(struct eh_event_link_info *links,
lconf.outbound.sp4_ctx = socket_ctx[socket_id].sp_ip4_out;
lconf.outbound.sp6_ctx = socket_ctx[socket_id].sp_ip6_out;
lconf.outbound.sa_ctx = socket_ctx[socket_id].sa_out;
lconf.outbound.ipv4_offloads = tx_offloads.ipv4_offloads;
lconf.outbound.ipv6_offloads = tx_offloads.ipv6_offloads;
lconf.outbound.lcore_id = lcore_id;
RTE_LOG(INFO, IPSEC,