aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
diff options
context:
space:
mode:
authorParav Pandit <parav@mellanox.com>2019-06-07 07:16:58 -0500
committerSaeed Mahameed <saeedm@mellanox.com>2019-07-03 12:50:42 -0700
commitdd28087c14777a7f2571260d44394eb709a59368 (patch)
tree0a619ef9ad17b0051017ac23b81c3e79e3b30824 /drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
parentnet/mlx5: E-Switch prepare functions change handler to be modular (diff)
downloadlinux-dev-dd28087c14777a7f2571260d44394eb709a59368.tar.xz
linux-dev-dd28087c14777a7f2571260d44394eb709a59368.zip
net/mlx5: Refactor mlx5_esw_query_functions for modularity
Functions change event output data size changes when functions other than VFs will be enabled in HCA CAP. With current API, multiple callers needs to align, calculate accurate size of the output data depending on number on non VF functions enabled in the device. Instead of duplicating such math at multiple places, refactor mlx5_esw_query_functions() to return raw output allocated by itself. Caller must free the allocated memory using kvfree() as described in the function comment section. This hides calcuation within mlx5_esw_query_functions() and provides simpler API. Signed-off-by: Parav Pandit <parav@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
index 42c0db585561..74ab7bd264ed 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
@@ -2075,19 +2075,19 @@ esw_vfs_changed_event_handler(struct mlx5_eswitch *esw, const u32 *out)
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;
- int err;
+ const u32 *out;
host_work = container_of(work, struct mlx5_host_work, work);
esw = host_work->esw;
- err = mlx5_esw_query_functions(esw->dev, out, sizeof(out));
- if (err)
+ out = mlx5_esw_query_functions(esw->dev);
+ if (IS_ERR(out))
goto out;
esw_vfs_changed_event_handler(esw, out);
+ kvfree(out);
out:
kfree(host_work);
}