netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: Saeed Mahameed <saeedm@mellanox.com>,
	Leon Romanovsky <leonro@mellanox.com>
Cc: "linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Bodong Wang <bodong@mellanox.com>,
	Parav Pandit <parav@mellanox.com>
Subject: [PATCH mlx5-next 03/16] net/mlx5: E-Switch, Return raw output for query esw functions
Date: Mon, 10 Jun 2019 23:38:18 +0000	[thread overview]
Message-ID: <20190610233733.12155-4-saeedm@mellanox.com> (raw)
In-Reply-To: <20190610233733.12155-1-saeedm@mellanox.com>

From: Bodong Wang <bodong@mellanox.com>

Current function only returns host num of VFs, later patch requires
other params such as host maximum num of VFs.

Return the raw output so that caller can extract info as needed.

Signed-off-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/eswitch.c | 21 ++-----------------
 .../net/ethernet/mellanox/mlx5/core/eswitch.h |  7 ++++++-
 .../mellanox/mlx5/core/eswitch_offloads.c     |  5 ++++-
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
index 504c0440b0b0..a4df109fbeb7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -1686,10 +1686,9 @@ static int eswitch_vport_event(struct notifier_block *nb,
 	return NOTIFY_OK;
 }
 
-static int query_esw_functions(struct mlx5_core_dev *dev,
-			       u32 *out, int outlen)
+int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen)
 {
-	u32 in[MLX5_ST_SZ_DW(query_esw_functions_in)] = {0};
+	u32 in[MLX5_ST_SZ_DW(query_esw_functions_in)] = {};
 
 	MLX5_SET(query_esw_functions_in, in, opcode,
 		 MLX5_CMD_OP_QUERY_ESW_FUNCTIONS);
@@ -1697,22 +1696,6 @@ static int query_esw_functions(struct mlx5_core_dev *dev,
 	return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
 }
 
-int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u16 *num_vfs)
-{
-	u32 out[MLX5_ST_SZ_DW(query_esw_functions_out)] = {0};
-	int err;
-
-	err = query_esw_functions(dev, out, sizeof(out));
-	if (err)
-		return err;
-
-	*num_vfs = MLX5_GET(query_esw_functions_out, out,
-			    host_params_context.host_num_of_vfs);
-	esw_debug(dev, "host_num_of_vfs=%d\n", *num_vfs);
-
-	return 0;
-}
-
 /* Public E-Switch API */
 #define ESW_ALLOWED(esw) ((esw) && MLX5_ESWITCH_MANAGER((esw)->dev))
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
index 135d9a29bbdf..e03811be771d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
@@ -387,7 +387,7 @@ bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0,
 bool mlx5_esw_multipath_prereq(struct mlx5_core_dev *dev0,
 			       struct mlx5_core_dev *dev1);
 
-int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u16 *num_vfs);
+int mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen);
 
 #define MLX5_DEBUG_ESWITCH_MASK BIT(3)
 
@@ -514,6 +514,11 @@ static inline int  mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs,
 static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw) {}
 static inline bool mlx5_esw_lag_prereq(struct mlx5_core_dev *dev0, struct mlx5_core_dev *dev1) { return true; }
 static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; }
+static inline int
+mlx5_esw_query_functions(struct mlx5_core_dev *dev, u32 *out, int outlen)
+{
+	return -EOPNOTSUPP;
+}
 
 #define FDB_MAX_CHAIN 1
 #define FDB_SLOW_PATH_CHAIN (FDB_MAX_CHAIN + 1)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index f843d8a35a2c..1638e4cdeb16 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -1762,6 +1762,7 @@ static void esw_offloads_steering_cleanup(struct mlx5_eswitch *esw)
 
 static void esw_functions_changed_event_handler(struct work_struct *work)
 {
+	u32 out[MLX5_ST_SZ_DW(query_esw_functions_out)] = {};
 	struct mlx5_host_work *host_work;
 	struct mlx5_eswitch *esw;
 	u16 num_vfs = 0;
@@ -1770,7 +1771,9 @@ static void esw_functions_changed_event_handler(struct work_struct *work)
 	host_work = container_of(work, struct mlx5_host_work, work);
 	esw = host_work->esw;
 
-	err = mlx5_esw_query_functions(esw->dev, &num_vfs);
+	err = mlx5_esw_query_functions(esw->dev, out, sizeof(out));
+	num_vfs = MLX5_GET(query_esw_functions_out, out,
+			   host_params_context.host_num_of_vfs);
 	if (err || num_vfs == esw->esw_funcs.num_vfs)
 		goto out;
 
-- 
2.21.0


  parent reply	other threads:[~2019-06-10 23:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10 23:38 [PATCH mlx5-next 00/16] Mellanox, mlx5 next updates 10-06-2019 Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 01/16] net/mlx5: Increase wait time for fw initialization Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 02/16] net/mlx5: E-Switch, Handle representors creation in handler context Saeed Mahameed
2019-06-10 23:38 ` Saeed Mahameed [this message]
2019-06-10 23:38 ` [PATCH mlx5-next 04/16] net/mlx5: Support querying max VFs from device Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 05/16] net/mlx5: Introduce EQ polling budget Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 06/16] net/mlx5: Change interrupt handler to call chain notifier Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 07/16] net/mlx5: Separate IRQ request/free from EQ life cycle Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 08/16] net/mlx5: Separate IRQ data from EQ table data Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 09/16] net/mlx5: Move IRQ rmap creation to IRQ allocation phase Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 10/16] net/mlx5: Move IRQ affinity set " Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 11/16] net/mlx5: Separate IRQ table creation from EQ table creation Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 12/16] net/mlx5: Generalize IRQ interface to work with irq_table Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 13/16] net/mlx5: Move all IRQ logic to pci_irq.c Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 14/16] net/mlx5: Rename mlx5_irq_info to mlx5_irq Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 15/16] net/mlx5: Use a single IRQ for all async EQs Saeed Mahameed
2019-06-10 23:38 ` [PATCH mlx5-next 16/16] net/mlx5: Add EQ enable/disable API Saeed Mahameed
2019-06-13 18:02 ` [PATCH mlx5-next 00/16] Mellanox, mlx5 next updates 10-06-2019 Saeed Mahameed

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=20190610233733.12155-4-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=bodong@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=parav@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).