From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 12985A0C4E; Tue, 2 Nov 2021 16:55:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4858411DB; Tue, 2 Nov 2021 16:54:47 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 47288411DB for ; Tue, 2 Nov 2021 16:54:46 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1A2CjbF5030442; Tue, 2 Nov 2021 08:54:43 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=AjG1SAeSPHlg5fHVf9gm2s/6NZrAVxzgJKXp0KbDgv0=; b=Pcgscbh3G1cWQA3zlS8BslYPzfdzUTxWN3a3WWSSULJETe+xLBpC9UMpOTB9Di+M2xFH 8LtOgNPFXx3X4lgQOHZDO4Nez4tzrTqKL2eKgX+otnATth6L8hD11/EJSLWb5Oxv6EPH i9FTSnkG4/29z0qeyBysnmJlFRNcxOTuC+8CFbWowitpYnSbr7zX62FwSze21EKAhuEk CGmnR9jsa4+tM8aZwRDHTVvxdzRKkDJarZuvkcpoDN/ProvGotoezi0QddoaIDqkYWq3 FnAaXp2coFj2Y8JVxQNheL/J3p86/oazJcaydxwzGqxysVKXPAYTzRPdTV7D5lRR+Zq7 dA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3c35mbh5p0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 02 Nov 2021 08:54:43 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 2 Nov 2021 08:54:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 2 Nov 2021 08:54:41 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id CC4E55B6932; Tue, 2 Nov 2021 08:54:39 -0700 (PDT) From: Nithin Dabilpuram To: , Nithin Dabilpuram , "Kiran Kumar K" , Sunil Kumar Kori , Satha Rao , Ray Kinsella CC: Date: Tue, 2 Nov 2021 21:24:17 +0530 Message-ID: <20211102155421.486-6-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20211102155421.486-1-ndabilpuram@marvell.com> References: <20211102155421.486-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: qMLgPldH8dd2hwq9kQBZ9NlEMQ6MHaF3 X-Proofpoint-ORIG-GUID: qMLgPldH8dd2hwq9kQBZ9NlEMQ6MHaF3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-02_08,2021-11-02_01,2020-04-07_01 Subject: [dpdk-dev] [PATCH 6/9] common/cnxk: support changing drop re flag after lf alloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add API to toggle drop_re flag after nix_lf_alloc() so that it can be used to toggle it runtime. Signed-off-by: Nithin Dabilpuram --- drivers/common/cnxk/roc_mbox.h | 1 + drivers/common/cnxk/roc_nix.c | 1 + drivers/common/cnxk/roc_nix.h | 1 + drivers/common/cnxk/roc_nix_ops.c | 39 ++++++++++++++++++++++++++++++++++++++ drivers/common/cnxk/roc_nix_priv.h | 1 + drivers/common/cnxk/version.map | 1 + 6 files changed, 44 insertions(+) diff --git a/drivers/common/cnxk/roc_mbox.h b/drivers/common/cnxk/roc_mbox.h index bf5495d..a7e7776 100644 --- a/drivers/common/cnxk/roc_mbox.h +++ b/drivers/common/cnxk/roc_mbox.h @@ -1075,6 +1075,7 @@ struct nix_rx_cfg { struct mbox_msghdr hdr; #define NIX_RX_OL3_VERIFY BIT(0) #define NIX_RX_OL4_VERIFY BIT(1) +#define NIX_RX_DROP_RE BIT(2) uint8_t __io len_verify; /* Outer L3/L4 len check */ #define NIX_RX_CSUM_OL4_VERIFY BIT(0) uint8_t __io csum_verify; /* Outer L4 checksum verification */ diff --git a/drivers/common/cnxk/roc_nix.c b/drivers/common/cnxk/roc_nix.c index c96b266..151d8c3 100644 --- a/drivers/common/cnxk/roc_nix.c +++ b/drivers/common/cnxk/roc_nix.c @@ -173,6 +173,7 @@ roc_nix_lf_alloc(struct roc_nix *roc_nix, uint32_t nb_rxq, uint32_t nb_txq, if (rc) goto fail; + nix->rx_cfg = rx_cfg; nix->sqb_size = rsp->sqb_size; nix->tx_chan_base = rsp->tx_chan_base; nix->rx_chan_base = rsp->rx_chan_base; diff --git a/drivers/common/cnxk/roc_nix.h b/drivers/common/cnxk/roc_nix.h index 8f36ce7..82d74de 100644 --- a/drivers/common/cnxk/roc_nix.h +++ b/drivers/common/cnxk/roc_nix.h @@ -445,6 +445,7 @@ int __roc_api roc_nix_lf_free(struct roc_nix *roc_nix); int __roc_api roc_nix_lf_inl_ipsec_cfg(struct roc_nix *roc_nix, struct roc_nix_ipsec_cfg *cfg, bool enb); int __roc_api roc_nix_cpt_ctx_cache_sync(struct roc_nix *roc_nix); +int __roc_api roc_nix_rx_drop_re_set(struct roc_nix *roc_nix, bool ena); /* Debug */ int __roc_api roc_nix_lf_get_reg_count(struct roc_nix *roc_nix); diff --git a/drivers/common/cnxk/roc_nix_ops.c b/drivers/common/cnxk/roc_nix_ops.c index 0e28302..04a78cf 100644 --- a/drivers/common/cnxk/roc_nix_ops.c +++ b/drivers/common/cnxk/roc_nix_ops.c @@ -450,3 +450,42 @@ roc_nix_eeprom_info_get(struct roc_nix *roc_nix, mbox_memcpy(info->buf, rsp->fwdata.sfp_eeprom.buf, SFP_EEPROM_SIZE); return 0; } + +int +roc_nix_rx_drop_re_set(struct roc_nix *roc_nix, bool ena) +{ + struct nix *nix = roc_nix_to_nix_priv(roc_nix); + struct mbox *mbox = get_mbox(roc_nix); + struct nix_rx_cfg *req; + int rc = -EIO; + + /* No-op if no change */ + if (ena == !!(nix->rx_cfg & ROC_NIX_LF_RX_CFG_DROP_RE)) + return 0; + + req = mbox_alloc_msg_nix_set_rx_cfg(mbox); + if (req == NULL) + return rc; + + if (ena) + req->len_verify |= NIX_RX_DROP_RE; + /* Keep other flags intact */ + if (nix->rx_cfg & ROC_NIX_LF_RX_CFG_LEN_OL3) + req->len_verify |= NIX_RX_OL3_VERIFY; + + if (nix->rx_cfg & ROC_NIX_LF_RX_CFG_LEN_OL4) + req->len_verify |= NIX_RX_OL4_VERIFY; + + if (nix->rx_cfg & ROC_NIX_LF_RX_CFG_CSUM_OL4) + req->csum_verify |= NIX_RX_CSUM_OL4_VERIFY; + + rc = mbox_process(mbox); + if (rc) + return rc; + + if (ena) + nix->rx_cfg |= ROC_NIX_LF_RX_CFG_DROP_RE; + else + nix->rx_cfg &= ~ROC_NIX_LF_RX_CFG_DROP_RE; + return 0; +} diff --git a/drivers/common/cnxk/roc_nix_priv.h b/drivers/common/cnxk/roc_nix_priv.h index 60a00a3..04575af 100644 --- a/drivers/common/cnxk/roc_nix_priv.h +++ b/drivers/common/cnxk/roc_nix_priv.h @@ -139,6 +139,7 @@ struct nix { uint16_t msixoff; uint8_t rx_pause; uint8_t tx_pause; + uint64_t rx_cfg; struct dev dev; uint16_t cints; uint16_t qints; diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map index a90e5fc..a139f0d 100644 --- a/drivers/common/cnxk/version.map +++ b/drivers/common/cnxk/version.map @@ -211,6 +211,7 @@ INTERNAL { roc_nix_rss_key_set; roc_nix_rss_reta_get; roc_nix_rss_reta_set; + roc_nix_rx_drop_re_set; roc_nix_rx_queue_intr_disable; roc_nix_rx_queue_intr_enable; roc_nix_sq_dump; -- 2.8.4