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

Commit 72c6ec18 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

RDMA: Move uverbs_abi_ver into struct ib_device_ops



No reason for every driver to emit code to set this, just make it part of
the driver's existing static const ops structure.

Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b9560a41
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2323,6 +2323,8 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
			dev_ops->driver_id != ops->driver_id);
		dev_ops->driver_id = ops->driver_id;
	}
	if (ops->uverbs_abi_ver)
		dev_ops->uverbs_abi_ver = ops->uverbs_abi_ver;

	SET_DEVICE_OP(dev_ops, add_gid);
	SET_DEVICE_OP(dev_ops, advise_mr);
+1 −1
Original line number Diff line number Diff line
@@ -1186,7 +1186,7 @@ static ssize_t abi_version_show(struct device *device,
	srcu_key = srcu_read_lock(&dev->disassociate_srcu);
	ib_dev = srcu_dereference(dev->ib_dev, &dev->disassociate_srcu);
	if (ib_dev)
		ret = sprintf(buf, "%d\n", ib_dev->uverbs_abi_ver);
		ret = sprintf(buf, "%u\n", ib_dev->ops.uverbs_abi_ver);
	srcu_read_unlock(&dev->disassociate_srcu, srcu_key);

	return ret;
+3 −3
Original line number Diff line number Diff line
@@ -3630,10 +3630,10 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata)
	u32 chip_met_rev_num = 0;
	int rc;

	dev_dbg(rdev_to_dev(rdev), "ABI version requested %d",
		ibdev->uverbs_abi_ver);
	dev_dbg(rdev_to_dev(rdev), "ABI version requested %u",
		ibdev->ops.uverbs_abi_ver);

	if (ibdev->uverbs_abi_ver != BNXT_RE_ABI_VERSION) {
	if (ibdev->ops.uverbs_abi_ver != BNXT_RE_ABI_VERSION) {
		dev_dbg(rdev_to_dev(rdev), " is different from the device %d ",
			BNXT_RE_ABI_VERSION);
		return -EPERM;
+1 −1
Original line number Diff line number Diff line
@@ -597,6 +597,7 @@ static void bnxt_re_unregister_ib(struct bnxt_re_dev *rdev)

static const struct ib_device_ops bnxt_re_dev_ops = {
	.driver_id = RDMA_DRIVER_BNXT_RE,
	.uverbs_abi_ver = BNXT_RE_ABI_VERSION,

	.add_gid = bnxt_re_add_gid,
	.alloc_hw_stats = bnxt_re_ib_alloc_hw_stats,
@@ -663,7 +664,6 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
	ibdev->local_dma_lkey = BNXT_QPLIB_RSVD_LKEY;

	/* User space */
	ibdev->uverbs_abi_ver = BNXT_RE_ABI_VERSION;
	ibdev->uverbs_cmd_mask =
			(1ull << IB_USER_VERBS_CMD_GET_CONTEXT)		|
			(1ull << IB_USER_VERBS_CMD_QUERY_DEVICE)	|
+1 −1
Original line number Diff line number Diff line
@@ -1237,6 +1237,7 @@ static void get_dev_fw_ver_str(struct ib_device *ibdev, char *str)

static const struct ib_device_ops iwch_dev_ops = {
	.driver_id = RDMA_DRIVER_CXGB3,
	.uverbs_abi_ver = IWCH_UVERBS_ABI_VERSION,

	.alloc_hw_stats	= iwch_alloc_stats,
	.alloc_mr = iwch_alloc_mr,
@@ -1316,7 +1317,6 @@ int iwch_register_device(struct iwch_dev *dev)
	dev->ibdev.phys_port_cnt = dev->rdev.port_info.nports;
	dev->ibdev.num_comp_vectors = 1;
	dev->ibdev.dev.parent = &dev->rdev.rnic_info.pdev->dev;
	dev->ibdev.uverbs_abi_ver = IWCH_UVERBS_ABI_VERSION;

	memcpy(dev->ibdev.iw_ifname, dev->rdev.t3cdev_p->lldev->name,
	       sizeof(dev->ibdev.iw_ifname));
Loading