From: Jie Liu <[email protected]> - sxe2_dev_init(): move the init_rss_err label above sxe2_security_uinit() so an RSS init failure still unwinds the security context instead of leaking it. - sxe2_buffer_split_supported_hdr_ptypes_get(): exclude the trailing RTE_PTYPE_UNKNOWN terminator from no_of_elements so applications do not receive a bogus ptype entry. - sxe2_switchdev_repr_match(): match the PF when the adapter's pf_num is among the requested ports instead of requiring every requested port to equal pf_num, which could never succeed with multiple ports.
Cc: [email protected] Cc: [email protected] Signed-off-by: Jie Liu <[email protected]> --- drivers/net/sxe2/sxe2_ethdev.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/sxe2/sxe2_ethdev.c b/drivers/net/sxe2/sxe2_ethdev.c index 88fe43298a..f4e65852d4 100644 --- a/drivers/net/sxe2/sxe2_ethdev.c +++ b/drivers/net/sxe2/sxe2_ethdev.c @@ -986,7 +986,7 @@ sxe2_buffer_split_supported_hdr_ptypes_get(struct rte_eth_dev *dev __rte_unused, RTE_PTYPE_UNKNOWN }; - *no_of_elements = RTE_DIM(ptypes); + *no_of_elements = RTE_DIM(ptypes) - 1; return ptypes; } @@ -2028,8 +2028,8 @@ static int32_t sxe2_dev_init(struct rte_eth_dev *dev, init_fc_state_err: (void)sxe2_flow_uninit(dev); init_flow_err: - sxe2_security_uinit(dev); init_rss_err: + sxe2_security_uinit(dev); init_security_err: sxe2_intr_uninit(dev); init_irq_err: @@ -2198,12 +2198,14 @@ static bool sxe2_switchdev_repr_match(struct sxe2_adapter *adapter, } for (port_idx = 0; port_idx < req_eth_da->nb_ports; ++port_idx) { - if (adapter->switchdev_info.pf_num != req_eth_da->ports[port_idx]) { - PMD_DEV_LOG_DEBUG(adapter, DRV, "switchdev pf %u not match req pf %u", - adapter->switchdev_info.pf_num, req_eth_da->ports[port_idx]); - rte_errno = EBUSY; - return false; - } + if (adapter->switchdev_info.pf_num == req_eth_da->ports[port_idx]) + break; + } + if (port_idx == req_eth_da->nb_ports) { + PMD_DEV_LOG_DEBUG(adapter, DRV, "switchdev pf %u not match req pf", + adapter->switchdev_info.pf_num); + rte_errno = EBUSY; + return false; } for (repr_idx = 0; repr_idx < req_eth_da->nb_representor_ports; ++repr_idx) { -- 2.52.0

