2021-01-05 18:32:00 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
|
|
|
/*
|
|
|
|
* vdpa device management interface
|
|
|
|
* Copyright (c) 2020 Mellanox Technologies Ltd. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UAPI_LINUX_VDPA_H_
|
|
|
|
#define _UAPI_LINUX_VDPA_H_
|
|
|
|
|
|
|
|
#define VDPA_GENL_NAME "vdpa"
|
|
|
|
#define VDPA_GENL_VERSION 0x1
|
|
|
|
|
|
|
|
enum vdpa_command {
|
|
|
|
VDPA_CMD_UNSPEC,
|
|
|
|
VDPA_CMD_MGMTDEV_NEW,
|
|
|
|
VDPA_CMD_MGMTDEV_GET, /* can dump */
|
2021-01-05 18:32:01 +08:00
|
|
|
VDPA_CMD_DEV_NEW,
|
|
|
|
VDPA_CMD_DEV_DEL,
|
2021-01-05 18:32:02 +08:00
|
|
|
VDPA_CMD_DEV_GET, /* can dump */
|
2021-10-27 01:55:13 +08:00
|
|
|
VDPA_CMD_DEV_CONFIG_GET, /* can dump */
|
vdpa: Add support for querying vendor statistics
Allows to read vendor statistics of a vdpa device. The specific
statistics data are received from the upstream driver in the form of an
(attribute name, attribute value) pairs.
An example of statistics for mlx5_vdpa device are:
received_desc - number of descriptors received by the virtqueue
completed_desc - number of descriptors completed by the virtqueue
A descriptor using indirect buffers is still counted as 1. In addition,
N chained descriptors are counted correctly N times as one would expect.
A new callback was added to vdpa_config_ops which provides the means for
the vdpa driver to return statistics results.
The interface allows for reading all the supported virtqueues, including
the control virtqueue if it exists.
Below are some examples taken from mlx5_vdpa which are introduced in the
following patch:
1. Read statistics for the virtqueue at index 1
$ vdpa dev vstats show vdpa-a qidx 1
vdpa-a:
queue_type tx queue_index 1 received_desc 3844836 completed_desc 3844836
2. Read statistics for the virtqueue at index 32
$ vdpa dev vstats show vdpa-a qidx 32
vdpa-a:
queue_type control_vq queue_index 32 received_desc 62 completed_desc 62
3. Read statisitics for the virtqueue at index 0 with json output
$ vdpa -j dev vstats show vdpa-a qidx 0
{"vstats":{"vdpa-a":{
"queue_type":"rx","queue_index":0,"name":"received_desc","value":417776,\
"name":"completed_desc","value":417548}}}
4. Read statistics for the virtqueue at index 0 with preety json output
$ vdpa -jp dev vstats show vdpa-a qidx 0
{
"vstats": {
"vdpa-a": {
"queue_type": "rx",
"queue_index": 0,
"name": "received_desc",
"value": 417776,
"name": "completed_desc",
"value": 417548
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Message-Id: <20220518133804.1075129-3-elic@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-05-18 21:38:00 +08:00
|
|
|
VDPA_CMD_DEV_VSTATS_GET,
|
2021-01-05 18:32:00 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
enum vdpa_attr {
|
|
|
|
VDPA_ATTR_UNSPEC,
|
|
|
|
|
vdpa: Add support for returning device configuration information
Add netlink attribute to store the negotiated features. This can be used
by userspace to get the current state of the vdpa instance.
Examples:
$ vdpa dev config show vdpa-a
vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 16 mtu 1500
negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
$ vdpa -j dev config show vdpa-a
{"config":{"vdpa-a":{"mac":"00:00:00:00:88:88","link ":"up","link_announce":false, \
"max_vq_pairs":16,"mtu":1500,"negotiated_features":["CSUM","GUEST_CSUM","MTU","MAC", \
"HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR","VERSION_1", \
"ACCESS_PLATFORM"]}}}
$ vdpa -jp dev config show vdpa-a
{
"config": {
"vdpa-a": {
"mac": "00:00:00:00:88:88",
"link ": "up",
"link_announce ": false,
"max_vq_pairs": 16,
"mtu": 1500,
"negotiated_features": [
"CSUM","GUEST_CSUM","MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ", \
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM"
]
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220105114646.577224-9-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
2022-01-05 19:46:40 +08:00
|
|
|
/* Pad attribute for 64b alignment */
|
|
|
|
VDPA_ATTR_PAD = VDPA_ATTR_UNSPEC,
|
|
|
|
|
2021-01-05 18:32:00 +08:00
|
|
|
/* bus name (optional) + dev name together make the parent device handle */
|
|
|
|
VDPA_ATTR_MGMTDEV_BUS_NAME, /* string */
|
|
|
|
VDPA_ATTR_MGMTDEV_DEV_NAME, /* string */
|
|
|
|
VDPA_ATTR_MGMTDEV_SUPPORTED_CLASSES, /* u64 */
|
|
|
|
|
2021-01-05 18:32:01 +08:00
|
|
|
VDPA_ATTR_DEV_NAME, /* string */
|
2021-01-05 18:32:02 +08:00
|
|
|
VDPA_ATTR_DEV_ID, /* u32 */
|
|
|
|
VDPA_ATTR_DEV_VENDOR_ID, /* u32 */
|
|
|
|
VDPA_ATTR_DEV_MAX_VQS, /* u32 */
|
|
|
|
VDPA_ATTR_DEV_MAX_VQ_SIZE, /* u16 */
|
2021-10-29 17:14:48 +08:00
|
|
|
VDPA_ATTR_DEV_MIN_VQ_SIZE, /* u16 */
|
2021-01-05 18:32:01 +08:00
|
|
|
|
2021-10-27 01:55:13 +08:00
|
|
|
VDPA_ATTR_DEV_NET_CFG_MACADDR, /* binary */
|
|
|
|
VDPA_ATTR_DEV_NET_STATUS, /* u8 */
|
|
|
|
VDPA_ATTR_DEV_NET_CFG_MAX_VQP, /* u16 */
|
|
|
|
VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */
|
|
|
|
|
vdpa: Add support for returning device configuration information
Add netlink attribute to store the negotiated features. This can be used
by userspace to get the current state of the vdpa instance.
Examples:
$ vdpa dev config show vdpa-a
vdpa-a: mac 00:00:00:00:88:88 link up link_announce false max_vq_pairs 16 mtu 1500
negotiated_features CSUM GUEST_CSUM MTU MAC HOST_TSO4 HOST_TSO6 STATUS \
CTRL_VQ MQ CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
$ vdpa -j dev config show vdpa-a
{"config":{"vdpa-a":{"mac":"00:00:00:00:88:88","link ":"up","link_announce":false, \
"max_vq_pairs":16,"mtu":1500,"negotiated_features":["CSUM","GUEST_CSUM","MTU","MAC", \
"HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR","VERSION_1", \
"ACCESS_PLATFORM"]}}}
$ vdpa -jp dev config show vdpa-a
{
"config": {
"vdpa-a": {
"mac": "00:00:00:00:88:88",
"link ": "up",
"link_announce ": false,
"max_vq_pairs": 16,
"mtu": 1500,
"negotiated_features": [
"CSUM","GUEST_CSUM","MTU","MAC","HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ", \
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM"
]
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220105114646.577224-9-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
2022-01-05 19:46:40 +08:00
|
|
|
VDPA_ATTR_DEV_NEGOTIATED_FEATURES, /* u64 */
|
vdpa: Support reporting max device capabilities
Add max_supported_vqs and supported_features fields to struct
vdpa_mgmt_dev. Upstream drivers need to feel these values according to
the device capabilities.
These values are reported back in a netlink message when showing management
devices.
Examples:
$ auxiliary/mlx5_core.sf.1:
supported_classes net
max_supported_vqs 257
dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
$ vdpa -j mgmtdev show
{"mgmtdev":{"auxiliary/mlx5_core.sf.1":{"supported_classes":["net"], \
"max_supported_vqs":257,"dev_features":["CSUM","GUEST_CSUM","MTU", \
"HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR", \
"VERSION_1","ACCESS_PLATFORM"]}}}
$ vdpa -jp mgmtdev show
{
"mgmtdev": {
"auxiliary/mlx5_core.sf.1": {
"supported_classes": [ "net" ],
"max_supported_vqs": 257,
"dev_features": ["CSUM","GUEST_CSUM","MTU","HOST_TSO4", \
"HOST_TSO6","STATUS","CTRL_VQ","MQ", \
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM"]
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220105114646.577224-11-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com>
2022-01-05 19:46:42 +08:00
|
|
|
VDPA_ATTR_DEV_MGMTDEV_MAX_VQS, /* u32 */
|
2022-09-29 09:45:50 +08:00
|
|
|
/* virtio features that are supported by the vDPA management device */
|
vdpa: Support reporting max device capabilities
Add max_supported_vqs and supported_features fields to struct
vdpa_mgmt_dev. Upstream drivers need to feel these values according to
the device capabilities.
These values are reported back in a netlink message when showing management
devices.
Examples:
$ auxiliary/mlx5_core.sf.1:
supported_classes net
max_supported_vqs 257
dev_features CSUM GUEST_CSUM MTU HOST_TSO4 HOST_TSO6 STATUS CTRL_VQ MQ \
CTRL_MAC_ADDR VERSION_1 ACCESS_PLATFORM
$ vdpa -j mgmtdev show
{"mgmtdev":{"auxiliary/mlx5_core.sf.1":{"supported_classes":["net"], \
"max_supported_vqs":257,"dev_features":["CSUM","GUEST_CSUM","MTU", \
"HOST_TSO4","HOST_TSO6","STATUS","CTRL_VQ","MQ","CTRL_MAC_ADDR", \
"VERSION_1","ACCESS_PLATFORM"]}}}
$ vdpa -jp mgmtdev show
{
"mgmtdev": {
"auxiliary/mlx5_core.sf.1": {
"supported_classes": [ "net" ],
"max_supported_vqs": 257,
"dev_features": ["CSUM","GUEST_CSUM","MTU","HOST_TSO4", \
"HOST_TSO6","STATUS","CTRL_VQ","MQ", \
"CTRL_MAC_ADDR","VERSION_1","ACCESS_PLATFORM"]
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Link: https://lore.kernel.org/r/20220105114646.577224-11-elic@nvidia.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Si-Wei Liu<si-wei.liu@oracle.com>
2022-01-05 19:46:42 +08:00
|
|
|
VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */
|
vdpa: Add support for querying vendor statistics
Allows to read vendor statistics of a vdpa device. The specific
statistics data are received from the upstream driver in the form of an
(attribute name, attribute value) pairs.
An example of statistics for mlx5_vdpa device are:
received_desc - number of descriptors received by the virtqueue
completed_desc - number of descriptors completed by the virtqueue
A descriptor using indirect buffers is still counted as 1. In addition,
N chained descriptors are counted correctly N times as one would expect.
A new callback was added to vdpa_config_ops which provides the means for
the vdpa driver to return statistics results.
The interface allows for reading all the supported virtqueues, including
the control virtqueue if it exists.
Below are some examples taken from mlx5_vdpa which are introduced in the
following patch:
1. Read statistics for the virtqueue at index 1
$ vdpa dev vstats show vdpa-a qidx 1
vdpa-a:
queue_type tx queue_index 1 received_desc 3844836 completed_desc 3844836
2. Read statistics for the virtqueue at index 32
$ vdpa dev vstats show vdpa-a qidx 32
vdpa-a:
queue_type control_vq queue_index 32 received_desc 62 completed_desc 62
3. Read statisitics for the virtqueue at index 0 with json output
$ vdpa -j dev vstats show vdpa-a qidx 0
{"vstats":{"vdpa-a":{
"queue_type":"rx","queue_index":0,"name":"received_desc","value":417776,\
"name":"completed_desc","value":417548}}}
4. Read statistics for the virtqueue at index 0 with preety json output
$ vdpa -jp dev vstats show vdpa-a qidx 0
{
"vstats": {
"vdpa-a": {
"queue_type": "rx",
"queue_index": 0,
"name": "received_desc",
"value": 417776,
"name": "completed_desc",
"value": 417548
}
}
}
Signed-off-by: Eli Cohen <elic@nvidia.com>
Message-Id: <20220518133804.1075129-3-elic@nvidia.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2022-05-18 21:38:00 +08:00
|
|
|
|
|
|
|
VDPA_ATTR_DEV_QUEUE_INDEX, /* u32 */
|
|
|
|
VDPA_ATTR_DEV_VENDOR_ATTR_NAME, /* string */
|
|
|
|
VDPA_ATTR_DEV_VENDOR_ATTR_VALUE, /* u64 */
|
|
|
|
|
2022-10-11 01:27:03 +08:00
|
|
|
/* virtio features that are provisioned to the vDPA device */
|
2022-09-27 15:48:08 +08:00
|
|
|
VDPA_ATTR_DEV_FEATURES, /* u64 */
|
|
|
|
|
2021-01-05 18:32:00 +08:00
|
|
|
/* new attributes must be added above here */
|
|
|
|
VDPA_ATTR_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|