diff mbox series

[RFC,4/4] vDPA: report device endian-ness to userspace through netlink

Message ID 20220901101601.61420-5-lingshan.zhu@intel.com (mailing list archive)
State RFC
Headers show
Series vDPA: support VHOST_GET/SET_VRING_ENDIAN | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Zhu, Lingshan Sept. 1, 2022, 10:16 a.m. UTC
This commit introduces a new netlink attr VDPA_ATTR_DEV_ENDIAN
to report device endian-ness to usersapce.

So the userspace tools can be aware of the endian-ness of
the device, even uninitialized legacy/transitional devices.

Signed-off-by: Zhu Lingshan <lingshan.zhu@intel.com>
---
 drivers/vdpa/vdpa.c       | 3 +++
 include/uapi/linux/vdpa.h | 1 +
 2 files changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index 8a08caf573d1..d361f951ff63 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -848,6 +848,9 @@  static int vdpa_dev_net_config_fill(struct vdpa_device *vdev, struct sk_buff *ms
 			      VDPA_ATTR_PAD))
 		return -EMSGSIZE;
 
+	if (nla_put_u8(msg, VDPA_ATTR_DEV_ENDIAN, le))
+		return -EMSGSIZE;
+
 	return vdpa_dev_net_mq_config_fill(vdev, msg, features, &config);
 }
 
diff --git a/include/uapi/linux/vdpa.h b/include/uapi/linux/vdpa.h
index 25c55cab3d7c..bb9797781f97 100644
--- a/include/uapi/linux/vdpa.h
+++ b/include/uapi/linux/vdpa.h
@@ -51,6 +51,7 @@  enum vdpa_attr {
 	VDPA_ATTR_DEV_QUEUE_INDEX,              /* u32 */
 	VDPA_ATTR_DEV_VENDOR_ATTR_NAME,		/* string */
 	VDPA_ATTR_DEV_VENDOR_ATTR_VALUE,        /* u64 */
+	VDPA_ATTR_DEV_ENDIAN,			/* u8 */
 
 	/* new attributes must be added above here */
 	VDPA_ATTR_MAX,