From: Sangtani Parag Satishbhai <[email protected]>
For Thor2 if any of the ports are attached on testpmd without "mpc=1" argument, code flow will not initialize core mpc structure which can lead to seg fault in bnxt_mpc_send while accessing tx queues. Fix it by adding NULL conditional check for mpc member of bp structure. Signed-off-by: Sangtani Parag Satishbhai <[email protected]> Reviewed-by: Kalesh AP <[email protected]> Reviewed-by: Sriharsha Basavapatna <[email protected]> --- drivers/net/bnxt/bnxt_mpc.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/bnxt/bnxt_mpc.c b/drivers/net/bnxt/bnxt_mpc.c index 2582b50782..ff2f0d7043 100644 --- a/drivers/net/bnxt/bnxt_mpc.c +++ b/drivers/net/bnxt/bnxt_mpc.c @@ -719,10 +719,20 @@ int bnxt_mpc_send(struct bnxt *bp, bool batch) { int rc; - struct bnxt_mpc_txq *mpc_queue = bp->mpc->mpc_txq[in_msg->chnl_id]; + struct bnxt_mpc_txq *mpc_queue; int retry = BNXT_MPC_RX_RETRY; uint32_t pi = 0; + /* + * TODO: This condition check is added to avoid + * segmentation fault in case mpc argument is + * missing in dev-args. Fix this by removing + * mpc argument from dev args. + */ + if (!bp->mpc) + return -1; + mpc_queue = bp->mpc->mpc_txq[in_msg->chnl_id]; + if (out_msg->cmp_type != CMPL_BASE_TYPE_MID_PATH_SHORT && out_msg->cmp_type != CMPL_BASE_TYPE_MID_PATH_LONG) return -1; -- 2.39.5 (Apple Git-154)

