OSDN Git Service

net/mlx5: E-switch, make query inline mode a static function
authorParav Pandit <parav@mellanox.com>
Wed, 18 Dec 2019 09:08:38 +0000 (03:08 -0600)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 9 Mar 2020 23:58:42 +0000 (16:58 -0700)
mlx5_eswitch_inline_mode_get() is used only in eswitch_offloads.c.
Hence, make it static and adjacent to its caller function.

Reviewed-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

index d010657..9907334 100644 (file)
@@ -425,7 +425,6 @@ int mlx5_devlink_eswitch_mode_get(struct devlink *devlink, u16 *mode);
 int mlx5_devlink_eswitch_inline_mode_set(struct devlink *devlink, u8 mode,
                                         struct netlink_ext_ack *extack);
 int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode);
-int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, u8 *mode);
 int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
                                        enum devlink_eswitch_encap_mode encap,
                                        struct netlink_ext_ack *extack);
index 3bed4f0..1a909d4 100644 (file)
@@ -1344,6 +1344,43 @@ out:
        return flow_rule;
 }
 
+static int mlx5_eswitch_inline_mode_get(const struct mlx5_eswitch *esw, u8 *mode)
+{
+       u8 prev_mlx5_mode, mlx5_mode = MLX5_INLINE_MODE_L2;
+       struct mlx5_core_dev *dev = esw->dev;
+       int vport;
+
+       if (!MLX5_CAP_GEN(dev, vport_group_manager))
+               return -EOPNOTSUPP;
+
+       if (esw->mode == MLX5_ESWITCH_NONE)
+               return -EOPNOTSUPP;
+
+       switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
+       case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
+               mlx5_mode = MLX5_INLINE_MODE_NONE;
+               goto out;
+       case MLX5_CAP_INLINE_MODE_L2:
+               mlx5_mode = MLX5_INLINE_MODE_L2;
+               goto out;
+       case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT:
+               goto query_vports;
+       }
+
+query_vports:
+       mlx5_query_nic_vport_min_inline(dev, esw->first_host_vport, &prev_mlx5_mode);
+       mlx5_esw_for_each_host_func_vport(esw, vport, esw->esw_funcs.num_vfs) {
+               mlx5_query_nic_vport_min_inline(dev, vport, &mlx5_mode);
+               if (prev_mlx5_mode != mlx5_mode)
+                       return -EINVAL;
+               prev_mlx5_mode = mlx5_mode;
+       }
+
+out:
+       *mode = mlx5_mode;
+       return 0;
+}
+
 static int esw_offloads_start(struct mlx5_eswitch *esw,
                              struct netlink_ext_ack *extack)
 {
@@ -2491,43 +2528,6 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode)
        return esw_inline_mode_to_devlink(esw->offloads.inline_mode, mode);
 }
 
-int mlx5_eswitch_inline_mode_get(struct mlx5_eswitch *esw, u8 *mode)
-{
-       u8 prev_mlx5_mode, mlx5_mode = MLX5_INLINE_MODE_L2;
-       struct mlx5_core_dev *dev = esw->dev;
-       int vport;
-
-       if (!MLX5_CAP_GEN(dev, vport_group_manager))
-               return -EOPNOTSUPP;
-
-       if (esw->mode == MLX5_ESWITCH_NONE)
-               return -EOPNOTSUPP;
-
-       switch (MLX5_CAP_ETH(dev, wqe_inline_mode)) {
-       case MLX5_CAP_INLINE_MODE_NOT_REQUIRED:
-               mlx5_mode = MLX5_INLINE_MODE_NONE;
-               goto out;
-       case MLX5_CAP_INLINE_MODE_L2:
-               mlx5_mode = MLX5_INLINE_MODE_L2;
-               goto out;
-       case MLX5_CAP_INLINE_MODE_VPORT_CONTEXT:
-               goto query_vports;
-       }
-
-query_vports:
-       mlx5_query_nic_vport_min_inline(dev, esw->first_host_vport, &prev_mlx5_mode);
-       mlx5_esw_for_each_host_func_vport(esw, vport, esw->esw_funcs.num_vfs) {
-               mlx5_query_nic_vport_min_inline(dev, vport, &mlx5_mode);
-               if (prev_mlx5_mode != mlx5_mode)
-                       return -EINVAL;
-               prev_mlx5_mode = mlx5_mode;
-       }
-
-out:
-       *mode = mlx5_mode;
-       return 0;
-}
-
 int mlx5_devlink_eswitch_encap_mode_set(struct devlink *devlink,
                                        enum devlink_eswitch_encap_mode encap,
                                        struct netlink_ext_ack *extack)