All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harman Kalra <hkalra@marvell.com>
To: <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>
Subject: [PATCH v3 09/11] net/octeontx: support allmulticast
Date: Tue, 24 May 2022 14:12:33 +0530	[thread overview]
Message-ID: <20220524084235.17796-9-hkalra@marvell.com> (raw)
In-Reply-To: <20220524084235.17796-1-hkalra@marvell.com>

Implement allmulticast operations for octeontx driver:
rte_eth_allmulticast_enable()/rte_eth_allmulticast_disable().

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 drivers/net/octeontx/base/octeontx_bgx.c | 19 ++++++++++
 drivers/net/octeontx/base/octeontx_bgx.h |  1 +
 drivers/net/octeontx/octeontx_ethdev.c   | 46 ++++++++++++++++++++++++
 3 files changed, 66 insertions(+)

diff --git a/drivers/net/octeontx/base/octeontx_bgx.c b/drivers/net/octeontx/base/octeontx_bgx.c
index 81a8cbecaf..1eacecbccc 100644
--- a/drivers/net/octeontx/base/octeontx_bgx.c
+++ b/drivers/net/octeontx/base/octeontx_bgx.c
@@ -144,6 +144,25 @@ octeontx_bgx_port_status(int port, octeontx_mbox_bgx_port_status_t *stat)
 	return res;
 }
 
+int
+octeontx_bgx_port_multicast_set(int port, int en)
+{
+	struct octeontx_mbox_hdr hdr;
+	uint8_t	prom;
+	int res;
+
+	hdr.coproc = OCTEONTX_BGX_COPROC;
+	hdr.msg = MBOX_BGX_PORT_SET_MCAST;
+	hdr.vfid = port;
+	prom = en ? 1 : 0;
+
+	res = octeontx_mbox_send(&hdr, &prom, sizeof(prom), NULL, 0);
+	if (res < 0)
+		return -EACCES;
+
+	return res;
+}
+
 int
 octeontx_bgx_port_xstats(int port, octeontx_mbox_bgx_port_stats_t *stats)
 {
diff --git a/drivers/net/octeontx/base/octeontx_bgx.h b/drivers/net/octeontx/base/octeontx_bgx.h
index c5662202ac..3213d04e99 100644
--- a/drivers/net/octeontx/base/octeontx_bgx.h
+++ b/drivers/net/octeontx/base/octeontx_bgx.h
@@ -166,6 +166,7 @@ int octeontx_bgx_port_stats_clr(int port);
 int octeontx_bgx_port_xstats(int port, octeontx_mbox_bgx_port_stats_t *stats);
 int octeontx_bgx_port_link_status(int port);
 int octeontx_bgx_port_promisc_set(int port, int en);
+int octeontx_bgx_port_multicast_set(int port, int en);
 int octeontx_bgx_port_mac_set(int port, uint8_t *mac_addr);
 int octeontx_bgx_port_mac_add(int port, uint8_t *mac_addr, int index);
 int octeontx_bgx_port_mac_del(int port, uint32_t index);
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index c15014bdde..3aca53fb98 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -847,6 +847,50 @@ octeontx_dev_link_update(struct rte_eth_dev *dev,
 	return rte_eth_linkstatus_set(dev, &link);
 }
 
+static int
+octeontx_port_mcast_set(struct octeontx_nic *nic, int en)
+{
+	struct rte_eth_dev *dev;
+	int res;
+
+	res = 0;
+	PMD_INIT_FUNC_TRACE();
+	dev = nic->dev;
+
+	res = octeontx_bgx_port_multicast_set(nic->port_id, en);
+	if (res < 0) {
+		octeontx_log_err("failed to set multicast mode %d",
+				nic->port_id);
+		return res;
+	}
+
+	/* Set proper flag for the mode */
+	dev->data->all_multicast = (en != 0) ? 1 : 0;
+
+	octeontx_log_dbg("port %d : multicast mode %s",
+			nic->port_id, en ? "set" : "unset");
+
+	return 0;
+}
+
+static int
+octeontx_allmulticast_enable(struct rte_eth_dev *dev)
+{
+	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+	PMD_INIT_FUNC_TRACE();
+	return octeontx_port_mcast_set(nic, 1);
+}
+
+static int
+octeontx_allmulticast_disable(struct rte_eth_dev *dev)
+{
+	struct octeontx_nic *nic = octeontx_pmd_priv(dev);
+
+	PMD_INIT_FUNC_TRACE();
+	return octeontx_port_mcast_set(nic, 0);
+}
+
 static inline int octeontx_dev_total_xstat(void)
 {
 	return NUM_BGX_XSTAT;
@@ -1480,6 +1524,8 @@ static const struct eth_dev_ops octeontx_dev_ops = {
 	.xstats_get_by_id	 = octeontx_dev_xstats_get_by_id,
 	.xstats_get_names	 = octeontx_dev_xstats_get_names,
 	.xstats_get_names_by_id	 = octeontx_dev_xstats_get_names_by_id,
+	.allmulticast_enable      = octeontx_allmulticast_enable,
+	.allmulticast_disable     = octeontx_allmulticast_disable,
 };
 
 /* Create Ethdev interface per BGX LMAC ports */
-- 
2.18.0


  parent reply	other threads:[~2022-05-24  8:43 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17 17:39 [PATCH 01/12] config: add thundert83 config Harman Kalra
2022-05-17 17:39 ` [PATCH 02/12] event/octeontx: fix SSO fastpath Harman Kalra
2022-05-23 16:10   ` [PATCH v2 01/11] " Harman Kalra
2022-05-23 16:10     ` [PATCH v2 02/11] net/octeontx: fix port close Harman Kalra
2022-05-23 16:10     ` [PATCH v2 03/11] net/octeontx: setting link attributes Harman Kalra
2022-05-23 16:10     ` [PATCH v2 04/11] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-23 16:10     ` [PATCH v2 05/11] net/thunderx: implement polling of link state change Harman Kalra
2022-05-23 16:10     ` [PATCH v2 06/11] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-23 16:10     ` [PATCH v2 07/11] net/thunderx: setting link attributes Harman Kalra
2022-05-23 16:10     ` [PATCH v2 08/11] net/octeontx: implement xstats Harman Kalra
2022-05-23 16:10     ` [PATCH v2 09/11] net/octeontx: support allmulticast Harman Kalra
2022-05-23 16:10     ` [PATCH v2 10/11] net/thunderx: device attach from secondary Harman Kalra
2022-05-23 16:11     ` [PATCH v2 11/11] net/thunderx: populate max and min MTU values Harman Kalra
2022-05-24  8:42   ` [PATCH v3 01/11] event/octeontx: fix SSO fastpath Harman Kalra
2022-05-24  8:42     ` [PATCH v3 02/11] net/octeontx: fix port close Harman Kalra
2022-05-24  8:42     ` [PATCH v3 03/11] net/octeontx: setting link attributes Harman Kalra
2022-05-24  8:42     ` [PATCH v3 04/11] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-24  8:42     ` [PATCH v3 05/11] net/thunderx: implement polling of link state change Harman Kalra
2022-05-24  8:42     ` [PATCH v3 06/11] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-24  8:42     ` [PATCH v3 07/11] net/thunderx: setting link attributes Harman Kalra
2022-05-24  8:42     ` [PATCH v3 08/11] net/octeontx: implement xstats Harman Kalra
2022-06-09 16:13       ` Jerin Jacob
2022-05-24  8:42     ` Harman Kalra [this message]
2022-05-24  8:42     ` [PATCH v3 10/11] net/thunderx: device attach from secondary Harman Kalra
2022-05-24  8:42     ` [PATCH v3 11/11] net/thunderx: populate max and min MTU values Harman Kalra
2022-06-09 15:55       ` Jerin Jacob
2022-06-09 15:53     ` [PATCH v3 01/11] event/octeontx: fix SSO fastpath Jerin Jacob
2022-05-17 17:39 ` [PATCH 03/12] net/octeontx: fix port close Harman Kalra
2022-05-17 17:39 ` [PATCH 04/12] net/octeontx: setting link attributes Harman Kalra
2022-05-17 17:39 ` [PATCH 05/12] net/octeontx: handle port reconfiguration Harman Kalra
2022-05-17 17:39 ` [PATCH 06/12] net/thunderx: implement polling of link state change Harman Kalra
2022-05-17 17:39 ` [PATCH 07/12] net/thunderx: reset Rx DMAC control register Harman Kalra
2022-05-17 17:39 ` [PATCH 08/12] net/thunderx: setting link attributes Harman Kalra
2022-05-17 17:39 ` [PATCH 09/12] net/octeontx: implement xstats Harman Kalra
2022-05-17 17:39 ` [PATCH 10/12] net/octeontx: support allmulticast Harman Kalra
2022-05-17 17:39 ` [PATCH 11/12] net/thunderx: device attach from secondary Harman Kalra
2022-05-17 17:39 ` [PATCH 12/12] net/thunderx: populate max and min MTU values Harman Kalra
2022-05-18  6:10 ` [PATCH 01/12] config: add thundert83 config Ruifeng Wang
2022-05-23 13:34 ` [PATCH v2] config: add thunderX t83 config Harman Kalra
2022-06-01 22:02   ` Thomas Monjalon

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=20220524084235.17796-9-hkalra@marvell.com \
    --to=hkalra@marvell.com \
    --cc=dev@dpdk.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.