vdpa: Add supprt for reading vdpa device statistics
PATCH 1/1 vdpa: Add supprt for reading vdpa device statistics
Read statistics of a vdpa device. The specific data is a recieved as a pair of attribute name and attribute value.
Examples:
1. Read statistics for the virtqueue at index 1
$ vdpa dev vstats show vdpa-a qidx 1 vdpa-a: qtype tx qidx 1 received_desc 4583367 completed_desc 4583367
2. Read statistics for the virtqueue at index 32
$ vdpa dev vstats show vdpa-a qidx 32 vdpa-a: qtype cvq qidx 32 received_desc 0 completed_desc 0
3. Read statisitics for the virtqueue at index 0 with json output
$ vdpa -j dev vstats show vdpa-a qidx 0
{"vstats":{"vdpa-a":{
"qtype":"rx","qidx":0,"name":"received_desc","value":490205,"name":"completed_desc","value":489964}}}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": { "qtype": "rx",
"qidx": 0,
"name": "received_desc",
"value": 490205,
"name": "completed_desc",
"value": 489964
}
}
}Signed-off-by Eli Cohen <[email protected]>
--- vdpa/include/uapi/linux/vdpa.h | 6 ++ vdpa/vdpa.c | 192 +++++++++++++++++++++++++++++++++ 2 files changed, 198 insertions(+)
vdpa/include/uapi/linux/vdpa.h +6 -0
@@ -18,6 +18,7 @@ enum vdpa_command {VDPA_CMD_DEV_DEL ,VDPA_CMD_DEV_GET ,/* can dump */ VDPA_CMD_DEV_CONFIG_GET ,/* can dump */ + VDPA_CMD_DEV_STATS_GET, }; enum vdpa_attr {
@@ -46,6 +47,11 @@ enum vdpa_attr {VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ + +VDPA_ATTR_DEV_QUEUE_INDEX ,/* u32 */ +VDPA_ATTR_DEV_VENDOR_ATTR_NAME ,/* string */ +VDPA_ATTR_DEV_VENDOR_ATTR_VALUE ,/* u64 */ +/* new attributes must be added above here */ VDPA_ATTR_MAX, };
vdpa/vdpa.c +192 -0
252 lines not on this page · raw message
Signature · 1 line
2.35.1