Commit 20893d9d authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

Merge branch 'vhca-tunnel' into rdma.git for-next

Max Gurtovoy says:

====================
Those two patches introduce VHCA tunnel mechanism to DEVX interface
needed for Bluefield SOC. See extensive commit messages for more
information.
====================

Based on the mlx5-next branch from
git://git.kernel.org/pub/scm/linux/kernel/git/mellanox/linux for
dependencies

* branch 'vcha-tunnel':
  IB/mlx5: Implement VHCA tunnel mechanism in DEVX
  net/mlx5: Introduce VHCA tunnel device capability
parents f10ff380 b6142608
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -894,12 +894,16 @@ static int devx_get_uid(struct mlx5_ib_ucontext *c, void *cmd_in)

	return c->devx_uid;
}
static bool devx_is_general_cmd(void *in)

static bool devx_is_general_cmd(void *in, struct mlx5_ib_dev *dev)
{
	u16 opcode = MLX5_GET(general_obj_in_cmd_hdr, in, opcode);

	if (opcode >= MLX5_CMD_OP_GENERAL_START &&
	    opcode < MLX5_CMD_OP_GENERAL_END)
	/* Pass all cmds for vhca_tunnel as general, tracking is done in FW */
	if ((MLX5_CAP_GEN_64(dev->mdev, vhca_tunnel_commands) &&
	     MLX5_GET(general_obj_in_cmd_hdr, in, vhca_tunnel_id)) ||
	    (opcode >= MLX5_CMD_OP_GENERAL_START &&
	     opcode < MLX5_CMD_OP_GENERAL_END))
		return true;

	switch (opcode) {
@@ -1025,7 +1029,7 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OTHER)(
		return uid;

	/* Only white list of some general HCA commands are allowed for this method. */
	if (!devx_is_general_cmd(cmd_in))
	if (!devx_is_general_cmd(cmd_in, dev))
		return -EINVAL;

	cmd_out = uverbs_zalloc(attrs, cmd_out_len);
@@ -1410,6 +1414,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
	u32 obj_id;
	u16 opcode;

	if (MLX5_GET(general_obj_in_cmd_hdr, cmd_in, vhca_tunnel_id))
		return -EINVAL;

	uid = devx_get_uid(c, cmd_in);
	if (uid < 0)
		return uid;
@@ -1509,6 +1516,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_MODIFY)(
	int err;
	int uid;

	if (MLX5_GET(general_obj_in_cmd_hdr, cmd_in, vhca_tunnel_id))
		return -EINVAL;

	uid = devx_get_uid(c, cmd_in);
	if (uid < 0)
		return uid;
@@ -1551,6 +1561,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_QUERY)(
	int uid;
	struct mlx5_ib_dev *mdev = to_mdev(c->ibucontext.device);

	if (MLX5_GET(general_obj_in_cmd_hdr, cmd_in, vhca_tunnel_id))
		return -EINVAL;

	uid = devx_get_uid(c, cmd_in);
	if (uid < 0)
		return uid;
@@ -1688,6 +1701,9 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY)(
	struct devx_async_cmd_event_file *ev_file;
	struct devx_async_data *async_data;

	if (MLX5_GET(general_obj_in_cmd_hdr, cmd_in, vhca_tunnel_id))
		return -EINVAL;

	uid = devx_get_uid(c, cmd_in);
	if (uid < 0)
		return uid;
+4 −2
Original line number Diff line number Diff line
@@ -1390,7 +1390,9 @@ struct mlx5_ifc_cmd_hca_cap_bits {
	u8	   reserved_at_6c8[0x28];
	u8	   sf_base_id[0x10];

	u8	   reserved_at_700[0x100];
	u8	   reserved_at_700[0x80];
	u8	   vhca_tunnel_commands[0x40];
	u8	   reserved_at_7c0[0x40];
};

enum mlx5_flow_destination_type {
@@ -9694,7 +9696,7 @@ struct mlx5_ifc_general_obj_in_cmd_hdr_bits {
	u8         opcode[0x10];
	u8         uid[0x10];

	u8         reserved_at_20[0x10];
	u8         vhca_tunnel_id[0x10];
	u8         obj_type[0x10];

	u8         obj_id[0x20];