From: <wanry@3snic.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@amd.com>, Renyong Wan <wanry@3snic.com>,
Steven Song <steven.song@3snic.com>
Subject: [PATCH v3 21/32] net/sssnic: add allmulticast and promiscuous ops
Date: Fri, 1 Sep 2023 11:28:31 +0800 [thread overview]
Message-ID: <20230901032842.223547-22-wanry@3snic.com> (raw)
In-Reply-To: <20230901032842.223547-1-wanry@3snic.com>
From: Renyong Wan <wanry@3snic.com>
Signed-off-by: Steven Song <steven.song@3snic.com>
Signed-off-by: Renyong Wan <wanry@3snic.com>
---
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
next prev parent reply other threads:[~2023-09-01 3:31 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-01 3:28 [PATCH v3 00/32] Introduce sssnic PMD for 3SNIC's 9x0 serials Ethernet adapters wanry
2023-09-01 3:28 ` [PATCH v3 01/32] net/sssnic: add build and doc infrastructure wanry
2023-09-01 3:28 ` [PATCH v3 02/32] net/sssnic: add log type and log macros wanry
2023-09-01 3:28 ` [PATCH v3 03/32] net/sssnic: support probe and remove wanry
2023-09-01 3:28 ` [PATCH v3 04/32] net/sssnic: initialize hardware base wanry
2023-09-01 3:28 ` [PATCH v3 05/32] net/sssnic: add event queue wanry
2023-09-01 3:28 ` [PATCH v3 06/32] net/sssnic/base: add message definition and utility wanry
2023-09-01 3:28 ` [PATCH v3 07/32] net/sssnic/base: add mailbox support wanry
2023-09-01 3:28 ` [PATCH v3 08/32] net/sssnic/base: add work queue wanry
2023-09-01 3:28 ` [PATCH v3 09/32] net/sssnic/base: add control queue wanry
2023-09-01 3:28 ` [PATCH v3 10/32] net/sssnic: add dev configure and infos get wanry
2023-09-01 3:28 ` [PATCH v3 11/32] net/sssnic: add dev MAC ops wanry
2023-09-01 3:28 ` [PATCH v3 12/32] net/sssnic: support dev link status wanry
2023-09-01 3:28 ` [PATCH v3 13/32] net/sssnic: support link status event wanry
2023-09-01 3:28 ` [PATCH v3 14/32] net/sssnic: support Rx queue setup and release wanry
2023-09-01 3:28 ` [PATCH v3 15/32] net/sssnic: support Tx " wanry
2023-09-01 3:28 ` [PATCH v3 16/32] net/sssnic: support Rx queue start and stop wanry
2023-09-01 3:28 ` [PATCH v3 17/32] net/sssnic: support Tx " wanry
2023-09-01 3:28 ` [PATCH v3 18/32] net/sssnic: add Rx interrupt support wanry
2023-09-01 3:28 ` [PATCH v3 19/32] net/sssnic: support dev start and stop wanry
2023-09-01 3:28 ` [PATCH v3 20/32] net/sssnic: support dev close and reset wanry
2023-09-01 3:28 ` wanry [this message]
2023-09-01 3:28 ` [PATCH v3 22/32] net/sssnic: add basic and extended stats ops wanry
2023-09-01 3:28 ` [PATCH v3 23/32] net/sssnic: support Rx packet burst wanry
2023-09-01 3:28 ` [PATCH v3 24/32] net/sssnic: support Tx " wanry
2023-09-01 3:28 ` [PATCH v3 25/32] net/sssnic: add RSS support wanry
2023-09-01 3:28 ` [PATCH v3 26/32] net/sssnic: support dev MTU set wanry
2023-09-01 3:28 ` [PATCH v3 27/32] net/sssnic: support dev queue info get wanry
2023-09-01 3:28 ` [PATCH v3 28/32] net/sssnic: support dev firmware version get wanry
2023-09-01 3:28 ` [PATCH v3 29/32] net/sssnic: add dev flow control ops wanry
2023-09-01 3:28 ` [PATCH v3 30/32] net/sssnic: support VLAN offload and filter wanry
2023-09-01 3:28 ` [PATCH v3 31/32] net/sssnic: add generic flow ops wanry
2023-09-01 3:28 ` [PATCH v3 32/32] net/sssnic: add VF dev support wanry
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230901032842.223547-22-wanry@3snic.com \
--to=wanry@3snic.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=steven.song@3snic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).