common/cnxk: fix SQ flush sequence

Fix SQ flush sequence to issue NIX RX SW Sync after SMQ flush.
This sync ensures that all the packets that were in-flight are
flushed out of memory.

This patch also fixes NULL return issues reported by
static analysis tool in Traffic Manager and sync's mailbox
to that of the kernel version.

Fixes: 05d727e8b14a ("common/cnxk: support NIX traffic management")
Fixes: 0b7e667ee303 ("common/cnxk: enable packet marking")
Cc: stable@dpdk.org

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
Satha Rao 2022-05-08 13:18:16 +05:30 committed by Jerin Jacob
parent 064e790375
commit e746aec161
3 changed files with 49 additions and 2 deletions

View File

@ -116,7 +116,7 @@ struct mbox_msghdr {
msg_rsp) \
M(SSO_GRP_GET_PRIORITY, 0x606, sso_grp_get_priority, sso_info_req, \
sso_grp_priority) \
M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, msg_req, msg_rsp) \
M(SSO_WS_CACHE_INV, 0x607, sso_ws_cache_inv, ssow_lf_inv_req, msg_rsp) \
M(SSO_GRP_QOS_CONFIG, 0x608, sso_grp_qos_config, sso_grp_qos_cfg, \
msg_rsp) \
M(SSO_GRP_GET_STATS, 0x609, sso_grp_get_stats, sso_info_req, \
@ -125,6 +125,9 @@ struct mbox_msghdr {
sso_hws_stats) \
M(SSO_HW_RELEASE_XAQ, 0x611, sso_hw_release_xaq_aura, \
sso_hw_xaq_release, msg_rsp) \
M(SSO_CONFIG_LSW, 0x612, ssow_config_lsw, ssow_config_lsw, msg_rsp) \
M(SSO_HWS_CHNG_MSHIP, 0x613, ssow_chng_mship, ssow_chng_mship, \
msg_rsp) \
/* TIM mbox IDs (range 0x800 - 0x9FF) */ \
M(TIM_LF_ALLOC, 0x800, tim_lf_alloc, tim_lf_alloc_req, \
tim_lf_alloc_rsp) \
@ -259,7 +262,8 @@ struct mbox_msghdr {
M(NIX_CPT_BP_ENABLE, 0x8020, nix_cpt_bp_enable, nix_bp_cfg_req, \
nix_bp_cfg_rsp) \
M(NIX_CPT_BP_DISABLE, 0x8021, nix_cpt_bp_disable, nix_bp_cfg_req, \
msg_rsp)
msg_rsp) \
M(NIX_RX_SW_SYNC, 0x8022, nix_rx_sw_sync, msg_req, msg_rsp)
/* Messages initiated by AF (range 0xC00 - 0xDFF) */
#define MBOX_UP_CGX_MESSAGES \
@ -1268,6 +1272,33 @@ struct ssow_lf_free_req {
uint16_t __io hws;
};
#define SSOW_INVAL_SELECTIVE_VER 0x1000
struct ssow_lf_inv_req {
struct mbox_msghdr hdr;
uint16_t nb_hws; /* Number of HWS to invalidate*/
uint16_t hws[MAX_RVU_BLKLF_CNT]; /* Array of HWS */
};
struct ssow_config_lsw {
struct mbox_msghdr hdr;
#define SSOW_LSW_DIS 0
#define SSOW_LSW_GW_WAIT 1
#define SSOW_LSW_GW_IMM 2
uint8_t __io lsw_mode;
#define SSOW_WQE_REL_LSW_WAIT 0
#define SSOW_WQE_REL_IMM 1
uint8_t __io wqe_release;
};
struct ssow_chng_mship {
struct mbox_msghdr hdr;
uint8_t __io set; /* Membership set to modify. */
uint8_t __io enable; /* Enable/Disable the hwgrps. */
uint8_t __io hws; /* HWS to modify. */
uint16_t __io nb_hwgrps; /* Number of hwgrps in the array */
uint16_t __io hwgrps[MAX_RVU_BLKLF_CNT]; /* Array of hwgrps. */
};
struct sso_hw_setconfig {
struct mbox_msghdr hdr;
uint32_t __io npa_aura_id;

View File

@ -590,6 +590,7 @@ nix_tm_sq_flush_pre(struct roc_nix_sq *sq)
struct nix_tm_node *node, *sibling;
struct nix_tm_node_list *list;
enum roc_nix_tm_tree tree;
struct msg_req *req;
struct mbox *mbox;
struct nix *nix;
uint16_t qid;
@ -679,6 +680,12 @@ nix_tm_sq_flush_pre(struct roc_nix_sq *sq)
rc);
goto cleanup;
}
req = mbox_alloc_msg_nix_rx_sw_sync(mbox);
if (!req)
return -ENOSPC;
rc = mbox_process(mbox);
cleanup:
/* Restore cgx state */
if (!roc_nix->io_enabled) {

View File

@ -110,6 +110,9 @@ nix_tm_update_red_algo(struct nix *nix, bool red_send)
/* Update txschq config */
req = mbox_alloc_msg_nix_txschq_cfg(mbox);
if (req == NULL)
return -ENOSPC;
req->lvl = tm_node->hw_lvl;
k = prepare_tm_shaper_red_algo(tm_node, req->reg, req->regval,
req->regval_mask);
@ -208,6 +211,9 @@ nix_tm_mark_init(struct nix *nix)
/* Null mark format */
req = mbox_alloc_msg_nix_mark_format_cfg(mbox);
if (req == NULL)
return -ENOSPC;
rc = mbox_process_msg(mbox, (void *)&rsp);
if (rc) {
plt_err("TM failed to alloc null mark format, rc=%d", rc);
@ -220,6 +226,9 @@ nix_tm_mark_init(struct nix *nix)
for (i = 0; i < ROC_NIX_TM_MARK_MAX; i++) {
for (j = 0; j < ROC_NIX_TM_MARK_COLOR_MAX; j++) {
req = mbox_alloc_msg_nix_mark_format_cfg(mbox);
if (req == NULL)
return -ENOSPC;
req->offset = mark_off[i];
switch (j) {