From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA4C7606A31C for ; Sun, 29 Nov 2026 20:53:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=networkplumber-org.20260707.gappssmtp.com header.i=@networkplumber-org.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=W3tbQent Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C714140E2F; Sun, 29 Nov 2026 21:50:54 +0100 (CET) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mails.dpdk.org (Postfix) with ESMTPS id 54E9B40C35 for ; Sun, 29 Nov 2026 21:50:51 +0100 (CET) Received: by mail-pj1-f48.google.com with SMTP id 98e67ed59e1d1-3b54096b2d0so1245839a91.1 for ; Sun, 29 Nov 2026 12:50:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20260707.gappssmtp.com; s=20260707; t=1795985450; x=1796590250; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=aByJIhR4zyM37kLYEPCgaNaw66NRiqhvu/u54cHdVmw=; b=W3tbQentNV7bLnzEAsBvavs03jXq8GzKj52X+PVJXw5suVrdWgzcjD6gVtnj9MgtCt UIWJ5rR8r5LamTbuWRQ84UWjGOmbAS4ObvaTAwVa/91VwBwCfansNK+6a3P9/u+iDmD7 mVs2cF4Bmi95khQb0Fs1158z348dJMlyOb3jQDx3nMM0rgGYBq7RpKXQCgoLxSgVRXP4 kMpRXfj5YGaE4yAdBYOrkspEpl4bjKs2IbKu8tcqavsKyjo4DY0Nl3WpJli9X29XUXD6 +oSvHY+ZYe4p4tdukP4GiKAMzkHO/KmXuv2O1mhTk6ekcjjLcR70TL8/bJyXICjyLmQo 3FNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795985450; x=1796590250; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=aByJIhR4zyM37kLYEPCgaNaw66NRiqhvu/u54cHdVmw=; b=yFT3Tp6sEJqHkL0VC2JGHfX17DQmUgK0ROU6HNx4vnSlT4MU4RkNWGKikmFWP2NmAU vw0NTBrseMH5Xt2YpS+H5MuThBIoZ71mjFBbsVbGH94pQKVNMPH8yo6vgOpanxnJcXbm FciJgax7sTs/9GHxuDBpAnWaNpXJZY43yrCpXa9oB24Ub9GvpLdOKuNDZkZDj+cgEIXy 2TX/Jki+S5uQvk1EnulkyCik4tjIIE8VLACBw08aA/p7lrSXJWYkJ6Z8SX96xkLPxu+7 1x3biBIjmilVGjU2OY+odhp//yfgLhux+Gi23eG+f6xkksgD+iQsx2MPJZpNiEVtI0nE qVHg== X-Gm-Message-State: APuU4Z+Y2p0DUiHmGPR3mdV+2fTE+PevCqjgneBHAH2AZP+z9JIgD/0a 1pRlD5nFgQwHycO6RWj04c+6yUmVZSpZ/F+aHC/UtCdO2KrqRKlAVt5J1N/obZ0QtgreWGNULaK 3/E6NaGY= X-Gm-Gg: AZFdTZdwXp+meUA7n7xKCVrNBrXdpxV4r3BA299Q4k3qYIfLxNRsvbKEWMI+7Yelym3 h6BmaNt6bxlm0e6F66ccpbE/Rlr66T0TjdI0rt5500K1PAE46GvfIgUDpaejEciWlOyN1H4AbQT 7qnD/5E7n529uH+Fn/FT2soykfUVxkZ0cbLcUgzSFvHmC3o1vdJLnPQN5bFxzTOMaUJ1d2tSkjt 9y8miUsugPZxa2MtRcxKOk1kFqGr5C+Z7pOSVkgloYjk8IVzJA/BnAnZShOLzlvYaoPG/zJ//HG hP4S1q8NoT2GSUSoKVnEtACHscr/S/m1mHiArELTz6rGRJGnYfeCUYbJoIanC22ryTwn2Y50HV0 eKW2aLjVl8WaZ8pV46sS6UStncoURu7n+frFdotl82jffZzgaVgS3h5E/SJXfuXLog2YB7v827v pMMEVV1BSzR6KJmO+oVKTnnzx1iu4HI18KPWw0u1QwK3FZ+HWF0quuaLDVNbRAwf9zq6K98Erz8 FfcT+c7K6Nwbx9Ct8LCjiDUkFViNDSCdxyZcMAZm6vxYw+Q8PVVr5h2aw+IyiFpt95zRCOKYiRl PXqTsTs2Scyudt03sEpeZmxqi9zL77kg5Ixx4Vh8skuyOJ28DVydx5/3NdP7VVve6u42 X-Received: by 2002:a17:90b:5289:b0:3a4:77b8:1770 with SMTP id 98e67ed59e1d1-3b41c8fe855mr33430212a91.15.1795985449125; Sun, 29 Nov 2026 12:50:49 -0800 (PST) Received: from phoenix.lan (204-195-112-43.wavecable.com. [204.195.112.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3b50234fb25sm10383968a91.2.2026.11.29.12.50.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 12:50:48 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Srikanth Yalavarthi Subject: [PATCH 26/45] common/cnxk: remove unused roc functions Date: Sun, 29 Nov 2026 12:49:11 -0800 Message-ID: <20261129205006.1440292-27-stephen@networkplumber.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261129205006.1440292-1-stephen@networkplumber.org> References: <20261129205006.1440292-1-stephen@networkplumber.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 108 roc functions have no caller anywhere in the tree. The source scan covers the per-offload template files under net, event and crypto cnxk which a default config does not compile, so none of these are reached from a template either. Deleting them left several internal helpers unreachable, which the compiler reported: the flow control config getters, the inline timestamp pkind setter, the SQB aura resize helpers and the REE error interrupt registration. Those are removed as well, along with nix_lf_bpf_dump(), nix_rq_bulk_ena_dis_fill() and nix_aq_enq_write_rq_ena(), which only clang reports because gcc does not warn about an unused static inline in a .c file. Among them are the debug dumpers roc_cpt_cq_dump(), roc_nix_bpf_dump() and roc_npa_dump(), which are called from a debugger rather than from the tree. Say so if they should stay. roc_idev.h gains a forward declaration of struct roc_rvu_lf, which until now came in as the return type of roc_idev_rvu_lf_get(). Signed-off-by: Stephen Hemminger --- drivers/common/cnxk/cnxk_security.c | 24 -- drivers/common/cnxk/cnxk_security.h | 4 - drivers/common/cnxk/roc_cpt.c | 50 ---- drivers/common/cnxk/roc_cpt.h | 6 - drivers/common/cnxk/roc_cpt_debug.c | 22 -- drivers/common/cnxk/roc_dpi.c | 99 ------- drivers/common/cnxk/roc_dpi.h | 5 - drivers/common/cnxk/roc_idev.c | 40 --- drivers/common/cnxk/roc_idev.h | 4 +- drivers/common/cnxk/roc_mcs.c | 253 ----------------- drivers/common/cnxk/roc_mcs.h | 34 --- drivers/common/cnxk/roc_mcs_sec_cfg.c | 95 ------- drivers/common/cnxk/roc_ml.c | 97 ------- drivers/common/cnxk/roc_ml.h | 6 - drivers/common/cnxk/roc_nix.c | 8 - drivers/common/cnxk/roc_nix.h | 81 ------ drivers/common/cnxk/roc_nix_bpf.c | 270 ------------------ drivers/common/cnxk/roc_nix_fc.c | 222 --------------- drivers/common/cnxk/roc_nix_inl.c | 159 ----------- drivers/common/cnxk/roc_nix_inl.h | 11 - drivers/common/cnxk/roc_nix_inl_dev.c | 90 ------ drivers/common/cnxk/roc_nix_mac.c | 65 ----- drivers/common/cnxk/roc_nix_mcast.c | 117 -------- drivers/common/cnxk/roc_nix_ops.c | 43 --- drivers/common/cnxk/roc_nix_ptp.c | 9 - drivers/common/cnxk/roc_nix_queue.c | 364 ------------------------- drivers/common/cnxk/roc_nix_stats.c | 6 - drivers/common/cnxk/roc_nix_tm_ops.c | 257 ----------------- drivers/common/cnxk/roc_nix_tm_utils.c | 51 ---- drivers/common/cnxk/roc_nix_vlan.c | 243 ----------------- drivers/common/cnxk/roc_npa.c | 244 ----------------- drivers/common/cnxk/roc_npa.h | 6 - drivers/common/cnxk/roc_npa_debug.c | 39 --- drivers/common/cnxk/roc_npc.c | 117 -------- drivers/common/cnxk/roc_npc.h | 9 - drivers/common/cnxk/roc_ree.c | 81 ------ drivers/common/cnxk/roc_ree.h | 3 - drivers/common/cnxk/roc_sso.c | 64 ----- drivers/common/cnxk/roc_sso.h | 7 - 39 files changed, 1 insertion(+), 3304 deletions(-) diff --git a/drivers/common/cnxk/cnxk_security.c b/drivers/common/cnxk/cnxk_security.c index f2e25264ec..4e160f2e74 100644 --- a/drivers/common/cnxk/cnxk_security.c +++ b/drivers/common/cnxk/cnxk_security.c @@ -596,30 +596,6 @@ cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, return 0; } -bool -cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa) -{ - return !!sa->w2.s.valid; -} - -bool -cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa) -{ - return !!sa->w2.s.valid; -} - -bool -cnxk_ow_ipsec_inb_sa_valid(struct roc_ow_ipsec_inb_sa *sa) -{ - return !!sa->w2.s.valid; -} - -bool -cnxk_ow_ipsec_outb_sa_valid(struct roc_ow_ipsec_outb_sa *sa) -{ - return !!sa->w2.s.valid; -} - uint8_t cnxk_ipsec_ivlen_get(enum rte_crypto_cipher_algorithm c_algo, enum rte_crypto_auth_algorithm a_algo, diff --git a/drivers/common/cnxk/cnxk_security.h b/drivers/common/cnxk/cnxk_security.h index 55992e375b..d44cd19e75 100644 --- a/drivers/common/cnxk/cnxk_security.h +++ b/drivers/common/cnxk/cnxk_security.h @@ -46,8 +46,6 @@ int __roc_api cnxk_ot_ipsec_outb_sa_fill(struct roc_ot_ipsec_outb_sa *sa, struct rte_security_ipsec_xform *ipsec_xfrm, struct rte_crypto_sym_xform *crypto_xfrm, uint8_t ctx_ilen); -bool cnxk_ot_ipsec_inb_sa_valid(struct roc_ot_ipsec_inb_sa *sa); -bool cnxk_ot_ipsec_outb_sa_valid(struct roc_ot_ipsec_outb_sa *sa); /* [CN9K] */ int __roc_api cnxk_on_ipsec_inb_sa_create(struct rte_security_ipsec_xform *ipsec, @@ -65,8 +63,6 @@ int __roc_api cnxk_ow_ipsec_outb_sa_fill(struct roc_ow_ipsec_outb_sa *sa, struct rte_security_ipsec_xform *ipsec_xfrm, struct rte_crypto_sym_xform *crypto_xfrm, uint8_t ctx_ilen); -bool cnxk_ow_ipsec_inb_sa_valid(struct roc_ow_ipsec_inb_sa *sa); -bool cnxk_ow_ipsec_outb_sa_valid(struct roc_ow_ipsec_outb_sa *sa); static inline int ipsec_xform_cipher_verify(struct rte_crypto_sym_xform *crypto_xform) diff --git a/drivers/common/cnxk/roc_cpt.c b/drivers/common/cnxk/roc_cpt.c index 645c205480..fd8d2de5d2 100644 --- a/drivers/common/cnxk/roc_cpt.c +++ b/drivers/common/cnxk/roc_cpt.c @@ -260,56 +260,6 @@ cpt_lf_outb_cfg(struct dev *dev, uint16_t sso_pf_func, uint16_t nix_pf_func, return rc; } -int -roc_cpt_inline_ipsec_cfg(struct dev *cpt_dev, uint8_t lf_id, - struct roc_nix *roc_nix) -{ - bool ena = roc_nix ? true : false; - uint16_t nix_pf_func = 0; - uint16_t sso_pf_func = 0; - - if (ena) { - nix_pf_func = roc_nix_get_pf_func(roc_nix); - sso_pf_func = idev_sso_pffunc_get(); - } - - return cpt_lf_outb_cfg(cpt_dev, sso_pf_func, nix_pf_func, lf_id, ena); -} - -int -roc_cpt_inline_ipsec_inb_cfg_read(struct roc_cpt *roc_cpt, - struct roc_cpt_inline_ipsec_inb_cfg *cfg) -{ - struct cpt *cpt = roc_cpt_to_cpt_priv(roc_cpt); - struct nix_inline_ipsec_cfg *inb_cfg; - struct dev *dev = &cpt->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct msg_req *req; - int rc; - - req = mbox_alloc_msg_nix_read_inline_ipsec_cfg(mbox); - if (req == NULL) { - rc = -EIO; - goto exit; - } - - rc = mbox_process_msg(mbox, (void *)&inb_cfg); - if (rc) { - rc = -EIO; - goto exit; - } - cfg->cpt_credit = inb_cfg->cpt_credit; - cfg->egrp = inb_cfg->gen_cfg.egrp; - cfg->opcode = inb_cfg->gen_cfg.opcode; - cfg->param1 = inb_cfg->gen_cfg.param1; - cfg->param2 = inb_cfg->gen_cfg.param2; - cfg->bpid = inb_cfg->bpid; - cfg->credit_th = inb_cfg->credit_th; -exit: - mbox_put(mbox); - return rc; -} - int roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, struct roc_cpt_inline_ipsec_inb_cfg *cfg) { diff --git a/drivers/common/cnxk/roc_cpt.h b/drivers/common/cnxk/roc_cpt.h index ed566c86b0..cabfff19a1 100644 --- a/drivers/common/cnxk/roc_cpt.h +++ b/drivers/common/cnxk/roc_cpt.h @@ -239,10 +239,6 @@ void __roc_api roc_cpt_lf_reset(struct roc_cpt_lf *lf); int __roc_api roc_cpt_lf_ctx_flush(struct roc_cpt_lf *lf, void *cptr, bool inval); int __roc_api roc_cpt_lf_ctx_reload(struct roc_cpt_lf *lf, void *cptr); -int roc_cpt_inline_ipsec_cfg(struct dev *dev, uint8_t slot, - struct roc_nix *nix); -int roc_cpt_inline_ipsec_inb_cfg_read(struct roc_cpt *roc_cpt, - struct roc_cpt_inline_ipsec_inb_cfg *cfg); int roc_cpt_inline_ipsec_inb_cfg(struct roc_cpt *roc_cpt, struct roc_cpt_inline_ipsec_inb_cfg *cfg); int __roc_api roc_cpt_afs_print(struct roc_cpt *roc_cpt); @@ -263,6 +259,4 @@ int __roc_api roc_cpt_int_misc_cb_unregister(roc_cpt_int_misc_cb_t cb, void *arg bool roc_cpt_has_ie_engines(void); -void roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq); - #endif /* _ROC_CPT_H_ */ diff --git a/drivers/common/cnxk/roc_cpt_debug.c b/drivers/common/cnxk/roc_cpt_debug.c index be7b68c940..8ad7d6bd98 100644 --- a/drivers/common/cnxk/roc_cpt_debug.c +++ b/drivers/common/cnxk/roc_cpt_debug.c @@ -191,28 +191,6 @@ roc_cpt_parse_hdr_dump(FILE *file, const union cpt_parse_hdr_u *cpth) cpt_cnxk_parse_hdr_dump(file, &cpth->s); } -void -roc_cpt_cq_dump(FILE *file, const struct cpt_cq_s *cq) -{ - cpt_dump(file, "CPT_CQ \t%p:", cq); - - /* W0 */ - cpt_dump(file, "W0: compcode \t0x%x\t\tdoneint \t%u\t", cq->w0.s.compcode, - cq->w0.s.doneint); - cpt_dump(file, "W0: uc_compcode \t0x%x\t\tuc_info \t0%" PRIu64, cq->w0.s.uc_compcode, - (uint64_t)cq->w0.s.uc_info); - - /* W1 */ - cpt_dump(file, "W1: esn \t%" PRIx64 "\t\n", cq->w1.esn); - - /* W2 */ - cpt_dump(file, "W2: fmt \t0x%x\t\tuc_info2 \t%" PRIu64, cq->w2.s.fmt, - (uint64_t)cq->w2.s.uc_info2); - - /* W3 */ - cpt_dump(file, "W3: comp_ptr \t0x%" PRIx64 "\t\n", cq->w3.comp_ptr); -} - static int cpt_af_reg_read(struct roc_cpt *roc_cpt, uint64_t reg, uint64_t *val) { diff --git a/drivers/common/cnxk/roc_dpi.c b/drivers/common/cnxk/roc_dpi.c index 7fd45f5918..7364d3a424 100644 --- a/drivers/common/cnxk/roc_dpi.c +++ b/drivers/common/cnxk/roc_dpi.c @@ -282,48 +282,6 @@ roc_dpi_disable(struct roc_dpi *roc_dpi) return 0; } -int -roc_dpi_configure(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uint64_t chunk_base) -{ - struct plt_pci_device *pci_dev; - dpi_mbox_msg_t mbox_msg; - int rc; - - if (!roc_dpi) { - plt_err("roc_dpi is NULL"); - return -EINVAL; - } - - pci_dev = roc_dpi->pci_dev; - - roc_dpi_disable(roc_dpi); - rc = roc_dpi_wait_queue_idle(roc_dpi); - if (rc) - return rc; - - plt_write64(0x0, roc_dpi->rbase + DPI_VDMA_REQQ_CTL); - plt_write64(chunk_base, roc_dpi->rbase + DPI_VDMA_SADDR); - mbox_msg.u[0] = 0; - mbox_msg.u[1] = 0; - /* DPI PF driver expects vfid starts from index 0 */ - mbox_msg.s.vfid = roc_dpi->vfid; - mbox_msg.s.pri = roc_dpi->priority; - mbox_msg.s.cmd = DPI_QUEUE_OPEN; - mbox_msg.s.csize = chunk_sz; - mbox_msg.s.aura = aura; - mbox_msg.s.sso_pf_func = idev_sso_pffunc_get(); - mbox_msg.s.npa_pf_func = idev_npa_pffunc_get(); - mbox_msg.s.wqecsoff = idev_dma_cs_offset_get(); - if (mbox_msg.s.wqecsoff) - mbox_msg.s.wqecs = 1; - - rc = send_msg_to_pf(&pci_dev->addr, (const char *)&mbox_msg, sizeof(dpi_mbox_msg_t)); - if (rc < 0) - plt_err("Failed to send mbox message %d to DPI PF, err %d", mbox_msg.s.cmd, rc); - - return rc; -} - int roc_dpi_configure_v2(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uint64_t chunk_base) { @@ -487,30 +445,6 @@ roc_dpi_lf_chan_tbl_select(struct roc_dpi_lf *lf) return rc; } -int -roc_dpi_lf_chan_tbl_ena_dis(struct roc_dpi_lf *lf, bool ena) -{ - struct mbox *mbox = mbox_get(lf->dev->mbox); - struct dpi_lf_chan_tbl_ena_dis_req *req; - int rc; - - req = mbox_alloc_msg_dpi_lf_chan_tbl_ena_dis(mbox); - if (req == NULL) { - rc = -ENOSPC; - goto exit; - } - - req->lf_slot = lf->slot; - req->dpi_blkaddr = lf->blk_addr; - req->ena_dis = ena; - - rc = mbox_process(mbox); - -exit: - mbox_put(mbox); - return rc; -} - int dpi_chan_tbl_update(struct dev *dev, uint8_t blk_addr, uint16_t chan_tbl, uint64_t *tbl, uint16_t off, uint16_t nb_entries) @@ -688,39 +622,6 @@ roc_dpi_lf_ring_init(struct roc_dpi_lf_que *que, struct roc_dpi_lf_ring_cfg *rcf return rc; } -void -roc_dpi_lf_ring_fini(struct roc_dpi_lf_que *que) -{ - if (que->mz) { - plt_memzone_free(que->mz); - que->mz = NULL; - } -} - -int -roc_dpi_lf_ring_chan_cfg(struct roc_dpi_lf_que *que, union roc_dpi_lf_ccfg *ccfg) -{ - struct roc_dpi_lf *lf = que->lf; - struct mbox *mbox = mbox_get(lf->dev->mbox); - struct dpi_lf_chan_cfg_req *req; - int rc = -ENOSPC; - - req = mbox_alloc_msg_dpi_lf_chan_cfg(mbox); - if (req == NULL) - goto fail; - - req->dpi_blkaddr = lf->blk_addr; - req->def_config = ccfg->u; - req->lf_slot = lf->slot; - req->ring_idx = que == lf->queue ? 0 : 1; - - rc = mbox_process(mbox); - -fail: - mbox_put(mbox); - return rc; -} - int dpi_lf_init(struct roc_dpi_lf *lf, struct dev *dev, uint8_t slot) { diff --git a/drivers/common/cnxk/roc_dpi.h b/drivers/common/cnxk/roc_dpi.h index 7d6281bb14..95335ef62a 100644 --- a/drivers/common/cnxk/roc_dpi.h +++ b/drivers/common/cnxk/roc_dpi.h @@ -79,8 +79,6 @@ int __roc_api roc_dpi_dev_fini(struct roc_dpi *roc_dpi); int __roc_api roc_dpi_rsrc_init(struct roc_dpi *roc_dpi); int __roc_api roc_dpi_rsrc_fini(struct roc_dpi *roc_dpi); -int roc_dpi_configure(struct roc_dpi *dpi, uint32_t chunk_sz, uint64_t aura, - uint64_t chunk_base); int __roc_api roc_dpi_configure_v2(struct roc_dpi *roc_dpi, uint32_t chunk_sz, uint64_t aura, uint64_t chunk_base); int __roc_api roc_dpi_enable(struct roc_dpi *dpi); @@ -89,13 +87,10 @@ int __roc_api roc_dpi_disable(struct roc_dpi *dpi); int __roc_api roc_dpi_reset(struct roc_dpi *dpi); int __roc_api roc_dpi_lf_ring_init(struct roc_dpi_lf_que *que, struct roc_dpi_lf_ring_cfg *rcfg); -void roc_dpi_lf_ring_fini(struct roc_dpi_lf_que *que); int __roc_api roc_dpi_lf_pffunc_cfg(struct roc_dpi_lf *lf); -int roc_dpi_lf_ring_chan_cfg(struct roc_dpi_lf_que *que, union roc_dpi_lf_ccfg *cfg); int __roc_api roc_dpi_lf_chan_tbl_alloc(struct roc_dpi_lf *lf, uint16_t tbl_sz); int __roc_api roc_dpi_lf_chan_tbl_free(struct roc_dpi_lf *lf); int __roc_api roc_dpi_lf_chan_tbl_select(struct roc_dpi_lf *lf); -int roc_dpi_lf_chan_tbl_ena_dis(struct roc_dpi_lf *lf, bool ena); int __roc_api roc_dpi_lf_chan_tbl_update(struct roc_dpi_lf *lf, uint64_t *config, uint16_t offset, uint16_t entries); int __roc_api roc_dpi_lf_dump(struct roc_dpi_lf *lf, FILE *file); diff --git a/drivers/common/cnxk/roc_idev.c b/drivers/common/cnxk/roc_idev.c index 17b99682fd..01510bf249 100644 --- a/drivers/common/cnxk/roc_idev.c +++ b/drivers/common/cnxk/roc_idev.c @@ -190,20 +190,6 @@ roc_idev_lmt_base_addr_get(void) return lmt_base_addr; } -uint16_t -roc_idev_num_lmtlines_get(void) -{ - struct idev_cfg *idev; - uint16_t num_lmtlines; - - idev = idev_get_cfg(); - num_lmtlines = 0; - if (idev != NULL) - num_lmtlines = idev->num_lmtlines; - - return num_lmtlines; -} - struct roc_cpt * roc_idev_cpt_get(void) { @@ -215,22 +201,6 @@ roc_idev_cpt_get(void) return NULL; } -struct roc_rvu_lf * -roc_idev_rvu_lf_get(uint8_t rvu_lf_idx) -{ - struct idev_cfg *idev = idev_get_cfg(); - struct roc_rvu_lf *rvu_lf = NULL; - - if (idev != NULL) { - TAILQ_FOREACH(rvu_lf, &idev->rvu_lf_list, next) { - if (rvu_lf->idx == rvu_lf_idx) - return rvu_lf; - } - } - - return NULL; -} - void roc_idev_rvu_lf_set(struct roc_rvu_lf *rvu) { @@ -393,16 +363,6 @@ idev_dma_cs_offset_get(void) return 0; } -uint64_t -roc_idev_nix_inl_meta_aura_get(void) -{ - struct idev_cfg *idev = idev_get_cfg(); - - if (idev != NULL) - return idev->inl_cfg.meta_aura; - return 0; -} - uint8_t roc_idev_nix_rx_inject_get(uint16_t port) { diff --git a/drivers/common/cnxk/roc_idev.h b/drivers/common/cnxk/roc_idev.h index 3d272ec641..f3b00605d8 100644 --- a/drivers/common/cnxk/roc_idev.h +++ b/drivers/common/cnxk/roc_idev.h @@ -13,13 +13,11 @@ void __roc_api roc_idev_npa_halo_ena_set(int halo_ena); /* LMT */ uint64_t __roc_api roc_idev_lmt_base_addr_get(void); -uint16_t roc_idev_num_lmtlines_get(void); struct roc_cpt *__roc_api roc_idev_cpt_get(void); void roc_idev_cpt_set(struct roc_cpt *cpt); struct roc_nix *__roc_api roc_idev_npa_nix_get(void); -uint64_t roc_idev_nix_inl_meta_aura_get(void); struct roc_nix_list *roc_idev_nix_list_get(void); struct roc_mcs *roc_idev_mcs_get(uint8_t mcs_idx); @@ -33,7 +31,7 @@ void roc_idev_nix_rx_chan_set(uint16_t port, uint16_t chan); uint16_t __roc_api roc_idev_nix_inl_dev_pffunc_get(void); -struct roc_rvu_lf *roc_idev_rvu_lf_get(uint8_t rvu_lf_idx); +struct roc_rvu_lf; void roc_idev_rvu_lf_set(struct roc_rvu_lf *rvu); void roc_idev_rvu_lf_free(struct roc_rvu_lf *rvu); #endif /* _ROC_IDEV_H_ */ diff --git a/drivers/common/cnxk/roc_mcs.c b/drivers/common/cnxk/roc_mcs.c index 1b45f5dad9..5894750f7e 100644 --- a/drivers/common/cnxk/roc_mcs.c +++ b/drivers/common/cnxk/roc_mcs.c @@ -72,32 +72,6 @@ roc_mcs_hw_info_get(struct roc_mcs_hw_info *hw_info) return rc; } -int -roc_mcs_active_lmac_set(struct roc_mcs *mcs, struct roc_mcs_set_active_lmac *lmac) -{ - struct mcs_set_active_lmac *req; - struct msg_rsp *rsp; - - /* Only needed for 105N */ - if (!roc_model_is_cnf10kb()) - return 0; - - if (lmac == NULL) - return -EINVAL; - - MCS_SUPPORT_CHECK; - - req = mbox_alloc_msg_mcs_set_active_lmac(mcs->mbox); - if (req == NULL) - return -ENOMEM; - - req->lmac_bmap = lmac->lmac_bmap; - req->channel_base = lmac->channel_base; - req->mcs_id = mcs->idx; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - static int mcs_port_reset_set(struct roc_mcs *mcs, struct roc_mcs_port_reset_req *port, uint8_t reset) { @@ -117,28 +91,6 @@ mcs_port_reset_set(struct roc_mcs *mcs, struct roc_mcs_port_reset_req *port, uin return mbox_process_msg(mcs->mbox, (void *)&rsp); } -int -roc_mcs_lmac_mode_set(struct roc_mcs *mcs, struct roc_mcs_set_lmac_mode *port) -{ - struct mcs_set_lmac_mode *req; - struct msg_rsp *rsp; - - if (port == NULL) - return -EINVAL; - - MCS_SUPPORT_CHECK; - - req = mbox_alloc_msg_mcs_set_lmac_mode(mcs->mbox); - if (req == NULL) - return -ENOMEM; - - req->lmac_id = port->lmac_id; - req->mcs_id = mcs->idx; - req->mode = port->mode; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - int roc_mcs_pn_threshold_set(struct roc_mcs *mcs, struct roc_mcs_set_pn_threshold *pn) { @@ -162,181 +114,6 @@ roc_mcs_pn_threshold_set(struct roc_mcs *mcs, struct roc_mcs_set_pn_threshold *p return mbox_process_msg(mcs->mbox, (void *)&rsp); } -int -roc_mcs_ctrl_pkt_rule_alloc(struct roc_mcs *mcs, struct roc_mcs_alloc_ctrl_pkt_rule_req *req, - struct roc_mcs_alloc_ctrl_pkt_rule_rsp *rsp) -{ - struct mcs_alloc_ctrl_pkt_rule_req *rule_req; - struct mcs_alloc_ctrl_pkt_rule_rsp *rule_rsp; - int rc; - - MCS_SUPPORT_CHECK; - - if (req == NULL || rsp == NULL) - return -EINVAL; - - rule_req = mbox_alloc_msg_mcs_alloc_ctrl_pkt_rule(mcs->mbox); - if (rule_req == NULL) - return -ENOMEM; - - rule_req->rule_type = req->rule_type; - rule_req->mcs_id = mcs->idx; - rule_req->dir = req->dir; - - rc = mbox_process_msg(mcs->mbox, (void *)&rule_rsp); - if (rc) - return rc; - - rsp->rule_type = rule_rsp->rule_type; - rsp->rule_idx = rule_rsp->rule_idx; - rsp->dir = rule_rsp->dir; - - return 0; -} - -int -roc_mcs_ctrl_pkt_rule_free(struct roc_mcs *mcs, struct roc_mcs_free_ctrl_pkt_rule_req *req) -{ - struct mcs_free_ctrl_pkt_rule_req *rule_req; - struct msg_rsp *rsp; - - MCS_SUPPORT_CHECK; - - if (req == NULL) - return -EINVAL; - - rule_req = mbox_alloc_msg_mcs_free_ctrl_pkt_rule(mcs->mbox); - if (rule_req == NULL) - return -ENOMEM; - - rule_req->rule_type = req->rule_type; - rule_req->rule_idx = req->rule_idx; - rule_req->mcs_id = mcs->idx; - rule_req->dir = req->dir; - rule_req->all = req->all; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - -int -roc_mcs_ctrl_pkt_rule_write(struct roc_mcs *mcs, struct roc_mcs_ctrl_pkt_rule_write_req *req) -{ - struct mcs_ctrl_pkt_rule_write_req *rule_req; - struct msg_rsp *rsp; - - MCS_SUPPORT_CHECK; - - if (req == NULL) - return -EINVAL; - - rule_req = mbox_alloc_msg_mcs_ctrl_pkt_rule_write(mcs->mbox); - if (rule_req == NULL) - return -ENOMEM; - - rule_req->rule_type = req->rule_type; - rule_req->rule_idx = req->rule_idx; - rule_req->mcs_id = mcs->idx; - rule_req->dir = req->dir; - rule_req->data0 = req->data0; - rule_req->data1 = req->data1; - rule_req->data2 = req->data2; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - -int -roc_mcs_port_cfg_set(struct roc_mcs *mcs, struct roc_mcs_port_cfg_set_req *req) -{ - struct mcs_port_cfg_set_req *set_req; - struct msg_rsp *rsp; - - MCS_SUPPORT_CHECK; - - if (req == NULL) - return -EINVAL; - - set_req = mbox_alloc_msg_mcs_port_cfg_set(mcs->mbox); - if (set_req == NULL) - return -ENOMEM; - - set_req->cstm_tag_rel_mode_sel = req->cstm_tag_rel_mode_sel; - set_req->custom_hdr_enb = req->custom_hdr_enb; - set_req->fifo_skid = req->fifo_skid; - set_req->lmac_mode = req->port_mode; - set_req->lmac_id = req->port_id; - set_req->mcs_id = mcs->idx; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - -int -roc_mcs_port_cfg_get(struct roc_mcs *mcs, struct roc_mcs_port_cfg_get_req *req, - struct roc_mcs_port_cfg_get_rsp *rsp) -{ - struct mcs_port_cfg_get_req *get_req; - struct mcs_port_cfg_get_rsp *get_rsp; - int rc; - - MCS_SUPPORT_CHECK; - - if (req == NULL) - return -EINVAL; - - get_req = mbox_alloc_msg_mcs_port_cfg_get(mcs->mbox); - if (get_req == NULL) - return -ENOMEM; - - get_req->lmac_id = req->port_id; - get_req->mcs_id = mcs->idx; - - rc = mbox_process_msg(mcs->mbox, (void *)&get_rsp); - if (rc) - return rc; - - rsp->cstm_tag_rel_mode_sel = get_rsp->cstm_tag_rel_mode_sel; - rsp->custom_hdr_enb = get_rsp->custom_hdr_enb; - rsp->fifo_skid = get_rsp->fifo_skid; - rsp->port_mode = get_rsp->lmac_mode; - rsp->port_id = get_rsp->lmac_id; - - return 0; -} - -int -roc_mcs_custom_tag_cfg_get(struct roc_mcs *mcs, struct roc_mcs_custom_tag_cfg_get_req *req, - struct roc_mcs_custom_tag_cfg_get_rsp *rsp) -{ - struct mcs_custom_tag_cfg_get_req *get_req; - struct mcs_custom_tag_cfg_get_rsp *get_rsp; - int i, rc; - - MCS_SUPPORT_CHECK; - - if (req == NULL) - return -EINVAL; - - get_req = mbox_alloc_msg_mcs_custom_tag_cfg_get(mcs->mbox); - if (get_req == NULL) - return -ENOMEM; - - get_req->dir = req->dir; - get_req->mcs_id = mcs->idx; - - rc = mbox_process_msg(mcs->mbox, (void *)&get_rsp); - if (rc) - return rc; - - for (i = 0; i < 8; i++) { - rsp->cstm_etype[i] = get_rsp->cstm_etype[i]; - rsp->cstm_indx[i] = get_rsp->cstm_indx[i]; - } - - rsp->cstm_etype_en = get_rsp->cstm_etype_en; - rsp->dir = get_rsp->dir; - - return 0; -} - int roc_mcs_intr_configure(struct roc_mcs *mcs, struct roc_mcs_intr_cfg *config) { @@ -605,36 +382,6 @@ roc_mcs_port_recovery(struct roc_mcs *mcs, union roc_mcs_event_data *mdata, uint return rc; } -int -roc_mcs_port_reset(struct roc_mcs *mcs, struct roc_mcs_port_reset_req *port) -{ - struct roc_mcs_event_desc desc = {0}; - int rc; - - /* Initiate port reset and software recovery */ - rc = roc_mcs_port_recovery(mcs, &desc.metadata, port->port_id); - if (rc) - goto exit; - - desc.type = ROC_MCS_EVENT_PORT_RESET_RECOVERY; - /* Notify the entity details to the application which are recovered */ - mcs_event_cb_process(mcs, &desc); - -exit: - if (desc.metadata.num_tx_sa) - plt_free(desc.metadata.tx_sa_array); - if (desc.metadata.num_rx_sa) - plt_free(desc.metadata.rx_sa_array); - if (desc.metadata.num_tx_sc) - plt_free(desc.metadata.tx_sc_array); - if (desc.metadata.num_rx_sc) { - plt_free(desc.metadata.rx_sc_array); - plt_free(desc.metadata.sc_an_array); - } - - return rc; -} - int roc_mcs_event_cb_register(struct roc_mcs *mcs, enum roc_mcs_event_type event, roc_mcs_dev_cb_fn cb_fn, void *cb_arg, void *userdata) diff --git a/drivers/common/cnxk/roc_mcs.h b/drivers/common/cnxk/roc_mcs.h index eb50219561..bba7b855e6 100644 --- a/drivers/common/cnxk/roc_mcs.h +++ b/drivers/common/cnxk/roc_mcs.h @@ -508,22 +508,13 @@ __roc_api struct roc_mcs *roc_mcs_dev_get(uint8_t mcs_idx); /* HW info get */ __roc_api int roc_mcs_hw_info_get(struct roc_mcs_hw_info *hw_info); /* Active lmac bmap set */ -int roc_mcs_active_lmac_set(struct roc_mcs *mcs, struct roc_mcs_set_active_lmac *lmac); /* Port bypass mode set */ -int roc_mcs_lmac_mode_set(struct roc_mcs *mcs, struct roc_mcs_set_lmac_mode *port); /* (X)PN threshold set */ __roc_api int roc_mcs_pn_threshold_set(struct roc_mcs *mcs, struct roc_mcs_set_pn_threshold *pn); /* Reset port */ -int roc_mcs_port_reset(struct roc_mcs *mcs, struct roc_mcs_port_reset_req *port); /* Get port config */ -int roc_mcs_port_cfg_set(struct roc_mcs *mcs, struct roc_mcs_port_cfg_set_req *req); /* Set port config */ -int roc_mcs_port_cfg_get(struct roc_mcs *mcs, struct roc_mcs_port_cfg_get_req *req, - struct roc_mcs_port_cfg_get_rsp *rsp); /* Get custom tag config */ -int roc_mcs_custom_tag_cfg_get(struct roc_mcs *mcs, - struct roc_mcs_custom_tag_cfg_get_req *req, - struct roc_mcs_custom_tag_cfg_get_rsp *rsp); /* Resource allocation and free */ __roc_api int roc_mcs_rsrc_alloc(struct roc_mcs *mcs, struct roc_mcs_alloc_rsrc_req *req, @@ -532,56 +523,31 @@ __roc_api int roc_mcs_rsrc_free(struct roc_mcs *mcs, struct roc_mcs_free_rsrc_re /* SA policy read and write */ __roc_api int roc_mcs_sa_policy_write(struct roc_mcs *mcs, struct roc_mcs_sa_plcy_write_req *sa_plcy); -int roc_mcs_sa_policy_read(struct roc_mcs *mcs, - struct roc_mcs_sa_plcy_write_req *sa_plcy); /* PN Table read and write */ __roc_api int roc_mcs_pn_table_write(struct roc_mcs *mcs, struct roc_mcs_pn_table_write_req *pn_table); -int roc_mcs_pn_table_read(struct roc_mcs *mcs, - struct roc_mcs_pn_table_write_req *pn_table); /* RX SC read, write and enable */ __roc_api int roc_mcs_rx_sc_cam_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); -int roc_mcs_rx_sc_cam_read(struct roc_mcs *mcs, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); -int roc_mcs_rx_sc_cam_enable(struct roc_mcs *mcs, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); /* SECY policy read and write */ __roc_api int roc_mcs_secy_policy_write(struct roc_mcs *mcs, struct roc_mcs_secy_plcy_write_req *secy_plcy); -int roc_mcs_secy_policy_read(struct roc_mcs *mcs, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam); /* RX SC-SA MAP read and write */ __roc_api int roc_mcs_rx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map); -int roc_mcs_rx_sc_sa_map_read(struct roc_mcs *mcs, - struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map); /* TX SC-SA MAP read and write */ __roc_api int roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); -int roc_mcs_tx_sc_sa_map_read(struct roc_mcs *mcs, - struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map); /* SA to Port map update */ __roc_api void roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id); /* Flow entry read, write and enable */ __roc_api int roc_mcs_flowid_entry_write(struct roc_mcs *mcs, struct roc_mcs_flowid_entry_write_req *flowid_req); -int roc_mcs_flowid_entry_read(struct roc_mcs *mcs, - struct roc_mcs_flowid_entry_write_req *flowid_rsp); -int roc_mcs_flowid_entry_enable(struct roc_mcs *mcs, - struct roc_mcs_flowid_ena_dis_entry *entry); /* Control packet rule alloc, free and write */ -int roc_mcs_ctrl_pkt_rule_alloc(struct roc_mcs *mcs, - struct roc_mcs_alloc_ctrl_pkt_rule_req *req, - struct roc_mcs_alloc_ctrl_pkt_rule_rsp *rsp); -int roc_mcs_ctrl_pkt_rule_free(struct roc_mcs *mcs, - struct roc_mcs_free_ctrl_pkt_rule_req *req); -int roc_mcs_ctrl_pkt_rule_write(struct roc_mcs *mcs, - struct roc_mcs_ctrl_pkt_rule_write_req *req); /* Flow id stats get */ __roc_api int roc_mcs_flowid_stats_get(struct roc_mcs *mcs, struct roc_mcs_stats_req *mcs_req, diff --git a/drivers/common/cnxk/roc_mcs_sec_cfg.c b/drivers/common/cnxk/roc_mcs_sec_cfg.c index e2fd3e7b8c..5b8c3b27bd 100644 --- a/drivers/common/cnxk/roc_mcs_sec_cfg.c +++ b/drivers/common/cnxk/roc_mcs_sec_cfg.c @@ -201,15 +201,6 @@ roc_mcs_sa_policy_write(struct roc_mcs *mcs, struct roc_mcs_sa_plcy_write_req *s return mbox_process_msg(mcs->mbox, (void *)&rsp); } -int -roc_mcs_sa_policy_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_sa_plcy_write_req *sa __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_pn_table_write(struct roc_mcs *mcs, struct roc_mcs_pn_table_write_req *pn_table) { @@ -233,15 +224,6 @@ roc_mcs_pn_table_write(struct roc_mcs *mcs, struct roc_mcs_pn_table_write_req *p return mbox_process_msg(mcs->mbox, (void *)&rsp); } -int -roc_mcs_pn_table_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_pn_table_write_req *sa __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_rx_sc_cam_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam) { @@ -280,24 +262,6 @@ roc_mcs_rx_sc_cam_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_cam_write_req return 0; } -int -roc_mcs_rx_sc_cam_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - -int -roc_mcs_rx_sc_cam_enable(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_secy_policy_write(struct roc_mcs *mcs, struct roc_mcs_secy_plcy_write_req *secy_plcy) { @@ -321,15 +285,6 @@ roc_mcs_secy_policy_write(struct roc_mcs *mcs, struct roc_mcs_secy_plcy_write_re return mbox_process_msg(mcs->mbox, (void *)&rsp); } -int -roc_mcs_secy_policy_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_rx_sc_cam_write_req *rx_sc_cam __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_rx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map) { @@ -373,15 +328,6 @@ roc_mcs_rx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_rx_sc_sa_map *rx_ return 0; } -int -roc_mcs_rx_sc_sa_map_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_rx_sc_sa_map *rx_sc_sa_map __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map) { @@ -435,15 +381,6 @@ roc_mcs_tx_sc_sa_map_write(struct roc_mcs *mcs, struct roc_mcs_tx_sc_sa_map *tx_ return 0; } -int -roc_mcs_tx_sc_sa_map_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_tx_sc_sa_map *tx_sc_sa_map __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - int roc_mcs_flowid_entry_write(struct roc_mcs *mcs, struct roc_mcs_flowid_entry_write_req *flowid_req) { @@ -495,38 +432,6 @@ roc_mcs_flowid_entry_write(struct roc_mcs *mcs, struct roc_mcs_flowid_entry_writ return 0; } -int -roc_mcs_flowid_entry_read(struct roc_mcs *mcs __plt_unused, - struct roc_mcs_flowid_entry_write_req *flowid_rsp __plt_unused) -{ - MCS_SUPPORT_CHECK; - - return -ENOTSUP; -} - -int -roc_mcs_flowid_entry_enable(struct roc_mcs *mcs, struct roc_mcs_flowid_ena_dis_entry *entry) -{ - struct mcs_flowid_ena_dis_entry *flow_entry; - struct msg_rsp *rsp; - - MCS_SUPPORT_CHECK; - - if (entry == NULL) - return -EINVAL; - - flow_entry = mbox_alloc_msg_mcs_flowid_ena_entry(mcs->mbox); - if (flow_entry == NULL) - return -ENOMEM; - - flow_entry->flow_id = entry->flow_id; - flow_entry->ena = entry->ena; - flow_entry->mcs_id = mcs->idx; - flow_entry->dir = entry->dir; - - return mbox_process_msg(mcs->mbox, (void *)&rsp); -} - void roc_mcs_sa_port_map_update(struct roc_mcs *mcs, int sa_id, uint8_t port_id) { diff --git a/drivers/common/cnxk/roc_ml.c b/drivers/common/cnxk/roc_ml.c index e82bb58943..6f9869125a 100644 --- a/drivers/common/cnxk/roc_ml.c +++ b/drivers/common/cnxk/roc_ml.c @@ -94,44 +94,6 @@ roc_ml_addr_mlip2ap(struct roc_ml *roc_ml, void *addr) return PLT_PTR_ADD(addr, ml_mlr_base - ML_AXI_START_ADDR); } -uint64_t -roc_ml_addr_pa_to_offset(struct roc_ml *roc_ml, uint64_t phys_addr) -{ - struct ml *ml = roc_ml_to_ml_priv(roc_ml); - - if (roc_model_is_cn10ka()) - return phys_addr - ml->pci_dev->mem_resource[0].phys_addr; - else - return phys_addr - ml->pci_dev->mem_resource[0].phys_addr - ML_MLAB_BLK_OFFSET; -} - -uint64_t -roc_ml_addr_offset_to_pa(struct roc_ml *roc_ml, uint64_t offset) -{ - struct ml *ml = roc_ml_to_ml_priv(roc_ml); - - if (roc_model_is_cn10ka()) - return ml->pci_dev->mem_resource[0].phys_addr + offset; - else - return ml->pci_dev->mem_resource[0].phys_addr + ML_MLAB_BLK_OFFSET + offset; -} - -void -roc_ml_scratch_write_job(struct roc_ml *roc_ml, void *work_ptr) -{ - union ml_scratch_work_ptr_s reg_work_ptr; - union ml_scratch_fw_ctrl_s reg_fw_ctrl; - - reg_work_ptr.u64 = 0; - reg_work_ptr.s.work_ptr = PLT_U64_CAST(roc_ml_addr_ap2mlip(roc_ml, work_ptr)); - - reg_fw_ctrl.u64 = 0; - reg_fw_ctrl.s.valid = 1; - - roc_ml_reg_write64(roc_ml, reg_work_ptr.u64, ML_SCRATCH_WORK_PTR); - roc_ml_reg_write64(roc_ml, reg_fw_ctrl.u64, ML_SCRATCH_FW_CTRL); -} - bool roc_ml_scratch_is_valid_bit_set(struct roc_ml *roc_ml) { @@ -567,62 +529,3 @@ roc_ml_dev_fini(struct roc_ml *roc_ml) return 0; } - -int -roc_ml_blk_init(struct roc_bphy *roc_bphy, struct roc_ml *roc_ml) -{ - struct dev *dev; - struct ml *ml; - - if ((roc_ml == NULL) || (roc_bphy == NULL)) - return -EINVAL; - - PLT_STATIC_ASSERT(sizeof(struct ml) <= ROC_ML_MEM_SZ); - - ml = roc_ml_to_ml_priv(roc_ml); - memset(ml, 0, sizeof(*ml)); - - dev = &ml->dev; - - ml->pci_dev = roc_bphy->pci_dev; - dev->roc_ml = roc_ml; - - plt_ml_dbg( - "MLAB: Physical Address : 0x%016lx", - PLT_PTR_ADD_U64_CAST( - (void *)(uintptr_t)(ml->pci_dev->mem_resource[0].phys_addr), - ML_MLAB_BLK_OFFSET)); - plt_ml_dbg("MLAB: Virtual Address : 0x%016lx", - PLT_PTR_ADD_U64_CAST(ml->pci_dev->mem_resource[0].addr, ML_MLAB_BLK_OFFSET)); - - ml->ml_reg_addr = PLT_PTR_ADD(ml->pci_dev->mem_resource[0].addr, ML_MLAB_BLK_OFFSET); - ml->ml_mlr_base = 0; - ml->ml_mlr_base_saved = false; - - plt_spinlock_init(&roc_ml->sp_spinlock); - plt_spinlock_init(&roc_ml->fp_spinlock); - - return 0; -} - -int -roc_ml_blk_fini(struct roc_bphy *roc_bphy, struct roc_ml *roc_ml) -{ - struct ml *ml; - - if ((roc_ml == NULL) || (roc_bphy == NULL)) - return -EINVAL; - - ml = roc_ml_to_ml_priv(roc_ml); - - if (ml == NULL) - return -EINVAL; - - return 0; -} - -uint16_t -roc_ml_sso_pf_func_get(void) -{ - return idev_sso_pffunc_get(); -} diff --git a/drivers/common/cnxk/roc_ml.h b/drivers/common/cnxk/roc_ml.h index 8d4f5b5097..43cb7e9c3a 100644 --- a/drivers/common/cnxk/roc_ml.h +++ b/drivers/common/cnxk/roc_ml.h @@ -117,13 +117,10 @@ void __roc_api roc_ml_reg_write32(struct roc_ml *roc_ml, uint32_t val, uint64_t void __roc_api roc_ml_reg_save(struct roc_ml *roc_ml, uint64_t offset); /* Address translation functions */ -uint64_t roc_ml_addr_pa_to_offset(struct roc_ml *roc_ml, uint64_t phys_addr); -uint64_t roc_ml_addr_offset_to_pa(struct roc_ml *roc_ml, uint64_t offset); void *__roc_api roc_ml_addr_ap2mlip(struct roc_ml *roc_ml, void *addr); void *__roc_api roc_ml_addr_mlip2ap(struct roc_ml *roc_ml, void *addr); /* Scratch and JCMDQ functions */ -void roc_ml_scratch_write_job(struct roc_ml *roc_ml, void *jd); bool roc_ml_scratch_is_valid_bit_set(struct roc_ml *roc_ml); bool __roc_api roc_ml_scratch_is_done_bit_set(struct roc_ml *roc_ml); bool __roc_api roc_ml_scratch_enqueue(struct roc_ml *roc_ml, void *work_ptr); @@ -143,10 +140,7 @@ int __roc_api roc_ml_mlip_reset(struct roc_ml *roc_ml, bool force); /* Device / block functions */ int __roc_api roc_ml_dev_init(struct roc_ml *roc_ml); int __roc_api roc_ml_dev_fini(struct roc_ml *roc_ml); -int roc_ml_blk_init(struct roc_bphy *roc_bphy, struct roc_ml *roc_ml); -int roc_ml_blk_fini(struct roc_bphy *roc_bphy, struct roc_ml *roc_ml); /* Utility functions */ -uint16_t roc_ml_sso_pf_func_get(void); #endif /*_ROC_ML_H_*/ diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index ae6a918682..ce957d061f 100644 --- a/drivers/common/cnxk/roc_nix.c +++ b/drivers/common/cnxk/roc_nix.c @@ -30,14 +30,6 @@ roc_nix_get_base_chan(struct roc_nix *roc_nix) return nix->rx_chan_base; } -uint8_t -roc_nix_get_rx_chan_cnt(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - return nix->rx_chan_cnt; -} - uint16_t roc_nix_get_vwqe_interval(struct roc_nix *roc_nix) { diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 6afc4e4922..f3729f5e77 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -667,7 +667,6 @@ bool __roc_api roc_nix_is_sdp(struct roc_nix *roc_nix); bool __roc_api roc_nix_is_pf(struct roc_nix *roc_nix); bool __roc_api roc_nix_is_vf_or_sdp(struct roc_nix *roc_nix); int __roc_api roc_nix_get_base_chan(struct roc_nix *roc_nix); -uint8_t roc_nix_get_rx_chan_cnt(struct roc_nix *roc_nix); int __roc_api roc_nix_get_pf(struct roc_nix *roc_nix); int __roc_api roc_nix_get_vf(struct roc_nix *roc_nix); uint16_t __roc_api roc_nix_get_pf_func(struct roc_nix *roc_nix); @@ -812,7 +811,6 @@ int __roc_api roc_nix_tm_node_add(struct roc_nix *roc_nix, struct roc_nix_tm_node *roc_node); int __roc_api roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id, bool free); -int roc_nix_tm_free_resources(struct roc_nix *roc_nix, bool hw_only); int __roc_api roc_nix_tm_node_suspend_resume(struct roc_nix *roc_nix, uint32_t node_id, bool suspend); int __roc_api roc_nix_tm_node_parent_update(struct roc_nix *roc_nix, @@ -823,27 +821,17 @@ int __roc_api roc_nix_tm_node_shaper_update(struct roc_nix *roc_nix, uint32_t node_id, uint32_t profile_id, bool force_update); -int roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix, - uint32_t node_id, bool pkt_mode); int __roc_api roc_nix_tm_shaper_profile_add( struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *profile); -int roc_nix_tm_shaper_profile_update( - struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *profile); int __roc_api roc_nix_tm_shaper_profile_delete(struct roc_nix *roc_nix, uint32_t id); -int roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl, - uint16_t discontig, uint16_t contig); uint16_t __roc_api roc_nix_tm_leaf_cnt(struct roc_nix *roc_nix); struct roc_nix_tm_node *__roc_api roc_nix_tm_node_get(struct roc_nix *roc_nix, uint32_t node_id); -struct roc_nix_tm_node * -roc_nix_tm_node_next(struct roc_nix *roc_nix, struct roc_nix_tm_node *__prev); struct roc_nix_tm_shaper_profile *__roc_api roc_nix_tm_shaper_profile_get(struct roc_nix *roc_nix, uint32_t profile_id); -struct roc_nix_tm_shaper_profile *roc_nix_tm_shaper_profile_next( - struct roc_nix *roc_nix, struct roc_nix_tm_shaper_profile *__prev); int __roc_api roc_nix_tm_node_stats_get(struct roc_nix *roc_nix, uint32_t node_id, bool clear, @@ -871,15 +859,8 @@ int roc_nix_tm_hierarchy_xmit_enable(struct roc_nix *roc_nix, enum roc_nix_tm_tr /* * TM utilities API. */ -int roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id); -bool roc_nix_tm_root_has_sp(struct roc_nix *roc_nix); -void roc_nix_tm_rsrc_max(bool pf, uint16_t schq[ROC_TM_LVL_MAX]); int __roc_api roc_nix_tm_rsrc_count(struct roc_nix *roc_nix, uint16_t schq[ROC_TM_LVL_MAX]); -int roc_nix_tm_node_name_get(struct roc_nix *roc_nix, - uint32_t node_id, char *buf, - size_t buflen); -int roc_nix_smq_flush(struct roc_nix *roc_nix); int __roc_api roc_nix_tm_max_prio(struct roc_nix *roc_nix, int lvl); int __roc_api roc_nix_tm_lvl_is_leaf(struct roc_nix *roc_nix, int lvl); void __roc_api @@ -916,8 +897,6 @@ int __roc_api roc_nix_bpf_free(struct roc_nix *roc_nix, struct roc_nix_bpf_objs *profs, uint8_t num_prof); -int roc_nix_bpf_free_all(struct roc_nix *roc_nix); - int __roc_api roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t id, enum roc_nix_bpf_level_flag lvl_flag, struct roc_nix_bpf_cfg *cfg); @@ -925,9 +904,6 @@ int __roc_api roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t id, int __roc_api roc_nix_bpf_ena_dis(struct roc_nix *roc_nix, uint16_t id, struct roc_nix_rq *rq, bool enable); -int roc_nix_bpf_dump(struct roc_nix *roc_nix, uint16_t id, - enum roc_nix_bpf_level_flag lvl_flag); - int __roc_api roc_nix_bpf_pre_color_tbl_setup( struct roc_nix *roc_nix, uint16_t id, enum roc_nix_bpf_level_flag lvl_flag, struct roc_nix_bpf_precolor *tbl); @@ -946,20 +922,12 @@ int __roc_api roc_nix_bpf_stats_reset(struct roc_nix *roc_nix, uint16_t id, uint64_t mask, enum roc_nix_bpf_level_flag lvl_flag); -int -roc_nix_bpf_lf_stats_read(struct roc_nix *roc_nix, uint64_t mask, - uint64_t stats[ROC_NIX_BPF_STATS_MAX] /* Out */); - -int roc_nix_bpf_lf_stats_reset(struct roc_nix *roc_nix, - uint64_t mask); - uint8_t __roc_api roc_nix_bpf_level_to_idx(enum roc_nix_bpf_level_flag lvl_flag); uint8_t __roc_api roc_nix_bpf_stats_to_idx(enum roc_nix_bpf_stats lvl_flag); /* MAC */ -int roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start); int __roc_api roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix, bool start); int __roc_api roc_nix_mac_loopback_enable(struct roc_nix *roc_nix, bool enable); @@ -977,7 +945,6 @@ int __roc_api roc_nix_mac_link_info_get(struct roc_nix *roc_nix, struct roc_nix_link_info *link_info); int __roc_api roc_nix_mac_fec_set(struct roc_nix *roc_nix, int fec); int __roc_api roc_nix_mac_fec_supported_get(struct roc_nix *roc_nix, uint64_t *supported_fec); -int roc_nix_mac_mtu_set(struct roc_nix *roc_nix, uint16_t mtu); int __roc_api roc_nix_mac_max_rx_len_set(struct roc_nix *roc_nix, uint16_t maxlen); int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, @@ -985,9 +952,7 @@ int __roc_api roc_nix_mac_link_cb_register(struct roc_nix *roc_nix, void __roc_api roc_nix_mac_link_cb_unregister(struct roc_nix *roc_nix); int __roc_api roc_nix_mac_link_info_get_cb_register( struct roc_nix *roc_nix, link_info_get_t link_info_get); -void roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix); int __roc_api roc_nix_q_err_cb_register(struct roc_nix *roc_nix, q_err_get_t sq_err_handle); -void roc_nix_q_err_cb_unregister(struct roc_nix *roc_nix); int __roc_api roc_nix_mac_stats_reset(struct roc_nix *roc_nix); int __roc_api roc_nix_mac_fwdata_get(struct roc_nix *roc_nix, struct roc_nix_mac_fwdata *fwdata); @@ -998,9 +963,6 @@ int __roc_api roc_nix_switch_hdr_set(struct roc_nix *roc_nix, uint64_t switch_he int __roc_api roc_nix_lso_fmt_setup(struct roc_nix *roc_nix); int __roc_api roc_nix_lso_fmt_get(struct roc_nix *roc_nix, uint8_t udp_tun[ROC_NIX_LSO_TUN_MAX], uint8_t tun[ROC_NIX_LSO_TUN_MAX]); -int roc_nix_lso_fmt_ipv4_frag_get(struct roc_nix *roc_nix); -int roc_nix_lso_custom_fmt_setup(struct roc_nix *roc_nix, struct nix_lso_format *fields, - uint16_t nb_fields); int roc_nix_lso_alt_flags_profile_setup(struct roc_nix *roc_nix, nix_lso_alt_flg_format_t *fmt); @@ -1011,18 +973,12 @@ int __roc_api roc_nix_eeprom_info_get(struct roc_nix *roc_nix, int __roc_api roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg); -int roc_nix_fc_config_get(struct roc_nix *roc_nix, - struct roc_nix_fc_cfg *fc_cfg); - int __roc_api roc_nix_fc_mode_set(struct roc_nix *roc_nix, enum roc_nix_fc_mode mode); int __roc_api roc_nix_pfc_mode_set(struct roc_nix *roc_nix, struct roc_nix_pfc_cfg *pfc_cfg); -int roc_nix_pfc_mode_get(struct roc_nix *roc_nix, - struct roc_nix_pfc_cfg *pfc_cfg); - 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); @@ -1031,8 +987,6 @@ void roc_nix_fc_npa_bp_cfg(struct roc_nix *roc_nix, uint64_t pool_id, uint8_t en uint8_t force, uint8_t tc, uint64_t drop_percent); int roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, uint8_t bp_cnt, uint16_t *bpids); -int roc_nix_bpids_free(struct roc_nix *roc_nix, uint8_t bp_cnt, - uint16_t *bpids); int roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t *cfg); int roc_nix_rx_chan_cfg_set(struct roc_nix *roc_nix, uint16_t chan, @@ -1080,7 +1034,6 @@ int __roc_api roc_nix_stats_queue_get(struct roc_nix *roc_nix, uint16_t qid, struct roc_nix_stats_queue *qstats); int __roc_api roc_nix_stats_queue_reset(struct roc_nix *roc_nix, uint16_t qid, bool is_rx); -int roc_nix_num_xstats_get(struct roc_nix *roc_nix); int __roc_api roc_nix_xstats_get(struct roc_nix *roc_nix, struct roc_nix_xstat *xstats, unsigned int n); int __roc_api roc_nix_xstats_names_get(struct roc_nix *roc_nix, @@ -1094,9 +1047,6 @@ int __roc_api roc_nix_rq_modify(struct roc_nix *roc_nix, struct roc_nix_rq *rq, bool ena); int __roc_api roc_nix_rq_cman_config(struct roc_nix *roc_nix, struct roc_nix_rq *rq); int __roc_api roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable); -int roc_nix_rq_multi_ena_dis(struct roc_nix *roc_nix, struct roc_nix_rq *rqs, - int nb_rx_queues, bool enable); -int roc_nix_rq_is_sso_enable(struct roc_nix *roc_nix, uint32_t qid); int __roc_api roc_nix_rq_fini(struct roc_nix_rq *rq); int __roc_api roc_nix_cq_init(struct roc_nix *roc_nix, struct roc_nix_cq *cq); int __roc_api roc_nix_cq_fini(struct roc_nix_cq *cq); @@ -1108,7 +1058,6 @@ int __roc_api roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable); void __roc_api roc_nix_sq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, uint32_t *head, uint32_t *tail); int roc_nix_sq_cnt_update(struct roc_nix_sq *sq, bool enable); -int roc_nix_sq_resize(struct roc_nix_sq *sq, uint32_t nb_desc); /* PTP */ int __roc_api roc_nix_ptp_rx_ena_dis(struct roc_nix *roc_nix, int enable); @@ -1119,41 +1068,11 @@ int __roc_api roc_nix_ptp_sync_time_adjust(struct roc_nix *roc_nix, int64_t delta); int __roc_api roc_nix_ptp_info_cb_register(struct roc_nix *roc_nix, ptp_info_update_t ptp_update); -void roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix); bool __roc_api roc_nix_ptp_is_enable(struct roc_nix *roc_nix); /* VLAN */ -int -roc_nix_vlan_mcam_entry_read(struct roc_nix *roc_nix, uint32_t index, - void **rsp); -int roc_nix_vlan_mcam_entry_write(struct roc_nix *roc_nix, uint32_t index, void *entry, - uint8_t intf, uint8_t enable); -int roc_nix_vlan_mcam_entry_alloc_and_write(struct roc_nix *roc_nix, void *entry, - uint8_t intf, uint8_t priority, - uint8_t ref_entry); -int roc_nix_vlan_mcam_entry_free(struct roc_nix *roc_nix, - uint32_t index); -int roc_nix_vlan_mcam_entry_ena_dis(struct roc_nix *roc_nix, - uint32_t index, const int enable); -int roc_nix_vlan_strip_vtag_ena_dis(struct roc_nix *roc_nix, - bool enable); -int roc_nix_vlan_insert_ena_dis(struct roc_nix *roc_nix, - struct roc_nix_vlan_config *vlan_cfg, - uint64_t *mcam_index, bool enable); -int roc_nix_vlan_tpid_set(struct roc_nix *roc_nix, uint32_t type, - uint16_t tpid); /* MCAST*/ -int roc_nix_mcast_mcam_entry_alloc(struct roc_nix *roc_nix, - uint16_t nb_entries, - uint8_t priority, - uint16_t index[]); -int roc_nix_mcast_mcam_entry_free(struct roc_nix *roc_nix, - uint32_t index); -int roc_nix_mcast_mcam_entry_write(struct roc_nix *roc_nix, void *entry, uint32_t index, - uint8_t intf, uint64_t action); -int roc_nix_mcast_mcam_entry_ena_dis(struct roc_nix *roc_nix, uint32_t index, - bool enable); int roc_nix_mcast_list_setup(struct mbox *mbox, uint8_t intf, int nb_entries, uint16_t *pf_funcs, uint16_t *channels, uint32_t *rqs, uint32_t *grp_index, uint32_t *start_index); diff --git a/drivers/common/cnxk/roc_nix_bpf.c b/drivers/common/cnxk/roc_nix_bpf.c index 5de4fc3efe..790c6c2ae2 100644 --- a/drivers/common/cnxk/roc_nix_bpf.c +++ b/drivers/common/cnxk/roc_nix_bpf.c @@ -99,60 +99,6 @@ meter_burst_to_nix(uint64_t value, uint64_t *exponent_p, uint64_t *mantissa_p) return NIX_BPF_BURST(exponent, mantissa); } -static inline void -nix_lf_bpf_dump(__io struct nix_band_prof_s *bpf) -{ - plt_dump("W0: cir_mantissa \t\t\t%d\nW0: pebs_mantissa \t\t\t0x%03x", - bpf->cir_mantissa, bpf->pebs_mantissa); - plt_dump("W0: peir_mantissa \t\t\t\t%d\nW0: cbs_exponent \t\t\t%d", - bpf->peir_mantissa, bpf->cbs_exponent); - plt_dump("W0: cir_exponent \t\t\t%d\nW0: pebs_exponent \t\t\t%d", - bpf->cir_exponent, bpf->pebs_exponent); - plt_dump("W0: peir_exponent \t\t\t%d\n", bpf->peir_exponent); - plt_dump("W0: tnl_ena \t\t\t%d\n", bpf->tnl_ena); - plt_dump("W0: icolor \t\t\t%d\n", bpf->icolor); - plt_dump("W0: pc_mode \t\t\t%d\n", bpf->pc_mode); - plt_dump("W1: hl_en \t\t%d\nW1: band_prof_id \t\t%d", bpf->hl_en, - bpf->band_prof_id); - plt_dump("W1: meter_algo \t\t%d\nW1: rc_action \t\t%d", bpf->meter_algo, - bpf->rc_action); - plt_dump("W1: yc_action \t\t\t%d\nW1: gc_action \t\t\t%d", - bpf->yc_action, bpf->gc_action); - plt_dump("W1: adjust_mantissa\t\t\t%d\nW1: adjust_exponent \t\t\t%d", - bpf->adjust_mantissa, bpf->adjust_exponent); - plt_dump("W1: rdiv \t\t\t%d\n", bpf->rdiv); - plt_dump("W1: l_select \t\t%d\nW2: lmode \t\t%d", bpf->l_sellect, - bpf->lmode); - plt_dump("W1: cbs_mantissa \t\t\t%d\n", bpf->cbs_mantissa); - plt_dump("W2: tsa \t\t\t0x%" PRIx64 "\n", (uint64_t)bpf->ts); - plt_dump("W3: c_accum \t\t%d\nW3: pe_accum \t\t%d", bpf->c_accum, - bpf->pe_accum); - plt_dump("W4: green_pkt_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->green_pkt_pass); - plt_dump("W5: yellow_pkt_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->yellow_pkt_pass); - plt_dump("W6: red_pkt_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->red_pkt_pass); - plt_dump("W7: green_octs_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->green_octs_pass); - plt_dump("W8: yellow_octs_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->yellow_octs_pass); - plt_dump("W9: red_octs_pass \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->red_octs_pass); - plt_dump("W10: green_pkt_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->green_pkt_drop); - plt_dump("W11: yellow_pkt_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->yellow_pkt_drop); - plt_dump("W12: red_pkt_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->red_pkt_drop); - plt_dump("W13: green_octs_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->green_octs_drop); - plt_dump("W14: yellow_octs_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->yellow_octs_drop); - plt_dump("W15: red_octs_drop \t\t\t0x%" PRIx64 "", - (uint64_t)bpf->red_octs_drop); -} - static inline void nix_precolor_conv_table_write(struct roc_nix *roc_nix, uint64_t val, uint32_t off) @@ -518,28 +464,6 @@ roc_nix_bpf_free(struct roc_nix *roc_nix, struct roc_nix_bpf_objs *profs, return rc; } -int -roc_nix_bpf_free_all(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_bandprof_free_req *req; - int rc; - - req = mbox_alloc_msg_nix_bandprof_free(mbox); - if (req == NULL) { - rc = -ENOSPC; - goto exit; - } - - req->free_all = true; - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_bpf_config(struct roc_nix *roc_nix, uint16_t id, enum roc_nix_bpf_level_flag lvl_flag, @@ -789,69 +713,6 @@ roc_nix_bpf_ena_dis(struct roc_nix *roc_nix, uint16_t id, struct roc_nix_rq *rq, return rc; } -int -roc_nix_bpf_dump(struct roc_nix *roc_nix, uint16_t id, - enum roc_nix_bpf_level_flag lvl_flag) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - volatile struct nix_band_prof_s *prof; - uint8_t level_idx; - int rc; - - if (roc_model_is_cn9k()) { - rc = NIX_ERR_HW_NOTSUP; - goto exit; - } - - level_idx = roc_nix_bpf_level_to_idx(lvl_flag); - if (level_idx == ROC_NIX_BPF_LEVEL_IDX_INVALID) { - rc = NIX_ERR_PARAM; - goto exit; - } - if (roc_model_is_cn10k()) { - struct nix_cn10k_aq_enq_rsp *rsp; - struct nix_cn10k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox); - if (aq == NULL) { - rc = -ENOSPC; - goto exit; - } - aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14 | id); - aq->ctype = NIX_AQ_CTYPE_BAND_PROF; - aq->op = NIX_AQ_INSTOP_READ; - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - prof = &rsp->prof; - } else { - struct nix_cn20k_aq_enq_rsp *rsp; - struct nix_cn20k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox); - if (aq == NULL) { - rc = -ENOSPC; - goto exit; - } - aq->qidx = (sw_to_hw_lvl_map[level_idx] << 14 | id); - aq->ctype = NIX_AQ_CTYPE_BAND_PROF; - aq->op = NIX_AQ_INSTOP_READ; - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - prof = &rsp->prof; - } - if (!rc) { - plt_dump("============= band prof id =%d ===============", id); - nix_lf_bpf_dump(prof); - } -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_bpf_pre_color_tbl_setup(struct roc_nix *roc_nix, uint16_t id, enum roc_nix_bpf_level_flag lvl_flag, @@ -1265,134 +1126,3 @@ roc_nix_bpf_stats_reset(struct roc_nix *roc_nix, uint16_t id, uint64_t mask, mbox_put(mbox); return rc; } - -int -roc_nix_bpf_lf_stats_read(struct roc_nix *roc_nix, uint64_t mask, - uint64_t stats[ROC_NIX_BPF_STATS_MAX]) -{ - uint8_t yellow_pkt_pass, yellow_octs_pass, yellow_pkt_drop; - uint8_t green_octs_drop, yellow_octs_drop, red_octs_drop; - uint8_t green_pkt_pass, green_octs_pass, green_pkt_drop; - uint8_t red_pkt_pass, red_octs_pass, red_pkt_drop; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - green_pkt_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_PASS); - green_octs_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS); - green_pkt_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_PKT_F_DROP); - green_octs_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP); - yellow_pkt_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS); - yellow_octs_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS); - yellow_pkt_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP); - yellow_octs_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP); - red_pkt_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_PASS); - red_octs_pass = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_PASS); - red_pkt_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_PKT_F_DROP); - red_octs_drop = - roc_nix_bpf_stats_to_idx(mask & ROC_NIX_BPF_RED_OCTS_F_DROP); - - if (green_pkt_pass != ROC_NIX_BPF_STATS_MAX) { - stats[green_pkt_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_OCTS_PASSED); - } - - if (green_octs_pass != ROC_NIX_BPF_STATS_MAX) { - stats[green_octs_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_PKTS_PASSED); - } - - if (green_pkt_drop != ROC_NIX_BPF_STATS_MAX) { - stats[green_pkt_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_OCTS_DROP); - } - - if (green_octs_drop != ROC_NIX_BPF_STATS_MAX) { - stats[green_octs_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_PKTS_DROP); - } - - if (yellow_pkt_pass != ROC_NIX_BPF_STATS_MAX) { - stats[yellow_pkt_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_PKTS_PASSED); - } - - if (yellow_octs_pass != ROC_NIX_BPF_STATS_MAX) { - stats[yellow_octs_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_OCTS_PASSED); - } - - if (yellow_pkt_drop != ROC_NIX_BPF_STATS_MAX) { - stats[yellow_pkt_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_GC_PKTS_DROP); - } - - if (yellow_octs_drop != ROC_NIX_BPF_STATS_MAX) { - stats[yellow_octs_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_OCTS_DROP); - } - - if (red_pkt_pass != ROC_NIX_BPF_STATS_MAX) { - stats[red_pkt_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_OCTS_PASSED); - } - - if (red_octs_pass != ROC_NIX_BPF_STATS_MAX) { - stats[red_octs_pass] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_PKTS_PASSED); - } - - if (red_pkt_drop != ROC_NIX_BPF_STATS_MAX) { - stats[red_pkt_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_YC_OCTS_DROP); - } - - if (red_octs_drop != ROC_NIX_BPF_STATS_MAX) { - stats[red_octs_drop] = - NIX_RD_STATS(NIX_STAT_LF_RX_RX_RC_PKTS_DROP); - } - - return 0; -} - -int -roc_nix_bpf_lf_stats_reset(struct roc_nix *roc_nix, uint64_t mask) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - if (mask & ROC_NIX_BPF_GREEN_PKT_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_GREEN_PKT_F_PASS); - if (mask & ROC_NIX_BPF_GREEN_OCTS_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_GREEN_OCTS_F_PASS); - if (mask & ROC_NIX_BPF_GREEN_PKT_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_GREEN_PKT_F_DROP); - if (mask & ROC_NIX_BPF_GREEN_OCTS_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_GREEN_OCTS_F_DROP); - if (mask & ROC_NIX_BPF_YELLOW_PKT_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_YELLOW_PKT_F_PASS); - if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_YELLOW_OCTS_F_PASS); - if (mask & ROC_NIX_BPF_YELLOW_PKT_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_YELLOW_PKT_F_DROP); - if (mask & ROC_NIX_BPF_YELLOW_OCTS_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_YELLOW_OCTS_F_DROP); - if (mask & ROC_NIX_BPF_RED_PKT_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_RED_PKT_F_PASS); - if (mask & ROC_NIX_BPF_RED_OCTS_F_PASS) - NIX_RST_STATS(ROC_NIX_BPF_RED_OCTS_F_PASS); - if (mask & ROC_NIX_BPF_RED_PKT_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_RED_PKT_F_DROP); - if (mask & ROC_NIX_BPF_RED_OCTS_F_DROP) - NIX_RST_STATS(ROC_NIX_BPF_RED_OCTS_F_DROP); - - return 0; -} diff --git a/drivers/common/cnxk/roc_nix_fc.c b/drivers/common/cnxk/roc_nix_fc.c index 8164a2ba0e..8c78ff9733 100644 --- a/drivers/common/cnxk/roc_nix_fc.c +++ b/drivers/common/cnxk/roc_nix_fc.c @@ -5,21 +5,6 @@ #include "roc_api.h" #include "roc_priv.h" -static int -nix_fc_rxchan_bpid_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - if (nix->chan_cnt != 0) - fc_cfg->rxchan_cfg.enable = true; - else - fc_cfg->rxchan_cfg.enable = false; - - fc_cfg->type = ROC_NIX_FC_RXCHAN_CFG; - - return 0; -} - static int nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable) { @@ -106,165 +91,6 @@ nix_fc_rxchan_bpid_set(struct roc_nix *roc_nix, bool enable) return rc; } -static int -nix_fc_cq_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_aq_enq_rsp *rsp; - int rc; - - if (roc_model_is_cn9k()) { - struct nix_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->cq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_CQ; - aq->op = NIX_AQ_INSTOP_READ; - } else if (roc_model_is_cn10k()) { - struct nix_cn10k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->cq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_CQ; - aq->op = NIX_AQ_INSTOP_READ; - } else { - struct nix_cn20k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->cq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_CQ; - aq->op = NIX_AQ_INSTOP_READ; - } - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - fc_cfg->cq_cfg.cq_drop = rsp->cq.drop; - fc_cfg->cq_cfg.cq_bp = rsp->cq.bp; - fc_cfg->cq_cfg.enable = rsp->cq.bp_ena; - fc_cfg->type = ROC_NIX_FC_CQ_CFG; - -exit: - mbox_put(mbox); - return rc; -} - -static int -nix_fc_rq_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct npa_cn20k_aq_enq_req *npa_req_cn20k; - struct npa_cn20k_aq_enq_rsp *npa_rsp_cn20k; - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_aq_enq_rsp *rsp; - struct npa_aq_enq_req *npa_req; - struct npa_aq_enq_rsp *npa_rsp; - int rc; - - if (roc_model_is_cn9k()) { - struct nix_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->rq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - } else if (roc_model_is_cn10k()) { - struct nix_cn10k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->rq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - } else { - struct nix_cn20k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = fc_cfg->rq_cfg.rq; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - } - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - if (roc_model_is_cn20k()) { - npa_req_cn20k = mbox_alloc_msg_npa_cn20k_aq_enq(mbox); - if (!npa_req_cn20k) { - rc = -ENOSPC; - goto exit; - } - - npa_req_cn20k->aura_id = rsp->rq.lpb_aura; - npa_req_cn20k->ctype = NPA_AQ_CTYPE_AURA; - npa_req_cn20k->op = NPA_AQ_INSTOP_READ; - - rc = mbox_process_msg(mbox, (void *)&npa_rsp_cn20k); - if (rc) - goto exit; - - fc_cfg->cq_cfg.cq_drop = npa_rsp_cn20k->aura.bp; - fc_cfg->cq_cfg.enable = npa_rsp_cn20k->aura.bp_ena; - fc_cfg->type = ROC_NIX_FC_RQ_CFG; - } else { - npa_req = mbox_alloc_msg_npa_aq_enq(mbox); - if (!npa_req) { - rc = -ENOSPC; - goto exit; - } - - npa_req->aura_id = rsp->rq.lpb_aura; - npa_req->ctype = NPA_AQ_CTYPE_AURA; - npa_req->op = NPA_AQ_INSTOP_READ; - - rc = mbox_process_msg(mbox, (void *)&npa_rsp); - if (rc) - goto exit; - - fc_cfg->cq_cfg.cq_drop = npa_rsp->aura.bp; - fc_cfg->cq_cfg.enable = npa_rsp->aura.bp_ena; - fc_cfg->type = ROC_NIX_FC_RQ_CFG; - } - -exit: - mbox_put(mbox); - return rc; -} - static int nix_fc_cq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) { @@ -410,25 +236,6 @@ nix_fc_rq_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) return 0; } -int -roc_nix_fc_config_get(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) -{ - if (!roc_nix_is_pf(roc_nix) && !roc_nix_is_lbk(roc_nix) && - !roc_nix_is_sdp(roc_nix)) - return 0; - - if (fc_cfg->type == ROC_NIX_FC_CQ_CFG) - return nix_fc_cq_config_get(roc_nix, fc_cfg); - else if (fc_cfg->type == ROC_NIX_FC_RQ_CFG) - return nix_fc_rq_config_get(roc_nix, fc_cfg); - else if (fc_cfg->type == ROC_NIX_FC_RXCHAN_CFG) - return nix_fc_rxchan_bpid_get(roc_nix, fc_cfg); - else if (fc_cfg->type == ROC_NIX_FC_TM_CFG) - return nix_tm_bp_config_get(roc_nix, &fc_cfg->tm_cfg.enable); - - return -EINVAL; -} - int roc_nix_fc_config_set(struct roc_nix *roc_nix, struct roc_nix_fc_cfg *fc_cfg) { @@ -735,28 +542,6 @@ roc_nix_pfc_mode_set(struct roc_nix *roc_nix, struct roc_nix_pfc_cfg *pfc_cfg) return rc; } -int -roc_nix_pfc_mode_get(struct roc_nix *roc_nix, struct roc_nix_pfc_cfg *pfc_cfg) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - if (roc_nix_is_lbk(roc_nix)) - return NIX_ERR_OP_NOTSUP; - - pfc_cfg->tc = nix->cev; - - if (nix->pfc_rx_pause && nix->pfc_tx_pause) - pfc_cfg->mode = ROC_NIX_FC_FULL; - else if (nix->pfc_rx_pause) - pfc_cfg->mode = ROC_NIX_FC_RX; - else if (nix->pfc_tx_pause) - pfc_cfg->mode = ROC_NIX_FC_TX; - else - pfc_cfg->mode = ROC_NIX_FC_NONE; - - return 0; -} - uint16_t roc_nix_chan_count_get(struct roc_nix *roc_nix) { @@ -832,13 +617,6 @@ roc_nix_bpids_alloc(struct roc_nix *roc_nix, uint8_t type, uint8_t bp_cnt, uint1 return nix_bpids_alloc(&nix->dev, type, bp_cnt, bpids); } -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); - return nix_bpids_free(&nix->dev, bp_cnt, bpids); -} - int roc_nix_rx_chan_cfg_get(struct roc_nix *roc_nix, uint16_t chan, bool is_cpt, uint64_t *cfg) { diff --git a/drivers/common/cnxk/roc_nix_inl.c b/drivers/common/cnxk/roc_nix_inl.c index 0eea0536aa..53d749080c 100644 --- a/drivers/common/cnxk/roc_nix_inl.c +++ b/drivers/common/cnxk/roc_nix_inl.c @@ -2089,14 +2089,6 @@ roc_nix_inl_inb_is_enabled(struct roc_nix *roc_nix) return nix->inl_inb_ena; } -bool -roc_nix_inl_outb_is_enabled(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - return nix->inl_outb_ena; -} - int roc_nix_inl_dev_rq_get(struct roc_nix_rq *rq, bool enable) { @@ -2341,39 +2333,6 @@ roc_nix_inb_mode_set(struct roc_nix *roc_nix, bool use_inl_dev) nix->inb_inl_dev = use_inl_dev; } -void -roc_nix_inl_inb_set(struct roc_nix *roc_nix, bool ena) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct idev_cfg *idev = idev_get_cfg(); - - if (!idev) - return; - /* Need to set here for cases when inbound SA table is - * managed outside RoC. - */ - nix->inl_inb_ena = ena; - - if (roc_model_is_cn9k() || roc_errata_nix_no_meta_aura()) - return; - - if (ena) { - nix->need_meta_aura = true; - 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 || roc_nix->custom_meta_aura_ena) - idev->inl_cfg.refs--; - - 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); - } -} - int roc_nix_inl_outb_soft_exp_poll_switch(struct roc_nix *roc_nix, bool poll) { @@ -2434,14 +2393,6 @@ roc_nix_inl_dev_rq(struct roc_nix *roc_nix) return NULL; } -uint16_t -roc_nix_inl_outb_sso_pffunc_get(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - return nix->outb_err_sso_pffunc; -} - int roc_nix_inl_cb_register(roc_nix_inl_sso_work_cb_t cb, void *args) { @@ -2468,27 +2419,6 @@ roc_nix_inl_cb_register(roc_nix_inl_sso_work_cb_t cb, void *args) return 0; } -int -roc_nix_inl_cb_unregister(roc_nix_inl_sso_work_cb_t cb, void *args) -{ - struct idev_cfg *idev = idev_get_cfg(); - struct nix_inl_dev *inl_dev; - - if (idev == NULL) - return -ENOENT; - - inl_dev = idev->nix_inl_dev; - if (!inl_dev) - return -ENOENT; - - if (inl_dev->work_cb != cb || inl_dev->cb_args != args) - return -EINVAL; - - inl_dev->work_cb = NULL; - inl_dev->cb_args = NULL; - return 0; -} - int roc_nix_inl_inb_tag_update(struct roc_nix *roc_nix, uint32_t tag_const, uint8_t tt) @@ -2752,95 +2682,6 @@ roc_nix_inl_cpt_lf_stats_get(struct roc_nix *roc_nix, enum roc_nix_cpt_lf_stats_ } } -static int -nix_inl_ts_pkind_set(struct roc_nix *roc_nix, bool ts_ena, bool inb_inl_dev, uint8_t profile_id) -{ - struct idev_cfg *idev = idev_get_cfg(); - struct nix_inl_dev *inl_dev = NULL; - void *sa, *sa_base = NULL; - struct nix *nix = NULL; - uint32_t rq_refs = 0; - uint16_t max_sa = 0; - uint8_t pkind = 0; - size_t inb_sa_sz; - int i; - - if (roc_model_is_cn9k()) - return 0; - - if (!inb_inl_dev && (roc_nix == NULL) && profile_id >= ROC_NIX_INL_PROFILE_CNT) - return -EINVAL; - - if (inb_inl_dev) { - if ((idev == NULL) || (idev->nix_inl_dev == NULL)) - return 0; - inl_dev = idev->nix_inl_dev; - } else { - nix = roc_nix_to_nix_priv(roc_nix); - if (!nix->inl_inb_ena) - return 0; - - sa_base = nix->inb_sa_base[profile_id]; - if (sa_base == NULL) - return 0; - inb_sa_sz = nix->inb_sa_sz[profile_id]; - max_sa = nix->inb_sa_max[profile_id]; - } - - if (inl_dev) { - for (i = 0; i < inl_dev->nb_rqs; i++) - rq_refs += inl_dev->rqs[i].inl_dev_refs; - - if (rq_refs == 0) { - sa_base = inl_dev->inb_sa_base[profile_id]; - if (sa_base == NULL) - return 0; - inl_dev->ts_ena = ts_ena; - max_sa = inl_dev->inb_sa_max[profile_id]; - inb_sa_sz = inl_dev->inb_sa_sz[profile_id]; - } else if (inl_dev->ts_ena != ts_ena) { - if (inl_dev->ts_ena) - plt_err("Inline device is already configured with TS enable"); - else - plt_err("Inline device is already configured with TS disable"); - return -ENOTSUP; - } else { - return 0; - } - } - - pkind = ts_ena ? ROC_IE_OT_CPT_TS_PKIND : ROC_IE_OT_CPT_PKIND; - - sa = (uint8_t *)sa_base; - if (pkind == ((struct roc_ot_ipsec_inb_sa *)sa)->w0.s.pkind) - return 0; - - for (i = 0; i < max_sa; i++) { - sa = ((uint8_t *)sa_base) + (i * inb_sa_sz); - ((struct roc_ot_ipsec_inb_sa *)sa)->w0.s.pkind = pkind; - } - return 0; -} - -int -roc_nix_inl_ts_pkind_set(struct roc_nix *roc_nix, bool ts_ena, bool inb_inl_dev, uint8_t profile_id) -{ - int cnt = 0; - - if (profile_id < ROC_NIX_INL_PROFILE_CNT) { - return nix_inl_ts_pkind_set(roc_nix, ts_ena, inb_inl_dev, profile_id); - } else if (profile_id == 0xFF) { - /* Configure for all valid profiles */ - for (cnt = 0; cnt < ROC_NIX_INL_PROFILE_CNT; cnt++) - if (nix_inl_ts_pkind_set(roc_nix, ts_ena, inb_inl_dev, cnt)) - return -EINVAL; - return 0; - } - - plt_err("Invalid NIX inline profile_id: %u", profile_id); - return -EINVAL; -} - void roc_nix_inl_dev_lock(void) { diff --git a/drivers/common/cnxk/roc_nix_inl.h b/drivers/common/cnxk/roc_nix_inl.h index 30f4196581..b9aee487c9 100644 --- a/drivers/common/cnxk/roc_nix_inl.h +++ b/drivers/common/cnxk/roc_nix_inl.h @@ -150,10 +150,6 @@ bool roc_nix_inl_dev_is_probed(void); void __roc_api roc_nix_inl_dev_lock(void); void __roc_api roc_nix_inl_dev_unlock(void); int __roc_api roc_nix_inl_dev_xaq_realloc(uint64_t aura_handle); -int roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats); -int roc_nix_inl_dev_stats_reset(void); -int roc_nix_inl_dev_cpt_setup(bool use_inl_dev_sso); -int roc_nix_inl_dev_cpt_release(void); bool __roc_api roc_nix_inl_dev_is_multi_channel(void); /* NIX Inline Inbound API */ @@ -182,7 +178,6 @@ uint32_t roc_nix_inl_inb_sa_sz(struct roc_nix *roc_nix, uintptr_t __roc_api roc_nix_inl_inb_sa_get(struct roc_nix *roc_nix, bool inl_dev_sa, uint32_t spi); void __roc_api roc_nix_inb_mode_set(struct roc_nix *roc_nix, bool use_inl_dev); -void roc_nix_inl_inb_set(struct roc_nix *roc_nix, bool ena); int __roc_api roc_nix_inl_dev_rq_get(struct roc_nix_rq *rq, bool ena); int __roc_api roc_nix_inl_dev_rq_put(struct roc_nix_rq *rq); bool __roc_api roc_nix_inb_is_with_inl_dev(struct roc_nix *roc_nix); @@ -190,23 +185,17 @@ struct roc_nix_rq *__roc_api roc_nix_inl_dev_rq(struct roc_nix *roc_nix); int __roc_api roc_nix_inl_inb_tag_update(struct roc_nix *roc_nix, uint32_t tag_const, uint8_t tt); int __roc_api roc_nix_reassembly_configure(struct roc_cpt_rxc_time_cfg *req_cfg, uint32_t max_wait_time); -int roc_nix_inl_ts_pkind_set(struct roc_nix *roc_nix, bool ts_ena, bool inb_inl_dev, - uint8_t profile_id); int __roc_api roc_nix_inl_rq_ena_dis(struct roc_nix *roc_nix, bool ena); int roc_nix_inl_meta_aura_check(struct roc_nix *roc_nix, struct roc_nix_rq *rq); /* NIX Inline Outbound API */ int __roc_api roc_nix_inl_outb_init(struct roc_nix *roc_nix); int __roc_api roc_nix_inl_outb_fini(struct roc_nix *roc_nix); -bool roc_nix_inl_outb_is_enabled(struct roc_nix *roc_nix); uintptr_t __roc_api roc_nix_inl_outb_sa_base_get(struct roc_nix *roc_nix); struct roc_cpt_lf *__roc_api roc_nix_inl_outb_lf_base_get(struct roc_nix *roc_nix); struct roc_cpt_lf *__roc_api roc_nix_inl_inb_inj_lf_get(struct roc_nix *roc_nix); -uint16_t roc_nix_inl_outb_sso_pffunc_get(struct roc_nix *roc_nix); int __roc_api roc_nix_inl_cb_register(roc_nix_inl_sso_work_cb_t cb, void *args); -int roc_nix_inl_cb_unregister(roc_nix_inl_sso_work_cb_t cb, - void *args); 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); diff --git a/drivers/common/cnxk/roc_nix_inl_dev.c b/drivers/common/cnxk/roc_nix_inl_dev.c index f0703f3154..9388f9d989 100644 --- a/drivers/common/cnxk/roc_nix_inl_dev.c +++ b/drivers/common/cnxk/roc_nix_inl_dev.c @@ -1362,64 +1362,6 @@ roc_nix_inl_dev_qptr_get(uint8_t qid) return &inl_dev->q_info[qid]; } -int -roc_nix_inl_dev_stats_get(struct roc_nix_stats *stats) -{ - struct idev_cfg *idev = idev_get_cfg(); - struct nix_inl_dev *inl_dev = NULL; - - if (stats == NULL) - return NIX_ERR_PARAM; - - if (idev && idev->nix_inl_dev) - inl_dev = idev->nix_inl_dev; - - if (!inl_dev) - return -EINVAL; - - stats->rx_octs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_OCTS); - stats->rx_ucast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_UCAST); - stats->rx_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_BCAST); - stats->rx_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_MCAST); - stats->rx_drop = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DROP); - stats->rx_drop_octs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DROP_OCTS); - stats->rx_fcs = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_FCS); - stats->rx_err = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_ERR); - stats->rx_drop_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_BCAST); - stats->rx_drop_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_MCAST); - stats->rx_drop_l3_bcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_L3BCAST); - stats->rx_drop_l3_mcast = INL_NIX_RX_STATS(NIX_STAT_LF_RX_RX_DRP_L3MCAST); - - return 0; -} - -int -roc_nix_inl_dev_stats_reset(void) -{ - struct idev_cfg *idev = idev_get_cfg(); - struct nix_inl_dev *inl_dev = NULL; - struct mbox *mbox; - int rc; - - if (idev && idev->nix_inl_dev) - inl_dev = idev->nix_inl_dev; - - if (!inl_dev) - return -EINVAL; - - mbox = mbox_get((&inl_dev->dev)->mbox); - - if (mbox_alloc_msg_nix_stats_rst(mbox) == NULL) { - rc = -ENOMEM; - goto exit; - } - - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_inl_dev_init(struct roc_nix_inl_dev *roc_inl_dev) { @@ -1667,35 +1609,3 @@ 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[0].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[0].dev == NULL) - return 0; - - return nix_inl_cpt_release(inl_dev); -} diff --git a/drivers/common/cnxk/roc_nix_mac.c b/drivers/common/cnxk/roc_nix_mac.c index 2c8c9a6443..f7d97393b1 100644 --- a/drivers/common/cnxk/roc_nix_mac.c +++ b/drivers/common/cnxk/roc_nix_mac.c @@ -5,30 +5,6 @@ #include "roc_api.h" #include "roc_priv.h" -int -roc_nix_mac_rxtx_start_stop(struct roc_nix *roc_nix, bool start) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - int rc; - - if (roc_nix_is_vf_or_sdp(roc_nix)) { - rc = NIX_ERR_OP_NOTSUP; - goto exit; - } - - if (start) - mbox_alloc_msg_cgx_start_rxtx(mbox); - else - mbox_alloc_msg_cgx_stop_rxtx(mbox); - - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_mac_link_event_start_stop(struct roc_nix *roc_nix, bool start) { @@ -344,38 +320,6 @@ roc_nix_mac_link_info_set(struct roc_nix *roc_nix, } -int -roc_nix_mac_mtu_set(struct roc_nix *roc_nix, uint16_t mtu) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_frs_cfg *req; - bool sdp_link = false; - int rc = -ENOSPC; - - if (roc_nix_is_sdp(roc_nix)) - sdp_link = true; - - req = mbox_alloc_msg_nix_set_hw_frs(mbox); - if (req == NULL) - goto exit; - req->maxlen = mtu; - req->update_smq = true; - req->sdp_link = sdp_link; - - rc = mbox_process(mbox); - if (rc) - goto exit; - - /* Save MTU for later use */ - nix->mtu = mtu; - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_mac_max_rx_len_set(struct roc_nix *roc_nix, uint16_t maxlen) { @@ -461,15 +405,6 @@ roc_nix_mac_link_info_get_cb_register(struct roc_nix *roc_nix, return 0; } -void -roc_nix_mac_link_info_get_cb_unregister(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - - dev->ops->link_status_get = NULL; -} - int roc_nix_mac_fwdata_get(struct roc_nix *roc_nix, struct roc_nix_mac_fwdata *data) { diff --git a/drivers/common/cnxk/roc_nix_mcast.c b/drivers/common/cnxk/roc_nix_mcast.c index eab4bde743..2957d41951 100644 --- a/drivers/common/cnxk/roc_nix_mcast.c +++ b/drivers/common/cnxk/roc_nix_mcast.c @@ -5,123 +5,6 @@ #include "roc_api.h" #include "roc_priv.h" -int -roc_nix_mcast_mcam_entry_alloc(struct roc_nix *roc_nix, uint16_t nb_entries, - uint8_t priority, uint16_t index[]) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct npc_mcam_alloc_entry_req *req; - struct npc_mcam_alloc_entry_rsp *rsp; - int rc = -ENOSPC, i; - - req = mbox_alloc_msg_npc_mcam_alloc_entry(mbox); - if (req == NULL) - goto exit; - req->ref_priority = priority; - req->count = nb_entries; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - for (i = 0; i < rsp->count; i++) - index[i] = rsp->entry_list[i]; - - rc = rsp->count; -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_mcast_mcam_entry_free(struct roc_nix *roc_nix, uint32_t index) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct npc_mcam_free_entry_req *req; - int rc = -ENOSPC; - - req = mbox_alloc_msg_npc_mcam_free_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - - rc = mbox_process_msg(mbox, NULL); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_mcast_mcam_entry_write(struct roc_nix *roc_nix, void *entry, uint32_t index, uint8_t intf, - uint64_t action) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - int rc = -ENOSPC; - - if (roc_model_is_cn20k()) { - struct npc_cn20k_mcam_write_entry_req *req; - - req = mbox_alloc_msg_npc_cn20k_mcam_write_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - req->intf = intf; - req->enable_entry = true; - mbox_memcpy(&req->entry_data, entry, sizeof(struct cn20k_mcam_entry)); - req->entry_data.action = action; - - } else { - struct npc_mcam_write_entry_req *req; - - req = mbox_alloc_msg_npc_mcam_write_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - req->intf = intf; - req->enable_entry = true; - mbox_memcpy(&req->entry_data, entry, sizeof(struct mcam_entry)); - req->entry_data.action = action; - } - - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_mcast_mcam_entry_ena_dis(struct roc_nix *roc_nix, uint32_t index, - bool enable) -{ - struct npc_mcam_ena_dis_entry_req *req; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - int rc = -ENOSPC; - - if (enable) { - req = mbox_alloc_msg_npc_mcam_ena_entry(mbox); - if (req == NULL) - goto exit; - } else { - req = mbox_alloc_msg_npc_mcam_dis_entry(mbox); - if (req == NULL) - goto exit; - } - - req->entry = index; - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - int roc_nix_mcast_list_setup(struct mbox *mbox, uint8_t intf, int nb_entries, uint16_t *pf_funcs, uint16_t *channels, uint32_t *rqs, uint32_t *grp_index, diff --git a/drivers/common/cnxk/roc_nix_ops.c b/drivers/common/cnxk/roc_nix_ops.c index 13a548216b..9ec7c09084 100644 --- a/drivers/common/cnxk/roc_nix_ops.c +++ b/drivers/common/cnxk/roc_nix_ops.c @@ -189,41 +189,6 @@ roc_nix_lso_alt_flags_profile_setup(struct roc_nix *roc_nix, nix_lso_alt_flg_for return rc; } -int -roc_nix_lso_custom_fmt_setup(struct roc_nix *roc_nix, - struct nix_lso_format *fields, uint16_t nb_fields) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_lso_format_cfg_rsp *rsp; - struct nix_lso_format_cfg *req; - int rc = -ENOSPC; - - if (nb_fields > NIX_LSO_FIELD_MAX) { - rc = -EINVAL; - goto exit; - } - - req = mbox_alloc_msg_nix_lso_format_cfg(mbox); - if (req == NULL) - goto exit; - - req->field_mask = NIX_LSO_FIELD_MASK; - mbox_memcpy(req->fields, fields, - sizeof(struct nix_lso_format) * nb_fields); - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - plt_nix_dbg("Setup custom format %u", rsp->lso_format_idx); - rc = rsp->lso_format_idx; -exit: - mbox_put(mbox); - return rc; -} - static int nix_lso_ipv4(struct roc_nix *roc_nix) { @@ -481,14 +446,6 @@ roc_nix_lso_fmt_setup(struct roc_nix *roc_nix) return rc; } -int -roc_nix_lso_fmt_ipv4_frag_get(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - return nix->lso_ipv4_idx; -} - int roc_nix_lso_fmt_get(struct roc_nix *roc_nix, uint8_t udp_tun[ROC_NIX_LSO_TUN_MAX], diff --git a/drivers/common/cnxk/roc_nix_ptp.c b/drivers/common/cnxk/roc_nix_ptp.c index 187e6c8d4f..cc435a235d 100644 --- a/drivers/common/cnxk/roc_nix_ptp.c +++ b/drivers/common/cnxk/roc_nix_ptp.c @@ -133,15 +133,6 @@ roc_nix_ptp_info_cb_register(struct roc_nix *roc_nix, return 0; } -void -roc_nix_ptp_info_cb_unregister(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - - dev->ops->ptp_info_update = NULL; -} - bool roc_nix_ptp_is_enable(struct roc_nix *roc_nix) { diff --git a/drivers/common/cnxk/roc_nix_queue.c b/drivers/common/cnxk/roc_nix_queue.c index 8e7e597be2..eebcd8e326 100644 --- a/drivers/common/cnxk/roc_nix_queue.c +++ b/drivers/common/cnxk/roc_nix_queue.c @@ -12,47 +12,6 @@ typedef void *(*nix_aq_enq_alloc_t)(struct mbox *mbox); -static inline void -nix_aq_enq_write_rq_ena(void *msg, uint16_t qid, bool enable) -{ - struct nix_aq_enq_req *aq = msg; - - aq->qidx = qid; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_WRITE; - aq->rq.ena = enable; - aq->rq_mask.ena = ~(aq->rq_mask.ena); -} - -static inline int -nix_rq_bulk_ena_dis_fill(struct mbox *mbox, struct roc_nix_rq *rqs, int nb_rx_queues, - bool enable, nix_aq_enq_alloc_t alloc) -{ - int i; - - for (i = 0; i < nb_rx_queues; i++) { - void *aq; - int rc; - - if (rqs[i].qid == UINT16_MAX) - continue; - - aq = alloc(mbox); - if (!aq) { - rc = mbox_process(mbox); - if (rc) - return rc; - aq = alloc(mbox); - if (!aq) - return -ENOSPC; - } - - nix_aq_enq_write_rq_ena(aq, rqs[i].qid, enable); - } - - return 0; -} - static inline uint32_t nix_qsize_to_val(enum nix_q_size qsize) { @@ -90,28 +49,6 @@ nix_rq_vwqe_flush(struct roc_nix_rq *rq, uint16_t vwqe_interval) } } -static int -nix_rq_bulk_ena_dis(struct nix *nix, struct roc_nix_rq *rqs, int nb_rx_queues, bool enable) -{ - struct mbox *mbox = mbox_get((&nix->dev)->mbox); - nix_aq_enq_alloc_t alloc; - int rc; - - if (roc_model_is_cn9k()) - alloc = (nix_aq_enq_alloc_t)mbox_alloc_msg_nix_aq_enq; - else if (roc_model_is_cn10k()) - alloc = (nix_aq_enq_alloc_t)mbox_alloc_msg_nix_cn10k_aq_enq; - else /* CN20K */ - alloc = (nix_aq_enq_alloc_t)mbox_alloc_msg_nix_cn20k_aq_enq; - - rc = nix_rq_bulk_ena_dis_fill(mbox, rqs, nb_rx_queues, enable, alloc); - if (!rc && mbox_nonempty_nolock(mbox, 0)) - rc = mbox_process(mbox); - - mbox_put(mbox); - return rc; -} - int nix_rq_ena_dis(struct dev *dev, struct roc_nix_rq *rq, bool enable) { @@ -191,43 +128,6 @@ roc_nix_sq_ena_dis(struct roc_nix_sq *sq, bool enable) return rc; } -int -roc_nix_rq_multi_ena_dis(struct roc_nix *roc_nix, struct roc_nix_rq *rqs, int nb_rx_queues, - bool enable) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct roc_nix_rq *rq; - int rc, i; - - rc = nix_rq_bulk_ena_dis(nix, rqs, nb_rx_queues, enable); - if (rc) { - plt_err("Failed to %s Rx queues rc=%d pf=%d vf=%d nb_rx_queues=%d", - enable ? "enable" : "disable", rc, nix->dev.pf, nix->dev.vf, - nb_rx_queues); - return rc; - } - - for (i = 0; i < nb_rx_queues; i++) { - rq = &rqs[i]; - - if (rq->qid == UINT16_MAX) - continue; - - nix_rq_vwqe_flush(rq, nix->vwqe_interval); - - /* Check for meta aura if RQ is enabled */ - if (enable && nix->need_meta_aura) { - rc = roc_nix_inl_meta_aura_check(rq->roc_nix, rq); - if (rc) { - plt_err("Failed meta aura check for rq=%u rc=%d pf=%d vf=%d", - rq->qid, rc, nix->dev.pf, nix->dev.vf); - return rc; - } - } - } - return 0; -} - int roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable) { @@ -245,79 +145,6 @@ roc_nix_rq_ena_dis(struct roc_nix_rq *rq, bool enable) return rc; } -int -roc_nix_rq_is_sso_enable(struct roc_nix *roc_nix, uint32_t qid) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - bool sso_enable; - int rc; - - if (roc_model_is_cn9k()) { - struct nix_aq_enq_rsp *rsp; - struct nix_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = qid; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - sso_enable = rsp->rq.sso_ena; - } else if (roc_model_is_cn10k()) { - struct nix_cn10k_aq_enq_rsp *rsp; - struct nix_cn10k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn10k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = qid; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - sso_enable = rsp->rq.sso_ena; - } else { - struct nix_cn20k_aq_enq_rsp *rsp; - struct nix_cn20k_aq_enq_req *aq; - - aq = mbox_alloc_msg_nix_cn20k_aq_enq(mbox); - if (!aq) { - rc = -ENOSPC; - goto exit; - } - - aq->qidx = qid; - aq->ctype = NIX_AQ_CTYPE_RQ; - aq->op = NIX_AQ_INSTOP_READ; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - sso_enable = rsp->rq.sso_ena; - } - - rc = sso_enable ? true : false; -exit: - mbox_put(mbox); - return rc; -} - static int nix_rq_aura_buf_type_update(struct roc_nix_rq *rq, bool set) { @@ -2346,188 +2173,6 @@ roc_nix_sq_fini(struct roc_nix_sq *sq) return rc; } -static int -sqb_aura_dyn_expand(struct roc_nix_sq *sq, uint16_t count) -{ - struct nix *nix = roc_nix_to_nix_priv(sq->roc_nix); - uint64_t *sqbs = NULL; - uint16_t blk_sz; - int i; - - blk_sz = nix->sqb_size; - sqbs = calloc(1, count * sizeof(uint64_t)); - if (!sqbs) - return -ENOMEM; - - for (i = 0; i < count; i++) { - sqbs[i] = (uint64_t)plt_zmalloc(blk_sz, ROC_ALIGN); - if (!sqbs[i]) - break; - } - - if (i != count) { - i = i - 1; - for (; i >= 0; i--) - plt_free((void *)sqbs[i]); - free(sqbs); - return -ENOMEM; - } - - plt_io_wmb(); - - /* Add new buffers to sqb aura */ - for (i = 0; i < count; i++) - roc_npa_aura_op_free(sq->aura_handle, 0, sqbs[i]); - free(sqbs); - - /* Adjust SQ info */ - sq->nb_sqb_bufs += count; - sq->nb_sqb_bufs_adj += count; - sq->aura_sqb_bufs += count; - return 0; -} - -static int -sqb_aura_dyn_contract(struct roc_nix_sq *sq, uint16_t count) -{ - struct nix *nix = roc_nix_to_nix_priv(sq->roc_nix); - struct dev *dev = &nix->dev; - struct ndc_sync_op *ndc_req; - uint64_t *sqbs = NULL; - struct mbox *mbox; - uint64_t timeout; /* 10's of usec */ - uint64_t cycles; - int i, rc; - - mbox = dev->mbox; - /* Sync NDC-NIX-TX for LF */ - ndc_req = mbox_alloc_msg_ndc_sync_op(mbox_get(mbox)); - if (ndc_req == NULL) { - mbox_put(mbox); - return -EFAULT; - } - - ndc_req->nix_lf_tx_sync = 1; - rc = mbox_process(mbox); - if (rc) { - mbox_put(mbox); - return rc; - } - mbox_put(mbox); - - /* Wait for enough time based on shaper min rate */ - timeout = (sq->nb_desc * roc_nix_max_pkt_len(sq->roc_nix) * 8 * 1E5); - /* Wait for worst case scenario of this SQ being last priority - * and so have to wait for all other SQ's drain out by their own. - */ - timeout = timeout * nix->nb_tx_queues; - timeout = timeout / nix->tm_rate_min; - if (!timeout) - timeout = 10000; - cycles = (timeout * 10 * plt_tsc_hz()) / (uint64_t)1E6; - cycles += plt_tsc_cycles(); - - sqbs = calloc(1, count * sizeof(uint64_t)); - if (!sqbs) - return -ENOMEM; - - i = 0; - while (i < count && plt_tsc_cycles() < cycles) { - sqbs[i] = roc_npa_aura_op_alloc(sq->aura_handle, 0); - if (sqbs[i]) - i++; - else - plt_delay_us(1); - } - - if (i != count) { - plt_warn("SQ %u busy, unable to recover %u SQB's(%u desc)", sq->qid, count, - count * sq->sqes_per_sqb); - - /* Restore the SQB aura state and return */ - i--; - for (; i >= 0; i--) - roc_npa_aura_op_free(sq->aura_handle, 0, sqbs[i]); - free(sqbs); - return -EAGAIN; - } - - /* Extracted necessary SQB's, on free them */ - for (i = 0; i < count; i++) - plt_free((void *)sqbs[i]); - free(sqbs); - - /* Adjust SQ info */ - sq->nb_sqb_bufs -= count; - sq->nb_sqb_bufs_adj -= count; - sq->aura_sqb_bufs -= count; - return 0; -} - -int -roc_nix_sq_resize(struct roc_nix_sq *sq, uint32_t nb_desc) -{ - struct roc_nix *roc_nix = sq->roc_nix; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - uint16_t aura_sqb_bufs, nb_sqb_bufs, sqes_per_sqb; - int64_t *regaddr; - uint64_t wdata; - uint16_t diff; - int rc; - - if (!roc_nix->sq_resize_ena) - return -ENOTSUP; - - sqes_per_sqb = sq->sqes_per_sqb; - - /* Calculate new nb_sqb_bufs */ - nb_sqb_bufs = sq_desc_to_sqb(nix, sqes_per_sqb, nb_desc); - aura_sqb_bufs = sqb_slack_adjust(nix, nb_sqb_bufs, !!sq->sq_cnt_ptr); - - if (aura_sqb_bufs == sq->aura_sqb_bufs) - return 0; - - /* Issue atomic op to make sure all inflight LMTST's are complete - * assuming no new submissions will take place. - */ - wdata = ((uint64_t)sq->qid) << 32; - regaddr = (int64_t *)(nix->base + NIX_LF_SQ_OP_STATUS); - roc_atomic64_add_nosync(wdata, regaddr); - - /* Expand or Contract SQB aura */ - if (aura_sqb_bufs > sq->aura_sqb_bufs) { - /* Increase the limit */ - roc_npa_aura_limit_modify(sq->aura_handle, aura_sqb_bufs); - diff = aura_sqb_bufs - sq->aura_sqb_bufs; - roc_npa_aura_op_cnt_set(sq->aura_handle, 1, diff); - - rc = sqb_aura_dyn_expand(sq, diff); - } else { - diff = sq->aura_sqb_bufs - aura_sqb_bufs; - rc = sqb_aura_dyn_contract(sq, diff); - - /* Decrease the limit */ - if (!rc) { - roc_npa_aura_limit_modify(sq->aura_handle, aura_sqb_bufs); - roc_npa_aura_op_cnt_set(sq->aura_handle, 1, -(int64_t)diff); - } - } - - plt_io_wmb(); - if (!rc) { - sq->nb_desc = nb_desc; - if (sq->sq_cnt_ptr) - plt_atomic_store_explicit((uint64_t __plt_atomic *)sq->sq_cnt_ptr, nb_desc, - plt_memory_order_release); - *(uint64_t *)sq->fc = roc_npa_aura_op_cnt_get(sq->aura_handle); - } else { - roc_npa_aura_limit_modify(sq->aura_handle, sq->aura_sqb_bufs); - } - - plt_io_wmb(); - return rc; -} - void roc_nix_cq_head_tail_get(struct roc_nix *roc_nix, uint16_t qid, uint32_t *head, uint32_t *tail) @@ -2594,15 +2239,6 @@ roc_nix_q_err_cb_register(struct roc_nix *roc_nix, q_err_get_t sq_err_handle) return 0; } -void -roc_nix_q_err_cb_unregister(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - - dev->ops->q_err_cb = NULL; -} - int roc_nix_sq_cnt_update(struct roc_nix_sq *sq, bool enable) { diff --git a/drivers/common/cnxk/roc_nix_stats.c b/drivers/common/cnxk/roc_nix_stats.c index ec2aca8164..b173be5e53 100644 --- a/drivers/common/cnxk/roc_nix_stats.c +++ b/drivers/common/cnxk/roc_nix_stats.c @@ -21,12 +21,6 @@ xstats[index].name); \ } while (0) -int -roc_nix_num_xstats_get(struct roc_nix *roc_nix) -{ - return roc_nix_xstats_names_get(roc_nix, NULL, 0); -} - int roc_nix_stats_get(struct roc_nix *roc_nix, struct roc_nix_stats *stats) { diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c index 1086f471e6..406234b5c7 100644 --- a/drivers/common/cnxk/roc_nix_tm_ops.c +++ b/drivers/common/cnxk/roc_nix_tm_ops.c @@ -96,17 +96,6 @@ roc_nix_tm_sq_aura_fc(struct roc_nix_sq *sq, bool enable) return rc; } -int -roc_nix_tm_free_resources(struct roc_nix *roc_nix, bool hw_only) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - if (nix->tm_flags & NIX_TM_HIERARCHY_ENA) - return -EBUSY; - - return nix_tm_free_resources(roc_nix, BIT(ROC_NIX_TM_USER), hw_only); -} - static int nix_tm_adjust_shaper_pps_rate(struct nix_tm_shaper_profile *profile) { @@ -259,24 +248,6 @@ roc_nix_tm_shaper_profile_add(struct roc_nix *roc_nix, return nix_tm_shaper_profile_add(roc_nix, profile, 0); } -int -roc_nix_tm_shaper_profile_update(struct roc_nix *roc_nix, - struct roc_nix_tm_shaper_profile *roc_profile) -{ - struct nix_tm_shaper_profile *profile; - - profile = (struct nix_tm_shaper_profile *)roc_profile->reserved; - - profile->commit.rate = roc_profile->commit_rate; - profile->peak.rate = roc_profile->peak_rate; - profile->commit.size = roc_profile->commit_sz; - profile->peak.size = roc_profile->peak_sz; - profile->pkt_len_adj = roc_profile->pkt_len_adj; - profile->accuracy = roc_profile->accuracy; - - return nix_tm_shaper_profile_add(roc_nix, profile, 1); -} - int roc_nix_tm_shaper_profile_delete(struct roc_nix *roc_nix, uint32_t id) { @@ -320,124 +291,12 @@ roc_nix_tm_node_add(struct roc_nix *roc_nix, struct roc_nix_tm_node *roc_node) return nix_tm_node_add(roc_nix, node); } -int -roc_nix_tm_node_pkt_mode_update(struct roc_nix *roc_nix, uint32_t node_id, - bool pkt_mode) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_node *node, *child; - struct nix_tm_node_list *list; - int num_children = 0; - - node = nix_tm_node_search(nix, node_id, ROC_NIX_TM_USER); - if (!node) - return NIX_ERR_TM_INVALID_NODE; - - if (node->pkt_mode == pkt_mode) { - node->pkt_mode_set = true; - return 0; - } - - /* Check for any existing children, if there are any, - * then we cannot update the pkt mode as children's quantum - * are already taken in. - */ - list = nix_tm_node_list(nix, ROC_NIX_TM_USER); - TAILQ_FOREACH(child, list, node) { - if (child->parent == node) - num_children++; - } - - /* Cannot update mode if it has children or tree is enabled */ - if ((nix->tm_flags & NIX_TM_HIERARCHY_ENA) && num_children) - return -EBUSY; - - if (node->pkt_mode_set && num_children) - return NIX_ERR_TM_PKT_MODE_MISMATCH; - - node->pkt_mode = pkt_mode; - node->pkt_mode_set = true; - - return 0; -} - -int -roc_nix_tm_node_name_get(struct roc_nix *roc_nix, uint32_t node_id, char *buf, - size_t buflen) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_node *node; - - node = nix_tm_node_search(nix, node_id, ROC_NIX_TM_USER); - if (!node) { - plt_strlcpy(buf, "???", buflen); - return NIX_ERR_TM_INVALID_NODE; - } - - if (node->hw_lvl == NIX_TXSCH_LVL_CNT) - snprintf(buf, buflen, "SQ_%d", node->id); - else - snprintf(buf, buflen, "%s_%d", nix_tm_hwlvl2str(node->hw_lvl), - node->hw_id); - return 0; -} - int roc_nix_tm_node_delete(struct roc_nix *roc_nix, uint32_t node_id, bool free) { return nix_tm_node_delete(roc_nix, node_id, ROC_NIX_TM_USER, free); } -int -roc_nix_smq_flush(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_node_list *list; - enum roc_nix_tm_tree tree; - struct nix_tm_node *node; - int rc = 0; - - if (!(nix->tm_flags & NIX_TM_HIERARCHY_ENA)) - return 0; - - tree = nix->tm_tree; - list = nix_tm_node_list(nix, tree); - - /* XOFF & Flush all SMQ's. HRM mandates - * all SQ's empty before SMQ flush is issued. - */ - TAILQ_FOREACH(node, list, node) { - if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) - continue; - if (!(node->flags & NIX_TM_NODE_HWRES)) - continue; - - rc = nix_tm_smq_xoff(nix, node, true); - if (rc) { - plt_err("Failed to enable smq %u, rc=%d", node->hw_id, - rc); - goto exit; - } - } - - /* XON all SMQ's */ - TAILQ_FOREACH(node, list, node) { - if (node->hw_lvl != NIX_TXSCH_LVL_SMQ) - continue; - if (!(node->flags & NIX_TM_NODE_HWRES)) - continue; - - rc = nix_tm_smq_xoff(nix, node, false); - if (rc) { - plt_err("Failed to enable smq %u, rc=%d", node->hw_id, - rc); - goto exit; - } - } -exit: - return rc; -} - int roc_nix_tm_hierarchy_disable(struct roc_nix *roc_nix) { @@ -748,72 +607,6 @@ roc_nix_tm_node_suspend_resume(struct roc_nix *roc_nix, uint32_t node_id, return rc; } -int -roc_nix_tm_prealloc_res(struct roc_nix *roc_nix, uint8_t lvl, - uint16_t discontig, uint16_t contig) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct mbox *mbox = (&nix->dev)->mbox; - struct nix_txsch_alloc_req *req; - struct nix_txsch_alloc_rsp *rsp; - uint8_t hw_lvl; - int rc = -ENOSPC; - - hw_lvl = nix_tm_lvl2nix(nix, lvl); - if (hw_lvl == NIX_TXSCH_LVL_CNT) - return -EINVAL; - - /* Preallocate contiguous */ - if (nix->contig_rsvd[hw_lvl] < contig) { - req = mbox_alloc_msg_nix_txsch_alloc(mbox_get(mbox)); - if (req == NULL) { - mbox_put(mbox); - return rc; - } - req->schq_contig[hw_lvl] = contig - nix->contig_rsvd[hw_lvl]; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) { - mbox_put(mbox); - return rc; - } - - rc = nix_tm_copy_rsp_to_nix(nix, rsp); - mbox_put(mbox); - if (rc) - return rc; - } - - /* Preallocate contiguous */ - if (nix->discontig_rsvd[hw_lvl] < discontig) { - req = mbox_alloc_msg_nix_txsch_alloc(mbox_get(mbox)); - if (req == NULL) { - mbox_put(mbox); - return -ENOSPC; - } - req->schq[hw_lvl] = discontig - nix->discontig_rsvd[hw_lvl]; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) { - mbox_put(mbox); - return rc; - } - - rc = nix_tm_copy_rsp_to_nix(nix, rsp); - mbox_put(mbox); - if (rc) - return rc; - } - - /* Save thresholds */ - nix->contig_rsvd[hw_lvl] = contig; - nix->discontig_rsvd[hw_lvl] = discontig; - /* Release anything present above thresholds */ - nix_tm_release_resources(nix, hw_lvl, true, true); - nix_tm_release_resources(nix, hw_lvl, false, true); - return 0; -} - int roc_nix_tm_node_shaper_update(struct roc_nix *roc_nix, uint32_t node_id, uint32_t profile_id, bool force_update) @@ -1302,56 +1095,6 @@ roc_nix_tm_rsrc_count(struct roc_nix *roc_nix, uint16_t schq[ROC_TM_LVL_MAX]) return rc; } -void -roc_nix_tm_rsrc_max(bool pf, uint16_t schq[ROC_TM_LVL_MAX]) -{ - uint8_t hw_lvl, i; - uint16_t max; - - for (i = 0; i < ROC_TM_LVL_MAX; i++) { - hw_lvl = pf ? nix_tm_lvl2nix_tl1_root(i) : - nix_tm_lvl2nix_tl2_root(i); - - switch (hw_lvl) { - case NIX_TXSCH_LVL_SMQ: - max = (roc_model_is_cn9k() ? NIX_CN9K_TXSCH_LVL_SMQ_MAX : - (roc_model_is_cn10k() ? NIX_CN10K_TXSCH_LVL_SMQ_MAX : - NIX_TXSCH_LVL_SMQ_MAX)); - break; - case NIX_TXSCH_LVL_TL4: - max = (roc_model_is_cn9k() ? NIX_CN9K_TXSCH_LVL_TL4_MAX : - (roc_model_is_cn10k() ? NIX_CN10K_TXSCH_LVL_TL4_MAX : - NIX_TXSCH_LVL_TL4_MAX)); - break; - case NIX_TXSCH_LVL_TL3: - max = (roc_model_is_cn9k() ? NIX_CN9K_TXSCH_LVL_TL3_MAX : - (roc_model_is_cn10k() ? NIX_CN10K_TXSCH_LVL_TL3_MAX : - NIX_TXSCH_LVL_TL3_MAX)); - break; - case NIX_TXSCH_LVL_TL2: - max = pf ? NIX_TXSCH_LVL_TL2_MAX : 1; - break; - case NIX_TXSCH_LVL_TL1: - max = pf ? 1 : 0; - break; - default: - max = 0; - break; - } - schq[i] = max; - } -} - -bool -roc_nix_tm_root_has_sp(struct roc_nix *roc_nix) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - - if (nix->tm_flags & NIX_TM_TL1_NO_SP) - return false; - return true; -} - static inline struct nix * pf_func_to_nix_get(uint16_t pf_func) { diff --git a/drivers/common/cnxk/roc_nix_tm_utils.c b/drivers/common/cnxk/roc_nix_tm_utils.c index eaf6f9e4c7..158a37ff11 100644 --- a/drivers/common/cnxk/roc_nix_tm_utils.c +++ b/drivers/common/cnxk/roc_nix_tm_utils.c @@ -1019,19 +1019,6 @@ roc_nix_tm_leaf_cnt(struct roc_nix *roc_nix) return leaf_cnt; } -int -roc_nix_tm_node_lvl(struct roc_nix *roc_nix, uint32_t node_id) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_node *node; - - node = nix_tm_node_search(nix, node_id, ROC_NIX_TM_USER); - if (!node) - return NIX_ERR_TM_INVALID_NODE; - - return node->lvl; -} - struct roc_nix_tm_node * roc_nix_tm_node_get(struct roc_nix *roc_nix, uint32_t node_id) { @@ -1042,26 +1029,6 @@ roc_nix_tm_node_get(struct roc_nix *roc_nix, uint32_t node_id) return (struct roc_nix_tm_node *)node; } -struct roc_nix_tm_node * -roc_nix_tm_node_next(struct roc_nix *roc_nix, struct roc_nix_tm_node *__prev) -{ - struct nix_tm_node *prev = (struct nix_tm_node *)__prev; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_node_list *list; - - list = nix_tm_node_list(nix, ROC_NIX_TM_USER); - - /* HEAD of the list */ - if (!prev) - return (struct roc_nix_tm_node *)TAILQ_FIRST(list); - - /* Next entry */ - if (prev->tree != ROC_NIX_TM_USER) - return NULL; - - return (struct roc_nix_tm_node *)TAILQ_NEXT(prev, node); -} - struct roc_nix_tm_shaper_profile * roc_nix_tm_shaper_profile_get(struct roc_nix *roc_nix, uint32_t profile_id) { @@ -1072,24 +1039,6 @@ roc_nix_tm_shaper_profile_get(struct roc_nix *roc_nix, uint32_t profile_id) return (struct roc_nix_tm_shaper_profile *)profile; } -struct roc_nix_tm_shaper_profile * -roc_nix_tm_shaper_profile_next(struct roc_nix *roc_nix, - struct roc_nix_tm_shaper_profile *__prev) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct nix_tm_shaper_profile_list *list; - struct nix_tm_shaper_profile *prev; - - prev = (struct nix_tm_shaper_profile *)__prev; - list = &nix->shaper_profile_list; - - /* HEAD of the list */ - if (!prev) - return (struct roc_nix_tm_shaper_profile *)TAILQ_FIRST(list); - - return (struct roc_nix_tm_shaper_profile *)TAILQ_NEXT(prev, shaper); -} - struct nix_tm_node * nix_tm_node_alloc(void) { diff --git a/drivers/common/cnxk/roc_nix_vlan.c b/drivers/common/cnxk/roc_nix_vlan.c index 16100eb5d6..5240a95b08 100644 --- a/drivers/common/cnxk/roc_nix_vlan.c +++ b/drivers/common/cnxk/roc_nix_vlan.c @@ -5,235 +5,6 @@ #include "roc_api.h" #include "roc_priv.h" -int -roc_nix_vlan_mcam_entry_read(struct roc_nix *roc_nix, uint32_t index, - void **rsp) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct npc_mcam_read_entry_req *req; - int rc = -ENOSPC; - - req = mbox_alloc_msg_npc_mcam_read_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - - rc = mbox_process_msg(mbox, (void **)rsp); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_mcam_entry_write(struct roc_nix *roc_nix, uint32_t index, void *entry, uint8_t intf, - uint8_t enable) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct npc_mcam_write_entry_req *req; - struct npc_cn20k_mcam_write_entry_req *cn20k_req; - struct msghdr *rsp; - int rc = -ENOSPC; - - if (roc_model_is_cn20k()) { - cn20k_req = mbox_alloc_msg_npc_cn20k_mcam_write_entry(mbox); - if (cn20k_req == NULL) - goto exit; - cn20k_req->entry = index; - cn20k_req->intf = intf; - cn20k_req->enable_entry = enable; - mbox_memcpy(&cn20k_req->entry_data, entry, sizeof(struct cn20k_mcam_entry)); - } else { - req = mbox_alloc_msg_npc_mcam_write_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - req->intf = intf; - req->enable_entry = enable; - mbox_memcpy(&req->entry_data, entry, sizeof(struct mcam_entry)); - } - - rc = mbox_process_msg(mbox, (void *)&rsp); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_mcam_entry_alloc_and_write(struct roc_nix *roc_nix, void *entry, uint8_t intf, - uint8_t priority, uint8_t ref_entry) -{ - struct npc_mcam_alloc_and_write_entry_rsp *rsp; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - int rc = -ENOSPC; - - if (roc_model_is_cn20k()) { - struct npc_cn20k_mcam_alloc_and_write_entry_req *req; - - req = mbox_alloc_msg_npc_cn20k_mcam_alloc_and_write_entry(mbox); - if (req == NULL) - goto exit; - req->ref_prio = priority; - req->ref_entry = ref_entry; - req->intf = intf; - req->enable_entry = true; - mbox_memcpy(&req->entry_data, entry, sizeof(struct cn20k_mcam_entry)); - - } else { - struct npc_mcam_alloc_and_write_entry_req *req; - - req = mbox_alloc_msg_npc_mcam_alloc_and_write_entry(mbox); - if (req == NULL) - goto exit; - req->ref_priority = priority; - req->ref_entry = ref_entry; - req->intf = intf; - req->enable_entry = true; - mbox_memcpy(&req->entry_data, entry, sizeof(struct mcam_entry)); - } - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - rc = rsp->entry; -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_mcam_entry_free(struct roc_nix *roc_nix, uint32_t index) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct npc_mcam_free_entry_req *req; - int rc = -ENOSPC; - - req = mbox_alloc_msg_npc_mcam_free_entry(mbox); - if (req == NULL) - goto exit; - req->entry = index; - - rc = mbox_process_msg(mbox, NULL); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_mcam_entry_ena_dis(struct roc_nix *roc_nix, uint32_t index, - const int enable) -{ - struct npc_mcam_ena_dis_entry_req *req; - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - int rc = -ENOSPC; - - if (enable) { - req = mbox_alloc_msg_npc_mcam_ena_entry(mbox); - if (req == NULL) - goto exit; - } else { - req = mbox_alloc_msg_npc_mcam_dis_entry(mbox); - if (req == NULL) - goto exit; - } - - req->entry = index; - rc = mbox_process_msg(mbox, NULL); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_strip_vtag_ena_dis(struct roc_nix *roc_nix, bool enable) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_vtag_config *vtag_cfg; - int rc = -ENOSPC; - - vtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox); - if (vtag_cfg == NULL) - goto exit; - vtag_cfg->vtag_size = NIX_VTAGSIZE_T4; - vtag_cfg->cfg_type = 1; /* Rx VLAN configuration */ - vtag_cfg->rx.capture_vtag = 1; /* Always capture */ - vtag_cfg->rx.vtag_type = 0; /* Use index 0 */ - - if (enable) - vtag_cfg->rx.strip_vtag = 1; - else - vtag_cfg->rx.strip_vtag = 0; - - rc = mbox_process(mbox); -exit: - mbox_put(mbox); - return rc; -} - -int -roc_nix_vlan_insert_ena_dis(struct roc_nix *roc_nix, - struct roc_nix_vlan_config *vlan_cfg, - uint64_t *mcam_index, bool enable) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - struct mbox *mbox = mbox_get(dev->mbox); - struct nix_vtag_config *vtag_cfg; - struct nix_vtag_config_rsp *rsp; - int rc = -ENOSPC; - - vtag_cfg = mbox_alloc_msg_nix_vtag_cfg(mbox); - if (vtag_cfg == NULL) - goto exit; - vtag_cfg->cfg_type = 0; /* Tx VLAN configuration */ - vtag_cfg->vtag_size = NIX_VTAGSIZE_T4; - - if (enable) { - if (vlan_cfg->type & ROC_NIX_VLAN_TYPE_INNER) { - vtag_cfg->tx.vtag0 = vlan_cfg->vlan.vtag_inner; - vtag_cfg->tx.cfg_vtag0 = true; - } - if (vlan_cfg->type & ROC_NIX_VLAN_TYPE_OUTER) { - vtag_cfg->tx.vtag1 = vlan_cfg->vlan.vtag_outer; - vtag_cfg->tx.cfg_vtag1 = true; - } - } else { - if (vlan_cfg->type & ROC_NIX_VLAN_TYPE_INNER) { - vtag_cfg->tx.vtag0_idx = vlan_cfg->mcam.idx_inner; - vtag_cfg->tx.free_vtag0 = true; - } - if (vlan_cfg->type & ROC_NIX_VLAN_TYPE_OUTER) { - vtag_cfg->tx.vtag1_idx = vlan_cfg->mcam.idx_outer; - vtag_cfg->tx.free_vtag1 = true; - } - } - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - goto exit; - - if (enable) - *mcam_index = - (((uint64_t)rsp->vtag1_idx << 32) | rsp->vtag0_idx); - - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - int nix_vlan_tpid_set(struct mbox *mbox, uint16_t pcifunc, uint32_t type, uint16_t tpid) { @@ -257,17 +28,3 @@ nix_vlan_tpid_set(struct mbox *mbox, uint16_t pcifunc, uint32_t type, uint16_t t mbox_put(mbox); return rc; } - -int -roc_nix_vlan_tpid_set(struct roc_nix *roc_nix, uint32_t type, uint16_t tpid) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct dev *dev = &nix->dev; - int rc; - - rc = nix_vlan_tpid_set(dev->mbox, dev->pf_func, type, tpid); - if (rc) - plt_err("Failed to set tpid for PF, rc %d", rc); - - return rc; -} diff --git a/drivers/common/cnxk/roc_npa.c b/drivers/common/cnxk/roc_npa.c index 176a26dc6a..107fce8b61 100644 --- a/drivers/common/cnxk/roc_npa.c +++ b/drivers/common/cnxk/roc_npa.c @@ -464,65 +464,6 @@ npa_aura_fini(struct mbox *m_box, uint32_t aura_id) return rc; } -int -roc_npa_pool_op_pc_reset(uint64_t aura_handle) -{ - struct npa_lf *lf = idev_npa_obj_get(); - struct npa_aq_enq_req *pool_req; - struct npa_aq_enq_rsp *pool_rsp; - struct ndc_sync_op *ndc_req; - struct mbox_dev *mdev; - int rc = -ENOSPC, off; - struct mbox *mbox; - - if (lf == NULL) - return NPA_ERR_PARAM; - - mbox = mbox_get(lf->mbox); - mdev = &mbox->dev[0]; - plt_npa_dbg("lf=%p aura_handle=0x%" PRIx64, lf, aura_handle); - - pool_req = mbox_alloc_msg_npa_aq_enq(mbox); - if (pool_req == NULL) - goto exit; - pool_req->aura_id = roc_npa_aura_handle_to_aura(aura_handle); - pool_req->ctype = NPA_AQ_CTYPE_POOL; - pool_req->op = NPA_AQ_INSTOP_WRITE; - pool_req->pool.op_pc = 0; - pool_req->pool_mask.op_pc = ~pool_req->pool_mask.op_pc; - - rc = mbox_process(mbox); - if (rc < 0) - goto exit; - - off = mbox->rx_start + - PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); - pool_rsp = (struct npa_aq_enq_rsp *)((uintptr_t)mdev->mbase + off); - - if (pool_rsp->hdr.rc != 0) { - rc = NPA_ERR_AURA_POOL_FINI; - goto exit; - } - - /* Sync NDC-NPA for LF */ - ndc_req = mbox_alloc_msg_ndc_sync_op(mbox); - if (ndc_req == NULL) { - rc = -ENOSPC; - goto exit; - } - ndc_req->npa_lf_sync = 1; - rc = mbox_process(mbox); - if (rc) { - plt_err("Error on NDC-NPA LF sync, rc %d", rc); - rc = NPA_ERR_AURA_POOL_FINI; - goto exit; - } - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - int roc_npa_aura_drop_set(uint64_t aura_handle, uint64_t limit, bool ena) { @@ -1809,188 +1750,3 @@ roc_npa_dev_unlock(void) if (idev != NULL) plt_spinlock_unlock(&idev->npa_dev_lock); } - -int -roc_npa_dpc_alloc(uint8_t *counter_id, uint64_t conf) -{ - struct npa_cn20k_dpc_alloc_req *req; - struct npa_cn20k_dpc_alloc_rsp *rsp; - int rc = NPA_ERR_DPC_ALLOC, off; - struct mbox_dev *mdev; - struct mbox *mbox; - struct npa_lf *lf; - - lf = idev_npa_obj_get(); - if (lf == NULL) { - rc = NPA_ERR_DEVICE_NOT_BOUNDED; - return rc; - } - mdev = &lf->mbox->dev[0]; - - mbox = mbox_get(lf->mbox); - req = mbox_alloc_msg_npa_cn20k_dpc_alloc(mbox); - if (req == NULL) - goto exit; - - req->dpc_conf = conf; - rc = mbox_process(mbox); - if (rc < 0) - goto exit; - - off = mbox->rx_start + - PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); - rsp = (struct npa_cn20k_dpc_alloc_rsp *)((uintptr_t)mdev->mbase + off); - - if (rsp->hdr.rc != 0) - goto exit; - - *counter_id = rsp->cntr_id; - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - -int -roc_npa_dpc_free(uint8_t counter_id) -{ - struct npa_cn20k_dpc_free_req *free_req; - int rc = NPA_ERR_DPC_FREE, off; - struct mbox_dev *mdev; - struct msg_rsp *rsp; - struct mbox *mbox; - struct npa_lf *lf; - - lf = idev_npa_obj_get(); - if (lf == NULL) { - rc = NPA_ERR_DEVICE_NOT_BOUNDED; - return rc; - } - mdev = &lf->mbox->dev[0]; - mbox = mbox_get(lf->mbox); - free_req = mbox_alloc_msg_npa_cn20k_dpc_free(mbox); - if (free_req == NULL) - goto exit; - - free_req->cntr_id = counter_id; - rc = mbox_process(mbox); - if (rc < 0) - goto exit; - - off = mbox->rx_start + - PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); - rsp = (struct msg_rsp *)((uintptr_t)mdev->mbase + off); - if (rsp->hdr.rc != 0) - goto exit; - - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - -int -roc_npa_pool_dpc_enable(uint64_t aura_handle, uint8_t counter_id, uint32_t flags) -{ - struct npa_cn20k_aq_enq_req *req; - struct npa_cn20k_aq_enq_rsp *rsp; - int rc = -ENOSPC, off; - struct mbox_dev *mdev; - struct mbox *mbox; - struct npa_lf *lf; - - lf = idev_npa_obj_get(); - if (lf == NULL) { - rc = NPA_ERR_DEVICE_NOT_BOUNDED; - return rc; - } - mdev = &lf->mbox->dev[0]; - mbox = mbox_get(lf->mbox); - req = mbox_alloc_msg_npa_cn20k_aq_enq(mbox); - if (req == NULL) - goto exit; - - req->aura_id = roc_npa_aura_handle_to_aura(aura_handle); - req->op = NPA_AQ_INSTOP_WRITE; - if (!(flags & ROC_NPA_HALO_F)) { - /* Enable DPC in Aura */ - req->ctype = NPA_AQ_CTYPE_AURA; - req->aura.op_dpc_ena = 1; - req->aura.op_dpc_set = counter_id; - req->aura_mask.op_dpc_ena = 1; - req->aura_mask.op_dpc_set = 0; - req->aura_mask.op_dpc_set = ~req->aura_mask.op_dpc_set; - } else { - /* Enable DPC in Halo */ - req->ctype = NPA_AQ_CTYPE_HALO; - req->halo.op_dpc_ena = 1; - req->halo.op_dpc_set = counter_id; - req->halo_mask.op_dpc_ena = 1; - req->halo_mask.op_dpc_set = 0; - req->halo_mask.op_dpc_set = ~req->halo_mask.op_dpc_set; - } - - rc = mbox_process(mbox); - if (rc < 0) - goto exit; - - off = mbox->rx_start + - PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); - rsp = (struct npa_cn20k_aq_enq_rsp *)((uintptr_t)mdev->mbase + off); - if (rsp->hdr.rc != 0) - goto exit; - - rc = 0; -exit: - mbox_put(mbox); - return rc; -} - -int -roc_npa_pool_dpc_disable(uint64_t aura_handle, uint32_t flags) -{ - struct npa_cn20k_aq_enq_req *req; - struct npa_cn20k_aq_enq_rsp *rsp; - int rc = -ENOSPC, off; - struct mbox_dev *mdev; - struct mbox *mbox; - struct npa_lf *lf; - - lf = idev_npa_obj_get(); - if (lf == NULL) { - rc = NPA_ERR_DEVICE_NOT_BOUNDED; - return rc; - } - mdev = &lf->mbox->dev[0]; - mbox = mbox_get(lf->mbox); - req = mbox_alloc_msg_npa_cn20k_aq_enq(mbox); - if (req == NULL) - goto exit; - - req->aura_id = roc_npa_aura_handle_to_aura(aura_handle); - req->op = NPA_AQ_INSTOP_WRITE; - if (!(flags & ROC_NPA_HALO_F)) { - req->ctype = NPA_AQ_CTYPE_AURA; - req->aura.op_dpc_ena = 0; - req->aura_mask.op_dpc_ena = 1; - } else { - req->ctype = NPA_AQ_CTYPE_HALO; - req->halo.op_dpc_ena = 0; - req->halo_mask.op_dpc_ena = 1; - } - - rc = mbox_process(mbox); - if (rc < 0) - goto exit; - - off = mbox->rx_start + - PLT_ALIGN(sizeof(struct mbox_hdr), MBOX_MSG_ALIGN); - rsp = (struct npa_cn20k_aq_enq_rsp *)((uintptr_t)mdev->mbase + off); - if (rsp->hdr.rc != 0) - goto exit; - - rc = 0; -exit: - mbox_put(mbox); - return rc; -} diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index 576460f1d7..c715348e65 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -894,19 +894,13 @@ uint16_t __roc_api roc_npa_pf_func_get(void); /* Debug */ int roc_npa_ctx_dump(void); -int roc_npa_dump(void); /* Reset operation performance counter. */ -int roc_npa_pool_op_pc_reset(uint64_t aura_handle); int roc_npa_aura_drop_set(uint64_t aura_handle, uint64_t limit, bool ena); void roc_npa_dev_lock(void); void roc_npa_dev_unlock(void); -int roc_npa_dpc_alloc(uint8_t *counter_id, uint64_t conf); -int roc_npa_dpc_free(uint8_t counter_id); -int roc_npa_pool_dpc_enable(uint64_t aura_handle, uint8_t counter_id, uint32_t flags); -int roc_npa_pool_dpc_disable(uint64_t aura_handle, uint32_t flags); #endif /* _ROC_NPA_H_ */ diff --git a/drivers/common/cnxk/roc_npa_debug.c b/drivers/common/cnxk/roc_npa_debug.c index e2b50ae1c3..86f7603501 100644 --- a/drivers/common/cnxk/roc_npa_debug.c +++ b/drivers/common/cnxk/roc_npa_debug.c @@ -345,42 +345,3 @@ roc_npa_ctx_dump(void) mbox_put(mbox); return rc; } - -int -roc_npa_dump(void) -{ - struct npa_lf *lf; - int aura_cnt = 0; - uint32_t i; - - lf = idev_npa_obj_get(); - if (lf == NULL) - return NPA_ERR_DEVICE_NOT_BOUNDED; - - for (i = 0; i < lf->nr_pools; i++) { - if (plt_bitmap_get(lf->npa_bmp, i)) - continue; - aura_cnt++; - } - - npa_dump("npa@%p", lf); - npa_dump(" pf = %d", dev_get_pf(lf->pf_func)); - npa_dump(" vf = %d", dev_get_vf(lf->pf_func)); - npa_dump(" aura_cnt = %d", aura_cnt); - npa_dump(" \tpci_dev = %p", lf->pci_dev); - npa_dump(" \tnpa_bmp = %p", lf->npa_bmp); - npa_dump(" \tnpa_bmp_mem = %p", lf->npa_bmp_mem); - npa_dump(" \tnpa_qint_mem = %p", lf->npa_qint_mem); - npa_dump(" \tintr_handle = %p", lf->intr_handle); - npa_dump(" \tmbox = %p", lf->mbox); - npa_dump(" \tbase = 0x%" PRIx64 "", lf->base); - npa_dump(" \tstack_pg_ptrs = %d", lf->stack_pg_ptrs); - npa_dump(" \tstack_pg_bytes = %d", lf->stack_pg_bytes); - npa_dump(" \tnpa_msixoff = 0x%x", lf->npa_msixoff); - npa_dump(" \tnr_pools = %d", lf->nr_pools); - npa_dump(" \tpf_func = 0x%x", lf->pf_func); - npa_dump(" \taura_sz = %d", lf->aura_sz); - npa_dump(" \tqints = %d", lf->qints); - - return 0; -} diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c index f709c71e36..aecea84ee1 100644 --- a/drivers/common/cnxk/roc_npc.c +++ b/drivers/common/cnxk/roc_npc.c @@ -13,14 +13,6 @@ roc_npc_get_key_type(struct roc_npc *roc_npc, struct roc_npc_flow *flow) return npc_get_key_type(npc, flow); } -uint8_t -roc_npc_kex_key_type_config_get(struct roc_npc *roc_npc) -{ - struct npc *npc = roc_npc_to_npc_priv(roc_npc); - - return npc_kex_key_type_config_get(npc); -} - int roc_npc_mark_actions_get(struct roc_npc *roc_npc) { @@ -158,21 +150,6 @@ roc_npc_mcam_free(struct roc_npc *roc_npc, struct roc_npc_flow *mcam) return roc_npc_mcam_free_entry(roc_npc, mcam->mcam_id); } -int -roc_npc_mcam_init(struct roc_npc *roc_npc, struct roc_npc_flow *flow, - int mcam_id) -{ - struct npc *npc = roc_npc_to_npc_priv(roc_npc); - int rc; - - rc = npc_mcam_init(npc, flow, mcam_id); - if (rc != 0) { - plt_err("npc: mcam initialisation write failed"); - return rc; - } - return 0; -} - int roc_npc_mcam_move(struct roc_npc *roc_npc, uint16_t old_ent, uint16_t new_ent) { @@ -213,27 +190,6 @@ roc_npc_mcam_enable_all_entries(struct roc_npc *roc_npc, bool enable) return npc_flow_enable_all_entries(npc, enable); } -void -roc_npc_defrag_mcam_banks(struct roc_npc *roc_npc) -{ - struct npc *npc = roc_npc_to_npc_priv(roc_npc); - struct mbox *mbox = mbox_get(npc->mbox); - struct npc_mcam_defrag_req *req; - struct npc_mcam_defrag_rsp *rsp; - int rc = 0; - - req = (struct npc_mcam_defrag_req *)mbox_alloc_msg_npc_defrag(mbox); - if (req == NULL) - goto exit; - - rc = mbox_process_msg(mbox, (void *)&rsp); - if (rc) - plt_err("Error when defragmenting MCAM banks."); - -exit: - mbox_put(mbox); -} - int roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam, struct roc_npc_flow *ref_mcam, int prio, int *resp_count) @@ -243,15 +199,6 @@ roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam, return npc_mcam_alloc_entry(npc, mcam, ref_mcam, prio, resp_count); } -int -roc_npc_mcam_ena_dis_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam, - bool enable) -{ - struct npc *npc = roc_npc_to_npc_priv(roc_npc); - - return npc_mcam_ena_dis_entry(npc, mcam, enable); -} - int roc_npc_mcam_write_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam) { @@ -260,21 +207,6 @@ roc_npc_mcam_write_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam) return npc_mcam_write_entry(npc->mbox, mcam); } -int -roc_npc_get_low_priority_mcam(struct roc_npc *roc_npc) -{ - struct npc *npc = roc_npc_to_npc_priv(roc_npc); - - if (roc_model_is_cn20k()) - return (npc->mcam_entries - NPC_MCAME_RESVD_10XX - 1); - else if (roc_model_is_cn10k()) - return (npc->mcam_entries - NPC_MCAME_RESVD_10XX - 1); - else if (roc_model_is_cn98xx()) - return (npc->mcam_entries - NPC_MCAME_RESVD_98XX - 1); - else - return (npc->mcam_entries - NPC_MCAME_RESVD_9XXX - 1); -} - static int npc_mcam_tot_entries(void) { @@ -297,30 +229,6 @@ roc_npc_profile_name_get(struct roc_npc *roc_npc) return (char *)npc->profile_name; } -int -roc_npc_kex_capa_get(struct roc_nix *roc_nix, uint64_t *kex_capability) -{ - struct nix *nix = roc_nix_to_nix_priv(roc_nix); - struct npc npc; - int rc = 0; - - memset(&npc, 0, sizeof(npc)); - - npc.mbox = (&nix->dev)->mbox; - - rc = npc_mcam_fetch_kex_cfg(&npc); - if (rc) - return rc; - - rc = npc_mcam_fetch_hw_cap(&npc, &npc.hash_extract_cap); - if (rc) - return rc; - - *kex_capability = npc_get_kex_capability(&npc); - - return 0; -} - int roc_npc_init(struct roc_npc *roc_npc) { @@ -509,31 +417,6 @@ roc_npc_skip_size_pkind_get(struct roc_npc *roc_npc) return -1; } -int -roc_npc_validate_portid_action(struct roc_npc *roc_npc_src, struct roc_npc *roc_npc_dst) -{ - struct roc_nix *roc_nix_src = roc_npc_src->roc_nix; - struct nix *nix_src = roc_nix_to_nix_priv(roc_nix_src); - struct roc_nix *roc_nix_dst = roc_npc_dst->roc_nix; - struct nix *nix_dst = roc_nix_to_nix_priv(roc_nix_dst); - - if (roc_nix_is_pf(roc_npc_dst->roc_nix)) { - plt_err("Output port should be VF"); - return -EINVAL; - } - - if (nix_dst->dev.vf >= nix_src->dev.maxvf) { - plt_err("Invalid VF for output port"); - return -EINVAL; - } - - if (nix_src->dev.pf != nix_dst->dev.pf) { - plt_err("Output port should be VF of ingress PF"); - return -EINVAL; - } - return 0; -} - static int npc_parse_spi_to_sa_action(struct roc_npc *roc_npc, const struct roc_npc_action *act, struct roc_npc_flow *flow, uint8_t *has_spi_to_sa_action) diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h index 60aa9cdbed..8481cca824 100644 --- a/drivers/common/cnxk/roc_npc.h +++ b/drivers/common/cnxk/roc_npc.h @@ -453,7 +453,6 @@ struct roc_npc { int __roc_api roc_npc_init(struct roc_npc *roc_npc); int __roc_api roc_npc_fini(struct roc_npc *roc_npc); const char *__roc_api roc_npc_profile_name_get(struct roc_npc *roc_npc); -int roc_npc_kex_capa_get(struct roc_nix *roc_nix, uint64_t *kex_capability); struct roc_npc_flow *__roc_api roc_npc_flow_create(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, @@ -470,19 +469,14 @@ int __roc_api roc_npc_mcam_alloc_entry(struct roc_npc *roc_npc, struct roc_npc_f int roc_npc_mcam_alloc_entries(struct roc_npc *roc_npc, int ref_entry, int *alloc_entry, int req_count, int priority, int *resp_count, bool is_conti); -int roc_npc_mcam_ena_dis_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam, - bool enable); int __roc_api roc_npc_mcam_write_entry(struct roc_npc *roc_npc, struct roc_npc_flow *mcam); void roc_npc_mcam_write_rx_finalize(struct roc_npc *roc_npc, struct roc_npc_flow *flow); -void roc_npc_defrag_mcam_banks(struct roc_npc *roc_npc); uint8_t __roc_api roc_npc_get_key_type(struct roc_npc *roc_npc, struct roc_npc_flow *flow); -uint8_t roc_npc_kex_key_type_config_get(struct roc_npc *roc_npc); int __roc_api roc_npc_flow_parse(struct roc_npc *roc_npc, const struct roc_npc_attr *attr, const struct roc_npc_item_info pattern[], const struct roc_npc_action actions[], struct roc_npc_flow *flow); -int roc_npc_get_low_priority_mcam(struct roc_npc *roc_npc); int __roc_api roc_npc_mcam_free_counter(struct roc_npc *roc_npc, uint16_t ctr_id); int __roc_api roc_npc_mcam_read_counter(struct roc_npc *roc_npc, uint32_t ctr_id, uint64_t *count); int __roc_api roc_npc_mcam_clear_counter(struct roc_npc *roc_npc, uint32_t ctr_id); @@ -501,9 +495,6 @@ int __roc_api roc_npc_vtag_actions_sub_return(struct roc_npc *roc_npc, uint32_t int __roc_api roc_npc_mcam_merge_base_steering_rule(struct roc_npc *roc_npc, struct roc_npc_flow *flow); int __roc_api roc_npc_mcam_default_rule_action_get(struct roc_npc *roc_npc, uint64_t *action); -int roc_npc_validate_portid_action(struct roc_npc *roc_npc_src, - struct roc_npc *roc_npc_dst); -int roc_npc_mcam_init(struct roc_npc *roc_npc, struct roc_npc_flow *flow, int mcam_id); int __roc_api roc_npc_mcam_move(struct roc_npc *roc_npc, uint16_t old_ent, uint16_t new_ent); void *__roc_api roc_npc_aged_flow_ctx_get(struct roc_npc *roc_npc, uint32_t mcam_id); void roc_npc_sdp_channel_get(struct roc_npc *roc_npc, uint16_t *chan_base, diff --git a/drivers/common/cnxk/roc_ree.c b/drivers/common/cnxk/roc_ree.c index 923d9251ad..447b52d0fa 100644 --- a/drivers/common/cnxk/roc_ree.c +++ b/drivers/common/cnxk/roc_ree.c @@ -200,31 +200,6 @@ roc_ree_af_reg_read(struct roc_ree_vf *vf, uint64_t reg, uint64_t *val) return 0; } -int -roc_ree_af_reg_write(struct roc_ree_vf *vf, uint64_t reg, uint64_t val) -{ - struct ree_rd_wr_reg_msg *msg; - struct mbox *mbox; - - mbox = vf->dev->mbox; - msg = (struct ree_rd_wr_reg_msg *)mbox_alloc_msg_rsp( - mbox, 0, sizeof(*msg), sizeof(*msg)); - if (msg == NULL) { - plt_err("Could not allocate mailbox message"); - return -EFAULT; - } - - msg->hdr.id = MBOX_MSG_REE_RD_WR_REGISTER; - msg->hdr.sig = MBOX_REQ_SIG; - msg->hdr.pcifunc = vf->dev->pf_func; - msg->is_write = 1; - msg->reg_offset = reg; - msg->val = val; - msg->blkaddr = vf->block_address; - - return ree_send_mbox_msg(vf); -} - int roc_ree_rule_db_get(struct roc_ree_vf *vf, char *rule_db, uint32_t rule_db_len, char *rule_dbi, uint32_t rule_dbi_len) @@ -464,62 +439,6 @@ roc_ree_err_intr_unregister(struct roc_ree_vf *vf) vf->err_intr_registered = 0; } -static int -roc_ree_lf_err_intr_register(struct roc_ree_vf *vf, uint16_t msix_off, - uintptr_t base) -{ - struct plt_pci_device *pci_dev = vf->pci_dev; - int ret; - - /* Disable error interrupts */ - plt_write64(~0ull, base + REE_LF_MISC_INT_ENA_W1C); - - /* Register error interrupt handler */ - ret = dev_irq_register(pci_dev->intr_handle, - roc_ree_lf_err_intr_handler, (void *)base, - msix_off); - if (ret) - return ret; - - /* Enable error interrupts */ - plt_write64(~0ull, base + REE_LF_MISC_INT_ENA_W1S); - - return 0; -} - -int -roc_ree_err_intr_register(struct roc_ree_vf *vf) -{ - uint32_t i, j, ret; - uintptr_t base; - - for (i = 0; i < vf->nb_queues; i++) { - if (vf->lf_msixoff[i] == MSIX_VECTOR_INVALID) { - plt_err("Invalid REE LF MSI-X offset: 0x%x", - vf->lf_msixoff[i]); - return -EINVAL; - } - } - - for (i = 0; i < vf->nb_queues; i++) { - base = REE_LF_BAR2(vf, i); - ret = roc_ree_lf_err_intr_register(vf, vf->lf_msixoff[i], base); - if (ret) - goto intr_unregister; - } - - vf->err_intr_registered = 1; - return 0; - -intr_unregister: - /* Unregister the ones already registered */ - for (j = 0; j < i; j++) { - base = REE_LF_BAR2(vf, j); - roc_ree_lf_err_intr_unregister(vf, vf->lf_msixoff[j], base); - } - return ret; -} - int roc_ree_iq_enable(struct roc_ree_vf *vf, const struct roc_ree_qp *qp, uint8_t pri, uint32_t size_div2) diff --git a/drivers/common/cnxk/roc_ree.h b/drivers/common/cnxk/roc_ree.h index 9e9bd983aa..5afe7da8b4 100644 --- a/drivers/common/cnxk/roc_ree.h +++ b/drivers/common/cnxk/roc_ree.h @@ -115,8 +115,6 @@ int roc_ree_config_lf(struct roc_ree_vf *vf, uint8_t lf, uint8_t pri, uint32_t size); int roc_ree_af_reg_read(struct roc_ree_vf *vf, uint64_t reg, uint64_t *val); -int roc_ree_af_reg_write(struct roc_ree_vf *vf, uint64_t reg, - uint64_t val); int __roc_api roc_ree_rule_db_get(struct roc_ree_vf *vf, char *rule_db, uint32_t rule_db_len, char *rule_dbi, uint32_t rule_dbi_len); @@ -128,7 +126,6 @@ int __roc_api roc_ree_rule_db_prog(struct roc_ree_vf *vf, const char *rule_db, uint32_t rule_dbi_len); uintptr_t __roc_api roc_ree_qp_get_base(struct roc_ree_vf *vf, uint16_t qp_id); void __roc_api roc_ree_err_intr_unregister(struct roc_ree_vf *vf); -int roc_ree_err_intr_register(struct roc_ree_vf *vf); int __roc_api roc_ree_iq_enable(struct roc_ree_vf *vf, const struct roc_ree_qp *qp, uint8_t pri, uint32_t size_div128); diff --git a/drivers/common/cnxk/roc_sso.c b/drivers/common/cnxk/roc_sso.c index b674dcf70c..98accfc399 100644 --- a/drivers/common/cnxk/roc_sso.c +++ b/drivers/common/cnxk/roc_sso.c @@ -356,26 +356,6 @@ roc_sso_pf_func_get(void) return idev_sso_pffunc_get(); } -uint64_t -roc_sso_ns_to_gw(uint64_t base, uint64_t ns) -{ - uint64_t current_us; - - current_us = plt_read64(base + SSOW_LF_GWS_NW_TIM); - /* From HRM, table 14-19: - * The SSOW_LF_GWS_NW_TIM[NW_TIM] period is specified in n-1 notation. - */ - current_us += 1; - - /* From HRM, table 14-1: - * SSOW_LF_GWS_NW_TIM[NW_TIM] specifies the minimum timeout. The SSO - * hardware times out a GET_WORK request within 1 usec of the minimum - * timeout specified by SSOW_LF_GWS_NW_TIM[NW_TIM]. - */ - current_us += 1; - return PLT_MAX(1UL, (uint64_t)PLT_DIV_CEIL(ns, (current_us * 1E3))); -} - int roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], uint16_t nb_hwgrp, uint8_t set, bool use_mbox) @@ -705,26 +685,6 @@ roc_sso_hwgrp_agq_release(struct roc_sso *roc_sso, uint16_t hwgrp) mbox_put(mbox); } -uint32_t -roc_sso_hwgrp_agq_from_tag(struct roc_sso *roc_sso, uint16_t hwgrp, uint32_t tag_mask, - uint8_t xqe_type) -{ - struct sso *sso = roc_sso_to_sso_priv(roc_sso); - struct sso_agq_ctx *ctx; - uint32_t i; - - plt_rmb(); - ctx = (struct sso_agq_ctx *)sso->agg_mem[hwgrp]; - for (i = 0; i < sso->agg_used[hwgrp]; i++) { - if (!ctx[i].ena) - continue; - if (ctx[i].tag == tag_mask && ctx[i].xqe_type == xqe_type) - return i; - } - - return UINT32_MAX; -} - int roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint16_t hwgrp, struct roc_sso_hwgrp_stats *stats) { @@ -771,16 +731,6 @@ roc_sso_hwgrp_stats_get(struct roc_sso *roc_sso, uint16_t hwgrp, struct roc_sso_ return rc; } -int -roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, uint8_t hws, - uint16_t hwgrp) -{ - struct sso *sso; - - sso = roc_sso_to_sso_priv(roc_sso); - return plt_bitmap_get(sso->link_map[hws], hwgrp); -} - int roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, struct roc_sso_hwgrp_qos *qos, uint16_t nb_qos) { @@ -1047,20 +997,6 @@ sso_hwgrp_release_xaq(struct dev *dev, uint16_t hwgrps) return rc; } -int -roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, uint16_t hwgrps) -{ - struct sso *sso = roc_sso_to_sso_priv(roc_sso); - struct dev *dev = &sso->dev; - int rc; - - if (!hwgrps) - return 0; - - rc = sso_hwgrp_release_xaq(dev, hwgrps); - return rc; -} - int roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp, uint8_t weight, uint8_t affinity, uint8_t priority) diff --git a/drivers/common/cnxk/roc_sso.h b/drivers/common/cnxk/roc_sso.h index 43af938a8e..da16cc1efb 100644 --- a/drivers/common/cnxk/roc_sso.h +++ b/drivers/common/cnxk/roc_sso.h @@ -88,18 +88,13 @@ int __roc_api roc_sso_hwgrp_qos_config(struct roc_sso *roc_sso, uint16_t nb_qos); int __roc_api roc_sso_hwgrp_alloc_xaq(struct roc_sso *roc_sso, uint32_t npa_aura_id, uint16_t hwgrps); -int roc_sso_hwgrp_release_xaq(struct roc_sso *roc_sso, - uint16_t hwgrps); int __roc_api roc_sso_hwgrp_set_priority(struct roc_sso *roc_sso, uint16_t hwgrp, uint8_t weight, uint8_t affinity, uint8_t priority); -uint64_t roc_sso_ns_to_gw(uint64_t base, uint64_t ns); int __roc_api roc_sso_hws_link(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], uint16_t nb_hwgrp, uint8_t set, bool use_mbox); int __roc_api roc_sso_hws_unlink(struct roc_sso *roc_sso, uint8_t hws, uint16_t hwgrp[], uint16_t nb_hwgrp, uint8_t set, bool use_mbox); -int roc_sso_hwgrp_hws_link_status(struct roc_sso *roc_sso, - uint8_t hws, uint16_t hwgrp); uintptr_t __roc_api roc_sso_hws_base_get(struct roc_sso *roc_sso, uint8_t hws); uintptr_t __roc_api roc_sso_hwgrp_base_get(struct roc_sso *roc_sso, uint16_t hwgrp); @@ -116,8 +111,6 @@ int __roc_api roc_sso_hwgrp_agq_alloc(struct roc_sso *roc_sso, uint16_t hwgrp, struct roc_sso_agq_data *data, uint32_t *agq_id); void __roc_api roc_sso_hwgrp_agq_free(struct roc_sso *roc_sso, uint16_t hwgrp, uint32_t agq_id); void roc_sso_hwgrp_agq_release(struct roc_sso *roc_sso, uint16_t hwgrp); -uint32_t roc_sso_hwgrp_agq_from_tag(struct roc_sso *roc_sso, uint16_t hwgrp, uint32_t tag, - uint8_t xqe_type); /* Utility function */ uint16_t __roc_api roc_sso_pf_func_get(void); -- 2.53.0