From 87aefef133e3d670be365efdaa620f36d97ee4bd Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Thu, 9 Jul 2020 15:08:31 +0530 Subject: [PATCH] net/bnxt: fix flow error on filter creation If set_em_filter/set_ntuple_filter cmds fails for some reason, driver is not filling the "rte_flow_error" string buffer. Same is the case when flow create fails due to an already existing mark id for the new flow id created. This leads to a crash in testpmd while trying to print the error message. Fixes: 5c1171c97216 ("net/bnxt: refactor filter/flow") Fixes: 9db66782bd06 ("net/bnxt: fix supporting zero mark ID with RSS action") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_flow.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/net/bnxt/bnxt_flow.c b/drivers/net/bnxt/bnxt_flow.c index 19bc66a5a2..499dcdf6b8 100644 --- a/drivers/net/bnxt/bnxt_flow.c +++ b/drivers/net/bnxt/bnxt_flow.c @@ -1786,12 +1786,24 @@ bnxt_flow_create(struct rte_eth_dev *dev, filter->enables |= HWRM_CFA_EM_FLOW_ALLOC_INPUT_ENABLES_L2_FILTER_ID; ret = bnxt_hwrm_set_em_filter(bp, filter->dst_id, filter); + if (ret != 0) { + rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to create EM filter"); + goto free_filter; + } } if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER) { filter->enables |= HWRM_CFA_NTUPLE_FILTER_ALLOC_INPUT_ENABLES_L2_FILTER_ID; ret = bnxt_hwrm_set_ntuple_filter(bp, filter->dst_id, filter); + if (ret != 0) { + rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to create ntuple filter"); + goto free_filter; + } } vnic = find_matching_vnic(bp, filter); @@ -1817,10 +1829,10 @@ done: */ flow_id = filter->flow_id & BNXT_FLOW_ID_MASK; if (bp->mark_table[flow_id].valid) { - PMD_DRV_LOG(ERR, - "Entry for Mark id 0x%x occupied" - " flow id 0x%x\n", - filter->mark, filter->flow_id); + rte_flow_error_set(error, EEXIST, + RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, + "Flow with mark id exists"); goto free_filter; } bp->mark_table[flow_id].valid = true; -- 2.20.1