net/mlx5: Enable to query min inline for a specific vport
authorRoi Dayan <roid@mellanox.com>
Tue, 22 Nov 2016 21:09:58 +0000 (23:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 24 Nov 2016 21:01:14 +0000 (16:01 -0500)
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>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/vport.c
include/linux/mlx5/vport.h

index ebf5dbc85bff6c3a26105b078febab78ad73f0ca..a2b32ed243155f25ff3aa785ceb1a2f5b2f81710 100644 (file)
@@ -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;
index 8e8d809bf3fd0be2e8bb1aaf621dd7796c68fba2..19403d6bf3690fbf99926dcfb7bbbdd3615a0cf2 100644 (file)
@@ -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));
@@ -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;
        }
index 525f17af108e35ea808e1dfe19345aad967d8c27..269e4401c342d1375e70a40ba9905dddf9b65cef 100644 (file)
@@ -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);
 
index 451b0bde9083c91dcff3bb3a80a5567eb1bf3378..ec35157ea7252c587894ff4f94d406f50b7aeb66 100644 (file)
 #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);
@@ -43,8 +49,8 @@ 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,