Skip to content

Commit

Permalink
net/mlx5: Enable to query min inline for a specific vport
Browse files Browse the repository at this point in the history
Also move the inline capablities enum to a shared header vport.h

Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Roi Dayan authored and David S. Miller committed Nov 24, 2016
1 parent 59bfde0 commit 34e4e99
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
6 changes: 0 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 mlx5_wqe_ctrl_seg ctrl;
struct mlx5_wqe_eth_seg eth;
Expand Down
11 changes: 5 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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->max_inline = param->max_inline;
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;

err = mlx5e_alloc_sq_db(sq, cpu_to_node(c->cpu));
Expand Down Expand Up @@ -3417,14 +3417,13 @@ static void mlx5e_query_min_inline(struct mlx5_core_dev *mdev,
u8 *min_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;
break;
case MLX5E_INLINE_MODE_VPORT_CONTEXT:
mlx5_query_nic_vport_min_inline(mdev,
min_inline_mode);
case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT:
mlx5_query_nic_vport_min_inline(mdev, 0, min_inline_mode);
break;
case MLX5_INLINE_MODE_NOT_REQUIRED:
case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
*min_inline_mode = MLX5_INLINE_MODE_NONE;
break;
}
Expand Down
14 changes: 8 additions & 6 deletions drivers/net/ethernet/mellanox/mlx5/core/vport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

void mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u8 *min_inline_mode)
int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 *min_inline)
{
u32 out[MLX5_ST_SZ_DW(query_nic_vport_context_out)] = {0};
int err;

mlx5_query_nic_vport_context(mdev, 0, out, sizeof(out));

*min_inline_mode = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.min_wqe_inline_mode);
err = mlx5_query_nic_vport_context(mdev, vport, out, sizeof(out));
if (!err)
*min_inline = MLX5_GET(query_nic_vport_context_out, out,
nic_vport_context.min_wqe_inline_mode);
return err;
}
EXPORT_SYMBOL_GPL(mlx5_query_nic_vport_min_inline);

Expand Down
10 changes: 8 additions & 2 deletions include/linux/mlx5/vport.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,21 @@
#include <linux/mlx5/driver.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_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport);
int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod,
u16 vport, u8 state);
int mlx5_query_nic_vport_mac_address(struct mlx5_core_dev *mdev,
u16 vport, u8 *addr);
void mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u8 *min_inline);
int mlx5_query_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 *min_inline);
int mlx5_modify_nic_vport_min_inline(struct mlx5_core_dev *mdev,
u16 vport, u8 min_inline);
int mlx5_modify_nic_vport_mac_address(struct mlx5_core_dev *dev,
Expand Down

0 comments on commit 34e4e99

Please sign in to comment.