Commit 34e4e990 authored by Roi Dayan's avatar Roi Dayan Committed by David S. Miller

net/mlx5: Enable to query min inline for a specific vport

Also move the inline capablities enum to a shared header vport.h
Signed-off-by: default avatarRoi Dayan <roid@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 59bfde01
...@@ -150,12 +150,6 @@ static inline int mlx5_max_log_rq_size(int wq_type) ...@@ -150,12 +150,6 @@ static inline int mlx5_max_log_rq_size(int wq_type)
} }
} }
enum {
MLX5E_INLINE_MODE_L2,
MLX5E_INLINE_MODE_VPORT_CONTEXT,
MLX5_INLINE_MODE_NOT_REQUIRED,
};
struct mlx5e_tx_wqe { struct mlx5e_tx_wqe {
struct mlx5_wqe_ctrl_seg ctrl; struct mlx5_wqe_ctrl_seg ctrl;
struct mlx5_wqe_eth_seg eth; struct mlx5_wqe_eth_seg eth;
......
...@@ -957,7 +957,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c, ...@@ -957,7 +957,7 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2; sq->bf_buf_size = (1 << MLX5_CAP_GEN(mdev, log_bf_reg_size)) / 2;
sq->max_inline = param->max_inline; sq->max_inline = param->max_inline;
sq->min_inline_mode = sq->min_inline_mode =
MLX5_CAP_ETH(mdev, wqe_inline_mode) == MLX5E_INLINE_MODE_VPORT_CONTEXT ? MLX5_CAP_ETH(mdev, wqe_inline_mode) == MLX5_CAP_INLINE_MODE_VPORT_CONTEXT ?
param->min_inline_mode : 0; param->min_inline_mode : 0;
err = mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu)); err = mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu));
...@@ -3417,14 +3417,13 @@ static void mlx5e_query_min_inline(struct mlx5_core_dev *mdev, ...@@ -3417,14 +3417,13 @@ static void mlx5e_query_min_inline(struct mlx5_core_dev *mdev,
u8 *min_inline_mode) u8 *min_inline_mode)
{ {
switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) { switch (MLX5_CAP_ETH(mdev, wqe_inline_mode)) {
case MLX5E_INLINE_MODE_L2: case MLX5_CAP_INLINE_MODE_L2:
*min_inline_mode = MLX5_INLINE_MODE_L2; *min_inline_mode = MLX5_INLINE_MODE_L2;
break; break;
case MLX5E_INLINE_MODE_VPORT_CONTEXT: case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT:
mlx5_query_nic_vport_min_inline(mdev, mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode);
min_inline_mode);
break; break;
case MLX5_INLINE_MODE_NOT_REQUIRED: case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
*min_inline_mode = MLX5_INLINE_MODE_NONE; *min_inline_mode = MLX5_INLINE_MODE_NONE;
break; break;
} }
......
...@@ -113,15 +113,17 @@ static int mlx5_modify_nic_vport_context(struct mlx5_core_dev *mdev, void *in, ...@@ -113,15 +113,17 @@ static int mlx5_modify_nic_vport_context(struct mlx5_core_dev *mdev, void *in,
return mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out)); return mlx5_cmd_exec(mdev, in, inlen, out, sizeof(out));
} }
void mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u8 *min_inline_mode) u16 vport, u8 *min_inline)
{ {
u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {0}; u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {0};
int err;
mlx5_query_nic_vport_context(mdev, 0, out, sizeof(out)); err = mlx5_query_nic_vport_context(mdev, vport, out, sizeof(out));
if (!err)
*min_inline_mode = MLX5_GET(query_nic_vport_context_out, out, *min_inline = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.min_wqe_inline_mode); nic_vport_context.min_wqe_inline_mode);
return err;
} }
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline); EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline);
......
...@@ -36,6 +36,12 @@ ...@@ -36,6 +36,12 @@
#include <linux/mlx5/driver.h> #include <linux/mlx5/driver.h>
#include <linux/mlx5/device.h> #include <linux/mlx5/device.h>
enum {
MLX5_CAP_INLINE_MODE_L2,
MLX5_CAP_INLINE_MODE_VPORT_CONTEXT,
MLX5_CAP_INLINE_MODE_NOT_REQUIRED,
};
u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport); u8 mlx5_query_vport_state(struct mlx5_core_dev *mdev, u8 opmod, u16 vport);
u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, u8 mlx5_query_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport); u16 vport);
...@@ -43,8 +49,8 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, ...@@ -43,8 +49,8 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport, u8 state); u16 vport, u8 state);
int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev, int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
u16 vport, u8 *addr); u16 vport, u8 *addr);
void mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev, int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u8 *min_inline); u16 vport, u8 *min_inline);
int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev, int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 min_inline); u16 vport, u8 min_inline);
int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev, int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment