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 4EB72A034F; Mon, 7 Jun 2021 20:07:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 663ED4114F; Mon, 7 Jun 2021 20:04:53 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 59A9441140 for ; Mon, 7 Jun 2021 20:04:51 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 157I1avO017507 for ; Mon, 7 Jun 2021 11:04:50 -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=hkMPla8Qo09EiwDlbM8L9G2zEPJqYB2WL2fPnFAX6Dc=; b=L7Lmgd6o/RJBvEJ3D10hXdwuZfyzuKVgkkWpVnq3p7nsl36Nom2CI6ohg4yvOZ6EFLou 63W/FmLpW8QzXRLtQJYZiIrqNN2nrl64tlc9vqr/d5jJo7s2TDiefH/JhiqZxGpP1DSH HtVnxvCF80kjBuLtPV3UX78Vx23Ikd+0JWVnWL53mwe9W/08RTrGzsg4C6viO/pLC37U C4HCgiAiazOpRiPKJULTP9gJ5YN2tUXYFcMAUV5jEBrpYsPtzp6ykp2lTG8RfGOdS/S4 xawJ+samsO/MfXyMURzUsV7KqCb7zouTniqACXeM2oQyEKBErvZ8Wu7nREGeGxLQBh17 9Q== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com with ESMTP id 391ecv2ej2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 07 Jun 2021 11:04:50 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 7 Jun 2021 11:04:48 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 7 Jun 2021 11:04:48 -0700 Received: from hyd1588t430.marvell.com (unknown [10.29.52.204]) by maili.marvell.com (Postfix) with ESMTP id 240EB3F7041; Mon, 7 Jun 2021 11:04:45 -0700 (PDT) From: Nithin Dabilpuram To: CC: , , , , , , Date: Mon, 7 Jun 2021 23:29:15 +0530 Message-ID: <20210607175943.31690-35-ndabilpuram@marvell.com> X-Mailer: git-send-email 2.8.4 In-Reply-To: <20210607175943.31690-1-ndabilpuram@marvell.com> References: <20210306153404.10781-1-ndabilpuram@marvell.com> <20210607175943.31690-1-ndabilpuram@marvell.com> MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: rCdqeTc11zi5AK-UHEFdNN8Z8weN6ow8 X-Proofpoint-ORIG-GUID: rCdqeTc11zi5AK-UHEFdNN8Z8weN6ow8 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-06-07_14:2021-06-04, 2021-06-07 signatures=0 Subject: [dpdk-dev] [PATCH v2 34/62] net/cnxk: add promiscuous mode enable and disable 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" From: Sunil Kumar Kori Add device operations to enable and disable promisc mode for cn9k and cn10k. Signed-off-by: Sunil Kumar Kori --- doc/guides/nics/cnxk.rst | 1 + doc/guides/nics/features/cnxk.ini | 1 + doc/guides/nics/features/cnxk_vec.ini | 1 + drivers/net/cnxk/cnxk_ethdev.c | 2 ++ drivers/net/cnxk/cnxk_ethdev.h | 2 ++ drivers/net/cnxk/cnxk_ethdev_ops.c | 56 +++++++++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+) diff --git a/doc/guides/nics/cnxk.rst b/doc/guides/nics/cnxk.rst index 6cb90a7..364e511 100644 --- a/doc/guides/nics/cnxk.rst +++ b/doc/guides/nics/cnxk.rst @@ -17,6 +17,7 @@ Features Features of the CNXK Ethdev PMD are: - Packet type information +- Promiscuous mode - Jumbo frames - SR-IOV VF - Lock-free Tx queue diff --git a/doc/guides/nics/features/cnxk.ini b/doc/guides/nics/features/cnxk.ini index 6fef725..9b2e163 100644 --- a/doc/guides/nics/features/cnxk.ini +++ b/doc/guides/nics/features/cnxk.ini @@ -17,6 +17,7 @@ Free Tx mbuf on demand = Y Queue start/stop = Y MTU update = Y TSO = Y +Promiscuous mode = Y RSS hash = Y Inner RSS = Y Jumbo frame = Y diff --git a/doc/guides/nics/features/cnxk_vec.ini b/doc/guides/nics/features/cnxk_vec.ini index 79cb1e2..31471e0 100644 --- a/doc/guides/nics/features/cnxk_vec.ini +++ b/doc/guides/nics/features/cnxk_vec.ini @@ -16,6 +16,7 @@ Fast mbuf free = Y Free Tx mbuf on demand = Y Queue start/stop = Y MTU update = Y +Promiscuous mode = Y RSS hash = Y Inner RSS = Y Jumbo frame = Y diff --git a/drivers/net/cnxk/cnxk_ethdev.c b/drivers/net/cnxk/cnxk_ethdev.c index 6b06ee5..1e58599 100644 --- a/drivers/net/cnxk/cnxk_ethdev.c +++ b/drivers/net/cnxk/cnxk_ethdev.c @@ -1078,6 +1078,8 @@ struct eth_dev_ops cnxk_eth_dev_ops = { .rx_queue_start = cnxk_nix_rx_queue_start, .rx_queue_stop = cnxk_nix_rx_queue_stop, .dev_supported_ptypes_get = cnxk_nix_supported_ptypes_get, + .promiscuous_enable = cnxk_nix_promisc_enable, + .promiscuous_disable = cnxk_nix_promisc_disable, }; static int diff --git a/drivers/net/cnxk/cnxk_ethdev.h b/drivers/net/cnxk/cnxk_ethdev.h index 3838573..73aef34 100644 --- a/drivers/net/cnxk/cnxk_ethdev.h +++ b/drivers/net/cnxk/cnxk_ethdev.h @@ -208,6 +208,8 @@ int cnxk_nix_remove(struct rte_pci_device *pci_dev); int cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu); int cnxk_nix_mac_addr_set(struct rte_eth_dev *eth_dev, struct rte_ether_addr *addr); +int cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev); +int cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev); int cnxk_nix_info_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info); int cnxk_nix_configure(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/cnxk/cnxk_ethdev_ops.c b/drivers/net/cnxk/cnxk_ethdev_ops.c index 21b55c4..6feb3a9 100644 --- a/drivers/net/cnxk/cnxk_ethdev_ops.c +++ b/drivers/net/cnxk/cnxk_ethdev_ops.c @@ -173,3 +173,59 @@ cnxk_nix_mtu_set(struct rte_eth_dev *eth_dev, uint16_t mtu) exit: return rc; } + +int +cnxk_nix_promisc_enable(struct rte_eth_dev *eth_dev) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct roc_nix *nix = &dev->nix; + int rc = 0; + + if (roc_nix_is_vf_or_sdp(nix)) + return rc; + + rc = roc_nix_npc_promisc_ena_dis(nix, true); + if (rc) { + plt_err("Failed to setup promisc mode in npc, rc=%d(%s)", rc, + roc_error_msg_get(rc)); + return rc; + } + + rc = roc_nix_mac_promisc_mode_enable(nix, true); + if (rc) { + plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc, + roc_error_msg_get(rc)); + roc_nix_npc_promisc_ena_dis(nix, false); + return rc; + } + + return 0; +} + +int +cnxk_nix_promisc_disable(struct rte_eth_dev *eth_dev) +{ + struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev); + struct roc_nix *nix = &dev->nix; + int rc = 0; + + if (roc_nix_is_vf_or_sdp(nix)) + return rc; + + rc = roc_nix_npc_promisc_ena_dis(nix, false); + if (rc < 0) { + plt_err("Failed to setup promisc mode in npc, rc=%d(%s)", rc, + roc_error_msg_get(rc)); + return rc; + } + + rc = roc_nix_mac_promisc_mode_enable(nix, false); + if (rc) { + plt_err("Failed to setup promisc mode in mac, rc=%d(%s)", rc, + roc_error_msg_get(rc)); + roc_nix_npc_promisc_ena_dis(nix, true); + return rc; + } + + return 0; +} -- 2.8.4