Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fe4d43e authored by Saeed Mahameed's avatar Saeed Mahameed
Browse files


This series provides some low level updates for mlx5 driver needed for
both rdma and netdev trees.

1) Termination flow steering table bits and hardware definitions.

2) Introduce the core dump HW access registers definitions.

3) Refactor and cleans-up VF representors functions handlers.

4) Renames host_params bits to function_changed bits and add the
support for eswitch functions change event in the eswitch general case.
(for both legacy and switchdev modes).

5) Potential error pointer dereference in error handling

Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parents b4b12b0d 8693115a
Loading
Loading
Loading
Loading
+10 −9
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ mlx5_ib_vport_rep_load(struct mlx5_core_dev *dev, struct mlx5_eswitch_rep *rep)
	if (!__mlx5_ib_add(ibdev, profile))
		return -EINVAL;

	rep->rep_if[REP_IB].priv = ibdev;
	rep->rep_data[REP_IB].priv = ibdev;

	return 0;
}
@@ -70,13 +70,13 @@ mlx5_ib_vport_rep_unload(struct mlx5_eswitch_rep *rep)
{
	struct mlx5_ib_dev *dev;

	if (!rep->rep_if[REP_IB].priv ||
	if (!rep->rep_data[REP_IB].priv ||
	    rep->vport != MLX5_VPORT_UPLINK)
		return;

	dev = mlx5_ib_rep_to_dev(rep);
	__mlx5_ib_remove(dev, dev->profile, MLX5_IB_STAGE_MAX);
	rep->rep_if[REP_IB].priv = NULL;
	rep->rep_data[REP_IB].priv = NULL;
}

static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)
@@ -84,16 +84,17 @@ static void *mlx5_ib_vport_get_proto_dev(struct mlx5_eswitch_rep *rep)
	return mlx5_ib_rep_to_dev(rep);
}

static const struct mlx5_eswitch_rep_ops rep_ops = {
	.load = mlx5_ib_vport_rep_load,
	.unload = mlx5_ib_vport_rep_unload,
	.get_proto_dev = mlx5_ib_vport_get_proto_dev,
};

void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev)
{
	struct mlx5_eswitch *esw = mdev->priv.eswitch;
	struct mlx5_eswitch_rep_if rep_if = {};

	rep_if.load = mlx5_ib_vport_rep_load;
	rep_if.unload = mlx5_ib_vport_rep_unload;
	rep_if.get_proto_dev = mlx5_ib_vport_get_proto_dev;

	mlx5_eswitch_register_vport_reps(esw, &rep_if, REP_IB);
	mlx5_eswitch_register_vport_reps(esw, &rep_ops, REP_IB);
}

void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev)
+1 −1
Original line number Diff line number Diff line
@@ -72,6 +72,6 @@ struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
static inline
struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
{
	return (struct mlx5_ib_dev *)rep->rep_if[REP_IB].priv;
	return rep->rep_data[REP_IB].priv;
}
#endif /* __MLX5_IB_REP_H__ */
+2 −2
Original line number Diff line number Diff line
@@ -316,7 +316,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
	case MLX5_CMD_OP_DESTROY_GENERAL_OBJECT:
	case MLX5_CMD_OP_DEALLOC_MEMIC:
	case MLX5_CMD_OP_PAGE_FAULT_RESUME:
	case MLX5_CMD_OP_QUERY_HOST_PARAMS:
	case MLX5_CMD_OP_QUERY_ESW_FUNCTIONS:
		return MLX5_CMD_STAT_OK;

	case MLX5_CMD_OP_QUERY_HCA_CAP:
@@ -628,7 +628,7 @@ const char *mlx5_command_str(int command)
	MLX5_COMMAND_STR_CASE(QUERY_MODIFY_HEADER_CONTEXT);
	MLX5_COMMAND_STR_CASE(ALLOC_MEMIC);
	MLX5_COMMAND_STR_CASE(DEALLOC_MEMIC);
	MLX5_COMMAND_STR_CASE(QUERY_HOST_PARAMS);
	MLX5_COMMAND_STR_CASE(QUERY_ESW_FUNCTIONS);
	default: return "unknown command opcode";
	}
}
+0 −27
Original line number Diff line number Diff line
@@ -83,30 +83,3 @@ void mlx5_ec_cleanup(struct mlx5_core_dev *dev)

	mlx5_peer_pf_cleanup(dev);
}

static int mlx5_query_host_params_context(struct mlx5_core_dev *dev,
					  u32 *out, int outlen)
{
	u32 in[MLX5_ST_SZ_DW(query_host_params_in)] = {};

	MLX5_SET(query_host_params_in, in, opcode,
		 MLX5_CMD_OP_QUERY_HOST_PARAMS);

	return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen);
}

int mlx5_query_host_params_num_vfs(struct mlx5_core_dev *dev, int *num_vf)
{
	u32 out[MLX5_ST_SZ_DW(query_host_params_out)] = {};
	int err;

	err = mlx5_query_host_params_context(dev, out, sizeof(out));
	if (err)
		return err;

	*num_vf = MLX5_GET(query_host_params_out, out,
			   host_params_context.host_num_of_vfs);
	mlx5_core_dbg(dev, "host_num_of_vfs %d\n", *num_vf);

	return 0;
}
+0 −4
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@ enum {
bool mlx5_read_embedded_cpu(struct mlx5_core_dev *dev);
int mlx5_ec_init(struct mlx5_core_dev *dev);
void mlx5_ec_cleanup(struct mlx5_core_dev *dev);
int mlx5_query_host_params_num_vfs(struct mlx5_core_dev *dev, int *num_vf);

#else  /* CONFIG_MLX5_ESWITCH */

@@ -24,9 +23,6 @@ static inline bool
mlx5_read_embedded_cpu(struct mlx5_core_dev *dev) { return false; }
static inline int mlx5_ec_init(struct mlx5_core_dev *dev) { return 0; }
static inline void mlx5_ec_cleanup(struct mlx5_core_dev *dev) {}
static inline int
mlx5_query_host_params_num_vfs(struct mlx5_core_dev *dev, int *num_vf)
{ return -EOPNOTSUPP; }

#endif /* CONFIG_MLX5_ESWITCH */

Loading