From: Adham Masarwah <adham@nvidia.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <matan@nvidia.com>, <idanhac@nvidia.com>,
<tamerh@nvidia.com>, <talshn@nvidia.com>,
<viacheslavo@nvidia.com>
Subject: [PATCH 1/2] net/mlx5: add support for set promiscuous modes in Windows
Date: Sun, 10 Apr 2022 13:31:06 +0300 [thread overview]
Message-ID: <20220410103107.66964-2-adham@nvidia.com> (raw)
Support of the set promiscuous modes by calling the new API
In Mlx5DevX Lib.
Added new glue API for Windows which will be used to communicate
with Windows driver to enable/disable PROMISC or ALLMC.
Signed-off-by: Adham Masarwah <adham@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
Acked-by: Matan Azard <matan@nvidia.com>
---
drivers/common/mlx5/windows/mlx5_glue.c | 31 +++++++++++++++++++++++++++++++
drivers/common/mlx5/windows/mlx5_glue.h | 6 ++++++
drivers/net/mlx5/windows/mlx5_os.c | 15 ++++++---------
3 files changed, 43 insertions(+), 9 deletions(-)
diff --git a/drivers/common/mlx5/windows/mlx5_glue.c b/drivers/common/mlx5/windows/mlx5_glue.c
index 535487a8d4..73d63ffd98 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.c
+++ b/drivers/common/mlx5/windows/mlx5_glue.c
@@ -328,6 +328,36 @@ mlx5_glue_devx_init_showdown_event(void *ctx)
return 0;
}
+static int
+mlx5_glue_devx_set_promisc_vport(void *ctx, uint32_t promisc_type, uint8_t f_enable)
+{
+#ifdef HAVE_DEVX_SET_PROMISC_SUPPORT
+ int devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_PROMISC_MODE;
+ struct mlx5_context *mlx5_ctx;
+ int err;
+
+ if (!ctx) {
+ errno = EINVAL;
+ return errno;
+ }
+ mlx5_ctx = (struct mlx5_context *)ctx;
+ if (promisc_type == MC_PROMISC)
+ devx_promisc_type = MLX5_DEVX_SET_PROMISC_VPORT_ALL_MULTICAST;
+ err = devx_set_promisc_vport(mlx5_ctx->devx_ctx, devx_promisc_type, f_enable);
+ if (err) {
+ errno = err;
+ return errno;
+ }
+ return 0;
+#else
+ (void)promisc_type;
+ (void)f_enable;
+ (void)ctx;
+ DRV_LOG(WARNING, "%s: is not supported", __func__);
+ return -ENOTSUP;
+#endif
+}
+
alignas(RTE_CACHE_LINE_SIZE)
const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.version = MLX5_GLUE_VERSION,
@@ -351,4 +381,5 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue){
.devx_query_eqn = mlx5_glue_devx_query_eqn,
.query_rt_values = mlx5_glue_query_rt_values,
.devx_init_showdown_event = mlx5_glue_devx_init_showdown_event,
+ .devx_set_promisc_vport = mlx5_glue_devx_set_promisc_vport,
};
diff --git a/drivers/common/mlx5/windows/mlx5_glue.h b/drivers/common/mlx5/windows/mlx5_glue.h
index db8f2e8319..eae8070b3f 100644
--- a/drivers/common/mlx5/windows/mlx5_glue.h
+++ b/drivers/common/mlx5/windows/mlx5_glue.h
@@ -49,6 +49,11 @@ struct mlx5dv_dr_action_dest_attr {
};
#endif
+enum {
+ ALL_PROMISC,
+ MC_PROMISC,
+};
+
/* LIB_GLUE_VERSION must be updated every time this structure is modified. */
struct mlx5_glue {
const char *version;
@@ -87,6 +92,7 @@ struct mlx5_glue {
int (*devx_query_eqn)(void *context, uint32_t cpus, uint32_t *eqn);
int (*query_rt_values)(void *ctx, void *devx_clock);
int (*devx_init_showdown_event)(void *ctx);
+ int (*devx_set_promisc_vport)(void *ctx, uint32_t promisc_type, uint8_t f_enable);
};
extern const struct mlx5_glue *mlx5_glue;
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index c7bb81549e..77f04cc931 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -729,7 +729,6 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
/**
* Set device promiscuous mode
- * Currently it has no support under Windows.
*
* @param dev
* Pointer to Ethernet device structure.
@@ -742,10 +741,9 @@ mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv,
int
mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
{
- (void)dev;
- (void)enable;
- DRV_LOG(WARNING, "%s: is not supported", __func__);
- return -ENOTSUP;
+ struct mlx5_priv *priv = dev->data->dev_private;
+
+ return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, ALL_PROMISC, enable);
}
/**
@@ -762,10 +760,9 @@ mlx5_os_set_promisc(struct rte_eth_dev *dev, int enable)
int
mlx5_os_set_allmulti(struct rte_eth_dev *dev, int enable)
{
- (void)dev;
- (void)enable;
- DRV_LOG(WARNING, "%s: is not supported", __func__);
- return -ENOTSUP;
+ struct mlx5_priv *priv = dev->data->dev_private;
+
+ return mlx5_glue->devx_set_promisc_vport(priv->sh->cdev->ctx, MC_PROMISC, enable);
}
/**
--
2.16.1.windows.4
next reply other threads:[~2022-04-10 10:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-10 10:31 Adham Masarwah [this message]
2022-04-10 10:31 ` [PATCH 2/2] net/mlx5: add support for set and get MTU " Adham Masarwah
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=20220410103107.66964-2-adham@nvidia.com \
--to=adham@nvidia.com \
--cc=dev@dpdk.org \
--cc=idanhac@nvidia.com \
--cc=matan@nvidia.com \
--cc=talshn@nvidia.com \
--cc=tamerh@nvidia.com \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.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).