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 0DC48424E7; Mon, 4 Sep 2023 07:00:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4854540EDC; Mon, 4 Sep 2023 06:58:03 +0200 (CEST) Received: from VLXDG1SPAM1.ramaxel.com (email.unionmem.com [221.4.138.186]) by mails.dpdk.org (Postfix) with ESMTP id 7BAED40DFD for ; Mon, 4 Sep 2023 06:57:58 +0200 (CEST) Received: from V12DG1MBS03.ramaxel.local ([172.26.18.33]) by VLXDG1SPAM1.ramaxel.com with ESMTP id 3844vHCo054275; Mon, 4 Sep 2023 12:57:17 +0800 (GMT-8) (envelope-from wanry@3snic.com) Received: from localhost.localdomain (10.64.136.151) by V12DG1MBS03.ramaxel.local (172.26.18.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.17; Mon, 4 Sep 2023 12:57:16 +0800 From: To: CC: , Renyong Wan , Steven Song Subject: [PATCH v5 21/32] net/sssnic: add allmulticast and promiscuous ops Date: Mon, 4 Sep 2023 12:56:47 +0800 Message-ID: <20230904045658.238185-22-wanry@3snic.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230904045658.238185-1-wanry@3snic.com> References: <20230904045658.238185-1-wanry@3snic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Originating-IP: [10.64.136.151] X-ClientProxiedBy: V12DG1MBS03.ramaxel.local (172.26.18.33) To V12DG1MBS03.ramaxel.local (172.26.18.33) X-DNSRBL: X-SPAM-SOURCE-CHECK: pass X-MAIL: VLXDG1SPAM1.ramaxel.com 3844vHCo054275 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Renyong Wan Signed-off-by: Steven Song Signed-off-by: Renyong Wan --- doc/guides/nics/features/sssnic.ini | 2 + drivers/net/sssnic/sssnic_ethdev.c | 72 +++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/doc/guides/nics/features/sssnic.ini b/doc/guides/nics/features/sssnic.ini index e3b8166629..359834ce4c 100644 --- a/doc/guides/nics/features/sssnic.ini +++ b/doc/guides/nics/features/sssnic.ini @@ -8,6 +8,8 @@ Link status = Y Link status event = Y Queue start/stop = Y Rx interrupt = Y +Promiscuous mode = Y +Allmulticast mode = Y Unicast MAC filter = Y Multicast MAC filter = Y Linux = Y diff --git a/drivers/net/sssnic/sssnic_ethdev.c b/drivers/net/sssnic/sssnic_ethdev.c index b59c4fd3ad..e1c805aeea 100644 --- a/drivers/net/sssnic/sssnic_ethdev.c +++ b/drivers/net/sssnic/sssnic_ethdev.c @@ -652,6 +652,74 @@ sssnic_ethdev_reset(struct rte_eth_dev *ethdev) return 0; } +static int +sssnic_ethdev_allmulticast_enable(struct rte_eth_dev *ethdev) +{ + struct sssnic_netdev *netdev = SSSNIC_ETHDEV_PRIVATE(ethdev); + uint32_t rx_mode; + int ret; + + rx_mode = netdev->rx_mode | SSSNIC_ETHDEV_RX_ALL_MCAST; + ret = sssnic_ethdev_rx_mode_set(ethdev, rx_mode); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to set rx_mode: %x", rx_mode); + return ret; + } + + return 0; +} + +static int +sssnic_ethdev_allmulticast_disable(struct rte_eth_dev *ethdev) +{ + struct sssnic_netdev *netdev = SSSNIC_ETHDEV_PRIVATE(ethdev); + uint32_t rx_mode; + int ret; + + rx_mode = netdev->rx_mode & (~SSSNIC_ETHDEV_RX_ALL_MCAST); + ret = sssnic_ethdev_rx_mode_set(ethdev, rx_mode); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to set rx_mode: %x", rx_mode); + return ret; + } + + return 0; +} + +static int +sssnic_ethdev_promiscuous_enable(struct rte_eth_dev *ethdev) +{ + struct sssnic_netdev *netdev = SSSNIC_ETHDEV_PRIVATE(ethdev); + uint32_t rx_mode; + int ret; + + rx_mode = netdev->rx_mode | SSSNIC_ETHDEV_RX_PROMISC; + ret = sssnic_ethdev_rx_mode_set(ethdev, rx_mode); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to set rx_mode: %x", rx_mode); + return ret; + } + + return 0; +} + +static int +sssnic_ethdev_promiscuous_disable(struct rte_eth_dev *ethdev) +{ + struct sssnic_netdev *netdev = SSSNIC_ETHDEV_PRIVATE(ethdev); + uint32_t rx_mode; + int ret; + + rx_mode = netdev->rx_mode & (~SSSNIC_ETHDEV_RX_PROMISC); + ret = sssnic_ethdev_rx_mode_set(ethdev, rx_mode); + if (ret != 0) { + PMD_DRV_LOG(ERR, "Failed to set rx_mode: %x", rx_mode); + return ret; + } + + return 0; +} + static const struct eth_dev_ops sssnic_ethdev_ops = { .dev_start = sssnic_ethdev_start, .dev_stop = sssnic_ethdev_stop, @@ -676,6 +744,10 @@ static const struct eth_dev_ops sssnic_ethdev_ops = { .tx_queue_stop = sssnic_ethdev_tx_queue_stop, .rx_queue_intr_enable = sssnic_ethdev_rx_queue_intr_enable, .rx_queue_intr_disable = sssnic_ethdev_rx_queue_intr_disable, + .allmulticast_enable = sssnic_ethdev_allmulticast_enable, + .allmulticast_disable = sssnic_ethdev_allmulticast_disable, + .promiscuous_enable = sssnic_ethdev_promiscuous_enable, + .promiscuous_disable = sssnic_ethdev_promiscuous_disable, }; static int -- 2.27.0