From patchwork Thu May 25 09:58: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: 127424 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 AA0BB42B9A; Thu, 25 May 2023 12:37:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E198542D10; Thu, 25 May 2023 12:37: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 BA43042D0D for ; Thu, 25 May 2023 12:37: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 34PA2X15020293 for ; Thu, 25 May 2023 03:37: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=FXPdTYZvfkKoFZjlaQSkQv5vMrk1UywA99FobYdnn7s=; b=j0Haly4mJM6dmE4wGNWC8SJ4g8FrhT98Py3EH+fIbj+HtvGDdAQdYKtYROCFG+06wcYd UMl6StJTcWvk62GR6CbTnCJzaUkgugjx/1YV8o0PsH6R2kbsUJ/L+OuPMpdAURCw7e3U jZTGnTrKxS/v2hhpXVP5CNxNcMcpLGNnjgkwxwcUnsPQIrU39abOGjYQcgzyd4ElbRXp GiuOBz8hsep6OROIwIz92KG/ED+PyxzXLw6kINcqpfKLlxq1yOWtWX2s/c0jPiyDQ0XG Pw5ZG6HH/j0Jpaw8Uk8J27JiQyVThY4BwLwvlkMOveHtaiv8fyDxw/LztR7Dwk6w7zkk tg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng3xk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:10 -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; Thu, 25 May 2023 03:37: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; Thu, 25 May 2023 03:37:09 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id E67775B69C3; Thu, 25 May 2023 02:59:20 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 01/32] common/cnxk: allocate dynamic BPIDs Date: Thu, 25 May 2023 15:28:33 +0530 Message-ID: <20230525095904.3967080-1-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: m7stuFxcZGxS3uFZG2R4rC5ZvSibs7HS X-Proofpoint-GUID: m7stuFxcZGxS3uFZG2R4rC5ZvSibs7HS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 --- v3: - Fixed checkpatch issues missed in v2. v2: - Rebased on top of dpdk-next-net-mrvl - Handled comments from Jerin w.r.t commit messages - Added few more fixes to the series. 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 Thu May 25 09:58: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: 127430 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 D58DA42B9A; Thu, 25 May 2023 12:37:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C50BE40FDF; Thu, 25 May 2023 12:37:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5299040DF8 for ; Thu, 25 May 2023 12:37:58 +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 34P9fXSX030806 for ; Thu, 25 May 2023 03:37:57 -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=FqmA23jRLqlxXwOqsb+AZ8IWSNDVKp2K28Q9VjRgGrE=; b=KtuJ3Dt8qbi9+jNpVEBgEFgJuEAPysJmIHsqTLGkxRH91yffNdJduIQM5Q+oD7z6EO3b LFyU3JSE74BZ9whZfIsDqT2xUy9+8oU18AjXiVcmq5CmmZDXUFgy1JQgJonLuwaxDEqv QqVgNL/P8U4fNtwH62InYShCNA6E7dGbw8QEC1KOsZwe51Bx2XSGjIl5YjSS/h4tanSS SMoOsvY66ASgB2BBdqT8mW++B+FS/LHNTz2HvKiDxjqUzka/veSx/cJdCU5d/6kasHOk JpRv0Floelj0ortI3H5c6czeETw5ApMNBvjW30ipcwBWFYiaRH/RgaqoRMgNl2g22lu2 hg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cp0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:57 -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; Thu, 25 May 2023 03:37:55 -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; Thu, 25 May 2023 03:37:55 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 9C98B5B6933; Thu, 25 May 2023 02:59:23 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Shijith Thotton Subject: [PATCH v3 02/32] common/cnxk: add pool BPID to RQ while using common pool Date: Thu, 25 May 2023 15:28:34 +0530 Message-ID: <20230525095904.3967080-2-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Z599rfPgoeHa4lbS_r1fv3zx3zhbe0jI X-Proofpoint-ORIG-GUID: Z599rfPgoeHa4lbS_r1fv3zx3zhbe0jI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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..8feb773e1d 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 3b0f95a304..dd649812b4 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 d3caa71586..e1e164499e 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -749,6 +749,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 Thu May 25 09:58: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: 127405 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 2F1AE42B9A; Thu, 25 May 2023 12:10:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B3D0F42D3B; Thu, 25 May 2023 12:10:00 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 2D3CB40DF8; Thu, 25 May 2023 12:09:54 +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 34PA2UjJ020269; Thu, 25 May 2023 03:09:53 -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=CuchXPbCdeFy2+MSWfeIl9xDHaRuDOo/V9V4cjMWk28=; b=jL5e8LsfUZ9Mow0vxybACn6yhfTBnSUvayOCFPUUPaEN/hxrmos5EDfJgcFarPfVEkrh yKRy/FvmjZ6/XBXhce7M3ZF/9CRezAgEI6gfAJgC/zeZf564vJLPQsn/q18wzhFSzy7Y NWP+mPZgbk5f5/8fkc0LWU6CPs+zizttrInyxxxH0TUPdMUuUsoCOcpxkeB71/Y5lXTx BEaYPDL773bARC6MqVpOiLbr07vG8375rMOJzn0pHd6bsCRv3Lflzp26qzfMQsbAsIC5 iQImyog94yF7No+PFaULuchPg93QawADSxOCx9mYUpWRKvW0Wv29FTH/L0f7ZLBNnsxY 1g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-6 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:09:53 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:39 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 8130C5B6AB1; Thu, 25 May 2023 02:59:26 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rahul Bhansali , Subject: [PATCH v3 03/32] common/cnxk: fix CPT backpressure disable on LBK Date: Thu, 25 May 2023 15:28:35 +0530 Message-ID: <20230525095904.3967080-3-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: CW7OgWr_rkgD929SG_fs_yzZm-TAsHEI X-Proofpoint-GUID: CW7OgWr_rkgD929SG_fs_yzZm-TAsHEI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 For LBK interfaces, roc_nix_inl_inb_is_enabled() is false, hence backpressure on CPT is disabled and causing CQ full interrupt. NIXX_AF_RX_CHAN[0x800]_CFG is global config for all PF, VF of RPM/LBK, hence backpressure disable on CPT is not required. Fixes: 0663a84524e5 ("common/cnxk: enable backpressure on CPT with inline inbound") cc: stable@dpdk.org Signed-off-by: Rahul Bhansali --- drivers/common/cnxk/roc_nix_fc.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 8feb773e1d..6d6997ed82 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -87,25 +87,11 @@ nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable) if (rc) goto exit; nix->cpt_lbpid = rsp->chan_bpid[0] & 0x1FF; - } else { - req = mbox_alloc_msg_nix_cpt_bp_disable(mbox); - if (req == NULL) - goto exit; - req->chan_base = 0; - if (roc_nix_is_lbk(roc_nix) || roc_nix_is_sdp(roc_nix)) - req->chan_cnt = NIX_LBK_MAX_CHAN; - else - req->chan_cnt = NIX_CGX_MAX_CHAN; - req->bpid_per_chan = 0; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - nix->cpt_lbpid = 0; } /* CPT to NIX BP on all channels */ - if (!roc_feature_nix_has_rxchan_multi_bpid() || !nix->cpt_nixbpid) + if (!roc_feature_nix_has_rxchan_multi_bpid() || !nix->cpt_nixbpid || + !roc_nix_inl_inb_is_enabled(roc_nix)) goto exit; mbox_put(mbox); From patchwork Thu May 25 09:58: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: 127403 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 5A79442B9A; Thu, 25 May 2023 12:09:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CDE940FDF; Thu, 25 May 2023 12:09:55 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 1D2B340DDB for ; Thu, 25 May 2023 12:09:52 +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 34PA2UjH020269; Thu, 25 May 2023 03:09: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=Iy0Q9bdLqXZ1cBBoj2TSOWu3yLEx/3wGMHDvSnZS9xw=; b=bhoPjyAInKtSONknIgSbW4+qU0U9nBi7F2JX5/rQKymJidtOq+nx2NtEcGY+PAHejhpE QiUzUAdwGmZaXsUHuDEHKgSKQSIObPXPLEEFCV9iV9RVKorp/sVKdGeRYJX+aYT9Uv1x e1FnV6ID/0OpUFIImY/pFgmDuSC/tgcHHQZJpx4yYfhQnbi1lZF/Bnr03HDJl1tkJAv/ 6IxYL8ndJ7To6c/qsbKI4mtCkflnGwTJtIlebh6OCb15NG7xskg3lSFgSP4h0uD2TThX 1bLgrnzZ8UhQLipzrFHLxbgrusuVqy4Wj/7BsbrJT2mCpCgyunlPst8asXWI9zZm65aW 6g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:09:51 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id A8C305B6B8D; Thu, 25 May 2023 02:59:29 -0700 (PDT) From: Nithin Dabilpuram To: Thomas Monjalon , Nithin Kumar Dabilpuram , Kiran Kumar K , "Sunil Kumar Kori" , Satha Rao CC: , Subject: [PATCH v3 04/32] common/cnxk: skip flow ctrl set on non-existent meta aura Date: Thu, 25 May 2023 15:28:36 +0530 Message-ID: <20230525095904.3967080-4-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: dTbK0XQB4h-1AoXF-Nf1_FVP84UsOpBw X-Proofpoint-GUID: dTbK0XQB4h-1AoXF-Nf1_FVP84UsOpBw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 57d02a87aa..edf2f5e639 100644 --- a/.mailmap +++ b/.mailmap @@ -991,6 +991,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 6d6997ed82..69e331d67d 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -297,7 +297,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); } @@ -395,6 +395,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; @@ -408,7 +409,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 42a52ed0ca..7cc41e0c31 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 Thu May 25 09:58: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: 127404 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 F2A4542B9A; Thu, 25 May 2023 12:09:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 77B9842D10; Thu, 25 May 2023 12:09:59 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id AF14740DDB for ; Thu, 25 May 2023 12:09:53 +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 34PA2UjI020269 for ; Thu, 25 May 2023 03:09: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=D4BDGQQMqWccWClE2RterRzKEOa3LSA/LyxMGcrEPHM=; b=ikbp+fm4TwoMY66KQrSQN02Z4R20cXo3ZXywWb/zyIeGYcfSie5eSbyN0K49sVIKFj/w MR7CnwwDYAfKxjvJwEKUzchQzTDIQaRiDggbwgCdbVoVhG9IfurCYPdoTK9eWOC15Asr 17MG0ib9d3X8GyaElKN0yFuZYozUyhVcUGas4SCX4V7mpPUKsOyE6lE5Wi2ejwo+tTMr pcsIg78bONzp5u3zZ3gbKhlqI04G9hbgdF+5gaICMOhn3OlUgRpbBtfBUdX5ifdZsctR r+Dt6I7+QXG4ajBk2OyZa805UqvaRofGY5l00L/K28/ILjqWTIomQXHTASzD7aU4Iklr KQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:52 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 96C255B6BA0; Thu, 25 May 2023 02:59:32 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH v3 05/32] common/cnxk: reduce sqes per sqb by one Date: Thu, 25 May 2023 15:28:37 +0530 Message-ID: <20230525095904.3967080-5-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4PkI-kFt8H8tHfbAp1Oj1UV0CsQO99hD X-Proofpoint-GUID: 4PkI-kFt8H8tHfbAp1Oj1UV0CsQO99hD X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 49d205af39..fd71ff15ca 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 Thu May 25 09:58: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: 127406 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 4A58042B9A; Thu, 25 May 2023 12:10:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C36CA42D40; Thu, 25 May 2023 12:10:01 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id DC7D940DDB for ; Thu, 25 May 2023 12:09:54 +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 34PA2UjK020269 for ; Thu, 25 May 2023 03:09:54 -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=EwSorMNJW2Y9R/Qq2mSC2YiNUhKZpeIHjUDQK9eQvOEFmcBof6+yXLJnZnRdLmHCgowQ HxtF5Sl1ZO3ks4pRZq59RZZv4RNvMnys20wgYom8/U+GUqOifM6PeM+QQ4xkQSxPZvGa F+RzMALzRaIpCISCW+dGwd7ulJ3BJagkVWU6E9K2XAPtrPa6zrok7XyFsS/QtaJpxadV KUnYWTGpbiTs/znOp49GhVKSeroCbLv6+g2E17/mgtsuzGka9Zs9NmRMAy6WYzuw4IoF XoKbaU7rq4ulaHtSn7XFNPH82FfhOSgubiHRWFZMz9PwFCrXUfbRWT0DNfTAfzWRUmu+ 6g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:53 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id B468A5B6BA9; Thu, 25 May 2023 02:59:35 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 06/32] common/cnxk: dump SW SSO work count as xstat Date: Thu, 25 May 2023 15:28:38 +0530 Message-ID: <20230525095904.3967080-6-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: fgHAzg1-QfyhMQ46Cj_-avrVqtk818Af X-Proofpoint-GUID: fgHAzg1-QfyhMQ46Cj_-avrVqtk818Af X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58: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: 127431 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 0612A42B9A; Thu, 25 May 2023 12:38:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC3EF42670; Thu, 25 May 2023 12:38:13 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 58B4740EDF for ; Thu, 25 May 2023 12:38:12 +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 34P9Il3L025637 for ; Thu, 25 May 2023 03:38: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=f3TGl0BAbGit/F5l6H+S+7Ij/MwtIwWleAxrJFDCDqQ=; b=hPAlLmeYimqDpQBKnT/p7vTZwNsrhesXfcqFLPOZN7jtlqQP7wtsBDNJDot6CY2qbfz6 h8Qg128+g9YD+ZzL78e3tf6CL/F8flI5rraf7TzQh9Z12R3NScjuI4eY4RAtuE8qombM FvDSg+QPaS+JOxPLShJKSiRokqvUZiAy144aZhwgyPlaIH5mUV+8H1tEs/AuPXF0I+on 0wgoIZ4SMiP7Qqv3CIC5MM46fXtwzx7DHrDGErcLYUmBRI9qw67W+ryuvTC/e7XHWtwG QoT3xaZmisl5hqOsXUmGNdP7uRKhjADdp/Vapc3P1rmOQVw8TfhEqDYRUtSyBBJf0aSi ww== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cpm-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:38:11 -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; Thu, 25 May 2023 03:38:08 -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; Thu, 25 May 2023 03:38:08 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 66E1C5B6BAE; Thu, 25 May 2023 02:59:38 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH v3 07/32] common/cnxk: add percent drop threshold to pool Date: Thu, 25 May 2023 15:28:39 +0530 Message-ID: <20230525095904.3967080-7-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: oIMD70qvIBUsx0AWET0WXYHBFwh0lhiv X-Proofpoint-ORIG-GUID: oIMD70qvIBUsx0AWET0WXYHBFwh0lhiv X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 69e331d67d..78f482ea52 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -283,6 +283,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; @@ -293,13 +294,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 */ @@ -462,8 +469,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); @@ -499,7 +506,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 9a02026ea6..d39bed6e84 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 Thu May 25 09:58: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: 127426 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 81FA142B9A; Thu, 25 May 2023 12:37:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 920EE42D52; Thu, 25 May 2023 12:37:17 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id DF6FF42D38 for ; Thu, 25 May 2023 12:37:14 +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 34P9Il3A025637 for ; Thu, 25 May 2023 03:37: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=E0GNLvc0t3enTAwrMf4NSvqhzwYsTAssiv6ZcfLIttg=; b=Qy8L904kwi5CbMt2M2/xbkeZzhXAOVIEBLAmXXmIahz2NSuyk+PxIfYWOEN/XOY2rIkv oFOj3ctvlg8fxW4+Gyac9eD3VYiKPtM87v6VKNIhzW4uk+4qkcgnTFoo6iJ3NcCCSFqF pQZve1RLnjGz9LDj//tsEJv+gm0yjhn7HRd9BNQoyYg6JjYNE0i3I35lTrDAZonUwU5t ATCvu1D6lL3RYZz5AzIjC6oucdEt1ZOlTB9M/qkvs1+jbOXrR2hAxyz6ZzNhJZNkbwyH Ip/P9qHECeImBcyOfrHd6/j7Mi9MRe54fB+fluG9ckxqPjleyRXc/TkUyKUdl5tpxev2 BA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cm7-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:13 -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; Thu, 25 May 2023 03:37:12 -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; Thu, 25 May 2023 03:37:12 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 8C3675B6BAF; Thu, 25 May 2023 02:59:41 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH v3 08/32] common/cnxk: make aura flow control config more predictable Date: Thu, 25 May 2023 15:28:40 +0530 Message-ID: <20230525095904.3967080-8-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 2oIGKFAg3S2NnWt7UwvhAzvXJKNWE6g0 X-Proofpoint-ORIG-GUID: 2oIGKFAg3S2NnWt7UwvhAzvXJKNWE6g0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 78f482ea52..21e3b7d5bd 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -300,13 +300,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 */ @@ -479,7 +479,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; @@ -508,34 +509,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); } } @@ -548,10 +540,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 dd649812b4..377439c2ba 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 d39bed6e84..8ad84198b9 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 Thu May 25 09:58: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: 127407 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 3926C42B9A; Thu, 25 May 2023 12:10:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C836842D43; Thu, 25 May 2023 12:10:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4F884410F9 for ; Thu, 25 May 2023 12:09: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 34PA2UjM020269 for ; Thu, 25 May 2023 03:09:54 -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=RVM/m52Y7hxTITvEiDTFbdcnXRAusinuOpZ8vDE0wyQ3DUSB+BkbxglXSUubB+OmwARI mixI7fIFKPobOlCI8jS6fCudlx8J24Vsw9Kqj2Ms6ZRonah2w6gmOiqL+ZAFd7GP4TJG km2ZBbEi1Qhw+jnvhxK80togGrXBRJ3G9ywY2PfKqlfxQnTtjPA0E3nMYglNjY5wT7Mi 2dhzVyzF1cGCjNJl+CrpmGBFsMa2Y64uCjQyz5T9YDiXYVuL8siNfEFi/nYp/hGlMqCy 0mXbqSTK3Naz7ZVMEWqLNyour7mdWneghPvYzKwJMGTRSL7aNej9iTfMB3tIndUZqba0 VQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:54 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id BB15F5B6BC2; Thu, 25 May 2023 02:59:44 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 09/32] common/cnxk: update age drop statistics Date: Thu, 25 May 2023 15:28:41 +0530 Message-ID: <20230525095904.3967080-9-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 0CHHovpkV_Sp-UT_anh27aQD74HAqLEu X-Proofpoint-GUID: 0CHHovpkV_Sp-UT_anh27aQD74HAqLEu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58: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: 127408 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 0524D42B9A; Thu, 25 May 2023 12:10:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E486F42D4D; Thu, 25 May 2023 12:10:03 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id C001142BDA for ; Thu, 25 May 2023 12:09: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 34PA2UjN020269 for ; Thu, 25 May 2023 03:09: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=UH5+qZ3wnEHaOrw3WAva1/jAUMPNxR6O7AKExw3H4Xo=; b=HTqaep/tsA6C6FsnZSmXJ3xls7pHIoE94bL/UxpFwV0oV5TadKdPFW4UCmJ0yqDbTGeo KN5T4UznJvcZ0hhOHMVlNhB1zVzMeOlbD5AaxOsjeT7RHmZlTJA1lCT+jvpHwh4inUTw iZSAdPL6pDyjes9DH0fjAEUEcgGMhF6Wz/POx8kwELMBWu95y+v4DUEDGJF3vKHUPdGz O3+INW+uqsUtPb/zJ0jnwx29xkZIhUbMvHA+njHf6TLhXnm2bFvG4fe2augEXPmkrPdL 2RawtIjmxqU2ud0e4j/qt4wrHowwFF0UDZA2rhg2r/Pf2KxCpbqRHBkSdGy/vTdizKB1 NA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:54 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 6F6595B6BC4; Thu, 25 May 2023 02:59:47 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 10/32] common/cnxk: fetch eng caps for inl outb inst format Date: Thu, 25 May 2023 15:28:42 +0530 Message-ID: <20230525095904.3967080-10-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: NYukjqpeLV6Mf64bjcgnpmtf70FYfgIO X-Proofpoint-GUID: NYukjqpeLV6Mf64bjcgnpmtf70FYfgIO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 7cc41e0c31..eeabf6edec 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 97537de17a..44e37d6550 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -287,6 +287,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 Thu May 25 09:58: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: 127433 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 AF4B642B9A; Thu, 25 May 2023 12:38:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DDBC42D43; Thu, 25 May 2023 12:38:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0F4C840DF8 for ; Thu, 25 May 2023 12:38:25 +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 34PA2X1M020293 for ; Thu, 25 May 2023 03:38:25 -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=CWnCJAUB5ff7lDoY2zA9PtOsLCtGAnJRIjAkd+Zh6G9JVU8jqOu7FK9G6/6eUQNV84Yf ejORs27+WMYxYtnQsmZbadxGdpQJgkisqToqLIdj9dIbzF7NLvK+tQOxCQFyUz1PLoGX JHyarH6K+12NA/4IA5ZqK6vbbReN91UplEGncC0bkc63hGobQOz8jTqnEskBNbp6ga7c 9+3OwiZerZijFamW1DyOmbRlHkuaeIAM3lOUQ2Z5ctyimiAJtvZfKvYC5H3Dz1MWOseE w1zm1gu08pm1DqrNu2UebQF6iwZo67VW+rvm2+ukPRDyFfrtOV2nPKuuJHh5g9COKmBn +A== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng44q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:38:25 -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; Thu, 25 May 2023 03:38:23 -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; Thu, 25 May 2023 03:38:23 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 15F9B5B6BC6; Thu, 25 May 2023 02:59:49 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH v3 11/32] common/cnxk: add receive error mask Date: Thu, 25 May 2023 15:28:43 +0530 Message-ID: <20230525095904.3967080-11-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: mXx1BTKCycDZpHCEO0UexpAGGj-mDU1a X-Proofpoint-GUID: mXx1BTKCycDZpHCEO0UexpAGGj-mDU1a X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58: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: 127425 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 E088F42B9A; Thu, 25 May 2023 12:37:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 319D742D42; Thu, 25 May 2023 12:37:15 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 8282B42D38; Thu, 25 May 2023 12:37:13 +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 34P9Il39025637; Thu, 25 May 2023 03:37:12 -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=qYs25ZXfnGe51QT8i4c7DAYsiQUh1+sENiSBIabishs=; b=F55Pe6AIR9qXirHbyKQA7I9Sdu99MvhXGMnic+yQb303NjL7/7DCDC3uT2Ig3Cf56Fpi YndwIXzhOnWc/AgbVssdZzNsARsOucdozJvd1CujZufntkSR8RqufA3esAcTdqxezme7 6XLOU0CK2SpoBRuTHplPUSW6dopkkVUnA+FQ90FPrMzpYsprTnscgAy9CPG0YPtT6CPX b+g73y4js7/DDY31pEgLUs88SFiAGP1tswNC08VQQp/2bE9QPod6rjCtp8jmN5xbSxFw LMUJHqg+1jdfc4/iya/I7r4XAMOIeKxRrSOUZIEmNxg6yWEcJreg+/YRoAMZxUCI1fmU 5g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cm7-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:37:12 -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; Thu, 25 May 2023 03:37:11 -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; Thu, 25 May 2023 03:37:11 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id EA80A5B6BD8; Thu, 25 May 2023 02:59:52 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan , Subject: [PATCH v3 12/32] common/cnxk: fix null pointer dereference Date: Thu, 25 May 2023 15:28:44 +0530 Message-ID: <20230525095904.3967080-12-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 2gMFPBSPY_1do2rgKsRjEWSAk9vwDlft X-Proofpoint-ORIG-GUID: 2gMFPBSPY_1do2rgKsRjEWSAk9vwDlft X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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") cc: stable@dpdk.org 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 0df148c3ed..ca948d3bc7 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 Thu May 25 09:58:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127409 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 90AC642B9A; Thu, 25 May 2023 12:10:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E72242D59; Thu, 25 May 2023 12:10:05 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 589AD40DF8; Thu, 25 May 2023 12:09:57 +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 34PA2UjP020269; Thu, 25 May 2023 03:09:56 -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=EErJCBu4Hf5WhA3l+PkT4PKdErQ4DKM+CBqChPj+feU=; b=Z3kZ23nohuoFrwhNDs9jh8BLwgdOVINtA2igIWFc1WDF64PN07n+fEwIjeVFyEK7hSiw sFK0fGrnqaqc3iqLSPyVspa4yHw9FDRtixYfokhI1+excod2x4+KlDtn7+6Wir3nYjUV VoTL8oq159mzL8ql5UtPwfonNJTCIk8aPXxl+geR5/d72oxVEgZVV5vR0zidcXi8T0tC fsd169Eg923v8TbkMAw+uN8aUHwngPalU5j4QY21YhGGSjaIFiko1A+FQ8bVnla+AkCi Ira1kGNZcqYvSWYmxOYGDsK+wiUa3aamloBSmJpfoXgD1dSIz7t62uk48giLdHaeEEnR 4w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-15 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:09:56 -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; Thu, 25 May 2023 03:09:40 -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; Thu, 25 May 2023 03:09:40 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 138CD5B6BDA; Thu, 25 May 2023 02:59:55 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan , Subject: [PATCH v3 13/32] common/cnxk: fix parameter in NIX dump Date: Thu, 25 May 2023 15:28:45 +0530 Message-ID: <20230525095904.3967080-13-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ahGgv5Zd4-C1eunWpdtfuktyEisbumde X-Proofpoint-GUID: ahGgv5Zd4-C1eunWpdtfuktyEisbumde X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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") cc: stable@dpdk.org 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 Thu May 25 09:58:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127428 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 D5F8842B9A; Thu, 25 May 2023 12:37:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E468642D55; Thu, 25 May 2023 12:37:25 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3A4E642D3B for ; Thu, 25 May 2023 12:37:24 +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 34P9fW2e030802 for ; Thu, 25 May 2023 03:37: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=pF0/mo+ugFJ6ML7HE9jK62FAOWdmX0OVv06BTm783T4=; b=g5uW3B/uFZOSNvMvqmMmewj5ylE7qgpCajf0yNPXun+OmPnlrozHQGgcBNt+E5SK/xUn EvTnIIg7x9oQNDDLmH3A5cp2o1pKmh+7HxfrSDGNbLA7jPwzvlaQltgdihtfKP9iyuUC A6H+kzLE2FxmAa5LR90DnvDvb+Omp3xNTf0l/drvULp4xgB5X9YNujwyTTdxSUos1JpY builTvFs3ts8TxncH9oXwBcXYwtg5RB7+7yo4guRxvYmJNhmwU104y725vqoNplEY1fI FLVfSFx7IZLOfX7tF9SCGJZnZoJ0qBSJkNtNsklwWMR1uMo3rWO9togGGp8EfaJq3HCL pA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:23 -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; Thu, 25 May 2023 03:37:21 -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; Thu, 25 May 2023 03:37:21 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 3A5CD5B6BDC; Thu, 25 May 2023 02:59:58 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Veerasenareddy Burru Subject: [PATCH v3 14/32] common/cnxk: set relchan in TL4 config for each SDP queue Date: Thu, 25 May 2023 15:28:46 +0530 Message-ID: <20230525095904.3967080-14-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: WH8Yfk5y8tg68HDF9i-F5XypJgXtZf-R X-Proofpoint-ORIG-GUID: WH8Yfk5y8tg68HDF9i-F5XypJgXtZf-R X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127410 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 8F69542B9A; Thu, 25 May 2023 12:10:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5FE0642D69; Thu, 25 May 2023 12:10:06 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id B884B410F9 for ; Thu, 25 May 2023 12:09:57 +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 34PA2UjQ020269 for ; Thu, 25 May 2023 03:09:57 -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=SX7fduDdyLzb4t1E90mtckfE4LVx79x03G6DW7+abbGua55g5pCrB3rAVi74FtOQdpwS wMh30QaUIV9ME2RWczyB4U2jcvuTjuLyQnp2uDuAo2Ads8ZlJKXoDD+EhI3+K+4dkTXb uVmJ6vj6q4GmHqlXct00aPQ/+wSHc9G5PXSRLYB+tHsNwt/nq6Q9QWaEj0V9ipcPnVSW eGD2XwV1tqF5jET5skZ08+YhyExORxvgTB9bKcJHhXdLJDSDsIjmQbynfIH50V2gDS8q wgUZTCuDKx02ToHgouc2A2VQv1jN1sCBkmHhYiCyY3p4BE1/6W3RHWbkng79BpM5SZ1O sw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-16 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:56 -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; Thu, 25 May 2023 03:09:43 -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; Thu, 25 May 2023 03:09:43 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 34ECC5B6C8D; Thu, 25 May 2023 03:00:01 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 15/32] common/cnxk: avoid STALL with dual rate on CNF95N Date: Thu, 25 May 2023 15:28:47 +0530 Message-ID: <20230525095904.3967080-15-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: jMnfh1AkV0OHhya_1ozcmmnaJsmblR-Z X-Proofpoint-GUID: jMnfh1AkV0OHhya_1ozcmmnaJsmblR-Z X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127411 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 AE8CA42B9A; Thu, 25 May 2023 12:10:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 829EA42D75; Thu, 25 May 2023 12:10: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 1A7DA40DF8 for ; Thu, 25 May 2023 12:09:57 +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 34PA2UjR020269 for ; Thu, 25 May 2023 03:09:57 -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=l+P2HmMlX74bavS4igtLhSI/OqN4Ng3zGMJld7gHJzU=; b=PADwZIV7WB7s4lZDdAJmsstJxOmM/Ma0XKxiIR5XiWliFg9XRC5/gf5MTp1ydsNtPJyr uzdc4tqUR8+73w7XAF76YyHlwZvJE0RyroOMBAC2NsMiqOvaxY3SAdRs24VmLlulKs8b NBxIU75Y2ofVTjyjVqq1bYv9gIDyUp2s0mHFvxI7xmMrGn93VsiCUfLPII09TuI4wzSN 9YCvfE3LFnJhtEqiRiJ8kft8hXHKCbhE0eEFLx6JKtHUL3V7DzOv5dPlQgQH5OOR8BLj 2MVyld5a4356xRnvMwtbZFGtZDOwB0w2Xhac9Av9o0wjsLv/LwiC2YQNd7vjcW8GG702 iA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-17 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:57 -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; Thu, 25 May 2023 03:09: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; Thu, 25 May 2023 03:09:43 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 0094E5B6CDA; Thu, 25 May 2023 03:00:04 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 16/32] common/cnxk: update errata info Date: Thu, 25 May 2023 15:28:48 +0530 Message-ID: <20230525095904.3967080-16-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: bWgYaxZZRioev-o7_S4D0CvwyZdA0V8v X-Proofpoint-GUID: bWgYaxZZRioev-o7_S4D0CvwyZdA0V8v X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 1333bde629..22d2406e94 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) { @@ -41,7 +41,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 */ @@ -51,13 +52,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) @@ -69,17 +63,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 Thu May 25 09:58:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127412 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 9839742B9A; Thu, 25 May 2023 12:10:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B243742D77; Thu, 25 May 2023 12:10:08 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 7D1EE410F9 for ; Thu, 25 May 2023 12:09:58 +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 34PA2UjS020269 for ; Thu, 25 May 2023 03:09:57 -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=DNRlbAMS5LxQbcNt2BkxsKkSEJnZYQZmFtUGdXBne/VTMd/fWHHeGHuh3HFO1Nj2AfcM Q2JWeelFm68rySBRg2W8uN3VSZn+DVff+cOVXPwshnEyo90AZXeXQ8M75V3FG1EUtwHt ZSw0lO2LeW3NxmSA0Qe63LLhniD2XTk/CV9IDFaRwFPQL2rFwPl4El2e7GMcrHljxeW9 lHRuPhyUjFt0wlqOYhHEaGgw5Pv2keZYbwpfZbP1sj+fQN2+Ak7X2L8/irjLv3cItFNo pWn1MvvLAp9kmWc/ZY3WPe5xkhycXbEqFKJsm54n6qStSorjd8cjJjyVuNjNUq2FhTgp ZQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-18 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:57 -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; Thu, 25 May 2023 03:09:44 -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; Thu, 25 May 2023 03:09:44 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id A83565B6D16; Thu, 25 May 2023 03:00:07 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH v3 17/32] common/cnxk: sync between mbox up and down messages Date: Thu, 25 May 2023 15:28:49 +0530 Message-ID: <20230525095904.3967080-17-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: QTW16jWatVSZM6yxd3cx78BWSgM2qYrN X-Proofpoint-GUID: QTW16jWatVSZM6yxd3cx78BWSgM2qYrN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127427 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 46B1A42B9A; Thu, 25 May 2023 12:37:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C0C8342D56; Thu, 25 May 2023 12:37:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 718BD42D52 for ; Thu, 25 May 2023 12:37:16 +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 34P9Il3B025637 for ; Thu, 25 May 2023 03:37:15 -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=c+B/fLLHSa4arzjx9si43rldDOxRwoSffyiZQkRIS91AvxNTcUlKedToexxPhTxI0Hu3 FLgsrYPUJl45Re/sNuMnj8wE6NNunUv14uMSLNvfZ9vlIS43N5dyFuhfZWCWG7oXJn7+ 4F85oLk1S2mt6NgaMbZyjTykKbXgeGcmK1q32xZZiFuhcTzriiM1Oea1q3Kz6mj/3cYW FxsYLY4xI/U3L2+BpajLJDfzhnzu+VG1NedZ6d7ErOo54E5KxFxLgR9Up3qzE60mgy8B FBVzTf1W8iLhNxj2sCCbSisZTKV9VKqWAjHWysEyeqdVRz4M0gcPeumRyE3okKTeH2SH oA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cm7-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:15 -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; Thu, 25 May 2023 03:37:14 -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; Thu, 25 May 2023 03:37:14 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 8D31C5B6D4A; Thu, 25 May 2023 03:00:10 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH v3 18/32] common/cnxk: add more comments to mbox code Date: Thu, 25 May 2023 15:28:50 +0530 Message-ID: <20230525095904.3967080-18-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Z8usJ59mdaGSHHFrLogFG4fp18MekW_b X-Proofpoint-ORIG-GUID: Z8usJ59mdaGSHHFrLogFG4fp18MekW_b X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127423 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 6DF1442B9A; Thu, 25 May 2023 12:37:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C1C4C410DC; Thu, 25 May 2023 12:37:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EB0DC40FDF for ; Thu, 25 May 2023 12:37:07 +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 34PA2O4p020184 for ; Thu, 25 May 2023 03:37: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=XpA2DBdNFzaAUIuc0qICk+8lIt/Ayrunob+eFCdqxKk=; b=bUSurox1WsmIvMMyMOACbJOagFTdDEv7tf+mi1c3zboTT6ruNYZ6P0UPnwjjyz/QbQdM tLyQOSxefPupS0Btf0D9PAaszvCdoHawLGU1/oJZEpm4XhcBKAjUKiQ9WxU/tqXCS7k1 qGVdMSPC1LOfj7lPXi4gTnO+jk+Z907HiYZVrBY+xjiUxN+B1mi/xjR1h4mkmPWfPyU8 2poDtBLLgdq9DLfDF4npeho9diYuOcIZtDxpAz+Y3rYqVPe/Zh0NiQpRW95u3miqTCz1 ZLF/0xvFmfwPrqEz6p87cbvPZI3Ap3KqWlX+LpSfm+PFx+SeLioT1YydFZbyjqmn5rRa bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng3x0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37: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; Thu, 25 May 2023 03:37: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; Thu, 25 May 2023 03:37:05 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 7C4F45B6D64; Thu, 25 May 2023 03:00:13 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Harman Kalra Subject: [PATCH v3 19/32] common/cnxk: add CN105xxN B0 model Date: Thu, 25 May 2023 15:28:51 +0530 Message-ID: <20230525095904.3967080-19-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ut7P48BACI179rRHfWTWtHv6kdBTziWN X-Proofpoint-GUID: ut7P48BACI179rRHfWTWtHv6kdBTziWN X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127413 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 6E20E42B9A; Thu, 25 May 2023 12:11:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7DC242D9B; Thu, 25 May 2023 12:10: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 D746640DF8 for ; Thu, 25 May 2023 12:09:58 +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 34PA2UjT020269 for ; Thu, 25 May 2023 03:09: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=JuF3si2adOAyDyOR3GAmlHHISP4ncbpm0uh5xA1FBa4ymPwI1hRHLUtwi3rM1h7Z1MsC Uhci6xxNj/KEIbzoq2a/ESn1Qy6fUQa6XQzQRL2D1riVabOHd4/DlY5O2c4s1Umk4UKy JGCSTwCHMXSQWKme3OQoDFf6wutovaHT4JM9vLKbxl0Im45e/ZRi+/c8fSzh4qpGHwzG 9MTYnmWc4uXiVTMJyEhqL83q3uJ04aKlI2XDbfEZOkwdcRg99EE/D7yLufjcqtYmDHWi o5iBNFoqMhcHi+x1vzQnKCpTbXrNXvBhFQmob7O6HXQiDIGbs+2asuvrZDHyE0DYIucW qg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0kq-19 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:09:57 -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; Thu, 25 May 2023 03:09:48 -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; Thu, 25 May 2023 03:09:48 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 684DD5B6DD2; Thu, 25 May 2023 03:00:16 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Hanumanth Pothula Subject: [PATCH v3 20/32] common/cnxk: access valid pass value Date: Thu, 25 May 2023 15:28:52 +0530 Message-ID: <20230525095904.3967080-20-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: erGWwDVkwkzWfQmSOhnmRMao5zf2Ngnz X-Proofpoint-GUID: erGWwDVkwkzWfQmSOhnmRMao5zf2Ngnz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Thu May 25 09:58:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127432 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 424AF42B9A; Thu, 25 May 2023 12:38:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31DF442D0D; Thu, 25 May 2023 12:38:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 5998A40DF8 for ; Thu, 25 May 2023 12:38:25 +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 34P9fVrC030786 for ; Thu, 25 May 2023 03:38:24 -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=gmKHXHWn9sI1nWRMWJ1y5JSOLfse1tOsnMaJfIaJ5Iw=; b=hemVPNdGMYNpYKZwuyLk/TDJqvJy5yV0UOdUeSb6xAXV7eSB7KP1ZbQOYRkhzpKm9JtW rknC/KHq7YQqOPe5wyrx2VOPhSvHhI8HLqrhamFgeRm51VCjNwqqY6w+w3urS3VV1xPW /2dwuM3Q05WsO4zsLROwS32tZz5czVkRkuG5AY4TBMGHdqNLATs2oJio7l/tF1LM+/D/ 5iASm8MXcY/RMIDsCFhgKxxv10UetN/A4rsfGYgOW9aWSNQt1sgrIF1Qhy8KRlMbtzPl jOonpzDrELD+6xdBUTbFSwTXBE3sdK+0QUCyZSFF1UuqTCqo2fTN+yNU6IH/hSP5Bj3i vQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cq8-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:38:24 -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; Thu, 25 May 2023 03:38:22 -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; Thu, 25 May 2023 03:38:22 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5C5035B6E84; Thu, 25 May 2023 03:00:19 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH v3 21/32] net/cnxk: add receive error mask Date: Thu, 25 May 2023 15:28:53 +0530 Message-ID: <20230525095904.3967080-21-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: wKylChA5mE-Vh5yyXNvHhAOYfq0KZSnY X-Proofpoint-ORIG-GUID: wKylChA5mE-Vh5yyXNvHhAOYfq0KZSnY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 eeabf6edec..3ceda8c8f9 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1267,6 +1267,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 Thu May 25 09:58:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127414 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 4DA1542B9A; Thu, 25 May 2023 12:11:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E442542D4B; Thu, 25 May 2023 12:10:11 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 2B1A442D32 for ; Thu, 25 May 2023 12:10:01 +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 34P9JcsN026560 for ; Thu, 25 May 2023 03:10:00 -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=IcP1j+cK3WmvmRDokNB4d0qU899kl5Fhb5MQPDyAfbc=; b=eenTzVWNnHAXRy2DE3VgLxQoSJvkc0j/BSAbVexgxi0cVgxeTht4rph0l6J52Hrr2fIB zHA2N8XEqQGE7rDzfcI7Rfz4I23o+kHrrfgtDo6iUPaa+0JB0Jq8n+z6sPC46SnqID+l ZwRyd/oB0vBDkv9PINGgomBl42bSaKxcbelVGtruQMfb/O+OXBcDXpQLOGswLAFyHzbz Tj5LCbG4bRa9dDrj1TaTAfd9j1/EtVHfbJXoDqvZfeya53lTSO7xGuS265oknNbgustC G11jXH4Ui8V3zjPoNK9i0Axi4CdPCk3sbLMrwhKVbsZmnCetkssn13NwUHyldKS2O7kk Zw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2ah4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10:00 -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; Thu, 25 May 2023 03:09:48 -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; Thu, 25 May 2023 03:09:48 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 5ABFF5B6E8C; Thu, 25 May 2023 03:00:22 -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 v3 22/32] common/cnxk: support of 1-N pool-aura per NIX LF Date: Thu, 25 May 2023 15:28:54 +0530 Message-ID: <20230525095904.3967080-22-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 6G_EfFHHUMO_QCZnEIFsQClXR5rCEcG9 X-Proofpoint-ORIG-GUID: 6G_EfFHHUMO_QCZnEIFsQClXR5rCEcG9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 1e519d8156..f049b5c348 100644 --- a/drivers/event/cnxk/cn10k_worker.h +++ b/drivers/event/cnxk/cn10k_worker.h @@ -168,6 +168,10 @@ cn10k_sso_hws_post_process(struct cn10k_sso_hws *ws, uint64_t *u64, RTE_MEMPOOL_CHECK_COOKIES(((struct rte_mbuf *)mbuf)->pool, (void **)&mbuf, 1, 1); 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); @@ -192,8 +196,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 3ceda8c8f9..aaa1014479 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1885,6 +1885,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 44e37d6550..e280d6c05e 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -610,6 +610,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) { From patchwork Thu May 25 09:58:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127429 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 0A45042B9A; Thu, 25 May 2023 12:37:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2AA4340FAE; Thu, 25 May 2023 12:37:45 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id EDCAD40FAE for ; Thu, 25 May 2023 12:37:42 +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 34PA2W3L020284 for ; Thu, 25 May 2023 03:37:41 -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=06m5qER3c3zLamXLRYCXJebgmX0o61Y3culNhGpHFVI=; b=RirXa3UyMRb74HjpVvHPbZ790tYhmzxO8WthdyCC3LfeWolSpyXiBTTuu9BR/FcBV+s+ KsnWFqZM60kFBAKh5tOMbHBNLpU7qRQ26xaT/Wfnh244pvlsuXi2k+JUe7CpzK8Y8QUy Y97Pu5sItw5+fDJynrHQPZw5LTjStR5XnSIu/fT1GnqoF2AfhHvaml/k8MNipBGvA4rb dkPdKPYVMVTR16DfOxmjNUcLk3vjrqNDfenMzt/ZIFjeMRxb/Icc9756EXHnqnrRdNL6 HUbjzhQ7+CPlqsbhLYwoSbPosGyIkWCU9zTQxiPrizbNjr9ytAsVobtV3mvZSDRBhGPC cw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng41g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:41 -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; Thu, 25 May 2023 03:37:39 -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; Thu, 25 May 2023 03:37:39 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id BC8C95B694F; Thu, 25 May 2023 03:00:25 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Pavan Nikhilesh , "Shijith Thotton" CC: , Subject: [PATCH v3 23/32] net/cnxk: support for inbound without inline dev mode Date: Thu, 25 May 2023 15:28:55 +0530 Message-ID: <20230525095904.3967080-23-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: BCpc0P_teO8HxZPc4k74XtHTu7XA15YX X-Proofpoint-GUID: BCpc0P_teO8HxZPc4k74XtHTu7XA15YX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Support for inbound Inline IPsec without Inline device RQ i.e both first pass and second pass hitting same ethdev RQ in poll mode. Remove the switching from inline dev to non inline dev mode as inline dev mode is default and can only be overridden by devargs. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_nix_queue.c | 3 +++ drivers/event/cnxk/cnxk_eventdev_adptr.c | 15 --------------- drivers/net/cnxk/cnxk_ethdev.c | 15 ++++++++++----- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c index d29fafa895..08e8bf7ea2 100644 --- a/drivers/common/cnxk/roc_nix_queue.c +++ b/drivers/common/cnxk/roc_nix_queue.c @@ -473,6 +473,9 @@ nix_rq_cfg(struct dev *dev, struct roc_nix_rq *rq, uint16_t qints, bool cfg, if (rq->ipsech_ena) { aq->rq.ipsech_ena = 1; aq->rq.ipsecd_drop_en = 1; + aq->rq.ena_wqwd = 1; + aq->rq.wqe_skip = rq->wqe_skip; + aq->rq.wqe_caching = 1; } aq->rq.lpb_aura = roc_npa_aura_handle_to_aura(rq->aura_handle); diff --git a/drivers/event/cnxk/cnxk_eventdev_adptr.c b/drivers/event/cnxk/cnxk_eventdev_adptr.c index 8ad84198b9..92aea92389 100644 --- a/drivers/event/cnxk/cnxk_eventdev_adptr.c +++ b/drivers/event/cnxk/cnxk_eventdev_adptr.c @@ -273,15 +273,6 @@ cnxk_sso_rx_adapter_queue_add( } dev->rx_offloads |= cnxk_eth_dev->rx_offload_flags; - - /* Switch to use PF/VF's NIX LF instead of inline device for inbound - * when all the RQ's are switched to event dev mode. We do this only - * when dev arg no_inl_dev=1 is selected. - */ - if (cnxk_eth_dev->inb.no_inl_dev && - cnxk_eth_dev->nb_rxq_sso == cnxk_eth_dev->nb_rxq) - cnxk_nix_inb_mode_set(cnxk_eth_dev, false); - return 0; } @@ -309,12 +300,6 @@ cnxk_sso_rx_adapter_queue_del(const struct rte_eventdev *event_dev, if (rc < 0) plt_err("Failed to clear Rx adapter config port=%d, q=%d", eth_dev->data->port_id, rx_queue_id); - - /* Removing RQ from Rx adapter implies need to use - * inline device for CQ/Poll mode. - */ - cnxk_nix_inb_mode_set(cnxk_eth_dev, true); - return rc; } diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index aaa1014479..916198d802 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -81,9 +81,6 @@ cnxk_nix_inb_mode_set(struct cnxk_eth_dev *dev, bool use_inl_dev) { struct roc_nix *nix = &dev->nix; - if (dev->inb.inl_dev == use_inl_dev) - return 0; - plt_nix_dbg("Security sessions(%u) still active, inl=%u!!!", dev->inb.nb_sess, !!dev->inb.inl_dev); @@ -119,7 +116,7 @@ nix_security_setup(struct cnxk_eth_dev *dev) /* By default pick using inline device for poll mode. * Will be overridden when event mode rq's are setup. */ - cnxk_nix_inb_mode_set(dev, true); + cnxk_nix_inb_mode_set(dev, !dev->inb.no_inl_dev); /* Allocate memory to be used as dptr for CPT ucode * WRITE_SA op. @@ -633,6 +630,7 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid, struct roc_nix_rq *rq; struct roc_nix_cq *cq; uint16_t first_skip; + uint16_t wqe_skip; int rc = -EINVAL; size_t rxq_sz; struct rte_mempool *lpb_pool = mp; @@ -712,8 +710,15 @@ cnxk_nix_rx_queue_setup(struct rte_eth_dev *eth_dev, uint16_t qid, rq->lpb_drop_ena = !(dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY); /* Enable Inline IPSec on RQ, will not be used for Poll mode */ - if (roc_nix_inl_inb_is_enabled(nix)) + if (roc_nix_inl_inb_is_enabled(nix) && !dev->inb.inl_dev) { rq->ipsech_ena = true; + /* WQE skip is needed when poll mode is enabled in CN10KA_B0 and above + * for Inline IPsec traffic to CQ without inline device. + */ + wqe_skip = RTE_ALIGN_CEIL(sizeof(struct rte_mbuf), ROC_CACHE_LINE_SZ); + wqe_skip = wqe_skip / ROC_CACHE_LINE_SZ; + rq->wqe_skip = wqe_skip; + } if (spb_pool) { rq->spb_ena = 1; From patchwork Thu May 25 09:58:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127415 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 1188A42B9A; Thu, 25 May 2023 12:11:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C75C42D8D; Thu, 25 May 2023 12:10: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 5CBD342D38; Thu, 25 May 2023 12:10: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 34PA2W0L020284; Thu, 25 May 2023 03:10:13 -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=uWBkUFd97SelxK/UZmQJCAYiiZRR1DpKt0jC+hj+jCU=; b=kad95VuhRiPcTcNxbpLOyEWFGi/qO7LuDjspUPsXyUZpKDuySP3vvIcd+L+O2jJtw4Ko DHWoUYT4nW04S8Z6RwAy7LJxn9yFjxFEmtdxjwDFyYg9mRL0ojmy0PxrpndQS5EDb4nU tfvGZO4u+UFJ93pGApIBRocGUQPhpU7DJ+uVQCd76Rj5YVzSl8bp6d9jmvFhiKngcVk8 YvrzvjBn/81+YTjrj9gfqAL+UFMWvalMh2Qt8khDU0/5K5838qb0PlUZJad9AfeaiIuW vuNl40I6qYqGPozeXfZUMbIUA//vl07iRaieHATqyx8fh0lbzqv4Sl0AnSdZ871OLy/E Bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-11 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:10: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; Thu, 25 May 2023 03:09:48 -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; Thu, 25 May 2023 03:09:48 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id DB75C5B6E92; Thu, 25 May 2023 03:00:28 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Subject: [PATCH v3 24/32] common/cnxk: fix inline device VF identification Date: Thu, 25 May 2023 15:28:56 +0530 Message-ID: <20230525095904.3967080-24-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: rHvX2ZShzesVrlDWsajFAvFkdLLpibxe X-Proofpoint-GUID: rHvX2ZShzesVrlDWsajFAvFkdLLpibxe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Fix inline device VF identification so that the right mbox region is used. Fixes: ee48f711f3b0 ("common/cnxk: support NIX inline inbound and outbound setup") cc: stable@dpdk.org Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/common/cnxk/roc_dev.c b/drivers/common/cnxk/roc_dev.c index 3125f9dda2..d87b00e7e8 100644 --- a/drivers/common/cnxk/roc_dev.c +++ b/drivers/common/cnxk/roc_dev.c @@ -1001,6 +1001,7 @@ dev_vf_hwcap_update(struct plt_pci_device *pci_dev, struct dev *dev) case PCI_DEVID_CNXK_RVU_AF_VF: case PCI_DEVID_CNXK_RVU_VF: case PCI_DEVID_CNXK_RVU_SDP_VF: + case PCI_DEVID_CNXK_RVU_NIX_INL_VF: dev->hwcap |= DEV_HWCAP_F_VF; break; } From patchwork Thu May 25 09:58:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127416 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 1E17C42B9A; Thu, 25 May 2023 12:11:23 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B80CE42DA9; Thu, 25 May 2023 12:10:17 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id BC14B42D82 for ; Thu, 25 May 2023 12:10: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 34PA2W0M020284 for ; Thu, 25 May 2023 03:10: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=FPvW2ZCf8hMabLK14AvQKjf76l7c1JJ/ZzmnBFoHcu4=; b=FPuvdbJfiO8NHMGDJWqfuVWjiOp1GVzXcE1Jc/R3hD/ZzdhPy+3MtashwaBVfuy6GR/5 wz44uZIjrVuf7cy97vGaRXvgAP6yJb+HUcOWwPFXvqNE/TYA8aMEKYvbGt6eZZeNeX1T xF7UrsrHSLKp0Ypmf+Sh5tf4Gwh1u6P3bhshNI4WpceEhNQGZai0TKcZ/oUN6exznntE 6tAoNRi00tPQgc+VvZnQdbz+Ts8oZGLuVvu0gbFSBzVao0wrLTg+lr3fNZtyBIKg7oii Ev9F1BmtfHZDGnk9hZnyH+zpF9FP6z+A8ihoP/KFMKou3Es8jEaPIX7n9E5cNm/rilQd Xw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-12 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10: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; Thu, 25 May 2023 03:09:48 -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; Thu, 25 May 2023 03:09:48 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id C5E865B6E97; Thu, 25 May 2023 03:00:31 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 25/32] common/cnxk: avoid inline dev CPT lf detach multiple times Date: Thu, 25 May 2023 15:28:57 +0530 Message-ID: <20230525095904.3967080-25-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: -zmVLmeMutmf2KHrfw7O5KEnYOe2mZY0 X-Proofpoint-GUID: -zmVLmeMutmf2KHrfw7O5KEnYOe2mZY0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 CPT LF detach is done along with all other LF's of inline device. Hence remove it from nix_inl_cpt_release(). Also provide ROC API for setup and release of CPT LF separately. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_nix_inl.h | 2 + drivers/common/cnxk/roc_nix_inl_dev.c | 59 ++++++++++++++++++++------- drivers/common/cnxk/version.map | 2 + 3 files changed, 48 insertions(+), 15 deletions(-) diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 885d95335e..ab1e9c0f98 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -158,6 +158,8 @@ void __roc_api roc_nix_inl_dev_unlock(void); int __roc_api roc_nix_inl_dev_xaq_realloc(uint64_t aura_handle); int __roc_api roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats); uint16_t __roc_api roc_nix_inl_dev_pffunc_get(void); +int __roc_api roc_nix_inl_dev_cpt_setup(bool use_inl_dev_sso); +int __roc_api roc_nix_inl_dev_cpt_release(void); /* NIX Inline Inbound API */ int __roc_api roc_nix_inl_inb_init(struct roc_nix *roc_nix); diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index ca948d3bc7..d76158e30d 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -172,7 +172,7 @@ nix_inl_nix_ipsec_cfg(struct nix_inl_dev *inl_dev, bool ena) } static int -nix_inl_cpt_setup(struct nix_inl_dev *inl_dev) +nix_inl_cpt_setup(struct nix_inl_dev *inl_dev, bool inl_dev_sso) { struct roc_cpt_lf *lf = &inl_dev->cpt_lf; struct dev *dev = &inl_dev->dev; @@ -186,7 +186,7 @@ nix_inl_cpt_setup(struct nix_inl_dev *inl_dev) eng_grpmask = (1ULL << ROC_CPT_DFLT_ENG_GRP_SE | 1ULL << ROC_CPT_DFLT_ENG_GRP_SE_IE | 1ULL << ROC_CPT_DFLT_ENG_GRP_AE); - rc = cpt_lfs_alloc(dev, eng_grpmask, RVU_BLOCK_ADDR_CPT0, false); + rc = cpt_lfs_alloc(dev, eng_grpmask, RVU_BLOCK_ADDR_CPT0, inl_dev_sso); if (rc) { plt_err("Failed to alloc CPT LF resources, rc=%d", rc); return rc; @@ -218,7 +218,7 @@ nix_inl_cpt_release(struct nix_inl_dev *inl_dev) { struct roc_cpt_lf *lf = &inl_dev->cpt_lf; struct dev *dev = &inl_dev->dev; - int rc, ret = 0; + int rc; if (!inl_dev->attach_cptlf) return 0; @@ -228,17 +228,11 @@ nix_inl_cpt_release(struct nix_inl_dev *inl_dev) /* Free LF resources */ rc = cpt_lfs_free(dev); - if (rc) + if (!rc) + lf->dev = NULL; + else plt_err("Failed to free CPT LF resources, rc=%d", rc); - ret |= rc; - - /* Detach LF */ - rc = cpt_lfs_detach(dev); - if (rc) - plt_err("Failed to detach CPT LF, rc=%d", rc); - ret |= rc; - - return ret; + return rc; } static int @@ -940,7 +934,7 @@ roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev) goto nix_release; /* Setup CPT LF */ - rc = nix_inl_cpt_setup(inl_dev); + rc = nix_inl_cpt_setup(inl_dev, false); if (rc) goto sso_release; @@ -1035,8 +1029,11 @@ roc_nix_inl_dev_fini(struct roc_nix_inl_dev *roc_inl_dev) /* Flush Inbound CTX cache entries */ nix_inl_cpt_ctx_cache_sync(inl_dev); + /* Release CPT */ + rc = nix_inl_cpt_release(inl_dev); + /* Release SSO */ - rc = nix_inl_sso_release(inl_dev); + rc |= nix_inl_sso_release(inl_dev); /* Release NIX */ rc |= nix_inl_nix_release(inl_dev); @@ -1052,3 +1049,35 @@ roc_nix_inl_dev_fini(struct roc_nix_inl_dev *roc_inl_dev) idev->nix_inl_dev = NULL; return 0; } + +int +roc_nix_inl_dev_cpt_setup(bool use_inl_dev_sso) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev = NULL; + + if (!idev || !idev->nix_inl_dev) + return -ENOENT; + inl_dev = idev->nix_inl_dev; + + if (inl_dev->cpt_lf.dev != NULL) + return -EBUSY; + + return nix_inl_cpt_setup(inl_dev, use_inl_dev_sso); +} + +int +roc_nix_inl_dev_cpt_release(void) +{ + struct idev_cfg *idev = idev_get_cfg(); + struct nix_inl_dev *inl_dev = NULL; + + if (!idev || !idev->nix_inl_dev) + return -ENOENT; + inl_dev = idev->nix_inl_dev; + + if (inl_dev->cpt_lf.dev == NULL) + return 0; + + return nix_inl_cpt_release(inl_dev); +} diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index c76564b46e..e1335e9068 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -174,6 +174,8 @@ INTERNAL { roc_nix_inl_cb_register; roc_nix_inl_cb_unregister; roc_nix_inl_ctx_write; + roc_nix_inl_dev_cpt_setup; + roc_nix_inl_dev_cpt_release; roc_nix_inl_dev_dump; roc_nix_inl_dev_fini; roc_nix_inl_dev_init; From patchwork Thu May 25 09:58:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127422 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 DA0B842B9A; Thu, 25 May 2023 12:37:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B426E40DF8; Thu, 25 May 2023 12:37:06 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id EEF6740DDB for ; Thu, 25 May 2023 12:37:04 +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 34P9fed7030891 for ; Thu, 25 May 2023 03:37:04 -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=NW+saCGBXwOTrekbjaVdFI5ao0v6J64Q845zbvBVPAw=; b=a4pm7nDmua/Erk9XUzj1cCYVpjuyDT8QQtyzBDTJc8R/McXlzml5u/NpRIUCKGj+5Lyy ctxAWGRUxLttfbpiOckBh8UGCOkSzRDIe6HS3P0ilxfo9UiXMZWSP8MhcqQMfE3edAe9 uoxUWTMP4HcyZe3zXshXjDSl2EFLKV5McgWLDFW81/WtaQjM0V7VKssos9aUFvEalDYD TPBRfIIrZtkKlJN4UfARQNEMiC9KQ3HIN6a/GIrIobq1gGWLngcrs2M6AC0CQX4t1dw+ eIsOA/PYRo3P/nEzPvweUgeo4Jz23AoSE5SC8ZBBCPK5ugajhoT7P9Kqpx+JHC+DOb74 lA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3qsspt2cm4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:37:04 -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; Thu, 25 May 2023 03:37: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; Thu, 25 May 2023 03:37:02 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 71ED05B6E9B; Thu, 25 May 2023 03:00:34 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 26/32] common/cnxk: skip CGX promisc mode with NPC exact match Date: Thu, 25 May 2023 15:28:58 +0530 Message-ID: <20230525095904.3967080-26-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: UGmRASBbK_3jiBLkjfkErj4xjLwxCThq X-Proofpoint-ORIG-GUID: UGmRASBbK_3jiBLkjfkErj4xjLwxCThq X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 When NPC exact match is enabled, we cannot use CGX promisc mode as CGX filtering is permanently disabled. Hence skip calling it to avoid mbox errors. Signed-off-by: Nithin Dabilpuram Signed-off-by: Kiran Kumar K --- drivers/common/cnxk/roc_nix_mac.c | 8 ++++++++ drivers/common/cnxk/roc_nix_priv.h | 1 + drivers/common/cnxk/roc_npc.c | 1 + drivers/common/cnxk/roc_npc_mcam.c | 1 + drivers/common/cnxk/roc_npc_priv.h | 1 + 5 files changed, 12 insertions(+) diff --git a/drivers/common/cnxk/roc_nix_mac.c b/drivers/common/cnxk/roc_nix_mac.c index ac30fb52d1..754d75ac73 100644 --- a/drivers/common/cnxk/roc_nix_mac.c +++ b/drivers/common/cnxk/roc_nix_mac.c @@ -201,6 +201,14 @@ roc_nix_mac_promisc_mode_enable(struct roc_nix *roc_nix, int enable) goto exit; } + /* Skip CGX promisc toggling if NPC exact match is enabled as + * CGX filtering is disabled permanently. + */ + if (nix->exact_match_ena) { + rc = 0; + goto exit; + } + if (enable) mbox_alloc_msg_cgx_promisc_enable(mbox); else diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 6872630dc8..ea4211dfed 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -130,6 +130,7 @@ struct nix { struct nix_qint *cints_mem; uint8_t configured_qints; uint8_t configured_cints; + uint8_t exact_match_ena; struct roc_nix_rq **rqs; struct roc_nix_sq **sqs; uint16_t vwqe_interval; diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index 1baa71fc45..d88c4d3bd6 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -272,6 +272,7 @@ roc_npc_init(struct roc_npc *roc_npc) roc_npc->rx_parse_nibble = npc->keyx_supp_nmask[NPC_MCAM_RX]; npc->mcam_entries = npc_mcam_tot_entries() >> npc->keyw[NPC_MCAM_RX]; + nix->exact_match_ena = npc->exact_match_ena; /* Free, free_rev, live and live_rev entries */ bmap_sz = plt_bitmap_get_memory_footprint(npc->mcam_entries); diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c index e0019818c7..62e0ce21b2 100644 --- a/drivers/common/cnxk/roc_npc_mcam.c +++ b/drivers/common/cnxk/roc_npc_mcam.c @@ -542,6 +542,7 @@ npc_mcam_fetch_kex_cfg(struct npc *npc) mbox_memcpy((char *)npc->profile_name, kex_rsp->mkex_pfl_name, MKEX_NAME_LEN); + npc->exact_match_ena = (kex_rsp->rx_keyx_cfg >> 40) & 0xF; npc_mcam_process_mkex_cfg(npc, kex_rsp); done: diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h index 6f41df18bb..30274e837b 100644 --- a/drivers/common/cnxk/roc_npc_priv.h +++ b/drivers/common/cnxk/roc_npc_priv.h @@ -404,6 +404,7 @@ struct npc { struct npc_prio_flow_list_head *prio_flow_list; struct plt_bitmap *rss_grp_entries; struct npc_flow_list ipsec_list; + uint8_t exact_match_ena; }; #define NPC_HASH_FIELD_LEN 16 From patchwork Thu May 25 09:58:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127434 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 E3B0942B9A; Thu, 25 May 2023 12:38:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C83642D5C; Thu, 25 May 2023 12:38: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 E951A42D3B for ; Thu, 25 May 2023 12:38:28 +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 34PA2X1N020293 for ; Thu, 25 May 2023 03:38: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=jkd+9g2j9Vo2n/Oh425aiK2uubTeIQC/7skbTG3/oMw=; b=VFrW3cCfgGB7D+k68QBEvHnWBxdCsgfZ2asawUAq0y61U6zGc2HteRrfRvDxFlc5g7lL oQehmJ23jyRx5OzG8LzAtbQWyPp6m6ua/BE9fFQ6M+O90XNZGLXNaVmkTxzI01aaEJKn Mftqp9pdI+G7Q4tPLvTzikbT9HbA0oJwVQB1rcOlD31iQVRmua35C1ygcWmC0cdUteRD +/6jW4oC7ViAySJ0wOqwE+3Wc2mqtFxcsUCr/XFCQU9xls65tFz+RrYqZiWH6/fyzbph 6hgSDQctSBELOR6ENblZAESog7Nfv7XfzchrEqOmTfRXj1NumpMOx0g6zpafpoPGVkVr 3g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng44u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:38:27 -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; Thu, 25 May 2023 03:38:26 -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; Thu, 25 May 2023 03:38:26 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 1F1895B6E9E; Thu, 25 May 2023 03:00:36 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , Subject: [PATCH v3 27/32] common/cnxk: configure PFC on SPB aura Date: Thu, 25 May 2023 15:28:59 +0530 Message-ID: <20230525095904.3967080-27-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Gjh_S92t39N-rx2Mjc_84VTALD4S0iWa X-Proofpoint-GUID: Gjh_S92t39N-rx2Mjc_84VTALD4S0iWa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 A RQ can be configured with lpb_aura and spb_aura at the same time and both can contribute to generate aura based back pressure from NIX to RPM. But currently PFC configuration are applied on lpb_aura only and spb_aura does not contribute to create back pressure. Patch adds support for the same. Signed-off-by: Sunil Kumar Kori --- drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_fc.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 548854952b..f60e546c01 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -198,6 +198,7 @@ struct roc_nix_fc_cfg { uint16_t cq_drop; bool enable; uint64_t pool; + uint64_t spb_pool; uint64_t pool_drop_pct; } rq_cfg; diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 21e3b7d5bd..44eade5ba6 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -303,6 +303,12 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) fc_cfg->rq_cfg.enable, roc_nix->force_rx_aura_bp, fc_cfg->rq_cfg.tc, pool_drop_pct); + if (rq->spb_ena) { + roc_nix_fc_npa_bp_cfg(roc_nix, fc_cfg->rq_cfg.spb_pool, + 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, roc_nix->force_rx_aura_bp, From patchwork Thu May 25 09:59:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127417 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 3546142B9A; Thu, 25 May 2023 12:11:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EC46042DB7; Thu, 25 May 2023 12:10:18 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 220AF42D84 for ; Thu, 25 May 2023 12:10: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 34PA2W0N020284 for ; Thu, 25 May 2023 03:10: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=3F5qvE8MCgnCTDafuCTzNxAOZNJcI5GGmtdKUPmPiCA=; b=ZbAO3064hl061vgIO9qVppxhiMDSbnBSFJN55mc7UBS+H8elIOalJOkEoZDQAi+5CCQC 3t57xcqDMSVdXEpxcjlmCE9ixOjJWxPl5oS79tXgtkNYcCOsRaq48PCl2YzGzp9bRxpj lKsHdkcMrsLQbavdaxacVlydJ/c3a3qSrTBhsThcrNqpn8UbFglsgTHW8pCr6Kb1LcrW Ul/CxpAgtyhuatcTTB+LUrl8nisWlMAomP3NR2Qt2gmlDmlccqIwcKvt6+RmKEx9PUOO eTjeagFraTFSDK5ql/ihM5wf2GxX29UHF823yUJEt+5Y3ifnzbfT8yEkF/I3Tm5nJp6e 0A== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-13 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10:14 -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; Thu, 25 May 2023 03:09:49 -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; Thu, 25 May 2023 03:09:48 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id B681C5B6E9F; Thu, 25 May 2023 03:00:39 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Gowrishankar Muthukrishnan Subject: [PATCH v3 28/32] common/nix: check for null dereference Date: Thu, 25 May 2023 15:29:00 +0530 Message-ID: <20230525095904.3967080-28-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 7HFY5mSHjv_uYZYYIq7PLVx93ZLdIXi8 X-Proofpoint-GUID: 7HFY5mSHjv_uYZYYIq7PLVx93ZLdIXi8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 Check for NULL value return before dereferencing on it. Signed-off-by: Gowrishankar Muthukrishnan --- drivers/common/cnxk/roc_nix.c | 8 +++++++- drivers/common/cnxk/roc_nix_fc.c | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index 39943e4ba7..152ef7269e 100644 --- a/drivers/common/cnxk/roc_nix.c +++ b/drivers/common/cnxk/roc_nix.c @@ -392,6 +392,7 @@ roc_nix_dev_init(struct roc_nix *roc_nix) { enum roc_nix_rss_reta_sz reta_sz; struct plt_pci_device *pci_dev; + struct roc_nix_list *nix_list; uint16_t max_sqb_count; uint64_t blkaddr; struct dev *dev; @@ -417,7 +418,12 @@ 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); + + nix_list = roc_idev_nix_list_get(); + if (nix_list == NULL) + return -EINVAL; + + TAILQ_INSERT_TAIL(nix_list, roc_nix, next); if (nix->dev.drv_inited) return 0; diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 44eade5ba6..f79baf9242 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -431,13 +431,18 @@ 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; + struct roc_nix_list *nix_list; uint8_t chan_pre; if (!roc_feature_nix_has_rxchan_multi_bpid()) return -ENOTSUP; + nix_list = roc_idev_nix_list_get(); + if (nix_list == NULL) + return -EINVAL; + /* 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) { + TAILQ_FOREACH(roc_nix_tmp, nix_list, next) { struct nix *nix = roc_nix_to_nix_priv(roc_nix_tmp); int i; From patchwork Thu May 25 09:59:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127420 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 C13B742B9A; Thu, 25 May 2023 12:11:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8E8142F88; Thu, 25 May 2023 12:10:22 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 51C2940FDF; Thu, 25 May 2023 12:10:16 +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 34PA2W0R020284; Thu, 25 May 2023 03:10:15 -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=I7nS0OMUdVCg6RnuGvU0Q/bPCyUdH93w5HBRHZi4J6Q=; b=d0lJvPX5hw6PbpCr6aTBfU5zcb2ByLOkOQ8FONookClbfR2wxaPORhQJqJUoQ88jn4Vy 1RGLfvIJ+/TsyvSAhA4qFvVKm7fR6AzbBDwSiO1paM2DwFPsBHj2JcRmmCDt07zFNQ4e dpz5+DW6H3+q5YWUylQjin7pqd6etsjoLw8aLrP3bnJrw4E8cDvkklXkw8IoPWMJVdI9 6KJLAevNrEHaqFKzAvCUqWvFnsIyei1xqOh52gXsjhSOydSSCqpjdsbziin4C0Dytb5T QMrpgxMBRtHOV60BEa7Wp9qulfSFa3TQ/7Qn2bngoHxi484TV5RMpmvAMG9uJvSIE7ZF bw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-16 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 25 May 2023 03:10:15 -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; Thu, 25 May 2023 03:09:49 -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; Thu, 25 May 2023 03:09:49 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 9CB105B6EA2; Thu, 25 May 2023 03:00:42 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla , Subject: [PATCH v3 29/32] common/cnxk: fix receive queue with multiple mask Date: Thu, 25 May 2023 15:29:01 +0530 Message-ID: <20230525095904.3967080-29-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: lxCj6FBNSvRNz6gouM6_qIeZ9QAVAD8F X-Proofpoint-GUID: lxCj6FBNSvRNz6gouM6_qIeZ9QAVAD8F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 enable or disable RQ mask based on function parameter.This fix allocates different profile for different rq masks Fixes: ddf955d3917e ("common/cnxk: support CPT second pass") cc: stable@dpdk.org Signed-off-by: Rakesh Kudurumalla --- drivers/common/cnxk/roc_nix_inl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 69f658ba87..16f858f561 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -1382,7 +1382,7 @@ roc_nix_inl_rq_ena_dis(struct roc_nix *roc_nix, bool enable) return -EFAULT; if (roc_feature_nix_has_inl_rq_mask()) { - rc = nix_inl_rq_mask_cfg(roc_nix, true); + rc = nix_inl_rq_mask_cfg(roc_nix, enable); if (rc) { plt_err("Failed to get rq mask rc=%d", rc); return rc; From patchwork Thu May 25 09:59:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127419 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 9CEDD42B9A; Thu, 25 May 2023 12:11:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E2D942DBC; Thu, 25 May 2023 12:10:21 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id E90AB42D38 for ; Thu, 25 May 2023 12:10:15 +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 34PA2W0Q020284 for ; Thu, 25 May 2023 03:10:15 -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=N4rURLMmA4O8P//Rjcyp7WWHUfXTYBxTp7z5KUCWcns=; b=dGd8n16xEfcM5AngDJzL5H9SUximOHtE8p9IfqCyOug+GIZOXMOwQngC9K0EcVlqn2il jEbVOF0NnUPKuLQewhmWkYdvFJESjIvwpJY3NBxD1GAbw+9Fjntvwb9IYxySdgIHnCh1 srVvXle5gTjrmg0bmCUJE/uOp/y1+ZEWaaE19jzM2/lpjxBOlM9JeXmnlDHuNYaufvqh AzROMG2dxFZOsMpENoiomHO3d7z0xmdszbpFSYYU2Iv7fmW2RWtLZDXauwk+qhL6Ml1f 3TgQCRGiV2LhM4U03JO2XGyG4ZiQsu0ElHLuBVyj0AhRZ520JdMJ3QdzdOtT0KJOa9Wh qQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-15 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10:15 -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; Thu, 25 May 2023 03:09:49 -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; Thu, 25 May 2023 03:09:49 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id D6E115B6EA5; Thu, 25 May 2023 03:00:45 -0700 (PDT) From: Nithin Dabilpuram To: Pavan Nikhilesh , Shijith Thotton , Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Rakesh Kudurumalla Subject: [PATCH v3 30/32] net/cnxk: handle extbuf completion on ethdev stop Date: Thu, 25 May 2023 15:29:02 +0530 Message-ID: <20230525095904.3967080-30-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: Q6gQgSIFxDJb1hrhenAcaHPjB_lmryV_ X-Proofpoint-GUID: Q6gQgSIFxDJb1hrhenAcaHPjB_lmryV_ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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 During tranmissoin of packets, CQ corresponding to SQ is polled for transmit completion packets in transmit function, when last burst is transmitted corresponding transmit completion packets are left in CQ.This patch reads leftover packets in CQ on ethdev stop.Moved transmit completion code to cn10k_rxtx.h and cn9k_ethdev.h to avoid code duplication Signed-off-by: Rakesh Kudurumalla --- drivers/event/cnxk/cn10k_tx_worker.h | 2 +- drivers/event/cnxk/cn9k_worker.h | 2 +- drivers/net/cnxk/cn10k_ethdev.c | 13 +++++ drivers/net/cnxk/cn10k_rxtx.h | 76 +++++++++++++++++++++++++ drivers/net/cnxk/cn10k_tx.h | 83 +--------------------------- drivers/net/cnxk/cn9k_ethdev.c | 14 +++++ drivers/net/cnxk/cn9k_ethdev.h | 77 ++++++++++++++++++++++++++ drivers/net/cnxk/cn9k_tx.h | 83 +--------------------------- 8 files changed, 188 insertions(+), 162 deletions(-) diff --git a/drivers/event/cnxk/cn10k_tx_worker.h b/drivers/event/cnxk/cn10k_tx_worker.h index c18786a14c..7f170ac5f0 100644 --- a/drivers/event/cnxk/cn10k_tx_worker.h +++ b/drivers/event/cnxk/cn10k_tx_worker.h @@ -55,7 +55,7 @@ cn10k_sso_tx_one(struct cn10k_sso_hws *ws, struct rte_mbuf *m, uint64_t *cmd, return 0; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, 1, 1); + handle_tx_completion_pkts(txq, 1); cn10k_nix_tx_skeleton(txq, cmd, flags, 0); /* Perform header writes before barrier diff --git a/drivers/event/cnxk/cn9k_worker.h b/drivers/event/cnxk/cn9k_worker.h index 1ce4b044e8..fcb82987e5 100644 --- a/drivers/event/cnxk/cn9k_worker.h +++ b/drivers/event/cnxk/cn9k_worker.h @@ -784,7 +784,7 @@ cn9k_sso_hws_event_tx(uint64_t base, struct rte_event *ev, uint64_t *cmd, txq = cn9k_sso_hws_xtract_meta(m, txq_data); if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, 1, 1); + handle_tx_completion_pkts(txq, 1); if (((txq->nb_sqb_bufs_adj - __atomic_load_n((int16_t *)txq->fc_mem, __ATOMIC_RELAXED)) diff --git a/drivers/net/cnxk/cn10k_ethdev.c b/drivers/net/cnxk/cn10k_ethdev.c index 2b4ab8b772..792c1b1970 100644 --- a/drivers/net/cnxk/cn10k_ethdev.c +++ b/drivers/net/cnxk/cn10k_ethdev.c @@ -367,6 +367,10 @@ static int cn10k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx) { struct cn10k_eth_txq *txq = eth_dev->data->tx_queues[qidx]; + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + uint16_t flags = dev->tx_offload_flags; + struct roc_nix *nix = &dev->nix; + uint32_t head = 0, tail = 0; int rc; rc = cnxk_nix_tx_queue_stop(eth_dev, qidx); @@ -375,6 +379,15 @@ cn10k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx) /* Clear fc cache pkts to trigger worker stop */ txq->fc_cache_pkts = 0; + + if ((flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) && txq->tx_compl.ena) { + struct roc_nix_sq *sq = &dev->sqs[qidx]; + do { + handle_tx_completion_pkts(txq, flags & NIX_TX_VWQE_F); + roc_nix_sq_head_tail_get(nix, sq->qid, &head, &tail); + } while (head != tail); + } + return 0; } diff --git a/drivers/net/cnxk/cn10k_rxtx.h b/drivers/net/cnxk/cn10k_rxtx.h index c256d54307..65dd57494a 100644 --- a/drivers/net/cnxk/cn10k_rxtx.h +++ b/drivers/net/cnxk/cn10k_rxtx.h @@ -113,4 +113,80 @@ struct cn10k_sec_sess_priv { (void *)((uintptr_t)(lmt_addr) + \ ((uint64_t)(lmt_num) << ROC_LMT_LINE_SIZE_LOG2) + (offset)) +static inline uint16_t +nix_tx_compl_nb_pkts(struct cn10k_eth_txq *txq, const uint64_t wdata, + const uint32_t qmask) +{ + uint16_t available = txq->tx_compl.available; + + /* Update the available count if cached value is not enough */ + if (!unlikely(available)) { + uint64_t reg, head, tail; + + /* Use LDADDA version to avoid reorder */ + reg = roc_atomic64_add_sync(wdata, txq->tx_compl.cq_status); + /* CQ_OP_STATUS operation error */ + if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) || + reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR)) + return 0; + + tail = reg & 0xFFFFF; + head = (reg >> 20) & 0xFFFFF; + if (tail < head) + available = tail - head + qmask + 1; + else + available = tail - head; + + txq->tx_compl.available = available; + } + return available; +} + +static inline void +handle_tx_completion_pkts(struct cn10k_eth_txq *txq, uint8_t mt_safe) +{ +#define CNXK_NIX_CQ_ENTRY_SZ 128 +#define CQE_SZ(x) ((x) * CNXK_NIX_CQ_ENTRY_SZ) + + uint16_t tx_pkts = 0, nb_pkts; + const uintptr_t desc = txq->tx_compl.desc_base; + const uint64_t wdata = txq->tx_compl.wdata; + const uint32_t qmask = txq->tx_compl.qmask; + uint32_t head = txq->tx_compl.head; + struct nix_cqe_hdr_s *tx_compl_cq; + struct nix_send_comp_s *tx_compl_s0; + struct rte_mbuf *m_next, *m; + + if (mt_safe) + rte_spinlock_lock(&txq->tx_compl.ext_buf_lock); + + nb_pkts = nix_tx_compl_nb_pkts(txq, wdata, qmask); + while (tx_pkts < nb_pkts) { + rte_prefetch_non_temporal((void *)(desc + + (CQE_SZ((head + 2) & qmask)))); + tx_compl_cq = (struct nix_cqe_hdr_s *) + (desc + CQE_SZ(head)); + tx_compl_s0 = (struct nix_send_comp_s *) + ((uint64_t *)tx_compl_cq + 1); + m = txq->tx_compl.ptr[tx_compl_s0->sqe_id]; + while (m->next != NULL) { + m_next = m->next; + rte_pktmbuf_free_seg(m); + m = m_next; + } + rte_pktmbuf_free_seg(m); + + head++; + head &= qmask; + tx_pkts++; + } + txq->tx_compl.head = head; + txq->tx_compl.available -= nb_pkts; + + plt_write64((wdata | nb_pkts), txq->tx_compl.cq_door); + + if (mt_safe) + rte_spinlock_unlock(&txq->tx_compl.ext_buf_lock); +} + #endif /* __CN10K_RXTX_H__ */ diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h index c9ec01cd9d..4f23a8dfc3 100644 --- a/drivers/net/cnxk/cn10k_tx.h +++ b/drivers/net/cnxk/cn10k_tx.h @@ -1151,83 +1151,6 @@ cn10k_nix_prepare_mseg(struct cn10k_eth_txq *txq, return segdw; } -static inline uint16_t -nix_tx_compl_nb_pkts(struct cn10k_eth_txq *txq, const uint64_t wdata, - const uint16_t pkts, const uint32_t qmask) -{ - uint32_t available = txq->tx_compl.available; - - /* Update the available count if cached value is not enough */ - if (unlikely(available < pkts)) { - uint64_t reg, head, tail; - - /* Use LDADDA version to avoid reorder */ - reg = roc_atomic64_add_sync(wdata, txq->tx_compl.cq_status); - /* CQ_OP_STATUS operation error */ - if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) || - reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR)) - return 0; - - tail = reg & 0xFFFFF; - head = (reg >> 20) & 0xFFFFF; - if (tail < head) - available = tail - head + qmask + 1; - else - available = tail - head; - - txq->tx_compl.available = available; - } - return RTE_MIN(pkts, available); -} - -static inline void -handle_tx_completion_pkts(struct cn10k_eth_txq *txq, const uint16_t pkts, - uint8_t mt_safe) -{ -#define CNXK_NIX_CQ_ENTRY_SZ 128 -#define CQE_SZ(x) ((x) * CNXK_NIX_CQ_ENTRY_SZ) - - uint16_t tx_pkts = 0, nb_pkts; - const uintptr_t desc = txq->tx_compl.desc_base; - const uint64_t wdata = txq->tx_compl.wdata; - const uint32_t qmask = txq->tx_compl.qmask; - uint32_t head = txq->tx_compl.head; - struct nix_cqe_hdr_s *tx_compl_cq; - struct nix_send_comp_s *tx_compl_s0; - struct rte_mbuf *m_next, *m; - - if (mt_safe) - rte_spinlock_lock(&txq->tx_compl.ext_buf_lock); - - nb_pkts = nix_tx_compl_nb_pkts(txq, wdata, pkts, qmask); - while (tx_pkts < nb_pkts) { - rte_prefetch_non_temporal((void *)(desc + - (CQE_SZ((head + 2) & qmask)))); - tx_compl_cq = (struct nix_cqe_hdr_s *) - (desc + CQE_SZ(head)); - tx_compl_s0 = (struct nix_send_comp_s *) - ((uint64_t *)tx_compl_cq + 1); - m = txq->tx_compl.ptr[tx_compl_s0->sqe_id]; - while (m->next != NULL) { - m_next = m->next; - rte_pktmbuf_free_seg(m); - m = m_next; - } - rte_pktmbuf_free_seg(m); - - head++; - head &= qmask; - tx_pkts++; - } - txq->tx_compl.head = head; - txq->tx_compl.available -= nb_pkts; - - plt_write64((wdata | nb_pkts), txq->tx_compl.cq_door); - - if (mt_safe) - rte_spinlock_unlock(&txq->tx_compl.ext_buf_lock); -} - static __rte_always_inline uint16_t cn10k_nix_xmit_pkts(void *tx_queue, uint64_t *ws, struct rte_mbuf **tx_pkts, uint16_t pkts, uint64_t *cmd, const uint16_t flags) @@ -1249,7 +1172,7 @@ cn10k_nix_xmit_pkts(void *tx_queue, uint64_t *ws, struct rte_mbuf **tx_pkts, bool sec; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, flags & NIX_TX_VWQE_F); + handle_tx_completion_pkts(txq, flags & NIX_TX_VWQE_F); if (!(flags & NIX_TX_VWQE_F)) { NIX_XMIT_FC_OR_RETURN(txq, pkts); @@ -1398,7 +1321,7 @@ cn10k_nix_xmit_pkts_mseg(void *tx_queue, uint64_t *ws, bool sec; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, flags & NIX_TX_VWQE_F); + handle_tx_completion_pkts(txq, flags & NIX_TX_VWQE_F); if (!(flags & NIX_TX_VWQE_F)) { NIX_XMIT_FC_OR_RETURN(txq, pkts); @@ -1953,7 +1876,7 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, uint64_t *ws, } wd; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, flags & NIX_TX_VWQE_F); + handle_tx_completion_pkts(txq, flags & NIX_TX_VWQE_F); if (!(flags & NIX_TX_VWQE_F)) { NIX_XMIT_FC_OR_RETURN(txq, pkts); diff --git a/drivers/net/cnxk/cn9k_ethdev.c b/drivers/net/cnxk/cn9k_ethdev.c index e55a2aa133..bae4dda5e2 100644 --- a/drivers/net/cnxk/cn9k_ethdev.c +++ b/drivers/net/cnxk/cn9k_ethdev.c @@ -329,14 +329,28 @@ static int cn9k_nix_tx_queue_stop(struct rte_eth_dev *eth_dev, uint16_t qidx) { struct cn9k_eth_txq *txq = eth_dev->data->tx_queues[qidx]; + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + uint16_t flags = dev->tx_offload_flags; + struct roc_nix *nix = &dev->nix; + uint32_t head = 0, tail = 0; int rc; + rc = cnxk_nix_tx_queue_stop(eth_dev, qidx); if (rc) return rc; /* Clear fc cache pkts to trigger worker stop */ txq->fc_cache_pkts = 0; + + if ((flags & NIX_TX_OFFLOAD_MBUF_NOFF_F) && txq->tx_compl.ena) { + struct roc_nix_sq *sq = &dev->sqs[qidx]; + do { + handle_tx_completion_pkts(txq, 0); + roc_nix_sq_head_tail_get(nix, sq->qid, &head, &tail); + } while (head != tail); + } + return 0; } diff --git a/drivers/net/cnxk/cn9k_ethdev.h b/drivers/net/cnxk/cn9k_ethdev.h index a82dcb3d19..9e0a3c5bb2 100644 --- a/drivers/net/cnxk/cn9k_ethdev.h +++ b/drivers/net/cnxk/cn9k_ethdev.h @@ -107,4 +107,81 @@ void cn9k_eth_set_tx_function(struct rte_eth_dev *eth_dev); /* Security context setup */ void cn9k_eth_sec_ops_override(void); +static inline uint16_t +nix_tx_compl_nb_pkts(struct cn9k_eth_txq *txq, const uint64_t wdata, + const uint32_t qmask) +{ + uint16_t available = txq->tx_compl.available; + + /* Update the available count if cached value is not enough */ + if (!unlikely(available)) { + uint64_t reg, head, tail; + + /* Use LDADDA version to avoid reorder */ + reg = roc_atomic64_add_sync(wdata, txq->tx_compl.cq_status); + /* CQ_OP_STATUS operation error */ + if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) || + reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR)) + return 0; + + tail = reg & 0xFFFFF; + head = (reg >> 20) & 0xFFFFF; + if (tail < head) + available = tail - head + qmask + 1; + else + available = tail - head; + + txq->tx_compl.available = available; + } + return available; +} + +static inline void +handle_tx_completion_pkts(struct cn9k_eth_txq *txq, uint8_t mt_safe) +{ +#define CNXK_NIX_CQ_ENTRY_SZ 128 +#define CQE_SZ(x) ((x) * CNXK_NIX_CQ_ENTRY_SZ) + + uint16_t tx_pkts = 0, nb_pkts; + const uintptr_t desc = txq->tx_compl.desc_base; + const uint64_t wdata = txq->tx_compl.wdata; + const uint32_t qmask = txq->tx_compl.qmask; + uint32_t head = txq->tx_compl.head; + struct nix_cqe_hdr_s *tx_compl_cq; + struct nix_send_comp_s *tx_compl_s0; + struct rte_mbuf *m_next, *m; + + if (mt_safe) + rte_spinlock_lock(&txq->tx_compl.ext_buf_lock); + + nb_pkts = nix_tx_compl_nb_pkts(txq, wdata, qmask); + while (tx_pkts < nb_pkts) { + rte_prefetch_non_temporal((void *)(desc + + (CQE_SZ((head + 2) & qmask)))); + tx_compl_cq = (struct nix_cqe_hdr_s *) + (desc + CQE_SZ(head)); + tx_compl_s0 = (struct nix_send_comp_s *) + ((uint64_t *)tx_compl_cq + 1); + m = txq->tx_compl.ptr[tx_compl_s0->sqe_id]; + while (m->next != NULL) { + m_next = m->next; + rte_pktmbuf_free_seg(m); + m = m_next; + } + rte_pktmbuf_free_seg(m); + + head++; + head &= qmask; + tx_pkts++; + } + txq->tx_compl.head = head; + txq->tx_compl.available -= nb_pkts; + + plt_write64((wdata | nb_pkts), txq->tx_compl.cq_door); + + if (mt_safe) + rte_spinlock_unlock(&txq->tx_compl.ext_buf_lock); +} + + #endif /* __CN9K_ETHDEV_H__ */ diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h index e956c1ad2a..8f1e05a461 100644 --- a/drivers/net/cnxk/cn9k_tx.h +++ b/drivers/net/cnxk/cn9k_tx.h @@ -559,83 +559,6 @@ cn9k_nix_xmit_mseg_one_release(uint64_t *cmd, void *lmt_addr, } while (lmt_status == 0); } -static inline uint16_t -nix_tx_compl_nb_pkts(struct cn9k_eth_txq *txq, const uint64_t wdata, - const uint16_t pkts, const uint32_t qmask) -{ - uint32_t available = txq->tx_compl.available; - - /* Update the available count if cached value is not enough */ - if (unlikely(available < pkts)) { - uint64_t reg, head, tail; - - /* Use LDADDA version to avoid reorder */ - reg = roc_atomic64_add_sync(wdata, txq->tx_compl.cq_status); - /* CQ_OP_STATUS operation error */ - if (reg & BIT_ULL(NIX_CQ_OP_STAT_OP_ERR) || - reg & BIT_ULL(NIX_CQ_OP_STAT_CQ_ERR)) - return 0; - - tail = reg & 0xFFFFF; - head = (reg >> 20) & 0xFFFFF; - if (tail < head) - available = tail - head + qmask + 1; - else - available = tail - head; - - txq->tx_compl.available = available; - } - return RTE_MIN(pkts, available); -} - -static inline void -handle_tx_completion_pkts(struct cn9k_eth_txq *txq, const uint16_t pkts, - uint8_t mt_safe) -{ -#define CNXK_NIX_CQ_ENTRY_SZ 128 -#define CQE_SZ(x) ((x) * CNXK_NIX_CQ_ENTRY_SZ) - - uint16_t tx_pkts = 0, nb_pkts; - const uintptr_t desc = txq->tx_compl.desc_base; - const uint64_t wdata = txq->tx_compl.wdata; - const uint32_t qmask = txq->tx_compl.qmask; - uint32_t head = txq->tx_compl.head; - struct nix_cqe_hdr_s *tx_compl_cq; - struct nix_send_comp_s *tx_compl_s0; - struct rte_mbuf *m_next, *m; - - if (mt_safe) - rte_spinlock_lock(&txq->tx_compl.ext_buf_lock); - - nb_pkts = nix_tx_compl_nb_pkts(txq, wdata, pkts, qmask); - while (tx_pkts < nb_pkts) { - rte_prefetch_non_temporal((void *)(desc + - (CQE_SZ((head + 2) & qmask)))); - tx_compl_cq = (struct nix_cqe_hdr_s *) - (desc + CQE_SZ(head)); - tx_compl_s0 = (struct nix_send_comp_s *) - ((uint64_t *)tx_compl_cq + 1); - m = txq->tx_compl.ptr[tx_compl_s0->sqe_id]; - while (m->next != NULL) { - m_next = m->next; - rte_pktmbuf_free_seg(m); - m = m_next; - } - rte_pktmbuf_free_seg(m); - - head++; - head &= qmask; - tx_pkts++; - } - txq->tx_compl.head = head; - txq->tx_compl.available -= nb_pkts; - - plt_write64((wdata | nb_pkts), txq->tx_compl.cq_door); - - if (mt_safe) - rte_spinlock_unlock(&txq->tx_compl.ext_buf_lock); -} - static __rte_always_inline uint16_t cn9k_nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts, uint64_t *cmd, const uint16_t flags) @@ -648,7 +571,7 @@ cn9k_nix_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts, uint16_t i; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, 0); + handle_tx_completion_pkts(txq, 0); NIX_XMIT_FC_OR_RETURN(txq, pkts); @@ -700,7 +623,7 @@ cn9k_nix_xmit_pkts_mseg(void *tx_queue, struct rte_mbuf **tx_pkts, uint64_t i; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, 0); + handle_tx_completion_pkts(txq, 0); NIX_XMIT_FC_OR_RETURN(txq, pkts); @@ -1049,7 +972,7 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t pkts_left; if (flags & NIX_TX_OFFLOAD_MBUF_NOFF_F && txq->tx_compl.ena) - handle_tx_completion_pkts(txq, pkts, 0); + handle_tx_completion_pkts(txq, 0); NIX_XMIT_FC_OR_RETURN(txq, pkts); From patchwork Thu May 25 09:59:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127418 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 1962F42B9A; Thu, 25 May 2023 12:11:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 297C042DB9; Thu, 25 May 2023 12:10:20 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 86DBD40FDF for ; Thu, 25 May 2023 12:10:15 +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 34PA2W0P020284 for ; Thu, 25 May 2023 03:10: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=EaOOIQ5hQQ3tIklf4KBcgZx3wittuffOSHRocNhXOaM=; b=F6Z65SlUNbbJaqvn5yC4PjwnoDl+9q2mscM0KTTnojx+aBEI9TLWrsUZhRA0GNKN72GS 6apHMEjTjaoIQ6lwuye3U+BAxa/Bi3XTWF7YIxUVuU5f8rKD+tCS34SLuwrKaU0QKeaS oZe330Us6PgvJRXgIC0tXravydviXzK31BVwEW2cKZfVXqIaT3z0AaLDXmmHE826JSXL cCQe1AdUP3ekjuHpp7Ego8T3fO+T8uLtorVU6Zmb5fPf4MplAzQBiCrQR92X43ZtMO8H ktafSmvKIw8cMEojn4d9zQyeZC9ZLdj04Gdfzn9xD3hMzuenT+VSkeXJnc9uq2+o9O9G Hw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-14 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10:14 -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; Thu, 25 May 2023 03:09:49 -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; Thu, 25 May 2023 03:09:49 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id B2AE65B6B94; Thu, 25 May 2023 03:00:49 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Srujana Challa Subject: [PATCH v3 31/32] net/cnxk: add aes-ccm to inline IPsec capabilities Date: Thu, 25 May 2023 15:29:03 +0530 Message-ID: <20230525095904.3967080-31-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: SHI76EhF79Zr8mSbLcZ4ixqscudUiyJn X-Proofpoint-GUID: SHI76EhF79Zr8mSbLcZ4ixqscudUiyJn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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: Srujana Challa Declares AES-CCM support in inline IPsec capabilities. Signed-off-by: Srujana Challa --- drivers/net/cnxk/cn10k_ethdev_sec.c | 30 +++++++++++++++++++++++++++++ drivers/net/cnxk/cn9k_ethdev_sec.c | 30 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k_ethdev_sec.c index 9625704ec1..5bc547051d 100644 --- a/drivers/net/cnxk/cn10k_ethdev_sec.c +++ b/drivers/net/cnxk/cn10k_ethdev_sec.c @@ -228,6 +228,36 @@ static struct rte_cryptodev_capabilities cn10k_eth_sec_crypto_caps[] = { }, } }, } }, + { /* AES CCM */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD, + {.aead = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + .aad_size = { + .min = 8, + .max = 12, + .increment = 4 + }, + .iv_size = { + .min = 11, + .max = 13, + .increment = 1 + } + }, } + }, } + }, { /* NULL (AUTH) */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c index 327f221e38..688b13ae1e 100644 --- a/drivers/net/cnxk/cn9k_ethdev_sec.c +++ b/drivers/net/cnxk/cn9k_ethdev_sec.c @@ -100,6 +100,36 @@ static struct rte_cryptodev_capabilities cn9k_eth_sec_crypto_caps[] = { }, } }, } }, + { /* AES CCM */ + .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, + {.sym = { + .xform_type = RTE_CRYPTO_SYM_XFORM_AEAD, + {.aead = { + .algo = RTE_CRYPTO_AEAD_AES_CCM, + .block_size = 16, + .key_size = { + .min = 16, + .max = 32, + .increment = 8 + }, + .digest_size = { + .min = 16, + .max = 16, + .increment = 0 + }, + .aad_size = { + .min = 8, + .max = 12, + .increment = 4 + }, + .iv_size = { + .min = 11, + .max = 13, + .increment = 1 + } + }, } + }, } + }, { /* AES CBC */ .op = RTE_CRYPTO_OP_TYPE_SYMMETRIC, {.sym = { From patchwork Thu May 25 09:59:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nithin Dabilpuram X-Patchwork-Id: 127421 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 6824C42B9A; Thu, 25 May 2023 12:11:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE09142F92; Thu, 25 May 2023 12:10: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 AC9FA42DAF for ; Thu, 25 May 2023 12:10:16 +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 34PA2W0S020284 for ; Thu, 25 May 2023 03:10:15 -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=t+dbgs7XkhEwxUbAkCfvm5gtvH78te1drlYCqir6PmM=; b=LLK34JS4ikaXTvBwnUKz2xq/z/fmRsRcrXotpscjGmXc+VXKx67wE3ft9a0y6RwJvA/V e0P/QRHMFpqB22roNVc7CISzDSUt5LMEN9YfSzrS/J5vv/HbKPZKQKQlaxtcVm2B2anl d8NVIZ2GG2wQAHtqOB+hVGRf4D21/awbJYk3fuEJEgHIutwQA6fXcuwdRnKXA2SM0seZ L8zqkX5ysougbMHTRwgPvGYLDSIlxiAOXD1iNtjpU77YOAf0UZXszAHhcCDE3mUtUsx+ YORKcL+3Ia94umMOUq9KS9fyg8fdrIHjoGJWyFbPLUNlcXjptEZ5HqLT5kyh4FJIC14J kQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qt5jng0pa-17 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Thu, 25 May 2023 03:10:15 -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; Thu, 25 May 2023 03:09:49 -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; Thu, 25 May 2023 03:09:49 -0700 Received: from hyd1588t430.caveonetworks.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 9A63C5B6D86; Thu, 25 May 2023 03:00:52 -0700 (PDT) From: Nithin Dabilpuram To: Nithin Kumar Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: , , Srujana Challa Subject: [PATCH v3 32/32] common/cnxk: add check for null auth and anti-replay Date: Thu, 25 May 2023 15:29:04 +0530 Message-ID: <20230525095904.3967080-32-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230525095904.3967080-1-ndabilpuram@marvell.com> References: <20230411091144.1087887-1-ndabilpuram@marvell.com> <20230525095904.3967080-1-ndabilpuram@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: cD5PFDNiRQM_DzVTdQg1ESwnTvumrL1l X-Proofpoint-GUID: cD5PFDNiRQM_DzVTdQg1ESwnTvumrL1l X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-25_06,2023-05-24_01,2023-05-22_02 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: Srujana Challa As per IPsec RFC, the anti-replay service can be selected for an SA only if the integrity service is selected for that SA. This patch adds the validation check for the same. Signed-off-by: Srujana Challa --- drivers/common/cnxk/cnxk_security.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index 13ca2c7791..a8c3ba90cd 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -155,6 +155,10 @@ ot_ipsec_sa_common_param_fill(union roc_ot_ipsec_sa_word2 *w2, switch (auth_xfrm->auth.algo) { case RTE_CRYPTO_AUTH_NULL: + if (w2->s.dir == ROC_IE_SA_DIR_INBOUND && ipsec_xfrm->replay_win_sz) { + plt_err("anti-replay can't be supported with integrity service disabled"); + return -EINVAL; + } w2->s.auth_type = ROC_IE_OT_SA_AUTH_NULL; break; case RTE_CRYPTO_AUTH_SHA1_HMAC: @@ -1392,6 +1396,11 @@ cnxk_on_ipsec_inb_sa_create(struct rte_security_ipsec_xform *ipsec, if (ret) return ret; + if (crypto_xform->type != RTE_CRYPTO_SYM_XFORM_AEAD && + crypto_xform->auth.algo == RTE_CRYPTO_AUTH_NULL && ipsec->replay_win_sz) { + plt_err("anti-replay can't be supported with integrity service disabled"); + return -EINVAL; + } if (crypto_xform->type == RTE_CRYPTO_SYM_XFORM_AEAD || auth_xform->auth.algo == RTE_CRYPTO_AUTH_NULL || auth_xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC) {