From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
RDMA mailing list <linux-rdma@vger.kernel.org>,
Maor Gottlieb <maorg@mellanox.com>,
Mark Bloch <markb@mellanox.com>,
Parav Pandit <parav@mellanox.com>, Petr Vorel <pvorel@suse.cz>,
Saeed Mahameed <saeedm@mellanox.com>,
linux-netdev <netdev@vger.kernel.org>,
Jiri Pirko <jiri@mellanox.com>
Subject: [PATCH mlx5-next v1 2/4] net/mlx5: Expose eswitch encap mode
Date: Wed, 12 Jun 2019 15:20:12 +0300 [thread overview]
Message-ID: <20190612122014.22359-3-leon@kernel.org> (raw)
In-Reply-To: <20190612122014.22359-1-leon@kernel.org>
From: Maor Gottlieb <maorg@mellanox.com>
Add API to get the current Eswitch encap mode.
It will be used in downstream patches to check if
flow table can be created with encap support or not.
Signed-off-by: Maor Gottlieb <maorg@mellanox.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 11 +++++++++++
include/linux/mlx5/eswitch.h | 12 ++++++++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 9ea0ccfe5ef5..0c68d93bea79 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -2452,6 +2452,17 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw)
}
EXPORT_SYMBOL_GPL(mlx5_eswitch_mode);
+enum devlink_eswitch_encap_mode
+mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev)
+{
+ struct mlx5_eswitch *esw;
+
+ esw = dev->priv.eswitch;
+ return ESW_ALLOWED(esw) ? esw->offloads.encap :
+ DEVLINK_ESWITCH_ENCAP_MODE_NONE;
+}
+EXPORT_SYMBOL(mlx5_eswitch_get_encap_mode);
+
bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1)
{
if ((dev0->priv.eswitch->mode == SRIOV_NONE &&
diff --git a/include/linux/mlx5/eswitch.h b/include/linux/mlx5/eswitch.h
index 0ca77dd1429c..f57c73e81267 100644
--- a/include/linux/mlx5/eswitch.h
+++ b/include/linux/mlx5/eswitch.h
@@ -7,6 +7,7 @@
#define _MLX5_ESWITCH_
#include <linux/mlx5/driver.h>
+#include <net/devlink.h>
#define MLX5_ESWITCH_MANAGER(mdev) MLX5_CAP_GEN(mdev, eswitch_manager)
@@ -60,4 +61,15 @@ u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);
struct mlx5_flow_handle *
mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw,
int vport, u32 sqn);
+
+#ifdef CONFIG_MLX5_ESWITCH
+enum devlink_eswitch_encap_mode
+mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev);
+#else /* CONFIG_MLX5_ESWITCH */
+static inline enum devlink_eswitch_encap_mode
+mlx5_eswitch_get_encap_mode(const struct mlx5_core_dev *dev)
+{
+ return DEVLINK_ESWITCH_ENCAP_MODE_NONE;
+}
+#endif /* CONFIG_MLX5_ESWITCH */
#endif
--
2.20.1
next prev parent reply other threads:[~2019-06-12 12:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 12:20 [PATCH rdma-next v1 0/4] Expose ENCAP mode to mlx5_ib Leon Romanovsky
2019-06-12 12:20 ` [PATCH mlx5-next v1 1/4] net/mlx5: Declare more strictly devlink encap mode Leon Romanovsky
2019-06-12 12:36 ` Petr Vorel
2019-06-13 4:32 ` Parav Pandit
2019-06-13 5:59 ` Leon Romanovsky
2019-06-16 10:07 ` Jiri Pirko
2019-06-16 10:15 ` Leon Romanovsky
2019-06-16 10:39 ` Jiri Pirko
2019-06-16 10:53 ` Leon Romanovsky
2019-06-16 11:18 ` Jiri Pirko
2019-06-12 12:20 ` Leon Romanovsky [this message]
2019-06-13 4:34 ` [PATCH mlx5-next v1 2/4] net/mlx5: Expose eswitch " Parav Pandit
2019-06-12 12:20 ` [PATCH rdma-next v1 3/4] RDMA/mlx5: Consider " Leon Romanovsky
2019-06-12 12:20 ` [PATCH rdma-next v1 4/4] RDMA/mlx5: Enable decap and packet reformat on FDB Leon Romanovsky
2019-06-16 12:44 ` [PATCH rdma-next v1 0/4] Expose ENCAP mode to mlx5_ib Leon Romanovsky
2019-06-17 20:18 ` Doug Ledford
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=20190612122014.22359-3-leon@kernel.org \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=jgg@mellanox.com \
--cc=jiri@mellanox.com \
--cc=leonro@mellanox.com \
--cc=linux-rdma@vger.kernel.org \
--cc=maorg@mellanox.com \
--cc=markb@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=pvorel@suse.cz \
--cc=saeedm@mellanox.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).