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

Commit e281682b authored by Saeed Mahameed's avatar Saeed Mahameed Committed by David S. Miller
Browse files

net/mlx5_core: HW data structs/types definitions cleanup



mlx5_ifc.h was heavily modified here since it is now generated by a
script from the device specification (PRM rev 0.25). This specification
is backward compatible to existing hardware.

Some structures/fields were added here in order to enable the Ethernet
functionality of the driver.

Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Signed-off-by: default avatarAmir Vadai <amirv@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent db058a18
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -390,8 +390,17 @@ const char *mlx5_command_str(int command)
	case MLX5_CMD_OP_ARM_RQ:
		return "ARM_RQ";

	case MLX5_CMD_OP_RESIZE_SRQ:
		return "RESIZE_SRQ";
	case MLX5_CMD_OP_CREATE_XRC_SRQ:
		return "CREATE_XRC_SRQ";

	case MLX5_CMD_OP_DESTROY_XRC_SRQ:
		return "DESTROY_XRC_SRQ";

	case MLX5_CMD_OP_QUERY_XRC_SRQ:
		return "QUERY_XRC_SRQ";

	case MLX5_CMD_OP_ARM_XRC_SRQ:
		return "ARM_XRC_SRQ";

	case MLX5_CMD_OP_ALLOC_PD:
		return "ALLOC_PD";
@@ -408,8 +417,8 @@ const char *mlx5_command_str(int command)
	case MLX5_CMD_OP_ATTACH_TO_MCG:
		return "ATTACH_TO_MCG";

	case MLX5_CMD_OP_DETACH_FROM_MCG:
		return "DETACH_FROM_MCG";
	case MLX5_CMD_OP_DETTACH_FROM_MCG:
		return "DETTACH_FROM_MCG";

	case MLX5_CMD_OP_ALLOC_XRCD:
		return "ALLOC_XRCD";
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ int mlx5_query_odp_caps(struct mlx5_core_dev *dev, struct mlx5_odp_caps *caps)
		goto out;
	}

	memcpy(caps, MLX5_ADDR_OF(query_hca_cap_out, out, capability_struct),
	memcpy(caps, MLX5_ADDR_OF(query_hca_cap_out, out, capability),
	       sizeof(*caps));

	mlx5_core_dbg(dev, "on-demand paging capabilities:\nrc: %08x\nuc: %08x\nud: %08x\n",
+3 −4
Original line number Diff line number Diff line
@@ -319,8 +319,7 @@ static void fw2drv_caps(struct mlx5_caps *caps, void *out)
	gen->max_srq_wqes = 1 << MLX5_GET_PR(cmd_hca_cap, out, log_max_srq_sz);
	gen->max_wqes = 1 << MLX5_GET_PR(cmd_hca_cap, out, log_max_qp_sz);
	gen->log_max_qp = MLX5_GET_PR(cmd_hca_cap, out, log_max_qp);
	gen->log_max_strq = MLX5_GET_PR(cmd_hca_cap, out, log_max_strq_sz);
	gen->log_max_srq = MLX5_GET_PR(cmd_hca_cap, out, log_max_srqs);
	gen->log_max_srq = MLX5_GET_PR(cmd_hca_cap, out, log_max_srq);
	gen->max_cqes = 1 << MLX5_GET_PR(cmd_hca_cap, out, log_max_cq_sz);
	gen->log_max_cq = MLX5_GET_PR(cmd_hca_cap, out, log_max_cq);
	gen->max_eqes = 1 << MLX5_GET_PR(cmd_hca_cap, out, log_max_eq_sz);
@@ -391,7 +390,7 @@ int mlx5_core_get_caps(struct mlx5_core_dev *dev, struct mlx5_caps *caps,
		goto query_ex;
	}
	mlx5_core_dbg(dev, "%s\n", caps_opmod_str(opmod));
	fw2drv_caps(caps, MLX5_ADDR_OF(query_hca_cap_out, out, capability_struct));
	fw2drv_caps(caps, MLX5_ADDR_OF(query_hca_cap_out, out, capability));

query_ex:
	kfree(out);
@@ -453,7 +452,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
	/* disable checksum */
	cur_caps->gen.flags &= ~MLX5_DEV_CAP_FLAG_CMDIF_CSUM;

	copy_rw_fields(MLX5_ADDR_OF(set_hca_cap_in, set_ctx, hca_capability_struct),
	copy_rw_fields(MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability),
		       cur_caps);
	err = set_caps(dev, set_ctx, set_sz);

+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ int mlx5_core_detach_mcg(struct mlx5_core_dev *dev, union ib_gid *mgid, u32 qpn)

	memset(&in, 0, sizeof(in));
	memset(&out, 0, sizeof(out));
	in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DETACH_FROM_MCG);
	in.hdr.opcode = cpu_to_be16(MLX5_CMD_OP_DETTACH_FROM_MCG);
	memcpy(in.gid, mgid, sizeof(*mgid));
	in.qpn = cpu_to_be32(qpn);
	err = mlx5_cmd_exec(dev, &in, sizeof(in), &out, sizeof(out));
+37 −0
Original line number Diff line number Diff line
@@ -223,3 +223,40 @@ int mlx5_free_uuars(struct mlx5_core_dev *dev, struct mlx5_uuar_info *uuari)

	return 0;
}

int mlx5_alloc_map_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
{
	phys_addr_t pfn;
	phys_addr_t uar_bar_start;
	int err;

	err = mlx5_cmd_alloc_uar(mdev, &uar->index);
	if (err) {
		mlx5_core_warn(mdev, "mlx5_cmd_alloc_uar() failed, %d\n", err);
		return err;
	}

	uar_bar_start = pci_resource_start(mdev->pdev, 0);
	pfn           = (uar_bar_start >> PAGE_SHIFT) + uar->index;
	uar->map      = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
	if (!uar->map) {
		mlx5_core_warn(mdev, "ioremap() failed, %d\n", err);
		err = -ENOMEM;
		goto err_free_uar;
	}

	return 0;

err_free_uar:
	mlx5_cmd_free_uar(mdev, uar->index);

	return err;
}
EXPORT_SYMBOL(mlx5_alloc_map_uar);

void mlx5_unmap_free_uar(struct mlx5_core_dev *mdev, struct mlx5_uar *uar)
{
	iounmap(uar->map);
	mlx5_cmd_free_uar(mdev, uar->index);
}
EXPORT_SYMBOL(mlx5_unmap_free_uar);
Loading