From patchwork Tue Apr 11 09:11:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125906 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 490764291B; Tue, 11 Apr 2023 11:12:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33F2240DFD; Tue, 11 Apr 2023 11:12:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 6375840A8B for ; Tue, 11 Apr 2023 11:12:05 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g53q014916 for ; Tue, 11 Apr 2023 02:12:04 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Y1hLE5YjSxzj9Hh+jJ301m516oo1oLIPCmNBYns3tV4=; b=AeM56L29lqfZxdj0vTJVa57yyV7L2MeNXOBbvyIdmYUfB8ItiS5fdxd37BYv73S1RWg9 pWCC616RMn+7pPAJOshiga7irrkEzH8yDsr9RvSJAuMYLhdcj6NtHDrnhRKKRVm7p+/K 33czqeJ+yxC1l18dVocNcfQy2mghnzr+FxJAPmJAoc8zV25mDQSObKENzCqmt78i90Sv sg0LLWyLa9Dq8191BCX4//0xYEtzmDvLhUOagP4FxbaDnfW215b0sMo1aYzvLxW2MkZg A7K6Lx0XnRtVmXm5gjIq7R6tO0gbYJAAtqp9jybeZRd6mPSwWuY/Qbxih5+w1vKUrZ8v RQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94e3-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:04 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:02 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:02 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C76033F706A; Tue, 11 Apr 2023 02:12:00 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 01/21] common/cnxk: allocate dynamic BPIDs Date: Tue, 11 Apr 2023 14:41:24 +0530 Message-ID: <20230411091144.1087887-1-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: DgSclimjK56d7J1GN-p8HZ84LtrJMGbn X-Proofpoint-GUID: DgSclimjK56d7J1GN-p8HZ84LtrJMGbn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao New mail box to allocate/free dynamic BPIDs based on NIX type. Added to new mail box APIs to get/set RX channel config with new BPIDs. Signed-off-by: Satha Rao --- Depends-on: series-27659 ("add hwpools and support exchanging mbufs between pools") drivers/common/cnxk/roc_cpt.c | 10 +- drivers/common/cnxk/roc_cpt.h | 3 +- drivers/common/cnxk/roc_features.h | 7 ++ drivers/common/cnxk/roc_mbox.h | 31 ++++- drivers/common/cnxk/roc_nix.h | 21 ++++ drivers/common/cnxk/roc_nix_fc.c | 182 +++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_inl.c | 24 ++-- drivers/common/cnxk/roc_nix_priv.h | 1 + drivers/common/cnxk/version.map | 5 + 9 files changed, 266 insertions(+), 18 deletions(-) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index dff2fbf2a4..d235ff51ca 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -311,8 +311,7 @@ roc_cpt_inline_ipsec_inb_cfg_read(struct roc_cpt *roc_cpt, } int -roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, uint16_t param1, - uint16_t param2, uint16_t opcode) +roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, struct roc_cpt_inline_ipsec_inb_cfg *cfg) { struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt); struct cpt_rx_inline_lf_cfg_msg *req; @@ -328,9 +327,10 @@ roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, uint16_t param1, } req->sso_pf_func = idev_sso_pffunc_get(); - req->param1 = param1; - req->param2 = param2; - req->opcode = opcode; + req->param1 = cfg->param1; + req->param2 = cfg->param2; + req->opcode = cfg->opcode; + req->bpid = cfg->bpid; rc = mbox_process(mbox); exit: diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index d3a5683dc8..92a18711dc 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -178,8 +178,7 @@ int __roc_api roc_cpt_inline_ipsec_cfg(struct dev *dev, uint8_t slot, int __roc_api roc_cpt_inline_ipsec_inb_cfg_read(struct roc_cpt *roc_cpt, struct roc_cpt_inline_ipsec_inb_cfg *cfg); int __roc_api roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, - uint16_t param1, uint16_t param2, - uint16_t opcode); + struct roc_cpt_inline_ipsec_inb_cfg *cfg); int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt); int __roc_api roc_cpt_lfs_print(struct roc_cpt *roc_cpt); void __roc_api roc_cpt_iq_disable(struct roc_cpt_lf *lf); diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h index 252f306a86..c2893faa65 100644 --- a/drivers/common/cnxk/roc_features.h +++ b/drivers/common/cnxk/roc_features.h @@ -40,4 +40,11 @@ roc_feature_nix_has_reass(void) return roc_model_is_cn10ka(); } +static inline bool +roc_feature_nix_has_rxchan_multi_bpid(void) +{ + if (roc_model_is_cn10kb() || roc_model_is_cn10ka_b0()) + return true; + return false; +} #endif diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index af3c10b0b0..3d5746b9b8 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -275,7 +275,12 @@ struct mbox_msghdr { M(NIX_SPI_TO_SA_ADD, 0x8026, nix_spi_to_sa_add, nix_spi_to_sa_add_req, \ nix_spi_to_sa_add_rsp) \ M(NIX_SPI_TO_SA_DELETE, 0x8027, nix_spi_to_sa_delete, \ - nix_spi_to_sa_delete_req, msg_rsp) + nix_spi_to_sa_delete_req, msg_rsp) \ + M(NIX_ALLOC_BPIDS, 0x8028, nix_alloc_bpids, nix_alloc_bpid_req, \ + nix_bpids) \ + M(NIX_FREE_BPIDS, 0x8029, nix_free_bpids, nix_bpids, msg_rsp) \ + M(NIX_RX_CHAN_CFG, 0x802a, nix_rx_chan_cfg, nix_rx_chan_cfg, \ + nix_rx_chan_cfg) /* Messages initiated by AF (range 0xC00 - 0xDFF) */ #define MBOX_UP_CGX_MESSAGES \ @@ -1186,6 +1191,30 @@ struct nix_bp_cfg_rsp { uint8_t __io chan_cnt; }; +struct nix_alloc_bpid_req { + struct mbox_msghdr hdr; + uint8_t __io bpid_cnt; + uint8_t __io type; + uint64_t __io rsvd; +}; + +struct nix_bpids { +#define ROC_NIX_MAX_BPID_CNT 8 + struct mbox_msghdr hdr; + uint8_t __io bpid_cnt; + uint16_t __io bpids[ROC_NIX_MAX_BPID_CNT]; + uint64_t __io rsvd; +}; + +struct nix_rx_chan_cfg { + struct mbox_msghdr hdr; + uint8_t __io type; /* Interface type(CGX/CPT/LBK) */ + uint8_t __io read; + uint16_t __io chan; /* RX channel to be configured */ + uint64_t __io val; /* NIX_AF_RX_CHAN_CFG value */ + uint64_t __io rsvd; +}; + /* Global NIX inline IPSec configuration */ struct nix_inline_ipsec_cfg { struct mbox_msghdr hdr; diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 0ec98ad630..2737bb9517 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -16,6 +16,17 @@ #define ROC_NIX_SQB_LOWER_THRESH 70U #define ROC_NIX_SQB_SLACK 12U +/* Reserved interface types for BPID allocation */ +#define ROC_NIX_INTF_TYPE_CGX 0 +#define ROC_NIX_INTF_TYPE_LBK 1 +#define ROC_NIX_INTF_TYPE_SDP 2 +#define ROC_NIX_INTF_TYPE_CPT 3 +#define ROC_NIX_INTF_TYPE_RSVD 4 + +/* Application based types for BPID allocation, start from end (255 unused rsvd) */ +#define ROC_NIX_INTF_TYPE_CPT_NIX 254 +#define ROC_NIX_INTF_TYPE_SSO 253 + enum roc_nix_rss_reta_sz { ROC_NIX_RSS_RETA_SZ_64 = 64, ROC_NIX_RSS_RETA_SZ_128 = 128, @@ -837,6 +848,16 @@ enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix); void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, uint8_t force, uint8_t tc); +int __roc_api roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, + uint8_t bp_cnt, uint16_t *bpids); +int __roc_api roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt, + uint16_t *bpids); +int __roc_api roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan, + bool is_cpt, uint64_t *cfg); +int __roc_api roc_nix_rx_chan_cfg_set(struct roc_nix *roc_nix, uint16_t chan, + bool is_cpt, uint64_t val); +int __roc_api roc_nix_chan_bpid_set(struct roc_nix *roc_nix, uint16_t chan, + uint64_t bpid, int ena, bool cpt_chan); /* NPC */ int __roc_api roc_nix_npc_promisc_ena_dis(struct roc_nix *roc_nix, int enable); diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index cec83b31f3..3b726673a6 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -104,6 +104,17 @@ nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable) nix->cpt_lbpid = 0; } + /* CPT to NIX BP on all channels */ + if (!roc_feature_nix_has_rxchan_multi_bpid() || !nix->cpt_nixbpid) + goto exit; + + mbox_put(mbox); + for (i = 0; i < nix->rx_chan_cnt; i++) { + rc = roc_nix_chan_bpid_set(roc_nix, i, nix->cpt_nixbpid, enable, false); + if (rc) + break; + } + return rc; exit: mbox_put(mbox); return rc; @@ -599,3 +610,174 @@ roc_nix_chan_count_get(struct roc_nix *roc_nix) return nix->chan_cnt; } + +/* Allocate BPID for requested type + * Returns number of BPIDs allocated + * 0 if no BPIDs available + * -ve value on error + */ +int +roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, uint8_t bp_cnt, uint16_t *bpids) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct mbox *mbox = mbox_get(nix->dev.mbox); + struct nix_alloc_bpid_req *req; + struct nix_bpids *rsp; + int rc = -EINVAL; + + /* Use this api for unreserved interface types */ + if ((type < ROC_NIX_INTF_TYPE_RSVD) || (bp_cnt > ROC_NIX_MAX_BPID_CNT) || !bpids) + goto exit; + + rc = -ENOSPC; + req = mbox_alloc_msg_nix_alloc_bpids(mbox); + if (req == NULL) + goto exit; + req->type = type; + req->bpid_cnt = bp_cnt; + + rc = mbox_process_msg(mbox, (void *)&rsp); + if (rc) + goto exit; + + for (rc = 0; rc < rsp->bpid_cnt; rc++) + bpids[rc] = rsp->bpids[rc]; +exit: + mbox_put(mbox); + return rc; +} + +int +roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt, uint16_t *bpids) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct mbox *mbox = mbox_get(nix->dev.mbox); + struct nix_bpids *req; + int rc = -EINVAL; + + /* Use this api for unreserved interface types */ + if ((bp_cnt > ROC_NIX_MAX_BPID_CNT) || !bpids) + goto exit; + + rc = -ENOSPC; + req = mbox_alloc_msg_nix_free_bpids(mbox); + if (req == NULL) + goto exit; + for (rc = 0; rc < bp_cnt; rc++) + req->bpids[rc] = bpids[rc]; + req->bpid_cnt = rc; + + rc = mbox_process(mbox); +exit: + mbox_put(mbox); + return rc; +} + +int +roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t *cfg) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct mbox *mbox = mbox_get(nix->dev.mbox); + struct nix_rx_chan_cfg *req; + struct nix_rx_chan_cfg *rsp; + int rc = -EINVAL; + + req = mbox_alloc_msg_nix_rx_chan_cfg(mbox); + if (req == NULL) + goto exit; + if (is_cpt) + req->type = ROC_NIX_INTF_TYPE_CPT; + req->chan = chan; + req->read = 1; + + rc = mbox_process_msg(mbox, (void *)&rsp); + if (rc) + goto exit; + *cfg = rsp->val; +exit: + mbox_put(mbox); + return rc; +} + +int +roc_nix_rx_chan_cfg_set(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t val) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct mbox *mbox = mbox_get(nix->dev.mbox); + struct nix_rx_chan_cfg *req; + int rc = -EINVAL; + + req = mbox_alloc_msg_nix_rx_chan_cfg(mbox); + if (req == NULL) + goto exit; + if (is_cpt) + req->type = ROC_NIX_INTF_TYPE_CPT; + req->chan = chan; + req->val = val; + req->read = 0; + + rc = mbox_process(mbox); + if (rc) + goto exit; +exit: + mbox_put(mbox); + return rc; +} + +#define NIX_BPID1_ENA 15 +#define NIX_BPID2_ENA 14 +#define NIX_BPID3_ENA 13 + +#define NIX_BPID1_OFF 20 +#define NIX_BPID2_OFF 32 +#define NIX_BPID3_OFF 44 + +int +roc_nix_chan_bpid_set(struct roc_nix *roc_nix, uint16_t chan, uint64_t bpid, int ena, bool cpt_chan) +{ + uint64_t cfg; + int rc; + + if (!roc_feature_nix_has_rxchan_multi_bpid()) + return -ENOTSUP; + + rc = roc_nix_rx_chan_cfg_get(roc_nix, chan, cpt_chan, &cfg); + if (rc) + return rc; + + if (ena) { + if ((((cfg >> NIX_BPID1_OFF) & GENMASK_ULL(8, 0)) == bpid) || + (((cfg >> NIX_BPID2_OFF) & GENMASK_ULL(8, 0)) == bpid) || + (((cfg >> NIX_BPID3_OFF) & GENMASK_ULL(8, 0)) == bpid)) + return 0; + + if (!(cfg & BIT_ULL(NIX_BPID1_ENA))) { + cfg &= ~GENMASK_ULL(NIX_BPID1_OFF + 8, NIX_BPID1_OFF); + cfg |= (((uint64_t)bpid << NIX_BPID1_OFF) | BIT_ULL(NIX_BPID1_ENA)); + } else if (!(cfg & BIT_ULL(NIX_BPID2_ENA))) { + cfg &= ~GENMASK_ULL(NIX_BPID2_OFF + 8, NIX_BPID2_OFF); + cfg |= (((uint64_t)bpid << NIX_BPID2_OFF) | BIT_ULL(NIX_BPID2_ENA)); + } else if (!(cfg & BIT_ULL(NIX_BPID3_ENA))) { + cfg &= ~GENMASK_ULL(NIX_BPID3_OFF + 8, NIX_BPID3_OFF); + cfg |= (((uint64_t)bpid << NIX_BPID3_OFF) | BIT_ULL(NIX_BPID3_ENA)); + } else { + plt_nix_dbg("Exceed maximum BPIDs"); + return -ENOSPC; + } + } else { + if (((cfg >> NIX_BPID1_OFF) & GENMASK_ULL(8, 0)) == bpid) { + cfg &= ~(GENMASK_ULL(NIX_BPID1_OFF + 8, NIX_BPID1_OFF) | + BIT_ULL(NIX_BPID1_ENA)); + } else if (((cfg >> NIX_BPID2_OFF) & GENMASK_ULL(8, 0)) == bpid) { + cfg &= ~(GENMASK_ULL(NIX_BPID2_OFF + 8, NIX_BPID2_OFF) | + BIT_ULL(NIX_BPID2_ENA)); + } else if (((cfg >> NIX_BPID3_OFF) & GENMASK_ULL(8, 0)) == bpid) { + cfg &= ~(GENMASK_ULL(NIX_BPID3_OFF + 8, NIX_BPID3_OFF) | + BIT_ULL(NIX_BPID3_ENA)); + } else { + plt_nix_dbg("BPID not found"); + return -EINVAL; + } + } + return roc_nix_rx_chan_cfg_set(roc_nix, chan, cpt_chan, cfg); +} diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 076d83e8d5..9485bba099 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -603,11 +603,10 @@ int roc_nix_inl_inb_init(struct roc_nix *roc_nix) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct roc_cpt_inline_ipsec_inb_cfg cfg; struct idev_cfg *idev = idev_get_cfg(); + uint16_t bpids[ROC_NIX_MAX_BPID_CNT]; struct roc_cpt *roc_cpt; - uint16_t opcode; - uint16_t param1; - uint16_t param2; int rc; if (idev == NULL) @@ -624,9 +623,9 @@ roc_nix_inl_inb_init(struct roc_nix *roc_nix) } if (roc_model_is_cn9k()) { - param1 = (ROC_ONF_IPSEC_INB_MAX_L2_SZ >> 3) & 0xf; - param2 = ROC_IE_ON_INB_IKEV2_SINGLE_SA_SUPPORT; - opcode = + cfg.param1 = (ROC_ONF_IPSEC_INB_MAX_L2_SZ >> 3) & 0xf; + cfg.param2 = ROC_IE_ON_INB_IKEV2_SINGLE_SA_SUPPORT; + cfg.opcode = ((ROC_IE_ON_INB_MAX_CTX_LEN << 8) | (ROC_IE_ON_MAJOR_OP_PROCESS_INBOUND_IPSEC | (1 << 6))); } else { @@ -634,13 +633,18 @@ roc_nix_inl_inb_init(struct roc_nix *roc_nix) u.u16 = 0; u.s.esp_trailer_disable = 1; - param1 = u.u16; - param2 = 0; - opcode = (ROC_IE_OT_MAJOR_OP_PROCESS_INBOUND_IPSEC | (1 << 6)); + cfg.param1 = u.u16; + cfg.param2 = 0; + cfg.opcode = (ROC_IE_OT_MAJOR_OP_PROCESS_INBOUND_IPSEC | (1 << 6)); + rc = roc_nix_bpids_alloc(roc_nix, ROC_NIX_INTF_TYPE_CPT_NIX, 1, bpids); + if (rc > 0) { + nix->cpt_nixbpid = bpids[0]; + cfg.bpid = nix->cpt_nixbpid; + } } /* Do onetime Inbound Inline config in CPTPF */ - rc = roc_cpt_inline_ipsec_inb_cfg(roc_cpt, param1, param2, opcode); + rc = roc_cpt_inline_ipsec_inb_cfg(roc_cpt, &cfg); if (rc && rc != -EEXIST) { plt_err("Failed to setup inbound lf, rc=%d", rc); return rc; diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 2fe9093324..99e27cdc56 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -208,6 +208,7 @@ struct nix { uint16_t outb_se_ring_cnt; uint16_t outb_se_ring_base; uint16_t cpt_lbpid; + uint16_t cpt_nixbpid; bool need_meta_aura; /* Mode provided by driver */ bool inb_inl_dev; diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 5281c71550..e7c6f6bce5 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -147,6 +147,9 @@ INTERNAL { roc_nix_bpf_stats_reset; roc_nix_bpf_stats_to_idx; roc_nix_bpf_timeunit_get; + roc_nix_bpids_alloc; + roc_nix_bpids_free; + roc_nix_chan_bpid_set; roc_nix_chan_count_get; roc_nix_cq_dump; roc_nix_cq_fini; @@ -277,6 +280,8 @@ INTERNAL { roc_nix_rss_key_set; roc_nix_rss_reta_get; roc_nix_rss_reta_set; + roc_nix_rx_chan_cfg_get; + roc_nix_rx_chan_cfg_set; roc_nix_rx_drop_re_set; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; From patchwork Tue Apr 11 09:11:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125907 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B15594291B; Tue, 11 Apr 2023 11:12:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 519AD4111C; Tue, 11 Apr 2023 11:12:10 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B5F084111C for ; Tue, 11 Apr 2023 11:12:08 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8Ak4d021460 for ; Tue, 11 Apr 2023 02:12:07 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=neXng+rYrw9NupGtmYLeVT/1o0SPimp/xruAiRk00aM=; b=CXtmkmGnxM4A4vHqJDoHTbgilPHFXl/djaAssrm08dXX9ZY9jLc/ePPIqvMBDFJJBxhi JWV5TIurH4IG4bwI8r0qDH9y1Mj1/tbhEWCH6BciYvJKYHIRvHkw6usLAeOLUtvuDZ92 s0FHsta9UeGLZ/bmqv0uaUBD+SjMwZnzI0EPDcU592itFr7SnlPBT7ouYdyiADQCrMfR /NrKsyTS/7iT4PbXf+x68/M7rTpDIk+7jg+0JglPCywdQ742TER+eYPdIuUTJ5+pM+Lp +uKYgKhDkZCtncRdFCx7D58+9s4PMX0wQWY0gMCq9RND3KwkfGTT56olM1szV61hwHsX pg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1rs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:07 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:05 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 96F1E3F7070; Tue, 11 Apr 2023 02:12:03 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Shijith Thotton Subject: [PATCH 02/21] common/cnxk: add pool BPID to RQ while using common pool Date: Tue, 11 Apr 2023 14:41:25 +0530 Message-ID: <20230411091144.1087887-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: DeCGUzl7Y0YlDHh58dYya_tHwkbnB3sG X-Proofpoint-ORIG-GUID: DeCGUzl7Y0YlDHh58dYya_tHwkbnB3sG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Shijith Thotton When RQs of two different traffic classes are using the same mempool, BPIDs could differ between the RQs and BPID of only one RQ can be configured per pool. In such cases, a new BPID is configured on both RQs and pool or pool back-pressure is disabled. CN103xx and CN106xx B0 supports configuring multiple BPID per RQ. Signed-off-by: Shijith Thotton --- drivers/common/cnxk/roc_idev.c | 12 +++ drivers/common/cnxk/roc_idev.h | 1 + drivers/common/cnxk/roc_idev_priv.h | 1 + drivers/common/cnxk/roc_nix.c | 5 + drivers/common/cnxk/roc_nix.h | 3 + drivers/common/cnxk/roc_nix_fc.c | 156 ++++++++++++++++------------ drivers/common/cnxk/roc_npa.c | 48 +++++++++ drivers/common/cnxk/roc_npa.h | 2 + drivers/common/cnxk/version.map | 2 + 9 files changed, 166 insertions(+), 64 deletions(-) diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c index 62a4fd8880..f420f0158d 100644 --- a/drivers/common/cnxk/roc_idev.c +++ b/drivers/common/cnxk/roc_idev.c @@ -39,6 +39,7 @@ idev_set_defaults(struct idev_cfg *idev) idev->bphy = NULL; idev->cpt = NULL; idev->nix_inl_dev = NULL; + TAILQ_INIT(&idev->roc_nix_list); plt_spinlock_init(&idev->nix_inl_dev_lock); plt_spinlock_init(&idev->npa_dev_lock); __atomic_store_n(&idev->npa_refcnt, 0, __ATOMIC_RELEASE); @@ -201,6 +202,17 @@ roc_nix_inl_outb_ring_base_get(struct roc_nix *roc_nix) return (uint64_t *)&inl_dev->sa_soft_exp_ring[nix->outb_se_ring_base]; } +struct roc_nix_list * +roc_idev_nix_list_get(void) +{ + struct idev_cfg *idev; + + idev = idev_get_cfg(); + if (idev != NULL) + return &idev->roc_nix_list; + return NULL; +} + void roc_idev_cpt_set(struct roc_cpt *cpt) { diff --git a/drivers/common/cnxk/roc_idev.h b/drivers/common/cnxk/roc_idev.h index 926aac0634..640ca97708 100644 --- a/drivers/common/cnxk/roc_idev.h +++ b/drivers/common/cnxk/roc_idev.h @@ -17,5 +17,6 @@ void __roc_api roc_idev_cpt_set(struct roc_cpt *cpt); struct roc_nix *__roc_api roc_idev_npa_nix_get(void); uint64_t __roc_api roc_idev_nix_inl_meta_aura_get(void); +struct roc_nix_list *__roc_api roc_idev_nix_list_get(void); #endif /* _ROC_IDEV_H_ */ diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h index b97d2936a2..d83522799f 100644 --- a/drivers/common/cnxk/roc_idev_priv.h +++ b/drivers/common/cnxk/roc_idev_priv.h @@ -32,6 +32,7 @@ struct idev_cfg { struct roc_sso *sso; struct nix_inl_dev *nix_inl_dev; struct idev_nix_inl_cfg inl_cfg; + struct roc_nix_list roc_nix_list; plt_spinlock_t nix_inl_dev_lock; plt_spinlock_t npa_dev_lock; }; diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index 97ef1c7133..39943e4ba7 100644 --- a/drivers/common/cnxk/roc_nix.c +++ b/drivers/common/cnxk/roc_nix.c @@ -417,6 +417,7 @@ roc_nix_dev_init(struct roc_nix *roc_nix) nix = roc_nix_to_nix_priv(roc_nix); pci_dev = roc_nix->pci_dev; dev = &nix->dev; + TAILQ_INSERT_TAIL(roc_idev_nix_list_get(), roc_nix, next); if (nix->dev.drv_inited) return 0; @@ -425,6 +426,10 @@ roc_nix_dev_init(struct roc_nix *roc_nix) goto skip_dev_init; memset(nix, 0, sizeof(*nix)); + + /* Since 0 is a valid BPID, use -1 to represent invalid value. */ + memset(nix->bpid, -1, sizeof(nix->bpid)); + /* Initialize device */ rc = dev_init(dev, pci_dev); if (rc) { diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 2737bb9517..188b8800d3 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -425,6 +425,8 @@ typedef void (*q_err_get_t)(struct roc_nix *roc_nix, void *data); typedef void (*link_info_get_t)(struct roc_nix *roc_nix, struct roc_nix_link_info *link); +TAILQ_HEAD(roc_nix_list, roc_nix); + struct roc_nix { /* Input parameters */ struct plt_pci_device *pci_dev; @@ -456,6 +458,7 @@ struct roc_nix { uint32_t buf_sz; uint64_t meta_aura_handle; uintptr_t meta_mempool; + TAILQ_ENTRY(roc_nix) next; #define ROC_NIX_MEM_SZ (6 * 1056) uint8_t reserved[ROC_NIX_MEM_SZ] __plt_cache_aligned; diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 3b726673a6..8b7659fb9a 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -428,17 +428,64 @@ roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode) return rc; } +static int +nix_rx_chan_multi_bpid_cfg(struct roc_nix *roc_nix, uint8_t chan, uint16_t bpid, uint16_t *bpid_new) +{ + struct roc_nix *roc_nix_tmp, *roc_nix_pre = NULL; + uint8_t chan_pre; + + if (!roc_feature_nix_has_rxchan_multi_bpid()) + return -ENOTSUP; + + /* Find associated NIX RX channel if Aura BPID is of that of a NIX. */ + TAILQ_FOREACH (roc_nix_tmp, roc_idev_nix_list_get(), next) { + struct nix *nix = roc_nix_to_nix_priv(roc_nix_tmp); + int i; + + for (i = 0; i < NIX_MAX_CHAN; i++) { + if (nix->bpid[i] == bpid) + break; + } + + if (i < NIX_MAX_CHAN) { + roc_nix_pre = roc_nix_tmp; + chan_pre = i; + break; + } + } + + /* Alloc and configure a new BPID if Aura BPID is that of a NIX. */ + if (roc_nix_pre) { + if (roc_nix_bpids_alloc(roc_nix, ROC_NIX_INTF_TYPE_SSO, 1, bpid_new) <= 0) + return -ENOSPC; + + if (roc_nix_chan_bpid_set(roc_nix_pre, chan_pre, *bpid_new, 1, false) < 0) + return -ENOSPC; + + if (roc_nix_chan_bpid_set(roc_nix, chan, *bpid_new, 1, false) < 0) + return -ENOSPC; + + return 0; + } else { + return roc_nix_chan_bpid_set(roc_nix, chan, bpid, 1, false); + } + + return 0; +} + +#define NIX_BPID_INVALID 0xFFFF + void roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, uint8_t force, uint8_t tc) { + uint32_t aura_id = roc_npa_aura_handle_to_aura(pool_id); struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct npa_lf *lf = idev_npa_obj_get(); struct npa_aq_enq_req *req; struct npa_aq_enq_rsp *rsp; + uint8_t bp_thresh, bp_intf; struct mbox *mbox; - uint32_t limit; - uint64_t shift; int rc; if (roc_nix_is_sdp(roc_nix)) @@ -446,93 +493,74 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, if (!lf) return; - mbox = mbox_get(lf->mbox); - req = mbox_alloc_msg_npa_aq_enq(mbox); - if (req == NULL) - goto exit; + mbox = lf->mbox; + req = mbox_alloc_msg_npa_aq_enq(mbox_get(mbox)); + if (req == NULL) { + mbox_put(mbox); + return; + } - req->aura_id = roc_npa_aura_handle_to_aura(pool_id); + req->aura_id = aura_id; req->ctype = NPA_AQ_CTYPE_AURA; req->op = NPA_AQ_INSTOP_READ; rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; + mbox_put(mbox); + if (rc) { + plt_nix_dbg("Failed to read context of aura 0x%" PRIx64, pool_id); + return; + } - limit = rsp->aura.limit; - shift = rsp->aura.shift; + bp_intf = 1 << nix->is_nix1; + bp_thresh = NIX_RQ_AURA_THRESH(rsp->aura.limit >> rsp->aura.shift); /* BP is already enabled. */ if (rsp->aura.bp_ena && ena) { - uint16_t bpid; - bool nix1; + uint16_t bpid = + (rsp->aura.bp_ena & 0x1) ? rsp->aura.nix0_bpid : rsp->aura.nix1_bpid; - nix1 = !!(rsp->aura.bp_ena & 0x2); - if (nix1) - bpid = rsp->aura.nix1_bpid; - else - bpid = rsp->aura.nix0_bpid; + /* Disable BP if BPIDs don't match and couldn't add new BPID. */ + if (bpid != nix->bpid[tc]) { + uint16_t bpid_new = NIX_BPID_INVALID; - /* If BP ids don't match disable BP. */ - if (((nix1 != nix->is_nix1) || (bpid != nix->bpid[tc])) && - !force) { - req = mbox_alloc_msg_npa_aq_enq(mbox); - if (req == NULL) - goto exit; + if ((nix_rx_chan_multi_bpid_cfg(roc_nix, tc, bpid, &bpid_new) < 0) && + !force) { + plt_info("Disabling BP/FC on aura 0x%" PRIx64 + " as it shared across ports or tc", + pool_id); - plt_info("Disabling BP/FC on aura 0x%" PRIx64 - " as it shared across ports or tc", - pool_id); - req->aura_id = roc_npa_aura_handle_to_aura(pool_id); - req->ctype = NPA_AQ_CTYPE_AURA; - req->op = NPA_AQ_INSTOP_WRITE; + if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false)) + plt_nix_dbg( + "Disabling backpressue failed on aura 0x%" PRIx64, + pool_id); + } - req->aura.bp_ena = 0; - req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena); - - mbox_process(mbox); + /* Configure Aura with new BPID if it is allocated. */ + if (bpid_new != NIX_BPID_INVALID) { + if (roc_npa_aura_bp_configure(pool_id, bpid_new, bp_intf, bp_thresh, + true)) + plt_nix_dbg( + "Enabling backpressue failed on aura 0x%" PRIx64, + pool_id); + } } - if ((nix1 != nix->is_nix1) || (bpid != nix->bpid[tc])) - plt_info("Ignoring aura 0x%" PRIx64 "->%u bpid mapping", - pool_id, nix->bpid[tc]); - goto exit; + return; } /* BP was previously enabled but now disabled skip. */ if (rsp->aura.bp && ena) - goto exit; - - req = mbox_alloc_msg_npa_aq_enq(mbox); - if (req == NULL) - goto exit; - - req->aura_id = roc_npa_aura_handle_to_aura(pool_id); - req->ctype = NPA_AQ_CTYPE_AURA; - req->op = NPA_AQ_INSTOP_WRITE; + return; if (ena) { - if (nix->is_nix1) { - req->aura.nix1_bpid = nix->bpid[tc]; - req->aura_mask.nix1_bpid = ~(req->aura_mask.nix1_bpid); - } else { - req->aura.nix0_bpid = nix->bpid[tc]; - req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid); - } - req->aura.bp = NIX_RQ_AURA_THRESH(limit >> shift); - req->aura_mask.bp = ~(req->aura_mask.bp); + if (roc_npa_aura_bp_configure(pool_id, nix->bpid[tc], bp_intf, bp_thresh, true)) + plt_nix_dbg("Enabling backpressue failed on aura 0x%" PRIx64, pool_id); } else { - req->aura.bp = 0; - req->aura_mask.bp = ~(req->aura_mask.bp); + if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false)) + plt_nix_dbg("Disabling backpressue failed on aura 0x%" PRIx64, pool_id); } - req->aura.bp_ena = (!!ena << nix->is_nix1); - req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena); - - mbox_process(mbox); -exit: - mbox_put(mbox); return; } diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index 42846ac4ec..d6a97e49c9 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -882,6 +882,54 @@ roc_npa_zero_aura_handle(void) return 0; } +int +roc_npa_aura_bp_configure(uint64_t aura_handle, uint16_t bpid, uint8_t bp_intf, uint8_t bp_thresh, + bool enable) +{ + uint32_t aura_id = roc_npa_aura_handle_to_aura(aura_handle); + struct npa_lf *lf = idev_npa_obj_get(); + struct npa_aq_enq_req *req; + struct mbox *mbox; + int rc = 0; + + if (lf == NULL) + return NPA_ERR_PARAM; + + mbox = mbox_get(lf->mbox); + req = mbox_alloc_msg_npa_aq_enq(mbox); + if (req == NULL) { + rc = -ENOMEM; + goto fail; + } + + req->aura_id = aura_id; + req->ctype = NPA_AQ_CTYPE_AURA; + req->op = NPA_AQ_INSTOP_WRITE; + + if (enable) { + if (bp_intf & 0x1) { + req->aura.nix0_bpid = bpid; + req->aura_mask.nix0_bpid = ~(req->aura_mask.nix0_bpid); + } else { + req->aura.nix1_bpid = bpid; + req->aura_mask.nix1_bpid = ~(req->aura_mask.nix1_bpid); + } + req->aura.bp = bp_thresh; + req->aura_mask.bp = ~(req->aura_mask.bp); + } else { + req->aura.bp = 0; + req->aura_mask.bp = ~(req->aura_mask.bp); + } + + req->aura.bp_ena = bp_intf; + req->aura_mask.bp_ena = ~(req->aura_mask.bp_ena); + + mbox_process(mbox); +fail: + mbox_put(mbox); + return rc; +} + static inline int npa_attach(struct mbox *m_box) { diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index 21608a40d9..546b7c93d9 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -746,6 +746,8 @@ uint64_t __roc_api roc_npa_zero_aura_handle(void); int __roc_api roc_npa_buf_type_update(uint64_t aura_handle, enum roc_npa_buf_type type, int cnt); uint64_t __roc_api roc_npa_buf_type_mask(uint64_t aura_handle); uint64_t __roc_api roc_npa_buf_type_limit_get(uint64_t type_mask); +int __roc_api roc_npa_aura_bp_configure(uint64_t aura_id, uint16_t bpid, uint8_t bp_intf, + uint8_t bp_thresh, bool enable); /* Init callbacks */ typedef int (*roc_npa_lf_init_cb_t)(struct plt_pci_device *pci_dev); diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index e7c6f6bce5..d740d9df81 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -99,6 +99,7 @@ INTERNAL { roc_idev_npa_nix_get; roc_idev_num_lmtlines_get; roc_idev_nix_inl_meta_aura_get; + roc_idev_nix_list_get; roc_ml_reg_read64; roc_ml_reg_write64; roc_ml_reg_read32; @@ -361,6 +362,7 @@ INTERNAL { roc_npa_aura_limit_modify; roc_npa_aura_op_range_get; roc_npa_aura_op_range_set; + roc_npa_aura_bp_configure; roc_npa_ctx_dump; roc_npa_dev_fini; roc_npa_dev_init; From patchwork Tue Apr 11 09:11:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125908 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4C8914291B; Tue, 11 Apr 2023 11:12:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1DBE42BC9; Tue, 11 Apr 2023 11:12:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DA0BE42BAC for ; Tue, 11 Apr 2023 11:12:11 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8SvlB021524; Tue, 11 Apr 2023 02:12:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=MqQdwTqy2PyVS7AEduFc1KUQCE64n3oo+dglHHUn+MU=; b=eDvFKaUvr+s/phcipqL3caAKt4h07/bpyGcFKGGCDaNqgFZwQfidf60W7GQ71A3VQb01 9VzzPMPRMYpzIy3BkfwvoqlajXKW/CJKthDz4QzkwStMVQXUrKB6QIubeXbbXtUGZOWn UYEF4cIIz+G32CNePcl2pnx6ZQiWSNrKMxndzAqxKC3szGbOgSNE+NoG3tDUilD1fE8I QegcJu0mn61x8sy4iujvhs8JQHXkKHz6nhXJPbjX2s9ZHN4gG2aTAkbwM83gngIkcmIh jHLjqYSqi9uVzI4DQur2apP62t6zrDrjXcVfnPmHLl4BroIKgOpcrZutptsAxL70j+rr 0g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1s2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 11 Apr 2023 02:12:10 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:09 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:08 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 97EF73F706A; Tue, 11 Apr 2023 02:12:06 -0700 (PDT) From: Nithin Dabilpuram To: Thomas Monjalon , Nithin Kumar Dabilpuram , Kiran Kumar K , "Sunil Kumar Kori" , Satha Rao CC: , Subject: [PATCH 03/21] common/cnxk: skip flow ctrl set on non-existent meta aura Date: Tue, 11 Apr 2023 14:41:26 +0530 Message-ID: <20230411091144.1087887-3-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: JxoVK_YqsN2Wj2G63dvr4R5QiyHrjs2l X-Proofpoint-ORIG-GUID: JxoVK_YqsN2Wj2G63dvr4R5QiyHrjs2l X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Skip setting flow control on local meta aura if it is not yet created. Also in flow control mode set, do get to confirm if it is in same state to avoid a set and unnecessary mbox failures. Signed-off-by: Nithin Dabilpuram --- .mailmap | 1 + drivers/common/cnxk/roc_dev.c | 1 + drivers/common/cnxk/roc_nix_fc.c | 4 ++-- drivers/common/cnxk/roc_nix_inl.c | 3 +++ drivers/net/cnxk/cnxk_ethdev.c | 5 +++-- drivers/net/cnxk/cnxk_ethdev_ops.c | 4 ++++ 6 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.mailmap b/.mailmap index 0859104404..be2eddf1b3 100644 --- a/.mailmap +++ b/.mailmap @@ -988,6 +988,7 @@ Nipun Gupta Nir Efrati Nirmoy Das Nithin Dabilpuram +Nithin Kumar Dabilpuram Nitin Saxena Nitzan Weller Noa Ezra diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index 2388237186..5e4e564ebe 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -421,6 +421,7 @@ process_msgs(struct dev *dev, struct mbox *mbox) dev->pf_func = msg->pcifunc; break; case MBOX_MSG_CGX_PRIO_FLOW_CTRL_CFG: + case MBOX_MSG_CGX_CFG_PAUSE_FRM: /* Handling the case where one VF tries to disable PFC * while PFC already configured on other VFs. This is * not an error but a warning which can be ignored. diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 8b7659fb9a..3618d2920b 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -311,7 +311,7 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc); - if (roc_nix->local_meta_aura_ena) + if (roc_nix->local_meta_aura_ena && roc_nix->meta_aura_handle) roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle, fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc); } @@ -409,6 +409,7 @@ roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode) goto exit; } + /* Set new config */ req = mbox_alloc_msg_cgx_cfg_pause_frm(mbox); if (req == NULL) goto exit; @@ -422,7 +423,6 @@ roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode) nix->rx_pause = rx_pause; nix->tx_pause = tx_pause; - exit: mbox_put(mbox); return rc; diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 9485bba099..b16756d642 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -131,6 +131,9 @@ nix_inl_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_ } roc_nix->meta_mempool = mp; + plt_nix_dbg("Created meta aura %p(%s)for port %d", (void *)*meta_aura, mp_name, + roc_nix->port_id); + if (!roc_nix->local_meta_aura_ena) { inl_cfg->buf_sz = buf_sz; inl_cfg->nb_bufs = nb_bufs; diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 1cae3084e1..3bccc34d79 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -378,8 +378,9 @@ nix_init_flow_ctrl_config(struct rte_eth_dev *eth_dev) if (rc) return rc; - fc->mode = (fc_mode == ROC_NIX_FC_FULL) ? RTE_ETH_FC_FULL : - RTE_ETH_FC_TX_PAUSE; + fc->mode = (fc_mode == ROC_NIX_FC_FULL) ? RTE_ETH_FC_FULL : RTE_ETH_FC_TX_PAUSE; + fc->rx_pause = (fc->mode == RTE_ETH_FC_FULL) || (fc->mode == RTE_ETH_FC_RX_PAUSE); + fc->tx_pause = (fc->mode == RTE_ETH_FC_FULL) || (fc->mode == RTE_ETH_FC_TX_PAUSE); return rc; } diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index 068b7c3502..bce6d59bbc 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -342,6 +342,10 @@ cnxk_nix_flow_ctrl_set(struct rte_eth_dev *eth_dev, return rc; } + /* Skip mode set if it is we are in same state */ + if (fc->rx_pause == rx_pause && fc->tx_pause == tx_pause) + return 0; + rc = roc_nix_fc_mode_set(nix, mode_map[fc_conf->mode]); if (rc) return rc; From patchwork Tue Apr 11 09:11:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125909 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F0EDE4291B; Tue, 11 Apr 2023 11:12:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0E97342C24; Tue, 11 Apr 2023 11:12:16 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id C2A1342B71 for ; Tue, 11 Apr 2023 11:12:14 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8VpNP021637 for ; Tue, 11 Apr 2023 02:12:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=mlAK037H9XpavehJcWHR9ZJDJHGRk8/FLpA5BdcKPp8=; b=Sieg/+UwYKgRLZcSuWW/dPYTNxYjFX0HgzKpqaGZ+oePgn7bgceV3sKzRR8Ko77vdyWw Wjz7Hoxojbmqx4xMAOsb+nEBKpMnzyfZyjV63mcHAsM/0VpR8F+puUklmrSAOG7QIrdE 1HldeKfkOBNtUWcBlSyrXQvxD2daxv0dgjposunAu83GUTrtjmKs6ApXpBBpUz8uQy5m +gVTLgwIU2yu6SHaulUVB4A3zS1+QLs9Qyd0i9Cs1NYolhYXGfxBSV94XqI/rckAZKsH 1wfW2KmQ6z6uKjfSZBCwAeNbrHq92rNjosow1eUz7HpUm8CFiBfkLEOx0pSk50Q+itEq qw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1sa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:13 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:12 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:12 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 9A5D53F7070; Tue, 11 Apr 2023 02:12:09 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH 04/21] common/cnxk: reduce sqes per sqb by one Date: Tue, 11 Apr 2023 14:41:27 +0530 Message-ID: <20230411091144.1087887-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: _y05Y-4DP4KdiMZcxxrDix0OVFdP3qe- X-Proofpoint-ORIG-GUID: _y05Y-4DP4KdiMZcxxrDix0OVFdP3qe- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao Each SQB reserves last SQE to store pointer to next SQB. So each SQB will holds either 31 or 63 based on send descriptors selected. This patch also consider sqb_slack to maintain threshold buffers to sync between HW and SW. Threshold will be maximum of 30% of queue size or sqb_slack. Signed-off-by: Satha Rao --- drivers/common/cnxk/roc_nix.h | 2 +- drivers/common/cnxk/roc_nix_priv.h | 2 +- drivers/common/cnxk/roc_nix_queue.c | 21 ++++++++++----------- drivers/event/cnxk/cn10k_eventdev.c | 2 +- drivers/event/cnxk/cn9k_eventdev.c | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 188b8800d3..50aef4fe85 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -13,7 +13,7 @@ #define ROC_NIX_BPF_STATS_MAX 12 #define ROC_NIX_MTR_ID_INVALID UINT32_MAX #define ROC_NIX_PFC_CLASS_INVALID UINT8_MAX -#define ROC_NIX_SQB_LOWER_THRESH 70U +#define ROC_NIX_SQB_THRESH 30U #define ROC_NIX_SQB_SLACK 12U /* Reserved interface types for BPID allocation */ diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 99e27cdc56..7144d1ee10 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -12,7 +12,7 @@ #define NIX_MAX_SQB ((uint16_t)512) #define NIX_DEF_SQB ((uint16_t)16) #define NIX_MIN_SQB ((uint16_t)8) -#define NIX_SQB_LIST_SPACE ((uint16_t)2) +#define NIX_SQB_PREFETCH ((uint16_t)1) /* Apply BP/DROP when CQ is 95% full */ #define NIX_CQ_THRESH_LEVEL (5 * 256 / 100) diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c index ac4d9856c1..d29fafa895 100644 --- a/drivers/common/cnxk/roc_nix_queue.c +++ b/drivers/common/cnxk/roc_nix_queue.c @@ -982,7 +982,7 @@ static int sqb_pool_populate(struct roc_nix *roc_nix, struct roc_nix_sq *sq) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); - uint16_t sqes_per_sqb, count, nb_sqb_bufs; + uint16_t sqes_per_sqb, count, nb_sqb_bufs, thr; struct npa_pool_s pool; struct npa_aura_s aura; uint64_t blk_sz; @@ -995,22 +995,21 @@ sqb_pool_populate(struct roc_nix *roc_nix, struct roc_nix_sq *sq) else sqes_per_sqb = (blk_sz / 8) / 8; + /* Reserve One SQE in each SQB to hold pointer for next SQB */ + sqes_per_sqb -= 1; + sq->nb_desc = PLT_MAX(512U, sq->nb_desc); - nb_sqb_bufs = sq->nb_desc / sqes_per_sqb; - nb_sqb_bufs += NIX_SQB_LIST_SPACE; + nb_sqb_bufs = PLT_DIV_CEIL(sq->nb_desc, sqes_per_sqb); + thr = PLT_DIV_CEIL((nb_sqb_bufs * ROC_NIX_SQB_THRESH), 100); + nb_sqb_bufs += NIX_SQB_PREFETCH; /* Clamp up the SQB count */ - nb_sqb_bufs = PLT_MIN(roc_nix->max_sqb_count, - (uint16_t)PLT_MAX(NIX_DEF_SQB, nb_sqb_bufs)); + nb_sqb_bufs = PLT_MIN(roc_nix->max_sqb_count, (uint16_t)PLT_MAX(NIX_DEF_SQB, nb_sqb_bufs)); sq->nb_sqb_bufs = nb_sqb_bufs; sq->sqes_per_sqb_log2 = (uint16_t)plt_log2_u32(sqes_per_sqb); - sq->nb_sqb_bufs_adj = - nb_sqb_bufs - - (PLT_ALIGN_MUL_CEIL(nb_sqb_bufs, sqes_per_sqb) / sqes_per_sqb); - sq->nb_sqb_bufs_adj = - (sq->nb_sqb_bufs_adj * ROC_NIX_SQB_LOWER_THRESH) / 100; + sq->nb_sqb_bufs_adj = nb_sqb_bufs; - nb_sqb_bufs += roc_nix->sqb_slack; + nb_sqb_bufs += PLT_MAX(thr, roc_nix->sqb_slack); /* Explicitly set nat_align alone as by default pool is with both * nat_align and buf_offset = 1 which we don't want for SQB. */ diff --git a/drivers/event/cnxk/cn10k_eventdev.c b/drivers/event/cnxk/cn10k_eventdev.c index 071ea5a212..afd8e323b8 100644 --- a/drivers/event/cnxk/cn10k_eventdev.c +++ b/drivers/event/cnxk/cn10k_eventdev.c @@ -995,7 +995,7 @@ cn10k_sso_txq_fc_update(const struct rte_eth_dev *eth_dev, int32_t tx_queue_id) (sqes_per_sqb - 1)); txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj; txq->nb_sqb_bufs_adj = - (ROC_NIX_SQB_LOWER_THRESH * txq->nb_sqb_bufs_adj) / 100; + ((100 - ROC_NIX_SQB_THRESH) * txq->nb_sqb_bufs_adj) / 100; } } diff --git a/drivers/event/cnxk/cn9k_eventdev.c b/drivers/event/cnxk/cn9k_eventdev.c index 2d2985f175..b104d19b9b 100644 --- a/drivers/event/cnxk/cn9k_eventdev.c +++ b/drivers/event/cnxk/cn9k_eventdev.c @@ -1037,7 +1037,7 @@ cn9k_sso_txq_fc_update(const struct rte_eth_dev *eth_dev, int32_t tx_queue_id) (sqes_per_sqb - 1)); txq->nb_sqb_bufs_adj = sq->nb_sqb_bufs_adj; txq->nb_sqb_bufs_adj = - (ROC_NIX_SQB_LOWER_THRESH * txq->nb_sqb_bufs_adj) / 100; + ((100 - ROC_NIX_SQB_THRESH) * txq->nb_sqb_bufs_adj) / 100; } } From patchwork Tue Apr 11 09:11:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125910 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 805374291B; Tue, 11 Apr 2023 11:12:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 42D3442D0E; Tue, 11 Apr 2023 11:12:19 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 01A12427EE for ; Tue, 11 Apr 2023 11:12:17 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g4Dg014876 for ; Tue, 11 Apr 2023 02:12:17 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=9t5F6QXl2+OkXJvfrO0FqCi0ioTbm2jGib5xFv65nWs=; b=C+hiflbi1S7DSSsCAXRM7jPGG6OYMcuwsjWEU0znGieUUBFwImjgH6BSuSB/j8yLTvWJ XqkEcius3wu77uhTK6wQczZ6MgFwEpwbgoF+EUh4STB6B0rWY82e1KifaZgiLsM4no3w LjH8dwpzUyQJiqtYMPkYLm3xMldOXQz39cn9Edw032t2ZMcq2tJNrG+3I5oUzsXVCgfi eIl4CLvWTM1GlMytwd4b+tBrerltySPnxAvaS27AEytTaCDJLfJvL3CJsOc2EQQ/j6AR TM78Z4GaJUkkq3UI8jd1fdo2L2jyQz598DMUohpuI2zeAY8ek6RE5SbEQ9xiFB7K4vAZ bQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94fm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:17 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:15 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:14 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C68493F7071; Tue, 11 Apr 2023 02:12:12 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 05/21] common/cnxk: dump SW SSO work count as xstat Date: Tue, 11 Apr 2023 14:41:28 +0530 Message-ID: <20230411091144.1087887-5-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Z2BtoPYEh3pcySL58y3pvYOMpv_EXkiT X-Proofpoint-GUID: Z2BtoPYEh3pcySL58y3pvYOMpv_EXkiT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Dump SW SSO work count as xstat. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_nix_inl_dev_irq.c | 1 + drivers/common/cnxk/roc_nix_inl_priv.h | 1 + drivers/common/cnxk/roc_nix_stats.c | 17 +++++++++++------ drivers/common/cnxk/roc_nix_xstats.h | 4 ++++ 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_inl_dev_irq.c b/drivers/common/cnxk/roc_nix_inl_dev_irq.c index 445b440447..becd7907f2 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev_irq.c +++ b/drivers/common/cnxk/roc_nix_inl_dev_irq.c @@ -41,6 +41,7 @@ nix_inl_sso_work_cb(struct nix_inl_dev *inl_dev) goto again; } + inl_dev->sso_work_cnt += cnt; plt_atomic_thread_fence(__ATOMIC_ACQ_REL); } diff --git a/drivers/common/cnxk/roc_nix_inl_priv.h b/drivers/common/cnxk/roc_nix_inl_priv.h index 528d2db365..b0a8976c6b 100644 --- a/drivers/common/cnxk/roc_nix_inl_priv.h +++ b/drivers/common/cnxk/roc_nix_inl_priv.h @@ -57,6 +57,7 @@ struct nix_inl_dev { bool is_nix1; uint8_t spb_drop_pc; uint8_t lpb_drop_pc; + uint64_t sso_work_cnt; /* NIX/CPT data */ void *inb_sa_base; diff --git a/drivers/common/cnxk/roc_nix_stats.c b/drivers/common/cnxk/roc_nix_stats.c index 6b5803af84..ca0e8ccb4f 100644 --- a/drivers/common/cnxk/roc_nix_stats.c +++ b/drivers/common/cnxk/roc_nix_stats.c @@ -24,12 +24,7 @@ int roc_nix_num_xstats_get(struct roc_nix *roc_nix) { - if (roc_nix_is_vf_or_sdp(roc_nix)) - return CNXK_NIX_NUM_XSTATS_REG; - else if (roc_model_is_cn9k()) - return CNXK_NIX_NUM_XSTATS_CGX; - - return CNXK_NIX_NUM_XSTATS_RPM; + return roc_nix_xstats_names_get(roc_nix, NULL, 0); } int @@ -360,6 +355,12 @@ roc_nix_xstats_get(struct roc_nix *roc_nix, struct roc_nix_xstat *xstats, xstats[count].id = count; count++; } + for (i = 0; i < PLT_DIM(inl_sw_xstats); i++) { + if (!inl_sw_xstats[i].offset) + xstats[count].value = inl_dev->sso_work_cnt; + xstats[count].id = count; + count++; + } } } @@ -475,6 +476,10 @@ roc_nix_xstats_names_get(struct roc_nix *roc_nix, inl_nix_rq_xstats, i); count++; } + for (i = 0; i < PLT_DIM(inl_sw_xstats); i++) { + NIX_XSTATS_NAME_PRINT(xstats_names, count, inl_sw_xstats, i); + count++; + } } } diff --git a/drivers/common/cnxk/roc_nix_xstats.h b/drivers/common/cnxk/roc_nix_xstats.h index 813fb7f578..11b8e1c0ff 100644 --- a/drivers/common/cnxk/roc_nix_xstats.h +++ b/drivers/common/cnxk/roc_nix_xstats.h @@ -206,6 +206,10 @@ static const struct cnxk_nix_xstats_name nix_tx_xstats_cgx[] = { {"cgx_tx_pause_packets", CGX_TX_PAUSE_PKTS}, }; +static const struct cnxk_nix_xstats_name inl_sw_xstats[] = { + {"inl_sso_work_cnt", 0}, +}; + #define CNXK_NIX_NUM_RX_XSTATS PLT_DIM(nix_rx_xstats) #define CNXK_NIX_NUM_TX_XSTATS PLT_DIM(nix_tx_xstats) #define CNXK_NIX_NUM_QUEUE_XSTATS PLT_DIM(nix_q_xstats) From patchwork Tue Apr 11 09:11:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125911 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8913A4291B; Tue, 11 Apr 2023 11:12:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9ECD42D12; Tue, 11 Apr 2023 11:12:23 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3B44C42D12 for ; Tue, 11 Apr 2023 11:12:22 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8YWB3021305 for ; Tue, 11 Apr 2023 02:12:21 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=IZJzYiBEt9LruT0K55ZXP6caZNBpY8CP/sPZF7L+Q1U=; b=ZKGMoJJ67G+pDvV6/1zTiFs+o//Hq450jcfAC2UfWXWUD1mRkOrYxTO9sQVmsmqKBRdo rUSZXDKjnro7AR2ZWU9sIPMCnESIHbpHSPcWqcfVXS1/lC2gL2ezbXc4VObdA9uyUj5w X0aGfQ9SMYPm2UnLxd50xkBHZBkitF6lwW2MaVI1/Z1F09r00/fE9h15J0BLFa84IUbn pGfmmn7p2hvuOQicyqxOBs489B7mjmY4E0KPYS/i8bMaU5+wgVr5wMcWEoFVC27B/mqK eKcsvJ59baMta1sFQ4P3fcvkCFE7v3bAeNWwC8e09NSl6ZQ5EaJH4obMog23b109dn2I bA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1ss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:21 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:19 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 89A1F3F7074; Tue, 11 Apr 2023 02:12:15 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH 06/21] common/cnxk: add percent drop threshold to pool Date: Tue, 11 Apr 2023 14:41:29 +0530 Message-ID: <20230411091144.1087887-6-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 4j7uUD-j5wvRJKlut9yjRtH3rwAO7vc_ X-Proofpoint-ORIG-GUID: 4j7uUD-j5wvRJKlut9yjRtH3rwAO7vc_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Sunil Kumar Kori Currently hard coded drop threshold(95%) is configured to aura/pool as a threshold for drop limit. Patch adds a input parameter to RoC API so that user passed percentage value can be configured. Signed-off-by: Sunil Kumar Kori --- drivers/common/cnxk/roc_nix.h | 6 ++++-- drivers/common/cnxk/roc_nix_fc.c | 17 ++++++++++++----- drivers/common/cnxk/roc_nix_inl.c | 2 +- drivers/common/cnxk/roc_nix_priv.h | 2 +- drivers/event/cnxk/cnxk_eventdev_adptr.c | 4 ++-- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 50aef4fe85..fde8fe4ecc 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -15,6 +15,7 @@ #define ROC_NIX_PFC_CLASS_INVALID UINT8_MAX #define ROC_NIX_SQB_THRESH 30U #define ROC_NIX_SQB_SLACK 12U +#define ROC_NIX_AURA_THRESH 95U /* Reserved interface types for BPID allocation */ #define ROC_NIX_INTF_TYPE_CGX 0 @@ -197,6 +198,7 @@ struct roc_nix_fc_cfg { uint16_t cq_drop; bool enable; uint64_t pool; + uint64_t pool_drop_pct; } rq_cfg; struct { @@ -849,8 +851,8 @@ uint16_t __roc_api roc_nix_chan_count_get(struct roc_nix *roc_nix); enum roc_nix_fc_mode __roc_api roc_nix_fc_mode_get(struct roc_nix *roc_nix); -void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, - uint8_t ena, uint8_t force, uint8_t tc); +void __roc_api roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, + uint8_t force, uint8_t tc, uint64_t drop_percent); int __roc_api roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, uint8_t bp_cnt, uint16_t *bpids); int __roc_api roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt, diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 3618d2920b..98dd9a9e66 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -297,6 +297,7 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) { struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct roc_nix_fc_cfg tmp; + uint64_t pool_drop_pct; struct roc_nix_rq *rq; int sso_ena = 0, rc; @@ -307,13 +308,19 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) return -EINVAL; if (sso_ena) { + pool_drop_pct = fc_cfg->rq_cfg.pool_drop_pct; + /* Use default value for zero pct */ + if (fc_cfg->rq_cfg.enable && !pool_drop_pct) + pool_drop_pct = ROC_NIX_AURA_THRESH; + roc_nix_fc_npa_bp_cfg(roc_nix, fc_cfg->rq_cfg.pool, fc_cfg->rq_cfg.enable, true, - fc_cfg->rq_cfg.tc); + fc_cfg->rq_cfg.tc, fc_cfg->rq_cfg.pool_drop_pct); if (roc_nix->local_meta_aura_ena && roc_nix->meta_aura_handle) roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle, - fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc); + fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc, + fc_cfg->rq_cfg.pool_drop_pct); } /* Copy RQ config to CQ config as they are occupying same area */ @@ -476,8 +483,8 @@ nix_rx_chan_multi_bpid_cfg(struct roc_nix *roc_nix, uint8_t chan, uint16_t bpid, #define NIX_BPID_INVALID 0xFFFF void -roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, - uint8_t force, uint8_t tc) +roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, uint8_t force, + uint8_t tc, uint64_t drop_percent) { uint32_t aura_id = roc_npa_aura_handle_to_aura(pool_id); struct nix *nix = roc_nix_to_nix_priv(roc_nix); @@ -513,7 +520,7 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, } bp_intf = 1 << nix->is_nix1; - bp_thresh = NIX_RQ_AURA_THRESH(rsp->aura.limit >> rsp->aura.shift); + bp_thresh = NIX_RQ_AURA_THRESH(drop_percent, rsp->aura.limit >> rsp->aura.shift); /* BP is already enabled. */ if (rsp->aura.bp_ena && ena) { diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index b16756d642..329ebf9405 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -263,7 +263,7 @@ roc_nix_inl_meta_aura_check(struct roc_nix *roc_nix, struct roc_nix_rq *rq) */ if (aura_setup && nix->rqs[0] && nix->rqs[0]->tc != ROC_NIX_PFC_CLASS_INVALID) roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle, - true, true, nix->rqs[0]->tc); + true, true, nix->rqs[0]->tc, ROC_NIX_AURA_THRESH); } else { rc = nix_inl_global_meta_buffer_validate(idev, rq); if (rc) diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 7144d1ee10..f900a81d8a 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -20,7 +20,7 @@ /* Apply LBP at 75% of actual BP */ #define NIX_CQ_LPB_THRESH_FRAC (75 * 16 / 100) #define NIX_CQ_FULL_ERRATA_SKID (1024ull * 256) -#define NIX_RQ_AURA_THRESH(x) (((x)*95) / 100) +#define NIX_RQ_AURA_THRESH(percent, val) (((val) * (percent)) / 100) /* IRQ triggered when NIX_LF_CINTX_CNT[QCOUNT] crosses this value */ #define CQ_CQE_THRESH_DEFAULT 0x1ULL diff --git a/drivers/event/cnxk/cnxk_eventdev_adptr.c b/drivers/event/cnxk/cnxk_eventdev_adptr.c index 5ec436382c..3dc3d04a1e 100644 --- a/drivers/event/cnxk/cnxk_eventdev_adptr.c +++ b/drivers/event/cnxk/cnxk_eventdev_adptr.c @@ -263,7 +263,7 @@ cnxk_sso_rx_adapter_queue_add( if (rxq_sp->tx_pause) roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix, rxq_sp->qconf.mp->pool_id, true, - dev->force_ena_bp, rxq_sp->tc); + dev->force_ena_bp, rxq_sp->tc, ROC_NIX_AURA_THRESH); cnxk_sso_tstamp_cfg(eth_dev->data->port_id, cnxk_eth_dev, dev); cnxk_eth_dev->nb_rxq_sso++; } @@ -307,7 +307,7 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev, rc = cnxk_sso_rxq_disable(cnxk_eth_dev, (uint16_t)rx_queue_id); roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix, rxq_sp->qconf.mp->pool_id, false, - dev->force_ena_bp, 0); + dev->force_ena_bp, 0, ROC_NIX_AURA_THRESH); cnxk_eth_dev->nb_rxq_sso--; /* Enable drop_re if it was disabled earlier */ From patchwork Tue Apr 11 09:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125912 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 351714291B; Tue, 11 Apr 2023 11:12:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B76042D2F; Tue, 11 Apr 2023 11:12:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 15BCA427EE for ; Tue, 11 Apr 2023 11:12:23 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B84Pdj020822 for ; Tue, 11 Apr 2023 02:12:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=HVvwvkNns8wa69UDeIQKD1OeOPPNGvAcXnrTwxgdwSw=; b=WPRfRa+b4QxduVxlhSDAOpxkJgeDdF9ridlvO35+BekAr3+7wlvZd+IlOvkNZaypECLP nVCoBqZCu28ceIaN4edS5/NqRGzXNYjR+gTCwrd8lzSTmI6hcxswLmXCRbwjy3hvjSqp WK4Ax9YkzoCf/ZVi3KjmEtB6OdhUL7V55sDTPRKatRefEYFbJblOT6k6PtsBTKZKc9mV N1XhN1QO8BF+zi3gJcbUrFBdI+9IuVmh6mZQ741mHElmi7jinzcUX5nQ5iM8QnVZqSVy EpDdzEfTyPi6KzYlq/39nMmzSrkcWp4+Kw0IvhkpZeqRpS+mqbdaT16OgGbCJADV4jDs WA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1t2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:23 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:21 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:21 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C71853F706A; Tue, 11 Apr 2023 02:12:18 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH 07/21] common/cnxk: make aura flow control config more predictable Date: Tue, 11 Apr 2023 14:41:30 +0530 Message-ID: <20230411091144.1087887-7-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: onLZizH9RlIoD6Vr7KGqPWQ10UncpYx2 X-Proofpoint-ORIG-GUID: onLZizH9RlIoD6Vr7KGqPWQ10UncpYx2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Restrict shared BPID config only when force BP is enabled and make aura flow control config more predictable by not disabling it if there is a collision but ignore new config and log the same. Also remove BPID setup from Rx adapter as it is now evaluated and configured every time ethdev is stopped/started. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_fc.c | 49 ++++++++++++------------ drivers/common/cnxk/roc_nix_inl.c | 2 +- drivers/common/cnxk/roc_npa.c | 3 ++ drivers/event/cnxk/cnxk_eventdev_adptr.c | 13 +------ 5 files changed, 32 insertions(+), 36 deletions(-) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index fde8fe4ecc..2b576f0891 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -451,6 +451,7 @@ struct roc_nix { bool custom_sa_action; bool local_meta_aura_ena; uint32_t meta_buf_sz; + bool force_rx_aura_bp; /* End of input parameters */ /* LMT line base for "Per Core Tx LMT line" mode*/ uintptr_t lmt_base; diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 98dd9a9e66..bbc27a6421 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -314,13 +314,13 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) pool_drop_pct = ROC_NIX_AURA_THRESH; roc_nix_fc_npa_bp_cfg(roc_nix, fc_cfg->rq_cfg.pool, - fc_cfg->rq_cfg.enable, true, - fc_cfg->rq_cfg.tc, fc_cfg->rq_cfg.pool_drop_pct); + fc_cfg->rq_cfg.enable, roc_nix->force_rx_aura_bp, + fc_cfg->rq_cfg.tc, pool_drop_pct); if (roc_nix->local_meta_aura_ena && roc_nix->meta_aura_handle) roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle, - fc_cfg->rq_cfg.enable, true, fc_cfg->rq_cfg.tc, - fc_cfg->rq_cfg.pool_drop_pct); + fc_cfg->rq_cfg.enable, roc_nix->force_rx_aura_bp, + fc_cfg->rq_cfg.tc, pool_drop_pct); } /* Copy RQ config to CQ config as they are occupying same area */ @@ -493,7 +493,8 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui struct npa_aq_enq_rsp *rsp; uint8_t bp_thresh, bp_intf; struct mbox *mbox; - int rc; + uint16_t bpid; + int rc, i; if (roc_nix_is_sdp(roc_nix)) return; @@ -522,34 +523,25 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui bp_intf = 1 << nix->is_nix1; bp_thresh = NIX_RQ_AURA_THRESH(drop_percent, rsp->aura.limit >> rsp->aura.shift); + bpid = (rsp->aura.bp_ena & 0x1) ? rsp->aura.nix0_bpid : rsp->aura.nix1_bpid; /* BP is already enabled. */ if (rsp->aura.bp_ena && ena) { - uint16_t bpid = - (rsp->aura.bp_ena & 0x1) ? rsp->aura.nix0_bpid : rsp->aura.nix1_bpid; - /* Disable BP if BPIDs don't match and couldn't add new BPID. */ if (bpid != nix->bpid[tc]) { uint16_t bpid_new = NIX_BPID_INVALID; - if ((nix_rx_chan_multi_bpid_cfg(roc_nix, tc, bpid, &bpid_new) < 0) && - !force) { - plt_info("Disabling BP/FC on aura 0x%" PRIx64 - " as it shared across ports or tc", + if (force && !nix_rx_chan_multi_bpid_cfg(roc_nix, tc, bpid, &bpid_new)) { + plt_info("Setting up shared BPID on shared aura 0x%" PRIx64, pool_id); - if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false)) - plt_nix_dbg( - "Disabling backpressue failed on aura 0x%" PRIx64, - pool_id); - } - - /* Configure Aura with new BPID if it is allocated. */ - if (bpid_new != NIX_BPID_INVALID) { + /* Configure Aura with new BPID if it is allocated. */ if (roc_npa_aura_bp_configure(pool_id, bpid_new, bp_intf, bp_thresh, true)) - plt_nix_dbg( - "Enabling backpressue failed on aura 0x%" PRIx64, + plt_err("Enabling backpressue failed on aura 0x%" PRIx64, pool_id); + } else { + plt_info("Ignoring port=%u tc=%u config on shared aura 0x%" PRIx64, + roc_nix->port_id, tc, pool_id); } } @@ -562,10 +554,19 @@ roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t ena, ui if (ena) { if (roc_npa_aura_bp_configure(pool_id, nix->bpid[tc], bp_intf, bp_thresh, true)) - plt_nix_dbg("Enabling backpressue failed on aura 0x%" PRIx64, pool_id); + plt_err("Enabling backpressue failed on aura 0x%" PRIx64, pool_id); } else { + bool found = !!force; + + /* Don't disable if existing BPID is not within this port's list */ + for (i = 0; i < nix->chan_cnt; i++) + if (bpid == nix->bpid[i]) + found = true; + if (!found) + return; + if (roc_npa_aura_bp_configure(pool_id, 0, 0, 0, false)) - plt_nix_dbg("Disabling backpressue failed on aura 0x%" PRIx64, pool_id); + plt_err("Disabling backpressue failed on aura 0x%" PRIx64, pool_id); } return; diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 329ebf9405..8592e1cb0b 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -263,7 +263,7 @@ roc_nix_inl_meta_aura_check(struct roc_nix *roc_nix, struct roc_nix_rq *rq) */ if (aura_setup && nix->rqs[0] && nix->rqs[0]->tc != ROC_NIX_PFC_CLASS_INVALID) roc_nix_fc_npa_bp_cfg(roc_nix, roc_nix->meta_aura_handle, - true, true, nix->rqs[0]->tc, ROC_NIX_AURA_THRESH); + true, false, nix->rqs[0]->tc, ROC_NIX_AURA_THRESH); } else { rc = nix_inl_global_meta_buffer_validate(idev, rq); if (rc) diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index d6a97e49c9..7463f2522c 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -892,6 +892,9 @@ roc_npa_aura_bp_configure(uint64_t aura_handle, uint16_t bpid, uint8_t bp_intf, struct mbox *mbox; int rc = 0; + plt_npa_dbg("Setting BPID %u BP_INTF 0x%x BP_THRESH %u enable %u on aura %" PRIx64, + bpid, bp_intf, bp_thresh, enable, aura_handle); + if (lf == NULL) return NPA_ERR_PARAM; diff --git a/drivers/event/cnxk/cnxk_eventdev_adptr.c b/drivers/event/cnxk/cnxk_eventdev_adptr.c index 3dc3d04a1e..81e61ed856 100644 --- a/drivers/event/cnxk/cnxk_eventdev_adptr.c +++ b/drivers/event/cnxk/cnxk_eventdev_adptr.c @@ -260,10 +260,8 @@ cnxk_sso_rx_adapter_queue_add( false); } - if (rxq_sp->tx_pause) - roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix, - rxq_sp->qconf.mp->pool_id, true, - dev->force_ena_bp, rxq_sp->tc, ROC_NIX_AURA_THRESH); + /* Propagate force bp devarg */ + cnxk_eth_dev->nix.force_rx_aura_bp = dev->force_ena_bp; cnxk_sso_tstamp_cfg(eth_dev->data->port_id, cnxk_eth_dev, dev); cnxk_eth_dev->nb_rxq_sso++; } @@ -293,8 +291,6 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev, int32_t rx_queue_id) { struct cnxk_eth_dev *cnxk_eth_dev = eth_dev->data->dev_private; - struct cnxk_sso_evdev *dev = cnxk_sso_pmd_priv(event_dev); - struct cnxk_eth_rxq_sp *rxq_sp; int i, rc = 0; RTE_SET_USED(event_dev); @@ -302,12 +298,7 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev, for (i = 0; i < eth_dev->data->nb_rx_queues; i++) cnxk_sso_rx_adapter_queue_del(event_dev, eth_dev, i); } else { - rxq_sp = cnxk_eth_rxq_to_sp( - eth_dev->data->rx_queues[rx_queue_id]); rc = cnxk_sso_rxq_disable(cnxk_eth_dev, (uint16_t)rx_queue_id); - roc_nix_fc_npa_bp_cfg(&cnxk_eth_dev->nix, - rxq_sp->qconf.mp->pool_id, false, - dev->force_ena_bp, 0, ROC_NIX_AURA_THRESH); cnxk_eth_dev->nb_rxq_sso--; /* Enable drop_re if it was disabled earlier */ From patchwork Tue Apr 11 09:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125913 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 584034291B; Tue, 11 Apr 2023 11:12:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C43242D39; Tue, 11 Apr 2023 11:12:28 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 0802E42D33 for ; Tue, 11 Apr 2023 11:12:26 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g5LY014919 for ; Tue, 11 Apr 2023 02:12:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=GiWDkVGqXr1djwwuHwXqbhBeFNhAu2LyoER252C6Q5U=; b=Wp8PMUROCn5pbR2OouH8hOf0JltzvgP5umnKaD565t9VPdxXQGXlv576/Tvr1ZwV3nOW WkKylrpVJmJV1P56umpwW0Pv/JH2gzMnrYSiNsbyBXay23ryY2U77GzDZIijmSMXopEl Mp+2YRhE9y9X0axXfxq6M7VHCU+fXhHv3n837AIcRp/F17fK6c5WzRpi7+NKk2erj/QU a3ZsAeJr6ymMqFmdWsbjTkJPHUO75mTYlgZKQWDkSUIilc8T95j3QDSM1zJMQ5YWLine 6g0LQd9WCXtsLJjzsInR5ga4MbboikZJXOTSAukvbDX/13Q+HVZYGZIq99dEBbIO+WcS Hg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:26 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:24 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:24 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 10DB73F706F; Tue, 11 Apr 2023 02:12:21 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 08/21] common/cnxk: update age drop statistics Date: Tue, 11 Apr 2023 14:41:31 +0530 Message-ID: <20230411091144.1087887-8-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: qvoAksi3pzx_TB1s3FmBeBhtgdlrd7vY X-Proofpoint-GUID: qvoAksi3pzx_TB1s3FmBeBhtgdlrd7vY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao Update age drop statistics. Added telemetry statistics for age drops. Signed-off-by: Satha Rao --- drivers/common/cnxk/cnxk_telemetry_nix.c | 4 ++++ drivers/common/cnxk/hw/nix.h | 2 ++ drivers/common/cnxk/roc_features.h | 6 ++++++ drivers/common/cnxk/roc_nix.h | 2 ++ drivers/common/cnxk/roc_nix_stats.c | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/drivers/common/cnxk/cnxk_telemetry_nix.c b/drivers/common/cnxk/cnxk_telemetry_nix.c index b7285cf137..ccae5d7853 100644 --- a/drivers/common/cnxk/cnxk_telemetry_nix.c +++ b/drivers/common/cnxk/cnxk_telemetry_nix.c @@ -680,6 +680,10 @@ nix_sq_ctx(volatile void *qctx, struct plt_tel_data *d) /* W12 */ CNXK_TEL_DICT_BF_PTR(d, ctx, pkts, w12_); + /* W13 */ + CNXK_TEL_DICT_INT(d, ctx, aged_drop_octs, w13_); + CNXK_TEL_DICT_INT(d, ctx, aged_drop_pkts, w13_); + /* W14 */ CNXK_TEL_DICT_BF_PTR(d, ctx, drop_octs, w14_); diff --git a/drivers/common/cnxk/hw/nix.h b/drivers/common/cnxk/hw/nix.h index 0d8f2a5e9b..fbdf1b64f6 100644 --- a/drivers/common/cnxk/hw/nix.h +++ b/drivers/common/cnxk/hw/nix.h @@ -363,6 +363,8 @@ #define NIX_LF_SQ_OP_STATUS (0xa30ull) #define NIX_LF_SQ_OP_DROP_OCTS (0xa40ull) #define NIX_LF_SQ_OP_DROP_PKTS (0xa50ull) +#define NIX_LF_SQ_OP_AGE_DROP_OCTS (0xa60ull) /* [CN10K, .) */ +#define NIX_LF_SQ_OP_AGE_DROP_PKTS (0xa70ull) /* [CN10K, .) */ #define NIX_LF_CQ_OP_INT (0xb00ull) #define NIX_LF_CQ_OP_DOOR (0xb30ull) #define NIX_LF_CQ_OP_STATUS (0xb40ull) diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h index c2893faa65..6fe01015d8 100644 --- a/drivers/common/cnxk/roc_features.h +++ b/drivers/common/cnxk/roc_features.h @@ -47,4 +47,10 @@ roc_feature_nix_has_rxchan_multi_bpid(void) return true; return false; } + +static inline bool +roc_feature_nix_has_age_drop_stats(void) +{ + return (roc_model_is_cn10kb() || roc_model_is_cn10ka_b0()); +} #endif diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 2b576f0891..f84e473db6 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -293,6 +293,8 @@ struct roc_nix_stats_queue { uint64_t tx_octs; uint64_t tx_drop_pkts; uint64_t tx_drop_octs; + uint64_t tx_age_drop_pkts; + uint64_t tx_age_drop_octs; }; }; }; diff --git a/drivers/common/cnxk/roc_nix_stats.c b/drivers/common/cnxk/roc_nix_stats.c index ca0e8ccb4f..1e93191a07 100644 --- a/drivers/common/cnxk/roc_nix_stats.c +++ b/drivers/common/cnxk/roc_nix_stats.c @@ -137,6 +137,10 @@ nix_stat_tx_queue_get(struct nix *nix, uint16_t qid, qstats->tx_octs = qstat_read(nix, qid, NIX_LF_SQ_OP_OCTS); qstats->tx_drop_pkts = qstat_read(nix, qid, NIX_LF_SQ_OP_DROP_PKTS); qstats->tx_drop_octs = qstat_read(nix, qid, NIX_LF_SQ_OP_DROP_OCTS); + if (roc_feature_nix_has_age_drop_stats()) { + qstats->tx_age_drop_pkts = qstat_read(nix, qid, NIX_LF_SQ_OP_AGE_DROP_PKTS); + qstats->tx_age_drop_octs = qstat_read(nix, qid, NIX_LF_SQ_OP_AGE_DROP_OCTS); + } } static int From patchwork Tue Apr 11 09:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125914 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0767B4291B; Tue, 11 Apr 2023 11:13:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88E9F42D2C; Tue, 11 Apr 2023 11:12:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 9992342D16 for ; Tue, 11 Apr 2023 11:12:29 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8S2oh021558 for ; Tue, 11 Apr 2023 02:12:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=2TkopDAp1mbYKV1nFdILeFSWEfW64qN75y0HbHuESA0=; b=HDTDv8+GrdhwzCC8S38fAEWRAmOmEhgXCQaO1zecnPgNbl98AQgEbNWAre3NE8rYIm45 qpEZ0ySNzrdGEaAdcBCfx3GSu/NibCqNlRisF4VPgVukOwrWUvYB2RhOsqFjkP/pdyp2 TqgE7/MA5G7eVH5s1OzK4jFTsiRE1xDPYzgqhhn0Qr242AVELsfx8+5tBkE623WzMKRF AlZEM1f2FUKYPsnShy62XgREfefkToOxyneqCE0/0auOdFMX2ku90butzlePo6R4klLo TA6VIj+ZLAbWBBNrco/5kv2IEjvY+bhCwj3tnIC/qHMJqkXqMf2VDvkH8yeZ7Zr3fsut LQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1tw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:28 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:26 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id BD9D23F706A; Tue, 11 Apr 2023 02:12:24 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 09/21] common/cnxk: fetch eng caps for inl outb inst format Date: Tue, 11 Apr 2023 14:41:32 +0530 Message-ID: <20230411091144.1087887-9-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: IXYhjsQ4Ob0_q8RS1yrfXThXTxv6hBSf X-Proofpoint-ORIG-GUID: IXYhjsQ4Ob0_q8RS1yrfXThXTxv6hBSf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Fetch engine caps and use it along with model check to determine inline outbound instruction format with NIX Tx offset or address. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_cpt.h | 3 + drivers/common/cnxk/roc_nix_inl.c | 101 ++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_inl.h | 1 + drivers/common/cnxk/roc_nix_priv.h | 1 + drivers/common/cnxk/version.map | 1 + drivers/net/cnxk/cn10k_ethdev_sec.c | 3 +- drivers/net/cnxk/cnxk_ethdev.c | 2 + drivers/net/cnxk/cnxk_ethdev.h | 3 + 8 files changed, 114 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index 92a18711dc..910bd37a0c 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -12,6 +12,9 @@ #define ROC_AE_CPT_BLOCK_TYPE1 0 #define ROC_AE_CPT_BLOCK_TYPE2 1 +#define ROC_LOADFVC_MAJOR_OP 0x01UL +#define ROC_LOADFVC_MINOR_OP 0x08UL + /* Default engine groups */ #define ROC_CPT_DFLT_ENG_GRP_SE 0UL #define ROC_CPT_DFLT_ENG_GRP_SE_IE 1UL diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 8592e1cb0b..67f8ce9aa0 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -602,6 +602,96 @@ nix_inl_rq_mask_cfg(struct roc_nix *roc_nix, bool enable) return rc; } +static void +nix_inl_eng_caps_get(struct nix *nix) +{ + struct roc_cpt_lf *lf = nix->cpt_lf_base; + uintptr_t lmt_base = lf->lmt_base; + union cpt_res_s res, *hw_res; + struct cpt_inst_s inst; + uint64_t *rptr; + + hw_res = plt_zmalloc(sizeof(*hw_res), ROC_CPT_RES_ALIGN); + if (hw_res == NULL) { + plt_err("Couldn't allocate memory for result address"); + return; + } + + rptr = plt_zmalloc(ROC_ALIGN, 0); + if (rptr == NULL) { + plt_err("Couldn't allocate memory for rptr"); + plt_free(hw_res); + return; + } + + /* Fill CPT_INST_S for LOAD_FVC/HW_CRYPTO_SUPPORT microcode op */ + memset(&inst, 0, sizeof(struct cpt_inst_s)); + inst.res_addr = (uint64_t)hw_res; + inst.rptr = (uint64_t)rptr; + inst.w4.s.opcode_major = ROC_LOADFVC_MAJOR_OP; + inst.w4.s.opcode_minor = ROC_LOADFVC_MINOR_OP; + inst.w7.s.egrp = ROC_CPT_DFLT_ENG_GRP_SE; + + /* Use 1 min timeout for the poll */ + const uint64_t timeout = plt_tsc_cycles() + 60 * plt_tsc_hz(); + + if (roc_model_is_cn9k()) { + uint64_t lmt_status; + + hw_res->cn9k.compcode = CPT_COMP_NOT_DONE; + plt_io_wmb(); + + do { + roc_lmt_mov_seg((void *)lmt_base, &inst, 4); + lmt_status = roc_lmt_submit_ldeor(lf->io_addr); + } while (lmt_status != 0); + + /* Wait until CPT instruction completes */ + do { + res.u64[0] = __atomic_load_n(&hw_res->u64[0], __ATOMIC_RELAXED); + if (unlikely(plt_tsc_cycles() > timeout)) + break; + } while (res.cn9k.compcode == CPT_COMP_NOT_DONE); + + if (res.cn9k.compcode != CPT_COMP_GOOD) { + plt_err("LOAD FVC operation timed out"); + return; + } + } else { + uint64_t lmt_arg, io_addr; + uint16_t lmt_id; + + hw_res->cn10k.compcode = CPT_COMP_NOT_DONE; + + /* Use this lcore's LMT line as no one else is using it */ + ROC_LMT_BASE_ID_GET(lmt_base, lmt_id); + memcpy((void *)lmt_base, &inst, sizeof(inst)); + + lmt_arg = ROC_CN10K_CPT_LMT_ARG | (uint64_t)lmt_id; + io_addr = lf->io_addr | ROC_CN10K_CPT_INST_DW_M1 << 4; + + roc_lmt_submit_steorl(lmt_arg, io_addr); + plt_io_wmb(); + + /* Wait until CPT instruction completes */ + do { + res.u64[0] = __atomic_load_n(&hw_res->u64[0], __ATOMIC_RELAXED); + if (unlikely(plt_tsc_cycles() > timeout)) + break; + } while (res.cn10k.compcode == CPT_COMP_NOT_DONE); + + if (res.cn10k.compcode != CPT_COMP_GOOD || res.cn10k.uc_compcode) { + plt_err("LOAD FVC operation timed out"); + goto exit; + } + } + + nix->cpt_eng_caps = plt_be_to_cpu_64(*rptr); +exit: + plt_free(rptr); + plt_free(hw_res); +} + int roc_nix_inl_inb_init(struct roc_nix *roc_nix) { @@ -652,6 +742,7 @@ roc_nix_inl_inb_init(struct roc_nix *roc_nix) plt_err("Failed to setup inbound lf, rc=%d", rc); return rc; } + nix->cpt_eng_caps = roc_cpt->hw_caps[CPT_ENG_TYPE_SE].u; /* Setup Inbound SA table */ rc = nix_inl_inb_sa_tbl_setup(roc_nix); @@ -871,6 +962,8 @@ roc_nix_inl_outb_init(struct roc_nix *roc_nix) } } + /* Fetch engine capabilities */ + nix_inl_eng_caps_get(nix); return 0; lf_fini: @@ -1571,3 +1664,11 @@ roc_nix_inl_meta_pool_cb_register(roc_nix_inl_meta_pool_cb_t cb) { meta_pool_cb = cb; } + +uint64_t +roc_nix_inl_eng_caps_get(struct roc_nix *roc_nix) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + + return nix->cpt_eng_caps; +} diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 6220ba6773..daa21a941a 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -212,5 +212,6 @@ int __roc_api roc_nix_inl_sa_sync(struct roc_nix *roc_nix, void *sa, bool inb, int __roc_api roc_nix_inl_ctx_write(struct roc_nix *roc_nix, void *sa_dptr, void *sa_cptr, bool inb, uint16_t sa_len); void __roc_api roc_nix_inl_outb_cpt_lfs_dump(struct roc_nix *roc_nix, FILE *file); +uint64_t __roc_api roc_nix_inl_eng_caps_get(struct roc_nix *roc_nix); #endif /* _ROC_NIX_INL_H_ */ diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index f900a81d8a..6872630dc8 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -209,6 +209,7 @@ struct nix { uint16_t outb_se_ring_base; uint16_t cpt_lbpid; uint16_t cpt_nixbpid; + uint64_t cpt_eng_caps; bool need_meta_aura; /* Mode provided by driver */ bool inb_inl_dev; diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index d740d9df81..809fd81b20 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -186,6 +186,7 @@ INTERNAL { roc_nix_inl_dev_rq_put; roc_nix_inl_dev_unlock; roc_nix_inl_dev_xaq_realloc; + roc_nix_inl_eng_caps_get; roc_nix_inl_inb_is_enabled; roc_nix_inl_inb_init; roc_nix_inl_inb_sa_base_get; diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c index 3c32de0f94..9625704ec1 100644 --- a/drivers/net/cnxk/cn10k_ethdev_sec.c +++ b/drivers/net/cnxk/cn10k_ethdev_sec.c @@ -809,7 +809,8 @@ cn10k_eth_sec_session_create(void *device, sess_priv.chksum = (!ipsec->options.ip_csum_enable << 1 | !ipsec->options.l4_csum_enable); sess_priv.dec_ttl = ipsec->options.dec_ttl; - if (roc_feature_nix_has_inl_ipsec_mseg()) + if (roc_feature_nix_has_inl_ipsec_mseg() && + dev->outb.cpt_eng_caps & BIT_ULL(35)) sess_priv.nixtx_off = 1; /* Pointer from eth_sec -> outb_sa */ diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 3bccc34d79..ff0c3b8ed1 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -203,6 +203,8 @@ nix_security_setup(struct cnxk_eth_dev *dev) plt_err("Outbound fc sw mem alloc failed"); goto sa_bmap_free; } + + dev->outb.cpt_eng_caps = roc_nix_inl_eng_caps_get(nix); } return 0; diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 62a06e5d03..d76f5486e6 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -285,6 +285,9 @@ struct cnxk_eth_dev_sec_outb { /* Lock to synchronize sa setup/release */ rte_spinlock_t lock; + + /* Engine caps */ + uint64_t cpt_eng_caps; }; struct cnxk_eth_dev { From patchwork Tue Apr 11 09:11:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125915 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4ACB84291B; Tue, 11 Apr 2023 11:13:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D34E742D37; Tue, 11 Apr 2023 11:12:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 778E742B8E for ; Tue, 11 Apr 2023 11:12:32 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8Ak4i021460 for ; Tue, 11 Apr 2023 02:12:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=EeWaPYelPMNytQ+EPBCmgFaAxZaFpnKVxc80DtcWxkA=; b=SWemfJkt09Yts0uxhgJU5I8vGFuxiQGlaaIqWH5/ErSjR1GeJvdT5Ks+ZiD4UyEsdD9z PIKOZl8xcxCaxYb235VrlPAQ8tSzlDEyWxZgsWLpjoX0f/1Meea4MdLjuIGnkMuBJGKJ LcimURohGNeKyr9x1LBxRtDhDUz1xJ0ELRZ+2F46+F+oyeJyvi8VSFHdPGx+Ky4TfOKx AAcNEBQFtk1iBoAQ1GnH2CM4wfPZPVr+66OmPiWZXmWZ5vRU1fTU3CVSTQ3HwwcJfgYM zacTHspG+SFCQ1+bH5ZEemgxGQFY7MqLfmPsKtkA2ui03mGGAVt8lgyOW1/d0+EO4hrK qw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1ub-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:31 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:29 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:29 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 7BBF13F706F; Tue, 11 Apr 2023 02:12:27 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH 10/21] common/cnxk: add receive error mask Date: Tue, 11 Apr 2023 14:41:33 +0530 Message-ID: <20230411091144.1087887-10-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: hE5y7zuz2bhqhfUsq2TWyjcEpUdJ_tpH X-Proofpoint-ORIG-GUID: hE5y7zuz2bhqhfUsq2TWyjcEpUdJ_tpH X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Rakesh Kudurumalla Adding support to configure receive error mask for 106B0 Signed-off-by: Rakesh Kudurumalla --- drivers/common/cnxk/roc_features.h | 6 ++++++ drivers/common/cnxk/roc_nix.h | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h index 6fe01015d8..ce12a1dca4 100644 --- a/drivers/common/cnxk/roc_features.h +++ b/drivers/common/cnxk/roc_features.h @@ -16,6 +16,12 @@ roc_feature_nix_has_inl_ipsec_mseg(void) return (roc_model_is_cn10kb() || roc_model_is_cn10ka_b0()); } +static inline bool +roc_feature_nix_has_drop_re_mask(void) +{ + return (roc_model_is_cn10kb() || roc_model_is_cn10ka_b0()); +} + static inline bool roc_feature_nix_has_inl_rq_mask(void) { diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index f84e473db6..37d0ed5ebe 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -242,6 +242,22 @@ struct roc_nix_eeprom_info { #define ROC_NIX_LF_RX_CFG_LEN_OL4 BIT_ULL(40) #define ROC_NIX_LF_RX_CFG_LEN_OL3 BIT_ULL(41) +#define ROC_NIX_LF_RX_CFG_RX_ERROR_MASK 0xFFFFFFFFFFF80000 +#define ROC_NIX_RE_PARTIAL BIT_ULL(1) +#define ROC_NIX_RE_JABBER BIT_ULL(2) +#define ROC_NIX_RE_CRC8_PCH BIT_ULL(5) +#define ROC_NIX_RE_CNC_INV BIT_ULL(6) +#define ROC_NIX_RE_FCS BIT_ULL(7) +#define ROC_NIX_RE_FCS_RCV BIT_ULL(8) +#define ROC_NIX_RE_TERMINATE BIT_ULL(9) +#define ROC_NIX_RE_MACSEC BIT_ULL(10) +#define ROC_NIX_RE_RX_CTL BIT_ULL(11) +#define ROC_NIX_RE_SKIP BIT_ULL(12) +#define ROC_NIX_RE_DMAPKT BIT_ULL(15) +#define ROC_NIX_RE_UNDERSIZE BIT_ULL(16) +#define ROC_NIX_RE_OVERSIZE BIT_ULL(17) +#define ROC_NIX_RE_OL2_LENMISM BIT_ULL(18) + /* Group 0 will be used for RSS, 1 -7 will be used for npc_flow RSS action*/ #define ROC_NIX_RSS_GROUP_DEFAULT 0 #define ROC_NIX_RSS_GRPS 8 From patchwork Tue Apr 11 09:11:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125916 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C39B14291B; Tue, 11 Apr 2023 11:13:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57C3442D3C; Tue, 11 Apr 2023 11:12:37 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 905A242D3C for ; Tue, 11 Apr 2023 11:12:35 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g4Di014876 for ; Tue, 11 Apr 2023 02:12:35 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=8H3vkhwEdfG0Xnaz+pnpBe5Xnla9mGuIsHKFC6KYMu8=; b=ct3AZu3o6Wfc6nviPCNFOnEPJ2Z2c3A/yOkUoTpJtkRoECO44n4N9HKxZCr0Oor2CTyT 7s1Lw2v3WO3hgqHaK7RRU5C47x/IHEMvMdECxlw3kyzgaK0qbiVFw0RAc2FyJnujWP7+ ta7e/nijSlRtwkpR/tsLaoWTO2Tfe+f5yNME1l5uB9JOJ+CVaNjavz6nmiJ5OMnozbhT YBK38UUi2/tmRFXRx+7b2cgLd7oGgL+6SbpP1JfhZI8XtZ3nYS4B/Cwtf4M/g9bM8Y5g QqtCo3fPU4s+qo0fuD6+mFOOWLtS7Z2W5gopzkS1SP06Jhok+E10zRg1PFAdJB8JF3YO rw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94h5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:34 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:32 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:32 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 6A0353F7071; Tue, 11 Apr 2023 02:12:30 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan Subject: [PATCH 11/21] common/cnxk: fix null pointer dereference Date: Tue, 11 Apr 2023 14:41:34 +0530 Message-ID: <20230411091144.1087887-11-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: WQusO-8XG37X0t6fYcRs4mv6F-xQCqSo X-Proofpoint-GUID: WQusO-8XG37X0t6fYcRs4mv6F-xQCqSo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Gowrishankar Muthukrishnan Fix null pointer dereferences reported by klocwork. Fixes: 4398c4092f3d ("common/cnxk: dump inline device RQ context") Fixes: 79dc6f324e82 ("common/cnxk: add inline function for statistics") Signed-off-by: Gowrishankar Muthukrishnan --- drivers/common/cnxk/roc_nix_debug.c | 8 +++++++- drivers/common/cnxk/roc_nix_inl_dev.c | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c index 399d0d7eae..a1c3db284b 100644 --- a/drivers/common/cnxk/roc_nix_debug.c +++ b/drivers/common/cnxk/roc_nix_debug.c @@ -733,7 +733,13 @@ roc_nix_queues_ctx_dump(struct roc_nix *roc_nix, FILE *file) inl_rq = roc_nix_inl_dev_rq(roc_nix); if (inl_rq) { struct idev_cfg *idev = idev_get_cfg(); - struct nix_inl_dev *inl_dev = idev->nix_inl_dev; + struct nix_inl_dev *inl_dev = NULL; + + if (idev && idev->nix_inl_dev) + inl_dev = idev->nix_inl_dev; + + if (!inl_dev) + return -EINVAL; rc = nix_q_ctx_get(&inl_dev->dev, NIX_AQ_CTYPE_RQ, inl_rq->qid, &ctx); if (rc) { diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index 196a04db09..b6abafd5c4 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -843,7 +843,7 @@ roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats) if (stats == NULL) return NIX_ERR_PARAM; - if (!idev && idev->nix_inl_dev) + if (idev && idev->nix_inl_dev) inl_dev = idev->nix_inl_dev; if (!inl_dev) From patchwork Tue Apr 11 09:11:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125917 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CB4844291B; Tue, 11 Apr 2023 11:13:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BB8F42D3B; Tue, 11 Apr 2023 11:12:39 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 3DC3542D17 for ; Tue, 11 Apr 2023 11:12:38 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8Ak4j021460 for ; Tue, 11 Apr 2023 02:12:37 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=vB5F9wdTXnhu3PoXzYyMW+N6thoN6PE0pCXipr8jinE=; b=YoEPwOKm+KlCCmlSLxryne1Q83F+HDpjpdnd1pv0aIrB2fdFWlmVHmEeOqkyHZ8HmZrO KTSMuI7pzALTL6j9rVoPgS07j5ifDw0VgLn4mcefES0MtH+BjtR0ILomkun8uwuneNyM bfEOvH4iWU/uxG5GcdzIGUI+oNe6StcrAcKuOhX43yh5blUmmQZ6LcDl4499zzG57tXq UljTN0OKh6HMflp8/WBQ4HEOfrHlmdJUlZSGktrpIT/eQ1we2o5a6hN1+ksBTZRH0g3m rLLFrQDBmtFNwUdGXuH8khUwy7Uh6CFE2WWcATMR7MV3gk41/vaT3LG+WJmSawcFixOR Jg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1un-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:37 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:35 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:35 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5554D3F706F; Tue, 11 Apr 2023 02:12:33 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan Subject: [PATCH 12/21] common/cnxk: fix parameter in NIX dump Date: Tue, 11 Apr 2023 14:41:35 +0530 Message-ID: <20230411091144.1087887-12-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: lUl8EtRNe5Y-JOjicMGzL8VDwJOvXJ5C X-Proofpoint-ORIG-GUID: lUl8EtRNe5Y-JOjicMGzL8VDwJOvXJ5C X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Gowrishankar Muthukrishnan Fix parameter passed to nix_dump to what expected in format specifier. Fixes: d2f168dfa5de ("common/cnxk: support 10K B0 for inline IPsec") Signed-off-by: Gowrishankar Muthukrishnan --- drivers/common/cnxk/roc_nix_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_debug.c b/drivers/common/cnxk/roc_nix_debug.c index a1c3db284b..8c7d902f1e 100644 --- a/drivers/common/cnxk/roc_nix_debug.c +++ b/drivers/common/cnxk/roc_nix_debug.c @@ -664,8 +664,8 @@ nix_lf_cq_dump(__io struct nix_cq_ctx_s *ctx, FILE *file) nix_dump(file, "W1: lbpid_high \t\t\t0x%03x\nW1: lbpid_med \t\t\t0x%03x\n" "W1: lbpid_low \t\t\t0x%03x\n(W1: lbpid) \t\t\t0x%03x\n", - ctx->lbpid_high, ctx->lbpid_med, ctx->lbpid_low, - ctx->lbpid_high << 6 | ctx->lbpid_med << 3 | ctx->lbpid_low); + ctx->lbpid_high, ctx->lbpid_med, ctx->lbpid_low, (unsigned int) + (ctx->lbpid_high << 6 | ctx->lbpid_med << 3 | ctx->lbpid_low)); nix_dump(file, "W1: lbp_ena \t\t\t\t%d\n", ctx->lbp_ena); nix_dump(file, "W2: update_time \t\t%d\nW2: avg_level \t\t\t%d", From patchwork Tue Apr 11 09:11:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125918 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 030AA4291B; Tue, 11 Apr 2023 11:13:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 89DD642D38; Tue, 11 Apr 2023 11:12:42 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 40D3142B8E for ; Tue, 11 Apr 2023 11:12:41 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B84Pdm020822 for ; Tue, 11 Apr 2023 02:12:40 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=pF0/mo+ugFJ6ML7HE9jK62FAOWdmX0OVv06BTm783T4=; b=SjFW73drMELr8N9A67dqU4iOCzr5u6GrbRLRvmgcyy8zQjx0yxMQZpey6j/0RPu+TLpL /ewVqCQSiBwU3KSt5iXKOq105MqLzA72o7HQDrxjgO7am12Qgbz3jY7U4K/Nr4gT/9r/ ysAiqa5ANim2fl8MNUenXsWpMHcQ4UVVLbay1zkGekZBGdyY2g9T+SH7ZapFtCJsquqI ythRIyGopd/l9uEFZxdph3Gc90MI9AL/b0V7Ai7rVclTceqIJMs7/z6SapsKTs6pMEZX 1YQr2IeV528c3KuTlyXAn0lvElad5R7OBr+6vbkqr2W/q6ZnN8uHCpFjtRWTpl8sa31L xQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1ux-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:40 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:38 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:38 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 45ED83F7070; Tue, 11 Apr 2023 02:12:36 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Veerasenareddy Burru Subject: [PATCH 13/21] common/cnxk: set relchan in TL4 config for each SDP queue Date: Tue, 11 Apr 2023 14:41:36 +0530 Message-ID: <20230411091144.1087887-13-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: rT2wkZFPDQ6QuXGH2IWcWry2mKgoF-bl X-Proofpoint-ORIG-GUID: rT2wkZFPDQ6QuXGH2IWcWry2mKgoF-bl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Veerasenareddy Burru set distinct relchan in each TL4 queue connected to SDP. currently rechan in TL4 SDP config is getting set to 0 for all SDP-NIX queues. Each TL4 queues for SDP need to be configured with distinct channel for SDP to provide per channel backpressure to NIX. Signed-off-by: Veerasenareddy Burru --- drivers/common/cnxk/roc_nix_tm_utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/common/cnxk/roc_nix_tm_utils.c b/drivers/common/cnxk/roc_nix_tm_utils.c index 5864833109..9ede1bebe7 100644 --- a/drivers/common/cnxk/roc_nix_tm_utils.c +++ b/drivers/common/cnxk/roc_nix_tm_utils.c @@ -582,6 +582,7 @@ nix_tm_topology_reg_prep(struct nix *nix, struct nix_tm_node *node, /* Configure TL4 to send to SDP channel instead of CGX/LBK */ if (nix->sdp_link) { + relchan = nix->tx_chan_base & 0xff; plt_tm_dbg("relchan=%u schq=%u tx_chan_cnt=%u\n", relchan, schq, nix->tx_chan_cnt); reg[k] = NIX_AF_TL4X_SDP_LINK_CFG(schq); From patchwork Tue Apr 11 09:11:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125919 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A51F44291B; Tue, 11 Apr 2023 11:13:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BAE9642D4A; Tue, 11 Apr 2023 11:12:44 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E694B41141 for ; Tue, 11 Apr 2023 11:12:43 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8UBi6021423 for ; Tue, 11 Apr 2023 02:12:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=0GiTkWCZQ0JJs8iGB/nny2WYlrJmKP7MD9Qe2wcYG1A=; b=VQY5HkMsI8kp1r0+Ukw1syC1sQPe6TwXpyVaC+Mnva+Vpf+Ifswg0bGeNEyrgovfEQEG gth3QwD3ctUx+H2qPXF6sJBnV543fx2QbezKb5egjzufMl6OrLRmCZ6jLFko4ZI0J3zW MerZXi1azMTy3b1tlxpFIXNSZ/L1sbAkBJTf2uCMUwjjuXPzO3HOfe6mEU8SepuhSiZ7 B4phBueLMUuxzIxixfSMUSsy8W2+/ZlC/QzvbwOpGw3THaM4WYNrpC6w7gmAwbK9LfTy /5+bReF9JItX2wqaFThyjmNDi0gnQG+lY1ie+hRHvSyYymXCpb7jbGsqKgyGh6yfiZ/y yQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1v4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:43 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:41 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 35E3A3F706A; Tue, 11 Apr 2023 02:12:38 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 14/21] common/cnxk: avoid STALL with dual rate on CNF95N Date: Tue, 11 Apr 2023 14:41:37 +0530 Message-ID: <20230411091144.1087887-14-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 3_dZ0nPGeZkmzS71t8AUN4iKPqwVOm8z X-Proofpoint-ORIG-GUID: 3_dZ0nPGeZkmzS71t8AUN4iKPqwVOm8z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Satha Rao Due to errata RED_ALGO STALL with dual shaper rate will hangs on platforms CNF95N and CNF95O. Set READ_ALGO to DISCARD with dual shaper rate on CNF95N and CNF95O. Signed-off-by: Satha Rao --- drivers/common/cnxk/roc_nix_tm_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_nix_tm_utils.c b/drivers/common/cnxk/roc_nix_tm_utils.c index 9ede1bebe7..3840d6d457 100644 --- a/drivers/common/cnxk/roc_nix_tm_utils.c +++ b/drivers/common/cnxk/roc_nix_tm_utils.c @@ -1267,7 +1267,8 @@ roc_nix_tm_shaper_default_red_algo(struct roc_nix_tm_node *node, tm_node->red_algo = roc_prof->red_algo; /* C0 doesn't support STALL when both PIR & CIR are enabled */ - if (roc_model_is_cn96_cx()) { + if (roc_model_is_cn96_cx() || roc_model_is_cnf95xxn_a0() || roc_model_is_cnf95xxo_a0() || + roc_model_is_cnf95xxn_a1() || roc_model_is_cnf95xxn_b0()) { nix_tm_shaper_conf_get(profile, &cir, &pir); if (pir.rate && cir.rate) From patchwork Tue Apr 11 09:11:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125920 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5DE3D4291B; Tue, 11 Apr 2023 11:13:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E8072427E9; Tue, 11 Apr 2023 11:12:47 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 8A7F4427E9 for ; Tue, 11 Apr 2023 11:12:46 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8Ak4k021460 for ; Tue, 11 Apr 2023 02:12:45 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=SK2+F/+BdwyuzkotB4wSaNAmoQolS/Z+nk1UkiuEpLE=; b=HLvPVmZ1EAxW9YZ6oxlleaFCr0pFi065gh1tU9aDv2Nb82zhzAWJNtHopx15vd7mU3fX 3uOxenWwbqxOaKX98wH3PlZfMZl4UrVShhkWVgDX3hs+waYwp7zif0fIYh4SxYGJwcK6 JjxVAm7n5o/h90JWSIBW+lsXOqD7304VZd6C9vUGy8I0Y1RT/flGJ0wduBCGr1BlXklf Mt5QCg+Z4KqVf9K8BUbzWBwHxDqshQr6+XZ9N1JJIGTZRmYXKIEvLE1NijilswyGyZki F76QX3lg27bNOVpoDtXWYY0yEp8GnfhATrj5CbmEXJiPRGTOdpzIRkemGI7vBRfx/UPF xw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1vc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:45 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:43 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:43 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id DF3473F706F; Tue, 11 Apr 2023 02:12:41 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH 15/21] common/cnxk: update errata info Date: Tue, 11 Apr 2023 14:41:38 +0530 Message-ID: <20230411091144.1087887-15-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: a09mBgNP66ItfULAWIZggOCH9ttqSFPG X-Proofpoint-ORIG-GUID: a09mBgNP66ItfULAWIZggOCH9ttqSFPG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Update errata info based on CN10KA B0 and CN10KB A0. Also remove duplicate model check roc_model_is_cn103xx() Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_errata.h | 20 ++++++++------------ drivers/common/cnxk/roc_features.h | 2 +- drivers/common/cnxk/roc_model.h | 6 ------ 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/common/cnxk/roc_errata.h b/drivers/common/cnxk/roc_errata.h index 2d15e639b7..7ff7e2fc35 100644 --- a/drivers/common/cnxk/roc_errata.h +++ b/drivers/common/cnxk/roc_errata.h @@ -6,7 +6,7 @@ #include "roc_model.h" -/* Errata IPBUNIXRX-40129 */ +/* Errata IPBUNIXRX-40129, IPBUNIXRX-40179 */ static inline bool roc_errata_nix_has_no_drop_re(void) { @@ -40,7 +40,8 @@ static inline bool roc_errata_nix_has_no_vwqe_flush_op(void) { return (roc_model_is_cn10ka_a0() || roc_model_is_cnf10ka_a0() || - roc_model_is_cnf10kb_a0()); + roc_model_is_cnf10kb_a0() || roc_model_is_cn10ka_a1() || roc_model_is_cn10ka_b0() || + roc_model_is_cn10kb_a0()); } /* Errata IPBURVUM-38481 */ @@ -50,13 +51,6 @@ roc_errata_ruvm_has_no_interrupt_with_msixen(void) return true; } -/* Errata IPBUNIXTX-39300 */ -static inline bool -roc_errata_nix_has_assign_incorrect_qintidx(void) -{ - return true; -} - /* Errata IPBUCPT-38551 */ static inline bool roc_errata_cpt_has_use_incorrect_ldwb(void) @@ -68,17 +62,19 @@ roc_errata_cpt_has_use_incorrect_ldwb(void) static inline bool roc_errata_nix_has_overwrite_incorrect_sq_intr(void) { - return true; + return (roc_model_is_cn10ka_a0() || roc_model_is_cnf10ka_a0() || + roc_model_is_cnf10kb_a0() || roc_model_is_cn10ka_a1()); } /* Errata IPBUNIXTX-39248 */ static inline bool roc_errata_nix_has_perf_issue_on_stats_update(void) { - return true; + return (roc_model_is_cn10ka_a0() || roc_model_is_cnf10ka_a0() || + roc_model_is_cnf10kb_a0() || roc_model_is_cn10ka_a1()); } -/* Errata IPBUCPT-38726, IPBUCPT-38727 */ +/* Errata IPBUCPT-38736, IPBUCPT-38737 */ static inline bool roc_errata_cpt_hang_on_x2p_bp(void) { diff --git a/drivers/common/cnxk/roc_features.h b/drivers/common/cnxk/roc_features.h index ce12a1dca4..36ef315f5a 100644 --- a/drivers/common/cnxk/roc_features.h +++ b/drivers/common/cnxk/roc_features.h @@ -7,7 +7,7 @@ static inline bool roc_feature_sso_has_stash(void) { - return (roc_model_is_cn103xx() | roc_model_is_cn10ka_b0()) ? true : false; + return (roc_model_is_cn10kb() | roc_model_is_cn10ka_b0()) ? true : false; } static inline bool diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h index f010cc4a44..58046af193 100644 --- a/drivers/common/cnxk/roc_model.h +++ b/drivers/common/cnxk/roc_model.h @@ -258,12 +258,6 @@ roc_model_is_cn10kb(void) return roc_model->flag & ROC_MODEL_CN103xx; } -static inline uint64_t -roc_model_is_cn103xx(void) -{ - return roc_model->flag & ROC_MODEL_CN103xx; -} - static inline bool roc_env_is_hw(void) { From patchwork Tue Apr 11 09:11:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125921 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 000224291B; Tue, 11 Apr 2023 11:13:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E06241611; Tue, 11 Apr 2023 11:12:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EC63F42BAC for ; Tue, 11 Apr 2023 11:12:49 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8V8Co021687 for ; Tue, 11 Apr 2023 02:12:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=kRHigjH98bdhwoGGG41niOq+Tw9a6wNDtexyz4Y2ZTM=; b=U6DwpM7XbCNsNU9jRHEm5f1jLnwzqdhZnbnHguXHrTje7kkhnIAfA9eUUUIv+OvSzYXS MANRTE7AxI6dr/TR4GKgoDKjjtnKeo2wpSWXYXI52F4e4quL+60OY6HipVGwHkFnHCci SP7tEukZn6uzN51WZ62m09wIa0y/T2diLT5JdARSuyrgY6WvIkedzQPjkAhcjWGELj75 VryeLHwKnJUjS+LoXh5CRXTsxy5QIIfrQxhag3h0QwUmXJTelUY3Xithd5dr07KxWZBE TuCaauV1nCoAMuspSKAhxFOIlHHaKcGbpJlmw+FaaTcRBlaTNIHuHlaZMCZyxY8tECwY EQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1vf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:48 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:47 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:47 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 060863F706A; Tue, 11 Apr 2023 02:12:44 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH 16/21] common/cnxk: sync between mbox up and down messages Date: Tue, 11 Apr 2023 14:41:39 +0530 Message-ID: <20230411091144.1087887-16-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: -G0CObFgzCp8dbPqw0k4M2vxphjLO4cG X-Proofpoint-ORIG-GUID: -G0CObFgzCp8dbPqw0k4M2vxphjLO4cG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Harman Kalra An issue is observed where if PF is with DPDK and VF as kernel netdev does not responds to link events. It was due to recent design change in kernel where sender checks whether previous interrupt is received before triggering current interrupt by waiting for mailbox data register to become zero. Signed-off-by: Harman Kalra --- drivers/common/cnxk/roc_dev.c | 20 ++++++++- drivers/common/cnxk/roc_mbox.c | 64 +++++++++++++++++++++-------- drivers/common/cnxk/roc_mbox.h | 15 +++++++ drivers/common/cnxk/roc_mbox_priv.h | 6 ++- 4 files changed, 84 insertions(+), 21 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index 5e4e564ebe..e5a5cd7c10 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -195,7 +195,8 @@ af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg) vf_msg->rc = msg->rc; vf_msg->pcifunc = msg->pcifunc; /* Send to VF */ - mbox_msg_send(&dev->mbox_vfpf_up, vf); + mbox_msg_send_up(&dev->mbox_vfpf_up, vf); + mbox_wait_for_zero(&dev->mbox_vfpf_up, vf); } } @@ -498,6 +499,7 @@ pf_vf_mbox_send_up_msg(struct dev *dev, void *rec_msg) /* Send to VF */ mbox_msg_send(vf_mbox, vf); + mbox_wait_for_zero(&dev->mbox_vfpf_up, vf); } } @@ -631,6 +633,7 @@ static void roc_pf_vf_mbox_irq(void *param) { struct dev *dev = param; + uint64_t mbox_data; uint64_t intr; intr = plt_read64(dev->bar2 + RVU_VF_INT); @@ -640,6 +643,13 @@ roc_pf_vf_mbox_irq(void *param) plt_write64(intr, dev->bar2 + RVU_VF_INT); plt_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf); + /* Reading for UP/DOWN message, next message sending will be delayed + * by 1ms until this region is zeroed mbox_wait_for_zero() + */ + mbox_data = plt_read64(dev->bar2 + RVU_VF_VFPF_MBOX0); + if (mbox_data) + plt_write64(!mbox_data, dev->bar2 + RVU_VF_VFPF_MBOX0); + /* First process all configuration messages */ process_msgs(dev, dev->mbox); @@ -651,6 +661,7 @@ static void roc_af_pf_mbox_irq(void *param) { struct dev *dev = param; + uint64_t mbox_data; uint64_t intr; intr = plt_read64(dev->bar2 + RVU_PF_INT); @@ -660,6 +671,13 @@ roc_af_pf_mbox_irq(void *param) plt_write64(intr, dev->bar2 + RVU_PF_INT); plt_base_dbg("Irq 0x%" PRIx64 "(pf:%d,vf:%d)", intr, dev->pf, dev->vf); + /* Reading for UP/DOWN message, next message sending will be delayed + * by 1ms until this region is zeroed mbox_wait_for_zero() + */ + mbox_data = plt_read64(dev->bar2 + RVU_PF_PFAF_MBOX0); + if (mbox_data) + plt_write64(!mbox_data, dev->bar2 + RVU_PF_PFAF_MBOX0); + /* First process all configuration messages */ process_msgs(dev, dev->mbox); diff --git a/drivers/common/cnxk/roc_mbox.c b/drivers/common/cnxk/roc_mbox.c index 7dcd188ca7..5338a960d9 100644 --- a/drivers/common/cnxk/roc_mbox.c +++ b/drivers/common/cnxk/roc_mbox.c @@ -10,18 +10,6 @@ #include "roc_api.h" #include "roc_priv.h" -#define RVU_AF_AFPF_MBOX0 (0x02000) -#define RVU_AF_AFPF_MBOX1 (0x02008) - -#define RVU_PF_PFAF_MBOX0 (0xC00) -#define RVU_PF_PFAF_MBOX1 (0xC08) - -#define RVU_PF_VFX_PFVF_MBOX0 (0x0000) -#define RVU_PF_VFX_PFVF_MBOX1 (0x0008) - -#define RVU_VF_VFPF_MBOX0 (0x0000) -#define RVU_VF_VFPF_MBOX1 (0x0008) - /* RCLK, SCLK in MHz */ uint16_t dev_rclk_freq; uint16_t dev_sclk_freq; @@ -194,10 +182,31 @@ mbox_alloc_msg_rsp(struct mbox *mbox, int devid, int size, int size_rsp) /** * @internal - * Send a mailbox message + * Synchronization between UP and DOWN messages */ -void -mbox_msg_send(struct mbox *mbox, int devid) +bool +mbox_wait_for_zero(struct mbox *mbox, int devid) +{ + uint64_t data; + + data = plt_read64((volatile void *)(mbox->reg_base + + (mbox->trigger | (devid << mbox->tr_shift)))); + + /* If data is non-zero wait for ~1ms and return to caller + * whether data has changed to zero or not after the wait. + */ + if (data) + usleep(1000); + else + return true; + + data = plt_read64((volatile void *)(mbox->reg_base + + (mbox->trigger | (devid << mbox->tr_shift)))); + return data == 0; +} + +static void +mbox_msg_send_data(struct mbox *mbox, int devid, uint8_t data) { struct mbox_dev *mdev = &mbox->dev[devid]; struct mbox_hdr *tx_hdr = @@ -223,9 +232,28 @@ mbox_msg_send(struct mbox *mbox, int devid) /* The interrupt should be fired after num_msgs is written * to the shared memory */ - plt_write64(1, (volatile void *)(mbox->reg_base + - (mbox->trigger | - (devid << mbox->tr_shift)))); + plt_write64(data, (volatile void *)(mbox->reg_base + + (mbox->trigger | (devid << mbox->tr_shift)))); +} + +/** + * @internal + * Send a mailbox message + */ +void +mbox_msg_send(struct mbox *mbox, int devid) +{ + mbox_msg_send_data(mbox, devid, MBOX_DOWN_MSG); +} + +/** + * @internal + * Send an UP mailbox message + */ +void +mbox_msg_send_up(struct mbox *mbox, int devid) +{ + mbox_msg_send_data(mbox, devid, MBOX_UP_MSG); } /** diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index 3d5746b9b8..93c5451c0f 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -35,6 +35,21 @@ struct mbox_msghdr { int __io rc; /* Msg processed response code */ }; +#define RVU_AF_AFPF_MBOX0 (0x02000) +#define RVU_AF_AFPF_MBOX1 (0x02008) + +#define RVU_PF_PFAF_MBOX0 (0xC00) +#define RVU_PF_PFAF_MBOX1 (0xC08) + +#define RVU_PF_VFX_PFVF_MBOX0 (0x0000) +#define RVU_PF_VFX_PFVF_MBOX1 (0x0008) + +#define RVU_VF_VFPF_MBOX0 (0x0000) +#define RVU_VF_VFPF_MBOX1 (0x0008) + +#define MBOX_DOWN_MSG 1 +#define MBOX_UP_MSG 2 + /* Mailbox message types */ #define MBOX_MSG_MASK 0xFFFF #define MBOX_MSG_INVALID 0xFFFE diff --git a/drivers/common/cnxk/roc_mbox_priv.h b/drivers/common/cnxk/roc_mbox_priv.h index 4fafca6f72..354c8fa52a 100644 --- a/drivers/common/cnxk/roc_mbox_priv.h +++ b/drivers/common/cnxk/roc_mbox_priv.h @@ -71,10 +71,12 @@ struct mbox { const char *mbox_id2name(uint16_t id); int mbox_id2size(uint16_t id); void mbox_reset(struct mbox *mbox, int devid); -int mbox_init(struct mbox *mbox, uintptr_t hwbase, uintptr_t reg_base, - int direction, int ndevsi, uint64_t intr_offset); +int mbox_init(struct mbox *mbox, uintptr_t hwbase, uintptr_t reg_base, int direction, int ndevsi, + uint64_t intr_offset); void mbox_fini(struct mbox *mbox); void mbox_msg_send(struct mbox *mbox, int devid); +void mbox_msg_send_up(struct mbox *mbox, int devid); +bool mbox_wait_for_zero(struct mbox *mbox, int devid); int mbox_wait_for_rsp(struct mbox *mbox, int devid); int mbox_wait_for_rsp_tmo(struct mbox *mbox, int devid, uint32_t tmo); int mbox_get_rsp(struct mbox *mbox, int devid, void **msg); From patchwork Tue Apr 11 09:11:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125922 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C6874291B; Tue, 11 Apr 2023 11:13:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A3DD042D61; Tue, 11 Apr 2023 11:12:54 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 1C35542D50 for ; Tue, 11 Apr 2023 11:12:53 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g4Cc014870 for ; Tue, 11 Apr 2023 02:12:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=pMe2IPo8T3ph4jGX2J317OQQDJEx08PoxAbJzmuXDno=; b=YOVBWoDynY7OEmLxb/Ch9hYF2EeimECxrWWTHCl9btXdKI7frJ9JQdikySuVOfrMcauw adjHS/Oi3Gjil+OfIoM0MgRd1M71j89KUVrx3W43dXbjHYZeFYXxtY31ReaMZVMetC3M f1tC1NayVvmLfWZQX5PsgBnltD/cJHjpUrZWMo7nlRrUmWNEXX/lQZzZBPkQUPXaZlMO KQ3SOdO1YdRjFyJ+3Lvn7cBffXchdx8cDWNHhInwxEzDy5zwZy+TeUaaEM8WjeVG/PrP HrcN84PcQk9o4KEYZWbNoFZKIF8NR1rNwTXC1jIAUBMdeEJiUpQ4CwJBzyE45fJhZog5 UA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94jw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:52 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:50 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:50 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id E2E393F706F; Tue, 11 Apr 2023 02:12:47 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH 17/21] common/cnxk: add more comments to mbox code Date: Tue, 11 Apr 2023 14:41:40 +0530 Message-ID: <20230411091144.1087887-17-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: XhU2jSK7dM5depUA0z1hS2GImRLpFgw8 X-Proofpoint-GUID: XhU2jSK7dM5depUA0z1hS2GImRLpFgw8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Harman Kalra Adding more comments to the mbox routines to understand the flow well. Signed-off-by: Harman Kalra --- drivers/common/cnxk/roc_dev.c | 20 +++++++++++++++++--- drivers/common/cnxk/roc_mbox.c | 5 +++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index e5a5cd7c10..3125f9dda2 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -98,6 +98,9 @@ pf_af_sync_msg(struct dev *dev, struct mbox_msghdr **rsp) return rc; } +/* PF will send the messages to AF and wait for responses and forward the + * responses to VF. + */ static int af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg) { @@ -115,9 +118,10 @@ af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg) /* We need to disable PF interrupts. We are in timer interrupt */ plt_write64(~0ull, dev->bar2 + RVU_PF_INT_ENA_W1C); - /* Send message */ + /* Send message to AF */ mbox_msg_send(mbox, 0); + /* Wait for AF response */ do { plt_delay_ms(sleep); timeout++; @@ -206,6 +210,7 @@ af_pf_wait_msg(struct dev *dev, uint16_t vf, int num_msg) return req_hdr->num_msgs; } +/* PF receives mbox DOWN messages from VF and forwards to AF */ static int vf_pf_process_msgs(struct dev *dev, uint16_t vf) { @@ -274,6 +279,7 @@ vf_pf_process_msgs(struct dev *dev, uint16_t vf) if (routed > 0) { plt_base_dbg("pf:%d routed %d messages from vf:%d to AF", dev->pf, routed, vf); + /* PF will send the messages to AF and wait for responses */ af_pf_wait_msg(dev, vf, routed); mbox_reset(dev->mbox, 0); } @@ -289,6 +295,7 @@ vf_pf_process_msgs(struct dev *dev, uint16_t vf) return i; } +/* VF sends Ack to PF's UP messages */ static int vf_pf_process_up_msgs(struct dev *dev, uint16_t vf) { @@ -339,6 +346,7 @@ vf_pf_process_up_msgs(struct dev *dev, uint16_t vf) return i; } +/* PF handling messages from VF */ static void roc_vf_pf_mbox_handle_msg(void *param) { @@ -352,8 +360,9 @@ roc_vf_pf_mbox_handle_msg(void *param) if (dev->intr.bits[vf / max_bits] & BIT_ULL(vf % max_bits)) { plt_base_dbg("Process vf:%d request (pf:%d, vf:%d)", vf, dev->pf, dev->vf); + /* VF initiated down messages */ vf_pf_process_msgs(dev, vf); - /* UP messages */ + /* VF replies to PF's UP messages */ vf_pf_process_up_msgs(dev, vf); dev->intr.bits[vf / max_bits] &= ~(BIT_ULL(vf % max_bits)); @@ -362,6 +371,7 @@ roc_vf_pf_mbox_handle_msg(void *param) dev->timer_set = 0; } +/* IRQ to PF from VF - PF context (interrupt thread) */ static void roc_vf_pf_mbox_irq(void *param) { @@ -392,6 +402,7 @@ roc_vf_pf_mbox_irq(void *param) } } +/* Received response from AF (PF context) / PF (VF context) */ static void process_msgs(struct dev *dev, struct mbox *mbox) { @@ -451,7 +462,7 @@ process_msgs(struct dev *dev, struct mbox *mbox) } mbox_reset(mbox, 0); - /* Update acked if someone is waiting a message */ + /* Update acked if someone is waiting a message - mbox_wait is waiting */ mdev->msgs_acked = msgs_acked; plt_wmb(); } @@ -597,6 +608,7 @@ mbox_process_msgs_up(struct dev *dev, struct mbox_msghdr *req) return -ENODEV; } +/* Received up messages from AF (PF context) / PF (in context) */ static void process_msgs_up(struct dev *dev, struct mbox *mbox) { @@ -629,6 +641,7 @@ process_msgs_up(struct dev *dev, struct mbox *mbox) } } +/* IRQ to VF from PF - VF context (interrupt thread) */ static void roc_pf_vf_mbox_irq(void *param) { @@ -657,6 +670,7 @@ roc_pf_vf_mbox_irq(void *param) process_msgs_up(dev, &dev->mbox_up); } +/* IRQ to PF from AF - PF context (interrupt thread) */ static void roc_af_pf_mbox_irq(void *param) { diff --git a/drivers/common/cnxk/roc_mbox.c b/drivers/common/cnxk/roc_mbox.c index 5338a960d9..c91fa63e83 100644 --- a/drivers/common/cnxk/roc_mbox.c +++ b/drivers/common/cnxk/roc_mbox.c @@ -350,6 +350,11 @@ mbox_wait(struct mbox *mbox, int devid, uint32_t rst_timo) uint32_t timeout = 0, sleep = 1; rst_timo = rst_timo * 1000; /* Milli seconds to micro seconds */ + + /* Waiting for mdev->msgs_acked tp become equal to mdev->num_msgs, + * mdev->msgs_acked are incremented at process_msgs() in interrupt + * thread context. + */ while (mdev->num_msgs > mdev->msgs_acked) { plt_delay_us(sleep); timeout += sleep; From patchwork Tue Apr 11 09:11:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125923 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B898B4291B; Tue, 11 Apr 2023 11:14:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBF5A42D51; Tue, 11 Apr 2023 11:12:57 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id D107A41143 for ; Tue, 11 Apr 2023 11:12:55 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8V8Cp021687 for ; Tue, 11 Apr 2023 02:12:55 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=XpA2DBdNFzaAUIuc0qICk+8lIt/Ayrunob+eFCdqxKk=; b=SGTY2iNbLgL4NbbVtWaJsGezxS0Q1TAsFzp6TK/vG46It5/1mkB7zQAdCXXwgN/zZg6m xSMYBE1WUPWaBcVx3pPYkQ73Spv/mpcZw5zEMMgh+LpjB79BjLG5JiGh7juTNu7RxQ6a 0zKF37LzWqoeaLJMhtHCydgAwfndr8YQKlmSkCunwUoDNNvzzooHfbQ8yw2nceV4KhKt 92JETzglwZEumO5FQc/WhY7o8FGXG61YsK3r4hN/Bwr1NcKp+jF/Tr1TZFVrmYPW25Z1 +kj2EhX3Ry+/VmobJZxGEZl/fuom98fttFotXT1b6fP1KqcDR+MmN2r67ojW/xAeltnG iA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1vy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:54 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:53 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:53 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id CE9C13F706A; Tue, 11 Apr 2023 02:12:50 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH 18/21] common/cnxk: add CN105xxN B0 model Date: Tue, 11 Apr 2023 14:41:41 +0530 Message-ID: <20230411091144.1087887-18-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: wl-j8nhbr-Y8ri_8keejJ6GmX-TTKUYN X-Proofpoint-ORIG-GUID: wl-j8nhbr-Y8ri_8keejJ6GmX-TTKUYN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Harman Kalra Adding support for CN105xxN B0 pass Signed-off-by: Harman Kalra --- drivers/common/cnxk/roc_model.c | 1 + drivers/common/cnxk/roc_model.h | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c index e4767ed91f..f4f2a38e70 100644 --- a/drivers/common/cnxk/roc_model.c +++ b/drivers/common/cnxk/roc_model.c @@ -66,6 +66,7 @@ static const struct model_db { {VENDOR_ARM, PART_105xx, 0, 1, ROC_MODEL_CNF105xx_A1, "cnf10ka_a1"}, {VENDOR_ARM, PART_103xx, 0, 0, ROC_MODEL_CN103xx_A0, "cn10kb_a0"}, {VENDOR_ARM, PART_105xxN, 0, 0, ROC_MODEL_CNF105xxN_A0, "cnf10kb_a0"}, + {VENDOR_ARM, PART_105xxN, 1, 0, ROC_MODEL_CNF105xxN_B0, "cnf10kb_b0"}, {VENDOR_CAVIUM, PART_98xx, 0, 0, ROC_MODEL_CN98xx_A0, "cn98xx_a0"}, {VENDOR_CAVIUM, PART_98xx, 0, 1, ROC_MODEL_CN98xx_A1, "cn98xx_a1"}, {VENDOR_CAVIUM, PART_96xx, 0, 0, ROC_MODEL_CN96xx_A0, "cn96xx_a0"}, diff --git a/drivers/common/cnxk/roc_model.h b/drivers/common/cnxk/roc_model.h index 58046af193..b6dab4f64e 100644 --- a/drivers/common/cnxk/roc_model.h +++ b/drivers/common/cnxk/roc_model.h @@ -31,6 +31,7 @@ struct roc_model { #define ROC_MODEL_CN106xx_A1 BIT_ULL(24) #define ROC_MODEL_CNF105xx_A1 BIT_ULL(25) #define ROC_MODEL_CN106xx_B0 BIT_ULL(26) +#define ROC_MODEL_CNF105xxN_B0 BIT_ULL(27) /* Following flags describe platform code is running on */ #define ROC_ENV_HW BIT_ULL(61) #define ROC_ENV_EMUL BIT_ULL(62) @@ -57,7 +58,7 @@ struct roc_model { #define ROC_MODEL_CN106xx (ROC_MODEL_CN106xx_A0 | ROC_MODEL_CN106xx_A1 | ROC_MODEL_CN106xx_B0) #define ROC_MODEL_CNF105xx (ROC_MODEL_CNF105xx_A0 | ROC_MODEL_CNF105xx_A1) -#define ROC_MODEL_CNF105xxN (ROC_MODEL_CNF105xxN_A0) +#define ROC_MODEL_CNF105xxN (ROC_MODEL_CNF105xxN_A0 | ROC_MODEL_CNF105xxN_B0) #define ROC_MODEL_CN103xx (ROC_MODEL_CN103xx_A0) #define ROC_MODEL_CN10K \ (ROC_MODEL_CN106xx | ROC_MODEL_CNF105xx | ROC_MODEL_CNF105xxN | \ @@ -252,6 +253,12 @@ roc_model_is_cnf10kb_a0(void) return roc_model->flag & ROC_MODEL_CNF105xxN_A0; } +static inline uint64_t +roc_model_is_cnf10kb_b0(void) +{ + return roc_model->flag & ROC_MODEL_CNF105xxN_B0; +} + static inline uint64_t roc_model_is_cn10kb(void) { From patchwork Tue Apr 11 09:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125924 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F34FB4291B; Tue, 11 Apr 2023 11:14:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 335AB42D56; Tue, 11 Apr 2023 11:13:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 207A042D69 for ; Tue, 11 Apr 2023 11:12:59 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8g548014916 for ; Tue, 11 Apr 2023 02:12:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=MmzjvofCfDTdP1mzh3IUkLuC154Th14guOmTM5PDxzs=; b=Q47IdfjG1hUVvh/+4rvx5Zp+bPmlC5EESEKZfHZYAn9iegVOfUxagjNN0aD0dw9DeB1W K8aLSPs8uxA1njpRwnhYCgz1P4lwUt0TXDZuo9rtlnm2Xla/NOR6jcWr1Gx1BRrzoiEk mTZPkbrxnez87bnxYlmQ2x75EdT5OsOdxMf/zpG3Y0EpOUyobfs+BJEe0pyic2Ch68FA n9eask71pORPt8qqKhr5lClLVNBBsFU+ORvsfMP1NRFXPf/QMbksKUz/vLKW1o4zz5B7 53pDBCqyu1GwNB5RASuizCr5IsBE73Mm+rfbdN9zEGjcxngQJtpe6aaSvcqO4sYX9uhC Jw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3purfs94kg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:12:58 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:56 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:56 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C86B83F706F; Tue, 11 Apr 2023 02:12:53 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Hanumanth Pothula Subject: [PATCH 19/21] common/cnxk: access valid pass value Date: Tue, 11 Apr 2023 14:41:42 +0530 Message-ID: <20230411091144.1087887-19-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: TeDcfO68N8PgOI-4beyGlZhzq_DONNda X-Proofpoint-GUID: TeDcfO68N8PgOI-4beyGlZhzq_DONNda X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Hanumanth Pothula There is a possibility of accessing an invalid pass value on rvu device look up failure, as the return value is dropped. Hence pass through the return value of rvu device look, to make sure valid pass value is accessed. Signed-off-by: Hanumanth Pothula --- drivers/common/cnxk/roc_model.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c index f4f2a38e70..6dc2afe7f0 100644 --- a/drivers/common/cnxk/roc_model.c +++ b/drivers/common/cnxk/roc_model.c @@ -148,6 +148,7 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass) #define SYSFS_PCI_DEVICES "/sys/bus/pci/devices" char dirname[PATH_MAX]; struct dirent *e; + int ret = -1; DIR *dir; dir = opendir(SYSFS_PCI_DEVICES); @@ -165,18 +166,19 @@ cn10k_part_pass_get(uint32_t *part, uint32_t *pass) e->d_name); /* Lookup for rvu device and get part pass information */ - if (!rvu_device_lookup(dirname, part, pass)) + ret = rvu_device_lookup(dirname, part, pass); + if (!ret) break; } closedir(dir); - return 0; + return ret; } static bool populate_model(struct roc_model *model, uint32_t midr) { - uint32_t impl, major, part, minor, pass; + uint32_t impl, major, part, minor, pass = 0; bool found = false; size_t i; From patchwork Tue Apr 11 09:11:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125925 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3E4A24291B; Tue, 11 Apr 2023 11:14:12 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7BC9A41143; Tue, 11 Apr 2023 11:13:04 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 892F242B8C for ; Tue, 11 Apr 2023 11:13:02 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8SvlL021524 for ; Tue, 11 Apr 2023 02:13:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=K/SKd7UZXntMp8B61Ex430z2cmPGljVhfHynllzjWcs=; b=VO86nvOttHubb6bRSHWQw0a06rG05N/OfGFPddBvI+4L5UKUsYp40MlEkCOe32akhIjw yj4kma8OUlgO/ZtsdwddmhRBxFdsU80GLNQoJF07aOtbj9/U3OmF4NCHLSPoPYMWA+Bo L17Wm39Otq6CFthJo3njR5g0lEl6ciy5A04qkCGIhF+1ljGNhLmw+cjDLwahJU6Q6Ybb fIyM/UT9cGYjPzrstMwTnRPvPojZFwaOdiheBkAnxJvaMjgaPj4dd3OQ2M9LXg4HHeyO k4m6AUZUbGzUQ4MWEzaurQ1YKyxUFdbj+CoWX5xBZOXJ7GZRgkcr8K23W1LF/f7xxmS5 Xw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:13:01 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:12:59 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:12:59 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C52413F706A; Tue, 11 Apr 2023 02:12:56 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH 20/21] net/cnxk: add receive error mask Date: Tue, 11 Apr 2023 14:41:43 +0530 Message-ID: <20230411091144.1087887-20-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: KZv7EZcAAAFtbGYhLkB9LNcWNi-R3oak X-Proofpoint-ORIG-GUID: KZv7EZcAAAFtbGYhLkB9LNcWNi-R3oak X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Rakesh Kudurumalla receive errors related to MACSEC and USXGMI are masked for cn10kb_b0 and cn10kb Signed-off-by: Rakesh Kudurumalla --- drivers/net/cnxk/cnxk_ethdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index ff0c3b8ed1..6b45ccd0f7 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1265,6 +1265,11 @@ cnxk_nix_configure(struct rte_eth_dev *eth_dev) ROC_NIX_LF_RX_CFG_LEN_IL4 | ROC_NIX_LF_RX_CFG_LEN_IL3 | ROC_NIX_LF_RX_CFG_LEN_OL4 | ROC_NIX_LF_RX_CFG_LEN_OL3); + rx_cfg &= (ROC_NIX_LF_RX_CFG_RX_ERROR_MASK); + + if (roc_feature_nix_has_drop_re_mask()) + rx_cfg |= (ROC_NIX_RE_CRC8_PCH | ROC_NIX_RE_MACSEC); + if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) { rx_cfg |= ROC_NIX_LF_RX_CFG_IP6_UDP_OPT; /* Disable drop re if rx offload security is enabled and From patchwork Tue Apr 11 09:11:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 125926 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id C97C44291B; Tue, 11 Apr 2023 11:14:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1900F42D77; Tue, 11 Apr 2023 11:13:07 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 2254742BB1 for ; Tue, 11 Apr 2023 11:13:05 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33B8UBiB021423 for ; Tue, 11 Apr 2023 02:13:05 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=gHYRezTmMtFHiSprPPAV58g1ee5+XIF+VT5LoekY4AU=; b=TWtN3YsAcK+AL2Gy3Zx7Mge3cBqDyMB3WunTHADgR6KooGwyzp5/H0Su3BF4e3UZ4C+1 xVgCoUm+kIV/bUJyB2mTsZum0LJxzzJ0ct9RAiBhze3bC46kByFyN/l7dUA+qrdmCwPI KrHrtW/fsBWROU/z2OTp/EF4QrMbPPJAYuxS/UVgFP2XK1ru2UIePCrbPatthwyZ4wRV b9Hebjv+a2iWfeAaI1+LqLPUwtod1PaJXqm0lcpAhY+gB9JePt19bXbXbWYCPOl5i3r0 XSed5cR59CQqNw5zf6KQHtzFfQ0xwXst4hriAxYVG5i09Xbaf1ze7xsRm+V7SGJCUYNw kg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3pvt73b1x2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Tue, 11 Apr 2023 02:13:05 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 11 Apr 2023 02:13:03 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 11 Apr 2023 02:13:03 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5390A3F706F; Tue, 11 Apr 2023 02:13:00 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , , Rahul Bhansali Subject: [PATCH 21/21] common/cnxk: support of 1:n pool:aura per NIX LF Date: Tue, 11 Apr 2023 14:41:44 +0530 Message-ID: <20230411091144.1087887-21-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230411091144.1087887-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: _x8DBdFDqrIYSCKZejXRsGVToeRAgnfq X-Proofpoint-ORIG-GUID: _x8DBdFDqrIYSCKZejXRsGVToeRAgnfq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-11_05,2023-04-06_03,2023-02-09_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Rahul Bhansali This will add the support of 1:n pool:aura per NIX LF when inl_cpt_channel devargs is set to inline device, otherwise it will create 1:1 pool:aura for CN103/CN106B0 SOCs. With 1:N, global pool will be created with Aura 0, and per NIX individual aura will be created and mapped to this global pool. Signed-off-by: Rahul Bhansali --- drivers/common/cnxk/roc_idev_priv.h | 1 + drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_inl.c | 178 ++++++++++++++++++++++++---- drivers/common/cnxk/roc_nix_inl.h | 4 + drivers/common/cnxk/version.map | 1 + drivers/event/cnxk/cn10k_worker.h | 9 +- drivers/net/cnxk/cn10k_rx_select.c | 5 +- drivers/net/cnxk/cnxk_ethdev.c | 3 + drivers/net/cnxk/cnxk_ethdev.h | 3 + drivers/net/cnxk/cnxk_ethdev_sec.c | 62 ++++++++++ 10 files changed, 240 insertions(+), 27 deletions(-) diff --git a/drivers/common/cnxk/roc_idev_priv.h b/drivers/common/cnxk/roc_idev_priv.h index d83522799f..4983578fc6 100644 --- a/drivers/common/cnxk/roc_idev_priv.h +++ b/drivers/common/cnxk/roc_idev_priv.h @@ -13,6 +13,7 @@ struct nix_inl_dev; struct idev_nix_inl_cfg { uint64_t meta_aura; + uintptr_t meta_mempool; uint32_t nb_bufs; uint32_t buf_sz; uint32_t refs; diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 37d0ed5ebe..548854952b 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -470,6 +470,7 @@ struct roc_nix { bool local_meta_aura_ena; uint32_t meta_buf_sz; bool force_rx_aura_bp; + bool custom_meta_aura_ena; /* End of input parameters */ /* LMT line base for "Per Core Tx LMT line" mode*/ uintptr_t lmt_base; diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 67f8ce9aa0..69f658ba87 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -7,6 +7,7 @@ uint32_t soft_exp_consumer_cnt; roc_nix_inl_meta_pool_cb_t meta_pool_cb; +roc_nix_inl_custom_meta_pool_cb_t custom_meta_pool_cb; PLT_STATIC_ASSERT(ROC_NIX_INL_ON_IPSEC_INB_SA_SZ == 1UL << ROC_NIX_INL_ON_IPSEC_INB_SA_SZ_LOG2); @@ -33,13 +34,14 @@ nix_inl_meta_aura_destroy(struct roc_nix *roc_nix) return -EINVAL; inl_cfg = &idev->inl_cfg; - if (roc_nix->local_meta_aura_ena) { + + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) { + meta_aura = &inl_cfg->meta_aura; + } else { meta_aura = &roc_nix->meta_aura_handle; snprintf(mempool_name, sizeof(mempool_name), "NIX_INL_META_POOL_%d", roc_nix->port_id + 1); mp_name = mempool_name; - } else { - meta_aura = &inl_cfg->meta_aura; } /* Destroy existing Meta aura */ @@ -72,7 +74,7 @@ nix_inl_meta_aura_destroy(struct roc_nix *roc_nix) static int nix_inl_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_t first_skip, - uint64_t *meta_aura) + uint64_t *meta_aura, bool is_local_metaaura) { uint64_t mask = BIT_ULL(ROC_NPA_BUF_TYPE_PACKET_IPSEC); struct idev_nix_inl_cfg *inl_cfg; @@ -89,7 +91,7 @@ nix_inl_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_ inl_cfg = &idev->inl_cfg; nix_inl_dev = idev->nix_inl_dev; - if (roc_nix->local_meta_aura_ena) { + if (is_local_metaaura) { /* Per LF Meta Aura */ inl_rq_id = nix_inl_dev->nb_rqs > 1 ? port_id : 0; inl_rq = &nix_inl_dev->rqs[inl_rq_id]; @@ -134,15 +136,107 @@ nix_inl_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_ plt_nix_dbg("Created meta aura %p(%s)for port %d", (void *)*meta_aura, mp_name, roc_nix->port_id); - if (!roc_nix->local_meta_aura_ena) { + if (!is_local_metaaura) { inl_cfg->buf_sz = buf_sz; inl_cfg->nb_bufs = nb_bufs; + inl_cfg->meta_mempool = mp; } else roc_nix->buf_sz = buf_sz; return 0; } +static int +nix_inl_custom_meta_aura_destroy(struct roc_nix *roc_nix) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct idev_nix_inl_cfg *inl_cfg; + char mempool_name[24] = {'\0'}; + char *mp_name = NULL; + uint64_t *meta_aura; + int rc; + + if (!idev) + return -EINVAL; + + inl_cfg = &idev->inl_cfg; + meta_aura = &roc_nix->meta_aura_handle; + snprintf(mempool_name, sizeof(mempool_name), "NIX_INL_META_POOL_%d", + roc_nix->port_id + 1); + mp_name = mempool_name; + + /* Destroy existing Meta aura */ + if (*meta_aura) { + uint64_t avail, limit; + + /* Check if all buffers are back to pool */ + avail = roc_npa_aura_op_available(*meta_aura); + limit = roc_npa_aura_op_limit_get(*meta_aura); + if (avail != limit) + plt_warn("Not all buffers are back to meta pool," + " %" PRIu64 " != %" PRIu64, avail, limit); + + rc = custom_meta_pool_cb(inl_cfg->meta_mempool, &roc_nix->meta_mempool, mp_name, + meta_aura, 0, 0, true); + if (rc) { + plt_err("Failed to destroy meta aura, rc=%d", rc); + return rc; + } + + roc_nix->buf_sz = 0; + } + + return 0; +} + +static int +nix_inl_custom_meta_aura_create(struct idev_cfg *idev, struct roc_nix *roc_nix, uint16_t first_skip, + uint64_t *meta_aura) +{ + uint64_t mask = BIT_ULL(ROC_NPA_BUF_TYPE_PACKET_IPSEC); + struct idev_nix_inl_cfg *inl_cfg; + struct nix_inl_dev *nix_inl_dev; + char mempool_name[24] = {'\0'}; + uint32_t nb_bufs, buf_sz; + char *mp_name = NULL; + uintptr_t mp; + int rc; + + inl_cfg = &idev->inl_cfg; + nix_inl_dev = idev->nix_inl_dev; + + /* Override meta buf count from devargs if present */ + if (nix_inl_dev && nix_inl_dev->nb_meta_bufs) + nb_bufs = nix_inl_dev->nb_meta_bufs; + else + nb_bufs = roc_npa_buf_type_limit_get(mask); + + /* Override meta buf size from devargs if present */ + if (nix_inl_dev && nix_inl_dev->meta_buf_sz) + buf_sz = nix_inl_dev->meta_buf_sz; + else + buf_sz = first_skip + NIX_INL_META_SIZE; + + /* Create Metapool name */ + snprintf(mempool_name, sizeof(mempool_name), "NIX_INL_META_POOL_%d", + roc_nix->port_id + 1); + mp_name = mempool_name; + + /* Allocate meta aura */ + rc = custom_meta_pool_cb(inl_cfg->meta_mempool, &mp, mp_name, meta_aura, + buf_sz, nb_bufs, false); + if (rc) { + plt_err("Failed to allocate meta aura, rc=%d", rc); + return rc; + } + + /* Overwrite */ + roc_nix->meta_mempool = mp; + roc_nix->buf_sz = buf_sz; + + return 0; +} + static int nix_inl_global_meta_buffer_validate(struct idev_cfg *idev, struct roc_nix_rq *rq) { @@ -228,6 +322,7 @@ roc_nix_inl_meta_aura_check(struct roc_nix *roc_nix, struct roc_nix_rq *rq) struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct idev_cfg *idev = idev_get_cfg(); struct idev_nix_inl_cfg *inl_cfg; + bool is_local_metaaura; bool aura_setup = false; uint64_t *meta_aura; int rc; @@ -238,18 +333,39 @@ roc_nix_inl_meta_aura_check(struct roc_nix *roc_nix, struct roc_nix_rq *rq) inl_cfg = &idev->inl_cfg; /* Create meta aura if not present */ - if (roc_nix->local_meta_aura_ena) - meta_aura = &roc_nix->meta_aura_handle; - else + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) { meta_aura = &inl_cfg->meta_aura; + is_local_metaaura = false; + } else { + meta_aura = &roc_nix->meta_aura_handle; + is_local_metaaura = true; + } if (!(*meta_aura)) { - rc = nix_inl_meta_aura_create(idev, roc_nix, rq->first_skip, meta_aura); + rc = nix_inl_meta_aura_create(idev, roc_nix, rq->first_skip, meta_aura, + is_local_metaaura); if (rc) return rc; aura_setup = true; } + + if (roc_nix->custom_meta_aura_ena) { + /* Create metaura for 1:N pool:aura */ + if (!custom_meta_pool_cb) + return -EFAULT; + + meta_aura = &roc_nix->meta_aura_handle; + if (!(*meta_aura)) { + rc = nix_inl_custom_meta_aura_create(idev, roc_nix, rq->first_skip, + meta_aura); + if (rc) + return rc; + + aura_setup = true; + } + } + /* Update rq meta aura handle */ rq->meta_aura_handle = *meta_aura; @@ -698,6 +814,7 @@ roc_nix_inl_inb_init(struct roc_nix *roc_nix) struct nix *nix = roc_nix_to_nix_priv(roc_nix); struct roc_cpt_inline_ipsec_inb_cfg cfg; struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev; uint16_t bpids[ROC_NIX_MAX_BPID_CNT]; struct roc_cpt *roc_cpt; int rc; @@ -749,9 +866,13 @@ roc_nix_inl_inb_init(struct roc_nix *roc_nix) if (rc) return rc; + inl_dev = idev->nix_inl_dev; + + roc_nix->custom_meta_aura_ena = (roc_nix->local_meta_aura_ena && + (inl_dev->is_multi_channel || roc_nix->custom_sa_action)); if (!roc_model_is_cn9k() && !roc_errata_nix_no_meta_aura()) { nix->need_meta_aura = true; - if (!roc_nix->local_meta_aura_ena) + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) idev->inl_cfg.refs++; } @@ -773,15 +894,17 @@ roc_nix_inl_inb_fini(struct roc_nix *roc_nix) return -EFAULT; nix->inl_inb_ena = false; + if (nix->need_meta_aura) { nix->need_meta_aura = false; - if (roc_nix->local_meta_aura_ena) { - nix_inl_meta_aura_destroy(roc_nix); - } else { + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) idev->inl_cfg.refs--; - if (!idev->inl_cfg.refs) - nix_inl_meta_aura_destroy(roc_nix); - } + + if (roc_nix->custom_meta_aura_ena) + nix_inl_custom_meta_aura_destroy(roc_nix); + + if (!idev->inl_cfg.refs) + nix_inl_meta_aura_destroy(roc_nix); } if (roc_feature_nix_has_inl_rq_mask()) { @@ -1309,17 +1432,18 @@ roc_nix_inl_inb_set(struct roc_nix *roc_nix, bool ena) if (ena) { nix->need_meta_aura = true; - if (!roc_nix->local_meta_aura_ena) + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) idev->inl_cfg.refs++; } else if (nix->need_meta_aura) { nix->need_meta_aura = false; - if (roc_nix->local_meta_aura_ena) { - nix_inl_meta_aura_destroy(roc_nix); - } else { + if (!roc_nix->local_meta_aura_ena || roc_nix->custom_meta_aura_ena) idev->inl_cfg.refs--; - if (!idev->inl_cfg.refs) - nix_inl_meta_aura_destroy(roc_nix); - } + + if (roc_nix->custom_meta_aura_ena) + nix_inl_custom_meta_aura_destroy(roc_nix); + + if (!idev->inl_cfg.refs) + nix_inl_meta_aura_destroy(roc_nix); } } @@ -1672,3 +1796,9 @@ roc_nix_inl_eng_caps_get(struct roc_nix *roc_nix) return nix->cpt_eng_caps; } + +void +roc_nix_inl_custom_meta_pool_cb_register(roc_nix_inl_custom_meta_pool_cb_t cb) +{ + custom_meta_pool_cb = cb; +} diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index daa21a941a..885d95335e 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -121,6 +121,9 @@ typedef void (*roc_nix_inl_sso_work_cb_t)(uint64_t *gw, void *args, typedef int (*roc_nix_inl_meta_pool_cb_t)(uint64_t *aura_handle, uintptr_t *mpool, uint32_t blk_sz, uint32_t nb_bufs, bool destroy, const char *mempool_name); +typedef int (*roc_nix_inl_custom_meta_pool_cb_t)(uintptr_t pmpool, uintptr_t *mpool, + const char *mempool_name, uint64_t *aura_handle, + uint32_t blk_sz, uint32_t nb_bufs, bool destroy); struct roc_nix_inl_dev { /* Input parameters */ @@ -199,6 +202,7 @@ int __roc_api roc_nix_inl_outb_soft_exp_poll_switch(struct roc_nix *roc_nix, bool poll); uint64_t *__roc_api roc_nix_inl_outb_ring_base_get(struct roc_nix *roc_nix); void __roc_api roc_nix_inl_meta_pool_cb_register(roc_nix_inl_meta_pool_cb_t cb); +void __roc_api roc_nix_inl_custom_meta_pool_cb_register(roc_nix_inl_custom_meta_pool_cb_t cb); /* NIX Inline/Outbound API */ enum roc_nix_inl_sa_sync_op { diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index 809fd81b20..c76564b46e 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -199,6 +199,7 @@ INTERNAL { roc_nix_inb_is_with_inl_dev; roc_nix_inl_meta_aura_check; roc_nix_inl_meta_pool_cb_register; + roc_nix_inl_custom_meta_pool_cb_register; roc_nix_inb_mode_set; roc_nix_inl_outb_fini; roc_nix_inl_outb_init; diff --git a/drivers/event/cnxk/cn10k_worker.h b/drivers/event/cnxk/cn10k_worker.h index 06c71c6092..07f0dad97d 100644 --- a/drivers/event/cnxk/cn10k_worker.h +++ b/drivers/event/cnxk/cn10k_worker.h @@ -167,6 +167,10 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64, mbuf = u64[1] - sizeof(struct rte_mbuf); rte_prefetch0((void *)mbuf); if (flags & NIX_RX_OFFLOAD_SECURITY_F) { + void *lookup_mem = ws->lookup_mem; + struct rte_mempool *mp = NULL; + uint64_t meta_aura; + const uint64_t mbuf_init = 0x100010000ULL | RTE_PKTMBUF_HEADROOM | (flags & NIX_RX_OFFLOAD_TSTAMP_F ? 8 : 0); @@ -191,8 +195,11 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64, cq_w1, cq_w5, sa_base, (uintptr_t)&iova, &loff, (struct rte_mbuf *)mbuf, d_off, flags, mbuf_init | ((uint64_t)port) << 48); + mp = (struct rte_mempool *)cnxk_nix_inl_metapool_get(port, lookup_mem); + meta_aura = mp ? mp->pool_id : m->pool->pool_id; + if (loff) - roc_npa_aura_op_free(m->pool->pool_id, 0, iova); + roc_npa_aura_op_free(meta_aura, 0, iova); } u64[0] = CNXK_CLR_SUB_EVENT(u64[0]); diff --git a/drivers/net/cnxk/cn10k_rx_select.c b/drivers/net/cnxk/cn10k_rx_select.c index b906f6725a..1e0de1b7ac 100644 --- a/drivers/net/cnxk/cn10k_rx_select.c +++ b/drivers/net/cnxk/cn10k_rx_select.c @@ -79,9 +79,10 @@ cn10k_eth_set_rx_function(struct rte_eth_dev *eth_dev) #undef R }; - /* Copy multi seg version with no offload for tear down sequence */ + /* Copy multi seg version with security for tear down sequence */ if (rte_eal_process_type() == RTE_PROC_PRIMARY) - dev->rx_pkt_burst_no_offload = nix_eth_rx_burst_mseg[0]; + dev->rx_pkt_burst_no_offload = + nix_eth_rx_burst_mseg_reas[NIX_RX_OFFLOAD_SECURITY_F]; if (dev->scalar_ena) { if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SCATTER) { diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 6b45ccd0f7..677539c35a 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1883,6 +1883,9 @@ cnxk_eth_dev_init(struct rte_eth_dev *eth_dev) /* Register callback for inline meta pool create */ roc_nix_inl_meta_pool_cb_register(cnxk_nix_inl_meta_pool_cb); + /* Register callback for inline meta pool create 1:N pool:aura */ + roc_nix_inl_custom_meta_pool_cb_register(cnxk_nix_inl_custom_meta_pool_cb); + dev->eth_dev = eth_dev; dev->configured = 0; dev->ptype_disable = 0; diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index d76f5486e6..85287dd66c 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -608,6 +608,9 @@ cnxk_eth_sec_sess_get_by_sess(struct cnxk_eth_dev *dev, struct rte_security_session *sess); int cnxk_nix_inl_meta_pool_cb(uint64_t *aura_handle, uintptr_t *mpool, uint32_t buf_sz, uint32_t nb_bufs, bool destroy, const char *mempool_name); +int cnxk_nix_inl_custom_meta_pool_cb(uintptr_t pmpool, uintptr_t *mpool, const char *mempool_name, + uint64_t *aura_handle, uint32_t buf_sz, uint32_t nb_bufs, + bool destroy); /* Congestion Management */ int cnxk_nix_cman_info_get(struct rte_eth_dev *dev, struct rte_eth_cman_info *info); diff --git a/drivers/net/cnxk/cnxk_ethdev_sec.c b/drivers/net/cnxk/cnxk_ethdev_sec.c index cd64daacc0..a66d58ca61 100644 --- a/drivers/net/cnxk/cnxk_ethdev_sec.c +++ b/drivers/net/cnxk/cnxk_ethdev_sec.c @@ -6,6 +6,7 @@ #include #define CNXK_NIX_INL_META_POOL_NAME "NIX_INL_META_POOL" +#define CN10K_HW_POOL_OPS_NAME "cn10k_hwpool_ops" #define CNXK_NIX_INL_SELFTEST "selftest" #define CNXK_NIX_INL_IPSEC_IN_MIN_SPI "ipsec_in_min_spi" @@ -114,6 +115,67 @@ cnxk_nix_inl_meta_pool_cb(uint64_t *aura_handle, uintptr_t *mpool, uint32_t buf_ return rc; } +/* Create Aura and link with Global mempool for 1:N Pool:Aura case */ +int +cnxk_nix_inl_custom_meta_pool_cb(uintptr_t pmpool, uintptr_t *mpool, const char *mempool_name, + uint64_t *aura_handle, uint32_t buf_sz, uint32_t nb_bufs, + bool destroy) +{ + struct rte_mempool *hp; + int rc; + + /* Destroy the mempool if requested */ + if (destroy) { + hp = rte_mempool_lookup(mempool_name); + if (!hp) + return -ENOENT; + + if (hp->pool_id != *aura_handle) { + plt_err("Meta pool aura mismatch"); + return -EINVAL; + } + + rte_mempool_free(hp); + plt_free(hp->pool_config); + + *aura_handle = 0; + *mpool = 0; + return 0; + } + + /* Need to make it similar to rte_pktmbuf_pool() for sake of OOP + * support. + */ + hp = rte_mempool_create_empty(mempool_name, nb_bufs, buf_sz, 0, + sizeof(struct rte_pktmbuf_pool_private), + SOCKET_ID_ANY, 0); + if (!hp) { + plt_err("Failed to create inline meta pool"); + return -EIO; + } + + rc = rte_mempool_set_ops_byname(hp, CN10K_HW_POOL_OPS_NAME, (void *)pmpool); + + if (rc) { + plt_err("Failed to setup ops, rc=%d", rc); + goto free_hp; + } + + /* Populate buffer */ + rc = rte_mempool_populate_default(hp); + if (rc < 0) { + plt_err("Failed to populate pool, rc=%d", rc); + goto free_hp; + } + + *aura_handle = hp->pool_id; + *mpool = (uintptr_t)hp; + return 0; +free_hp: + rte_mempool_free(hp); + return rc; +} + static int parse_max_ipsec_rules(const char *key, const char *value, void *extra_args) {