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

Commit 2528e33e authored by Matan Barak's avatar Matan Barak Committed by Doug Ledford
Browse files

IB/core: Pass hardware specific data in query_device



Vendors should be able to pass vendor specific data to/from
user-space via query_device uverb. In order to do this,
we need to pass the vendors' specific udata.

Signed-off-by: default avatarMatan Barak <matanb@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 24306dc6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -539,9 +539,11 @@ EXPORT_SYMBOL(ib_dispatch_event);
int ib_query_device(struct ib_device *device,
		    struct ib_device_attr *device_attr)
{
	struct ib_udata uhw = {.outlen = 0, .inlen = 0};

	memset(device_attr, 0, sizeof(*device_attr));

	return device->query_device(device, device_attr);
	return device->query_device(device, device_attr, &uhw);
}
EXPORT_SYMBOL(ib_query_device);

+1 −1
Original line number Diff line number Diff line
@@ -3428,7 +3428,7 @@ int ib_uverbs_ex_query_device(struct ib_uverbs_file *file,

	memset(&attr, 0, sizeof(attr));

	err = device->query_device(device, &attr);
	err = device->query_device(device, &attr, uhw);
	if (err)
		return err;

+5 −2
Original line number Diff line number Diff line
@@ -63,13 +63,16 @@
#include "c2_provider.h"
#include "c2_user.h"

static int c2_query_device(struct ib_device *ibdev,
			   struct ib_device_attr *props)
static int c2_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
			   struct ib_udata *uhw)
{
	struct c2_dev *c2dev = to_c2dev(ibdev);

	pr_debug("%s:%u\n", __func__, __LINE__);

	if (uhw->inlen || uhw->outlen)
		return -EINVAL;

	*props = c2dev->props;
	return 0;
}
+6 −2
Original line number Diff line number Diff line
@@ -1150,13 +1150,17 @@ static u64 fw_vers_string_to_u64(struct iwch_dev *iwch_dev)
	       (fw_mic & 0xffff);
}

static int iwch_query_device(struct ib_device *ibdev,
			     struct ib_device_attr *props)
static int iwch_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
			     struct ib_udata *uhw)
{

	struct iwch_dev *dev;

	PDBG("%s ibdev %p\n", __func__, ibdev);

	if (uhw->inlen || uhw->outlen)
		return -EINVAL;

	dev = to_iwch_dev(ibdev);
	memset(props, 0, sizeof *props);
	memcpy(&props->sys_image_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
+6 −2
Original line number Diff line number Diff line
@@ -302,13 +302,17 @@ static int c4iw_query_gid(struct ib_device *ibdev, u8 port, int index,
	return 0;
}

static int c4iw_query_device(struct ib_device *ibdev,
			     struct ib_device_attr *props)
static int c4iw_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
			     struct ib_udata *uhw)
{

	struct c4iw_dev *dev;

	PDBG("%s ibdev %p\n", __func__, ibdev);

	if (uhw->inlen || uhw->outlen)
		return -EINVAL;

	dev = to_c4iw_dev(ibdev);
	memset(props, 0, sizeof *props);
	memcpy(&props->sys_image_guid, dev->rdev.lldi.ports[0]->dev_addr, 6);
Loading