From: Zhu Lingshan <lingshan.zhu@intel.com>
To: jasowang@redhat.com, mst@redhat.com
Cc: virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, kvm@vger.kernel.org,
Zhu Lingshan <lingshan.zhu@intel.com>
Subject: [RFC 4/4] vDPA: report device endian-ness to userspace through netlink
Date: Thu, 1 Sep 2022 18:16:01 +0800 [thread overview]
Message-ID: <20220901101601.61420-5-lingshan.zhu@intel.com> (raw)
In-Reply-To: <20220901101601.61420-1-lingshan.zhu@intel.com>
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 --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,
--
2.31.1
prev parent reply other threads:[~2022-09-01 10:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 10:15 [RFC 0/4] vDPA: support VHOST_GET/SET_VRING_ENDIAN Zhu Lingshan
2022-09-01 10:15 ` [RFC 1/4] vDPA/ifcvf: add get/set_vq_endian support for vDPA Zhu Lingshan
2022-09-05 8:34 ` Jason Wang
2022-09-06 2:12 ` Zhu, Lingshan
2022-09-01 10:15 ` [RFC 2/4] vDPA: support ioctl VHOST_GET/SET_VRING_ENDIAN Zhu Lingshan
2022-09-01 10:16 ` [RFC 3/4] vDPA: detect device endian in _net_config_fill() and _fill_stats_rec() Zhu Lingshan
2022-09-01 10:16 ` Zhu Lingshan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220901101601.61420-5-lingshan.zhu@intel.com \
--to=lingshan.zhu@intel.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).