vdpa tool support for configuring max VQs
Subsystems (3)
PATCH 3/3 vdpa: Add support to configure max number of VQs
In reply to Eli CohenAdd support to configure max supported virtqueue pairs for a vdpa device. For this to be possible, add support for reading management device's capabilities. Management device capabilities give the user a hint as to how many virtqueue pairs at most he can ask for. Using this information the user can choose a valid number of virtqueue pairs when creating the device.
Examples:
- Show management device capabiliteis:
$ vdpa mgmtdev show 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
A user can now create a device based on the above information. In the above case 128 virtqueue pairs at most. The other VQ being for the control virtqueue.
- Add a vdpa device with 16 data virtqueue pairs
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 16
After feature negotiation has been completed, one can read the vdpa configuration using:
$ vdpa dev config show
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/include/uapi/linux/vdpa.h | 4 ++ vdpa/vdpa.c | 113 ++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-)
vdpa/include/uapi/linux/vdpa.h +4 -0
@@ -40,6 +40,10 @@ enum vdpa_attr {VDPA_ATTR_DEV_NET_CFG_MAX_VQP ,/* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU ,/* u16 */ +VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ +VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ +VDPA_ATTR_DEV_SUPPORTED_FEATURES ,/* u64 */ +/* new attributes must be added above here */ VDPA_ATTR_MAX, };
vdpa/vdpa.c +110 -3
181 lines not on this page · raw message
Signature · 1 line
2.34.1
cover vdpa tool support for configuring max VQs
The following three patch series contains:
1. Small fix to vdpa help message
2. Introduce missing definitions for virtio feature flags so they can be used in the 3rd patch.
3. Add support for configuring max number of VQs for a vdpa device and allow to get negotiated or max features for a vdpa device/mangement device.
Eli Cohen (3):
vdpa: Remove unsupported command line option
virtio: Define bit numbers for device independent features
vdpa: Add support to configure max number of VQs
include/uapi/linux/virtio_config.h | 16 ++-- vdpa/include/uapi/linux/vdpa.h | 4 + vdpa/vdpa.c | 115 ++++++++++++++++++++++++++++- 3 files changed, 123 insertions(+), 12 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/3 vdpa: Remove unsupported command line option
"-v[erbose]" option is not supported.
Remove it.
--- vdpa/vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
vdpa/vdpa.c +1 -1
@@ -711,7 +711,7 @@ static void help(void)fprintf (stderr,"Usage: vdpa [ OPTIONS ] OBJECT { COMMAND | help }\n" "where OBJECT := { mgmtdev | dev }\n" -" OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] }\n" ); +" OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] }\n" ); }static int vdpa_cmd (struct vdpa *vdpa,int argc,char **argv)
Signature · 1 line
2.34.1
PATCH 2/3 virtio: Define bit numbers for device independent features
In reply to Eli CohenDefine bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
include/uapi/linux/virtio_config.h +8 -8
@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80 -/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38 + +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've
Signature · 1 line
2.34.1
Re: [PATCH 1/3] vdpa: Remove unsupported command line option
In reply to Eli CohenQuoted 6 lines · Eli Cohen
"-v[erbose]" option is not supported.
Remove it.Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>
Quoted 20 lines
--- vdpa/vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)vdpa/vdpa.c +1
-2@@ -711,7 +711,7 @@ static void help(void)fprintf (stderr,"Usage: vdpa [ OPTIONS ] OBJECT { COMMAND | help }\n" "where OBJECT := { mgmtdev | dev }\n" -" OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] | -v[erbose] }\n" ); +" OPTIONS := { -V[ersion] | -n[o-nice-names] | -j[son] | -p[retty] }\n" ); }static int vdpa_cmd (struct vdpa *vdpa,int argc,char **argv) --2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
In reply to Eli CohenQuoted 21 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-1@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80 -/*
include/uapi/linux/virtio_config.h line 50
Quoted 10 lines
include/uapi/linux/virtio_config.h +3
-7-* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38
Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38
This part belongs to the virtio_ring.h any reason not pull that file instead of squashing those into virtio_config.h?
Thanks
Quoted 6 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 3/3] vdpa: Add support to configure max number of VQs
In reply to Eli CohenQuoted 22 lines · Eli Cohen
Add support to configure max supported virtqueue pairs for a vdpa device. For this to be possible, add support for reading management device's capabilities. Management device capabilities give the user a hint as to how many virtqueue pairs at most he can ask for. Using this information the user can choose a valid number of virtqueue pairs when creating the device.
Examples:
- Show management device capabiliteis:$ vdpa mgmtdev show 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_PLATFORMA user can now create a device based on the above information. In the above case 128 virtqueue pairs at most. The other VQ being for the control virtqueue.
- Add a vdpa device with 16 data virtqueue pairs
Quoted 8 lines
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 16After feature negotiation has been completed, one can read the vdpa configuration using:
$ vdpa dev config show 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
I wonder if lower case is better.
Quoted 13 lines
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- vdpa/include/uapi/linux/vdpa.h | 4 ++ vdpa/vdpa.c | 113 ++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-)vdpa/include/uapi/linux/vdpa.h +0
-0
vdpa/include/uapi/linux/vdpa.h enum vdpa_attr { · line 45
Quoted 6 lines
vdpa/include/uapi/linux/vdpa.h +3
-0@@ -40,6 +40,10 @@ enum vdpa_attr {VDPA_ATTR_DEV_NET_CFG_MAX_VQP ,/* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU ,/* u16 */ +VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ +VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */
I wonder if it's better to split the patches into three where the above command could be implemented separately.
Quoted 80 lines
vdpa/include/uapi/linux/vdpa.h +1
-0+/* new attributes must be added above here */ VDPA_ATTR_MAX, };vdpa/vdpa.c +33
-0@@ -23,6 +23,7 @@#define VDPA_OPT_VDEV_HANDLE BIT(3)#define VDPA_OPT_VDEV_MAC BIT(4)#define VDPA_OPT_VDEV_MTU BIT(5) +#define VDPA_OPT_MAX_VQP BIT(6)struct vdpa_opts {uint64_t present;/* flags of present items */ @@ -32,6 +33,7 @@ struct vdpa_opts {unsigned int device_id;char mac[ETH_ALEN ];uint16_t mtu; +uint16_t max_vqp; };struct vdpa {@@ -78,6 +80,9 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = { [VDPA_ATTR_DEV_VENDOR_ID] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQS] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16, + [VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64, + [VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32, + [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64, };static int attr_cb (const struct nlattr *attr,void *data)@@ -219,6 +224,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa) sizeof(opts->mac), opts->mac);if (opts->present &VDPA_OPT_VDEV_MTU )mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MTU , opts->mtu); +if (opts->present &VDPA_OPT_MAX_VQP ) +mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , opts->max_vqp); } static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,@@ -287,6 +294,14 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,NEXT_ARG_FWD (); o_found |=VDPA_OPT_VDEV_MTU ; + }else if ((matches (*argv,"max_vqp" ) ==0 ) && (o_optional &VDPA_OPT_MAX_VQP )) { +NEXT_ARG_FWD (); + err =vdpa_argv_u16 (vdpa, argc, argv, &opts->max_vqp); +if (err) +return err; + +NEXT_ARG_FWD (); + o_found |=VDPA_OPT_MAX_VQP ; }else {fprintf (stderr,"Unknown option \"%s\"\n" , *argv);return -EINVAL ;@@ -385,6 +400,77 @@ static const char *parse_class(int num)return class ? class :"< unknown class >" ; } +static const char *const net_feature_strs[64 ] = { + [VIRTIO_NET_F_CSUM ] ="CSUM" , + [VIRTIO_NET_F_GUEST_CSUM ] ="GUEST_CSUM" , + [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS ] ="CTRL_GUEST_OFFLOADS" , + [VIRTIO_NET_F_MTU ] ="MTU" , + [VIRTIO_NET_F_MAC ] ="MAC" , + [VIRTIO_NET_F_GUEST_TSO4 ] ="GUEST_TSO4" , + [VIRTIO_NET_F_GUEST_TSO6 ] ="GUEST_TSO6" , + [VIRTIO_NET_F_GUEST_ECN ] ="GUEST_ECN" , + [VIRTIO_NET_F_GUEST_UFO ] ="GUEST_UFO" , + [VIRTIO_NET_F_HOST_TSO4 ] ="HOST_TSO4" , + [VIRTIO_NET_F_HOST_TSO6 ] ="HOST_TSO6" , + [VIRTIO_NET_F_HOST_ECN ] ="HOST_ECN" , + [VIRTIO_NET_F_HOST_UFO ] ="HOST_UFO" , + [VIRTIO_NET_F_MRG_RXBUF ] ="MRG_RXBUF" , + [VIRTIO_NET_F_STATUS ] ="STATUS" , + [VIRTIO_NET_F_CTRL_VQ ] ="CTRL_VQ" , + [VIRTIO_NET_F_CTRL_RX ] ="CTRL_RX" ,
vdpa/vdpa.c static const char *parse_class(int num) · line 430
Quoted 10 lines
vdpa/vdpa.c +10
-0+ [VIRTIO_NET_F_CTRL_VLAN] = "CTRL_VLAN", + [VIRTIO_NET_F_CTRL_RX_EXTRA] = "CTRL_RX_EXTRA", + [VIRTIO_NET_F_GUEST_ANNOUNCE] = "GUEST_ANNOUNCE", + [VIRTIO_NET_F_MQ] = "MQ", + [VIRTIO_F_NOTIFY_ON_EMPTY] = "NOTIFY_ON_EMPTY", + [VIRTIO_NET_F_CTRL_MAC_ADDR] = "CTRL_MAC_ADDR", + [VIRTIO_F_ANY_LAYOUT] = "ANY_LAYOUT", + [VIRTIO_NET_F_RSC_EXT] = "RSC_EXT", + [VIRTIO_NET_F_STANDBY] = "STANDBY", +};
It seems we are still missing things that are already supported in the Linux uapi. I think it's better to support them. E.g the RSS and SPEED_DUPLEX etc.
Quoted 21 lines
vdpa/vdpa.c +21
-0+ +#define VDPA_EXT_FEATURES_SZ (VIRTIO_DEV_INDEPENDENT_F_END - \ + VIRTIO_DEV_INDEPENDENT_F_START + 1) + +static const char *const ext_feature_strs[VDPA_EXT_FEATURES_SZ ] = { + [VIRTIO_F_RING_INDIRECT_DESC -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_INDIRECT_DESC" , + [VIRTIO_F_RING_EVENT_IDX -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_EVENT_IDX" , + [VIRTIO_F_VERSION_1 -VIRTIO_DEV_INDEPENDENT_F_START ] ="VERSION_1" , + [VIRTIO_F_ACCESS_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ACCESS_PLATFORM" , + [VIRTIO_F_RING_PACKED -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_PACKED" , + [VIRTIO_F_IN_ORDER -VIRTIO_DEV_INDEPENDENT_F_START ] ="IN_ORDER" , + [VIRTIO_F_ORDER_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ORDER_PLATFORM" , + [VIRTIO_F_SR_IOV -VIRTIO_DEV_INDEPENDENT_F_START ] ="SR_IOV" , + [VIRTIO_F_NOTIFICATION_DATA -VIRTIO_DEV_INDEPENDENT_F_START ] ="NOTIFICATION_DATA" , +}; + +static void print_net_features (struct vdpa *vdpa,uint64_t features,bool maxf) +{ +const char *s; +int i; +
vdpa/vdpa.c static const char *parse_class(int num) · line 461
Quoted 10 lines
vdpa/vdpa.c +10
-0+if (maxf) +pr_out_array_start (vdpa,"dev_features" ); +else +pr_out_array_start (vdpa,"negotiated_features" ); + +for (i =0 ; i <64 ; i++) { +if (!(features & (1ULL << i))) +continue ; + +if (i >=VIRTIO_DEV_INDEPENDENT_F_START && i <=VIRTIO_DEV_INDEPENDENT_F_END )
I don't see any issue that just use VIRTIO_TRANSPORT_F_START and VIRTIO_TRANSPORT_F_END (even if END can change).
Quoted 23 lines
vdpa/vdpa.c +16
-0+ s = ext_feature_strs[i -VIRTIO_DEV_INDEPENDENT_F_START ]; + else + s = net_feature_strs[i]; + +if (!s) +print_uint (PRINT_ANY ,NULL ," unrecognized_bit_%d" , i); +else +print_string (PRINT_ANY ,NULL ," %s" , s); + } +pr_out_array_end (vdpa); +} +static void pr_out_mgmtdev_show (struct vdpa *vdpa,const struct nlmsghdr *nlh,struct nlattr **tb) {@@ -408,6 +494,22 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,pr_out_array_end (vdpa); } +if (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]) { +uint16_t num_vqs; + +if (!vdpa->json_output)
vdpa/vdpa.c static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh, · line 510
Quoted 10 lines
vdpa/vdpa.c +10
-0+printf ("\n" ); + num_vqs =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]); +print_uint (PRINT_ANY ,"max_supported_vqs" ," max_supported_vqs %d" , num_vqs); + } + +if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]) { +uint64_t features; + + features =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]); +print_net_features (vdpa, features, true);
Do we need to check whether it's a networking device before trying to print the feature and for other type devices we can simply print the bit number as a startup?
Thanks
Quoted 49 lines
vdpa/vdpa.c +10
-4+ } +pr_out_handle_end (vdpa); }@@ -557,7 +659,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv) NLM_F_REQUEST | NLM_F_ACK); err =vdpa_argv_parse_put (nlh, vdpa, argc, argv,VDPA_OPT_VDEV_MGMTDEV_HANDLE |VDPA_OPT_VDEV_NAME , -VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU ); +VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU |VDPA_OPT_MAX_VQP );if (err)return err;@@ -579,9 +681,10 @@ static int cmd_dev_del(struct vdpa *vdpa, int argc, char **argv)return mnlu_gen_socket_sndrcv (&vdpa->nlg, nlh,NULL ,NULL ); } -static void pr_out_dev_net_config (struct nlattr **tb) +static void pr_out_dev_net_config (struct vdpa *vdpa,struct nlattr **tb) {SPRINT_BUF (macaddr); +uint64_t val_u64;uint16_t val_u16;if (tb[VDPA_ATTR_DEV_NET_CFG_MACADDR ]) {@@ -610,6 +713,10 @@ static void pr_out_dev_net_config(struct nlattr **tb) val_u16 =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_NET_CFG_MTU ]);print_uint (PRINT_ANY ,"mtu" ,"mtu %d " , val_u16); } +if (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]) { + val_u64 =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]); +print_net_features (vdpa, val_u64, false); + } }static void pr_out_dev_config (struct vdpa *vdpa,struct nlattr **tb)@@ -619,7 +726,7 @@ static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)pr_out_vdev_handle_start (vdpa, tb);switch (device_id) {case VIRTIO_ID_NET : -pr_out_dev_net_config (tb); +pr_out_dev_net_config (vdpa, tb);break ;default :break ; --2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
In reply to Jason WangQuoted 21 lines · Jason Wang
Quoted 20 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80
Quoted 15 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in vdpa.c
Quoted 9 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?
Not sure what you mean here. I can't find virtio_ring.h in my tree.
Quoted 9 lines
Thanks
Quoted 6 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
Quoted 51 lines · Eli Cohen
Quoted 21 lines · Jason Wang
Quoted 20 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 15 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 9 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.
I meant just copy the virtio_ring.h in the linux tree. It seems cleaner.
Thanks
Quoted 11 lines
Quoted 10 lines
Thanks
Quoted 6 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 3/3] vdpa: Add support to configure max number of VQs
In reply to Jason WangQuoted 25 lines · Jason Wang
Quoted 24 lines · Eli Cohen
Add support to configure max supported virtqueue pairs for a vdpa device. For this to be possible, add support for reading management device's capabilities. Management device capabilities give the user a hint as to how many virtqueue pairs at most he can ask for. Using this information the user can choose a valid number of virtqueue pairs when creating the device.
Examples:
- Show management device capabiliteis:$ vdpa mgmtdev show 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_PLATFORMA user can now create a device based on the above information. In the above case 128 virtqueue pairs at most. The other VQ being for the control virtqueue.
- Add a vdpa device with 16 data virtqueue pairs
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 16
Quoted 9 lines
Quoted 6 lines
After feature negotiation has been completed, one can read the vdpa configuration using:
$ vdpa dev config show 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_PLATFORMI wonder if lower case is better.
I thought the capital letters will emphasize the fact that these are flag bits. Also, note the matching kernel patches have this documented in the change log with capital letters.
Quoted 16 lines
Quoted 16 lines
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- vdpa/include/uapi/linux/vdpa.h | 4 ++ vdpa/vdpa.c | 113 ++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-)vdpa/include/uapi/linux/vdpa.h +0
-0@@ -40,6 +40,10 @@ enum vdpa_attr {VDPA_ATTR_DEV_NET_CFG_MAX_VQP ,/* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */
Quoted 6 lines
vdpa/include/uapi/linux/vdpa.h enum vdpa_attr { · line 45
Quoted 3 lines
vdpa/include/uapi/linux/vdpa.h +3
-0+VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ +VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */I wonder if it's better to split the patches into three where the above command could be implemented separately.
I already sent three. You mean split the third patch into three?
Quoted 87 lines
Quoted 87 lines
vdpa/include/uapi/linux/vdpa.h +1
-0+/* new attributes must be added above here */ VDPA_ATTR_MAX, };vdpa/vdpa.c +39
-0@@ -23,6 +23,7 @@#define VDPA_OPT_VDEV_HANDLE BIT(3)#define VDPA_OPT_VDEV_MAC BIT(4)#define VDPA_OPT_VDEV_MTU BIT(5) +#define VDPA_OPT_MAX_VQP BIT(6)struct vdpa_opts {uint64_t present;/* flags of present items */ @@ -32,6 +33,7 @@ struct vdpa_opts {unsigned int device_id;char mac[ETH_ALEN ];uint16_t mtu; +uint16_t max_vqp; };struct vdpa {@@ -78,6 +80,9 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = { [VDPA_ATTR_DEV_VENDOR_ID] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQS] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16, + [VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64, + [VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32, + [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64, };static int attr_cb (const struct nlattr *attr,void *data)@@ -219,6 +224,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa) sizeof(opts->mac), opts->mac);if (opts->present &VDPA_OPT_VDEV_MTU )mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MTU , opts->mtu); +if (opts->present &VDPA_OPT_MAX_VQP ) +mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , opts->max_vqp); } static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,@@ -287,6 +294,14 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,NEXT_ARG_FWD (); o_found |=VDPA_OPT_VDEV_MTU ; + }else if ((matches (*argv,"max_vqp" ) ==0 ) && (o_optional &VDPA_OPT_MAX_VQP )) { +NEXT_ARG_FWD (); + err =vdpa_argv_u16 (vdpa, argc, argv, &opts->max_vqp); +if (err) +return err; + +NEXT_ARG_FWD (); + o_found |=VDPA_OPT_MAX_VQP ; }else {fprintf (stderr,"Unknown option \"%s\"\n" , *argv);return -EINVAL ;@@ -385,6 +400,77 @@ static const char *parse_class(int num)return class ? class :"< unknown class >" ; } +static const char *const net_feature_strs[64 ] = { + [VIRTIO_NET_F_CSUM ] ="CSUM" , + [VIRTIO_NET_F_GUEST_CSUM ] ="GUEST_CSUM" , + [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS ] ="CTRL_GUEST_OFFLOADS" , + [VIRTIO_NET_F_MTU ] ="MTU" , + [VIRTIO_NET_F_MAC ] ="MAC" , + [VIRTIO_NET_F_GUEST_TSO4 ] ="GUEST_TSO4" , + [VIRTIO_NET_F_GUEST_TSO6 ] ="GUEST_TSO6" , + [VIRTIO_NET_F_GUEST_ECN ] ="GUEST_ECN" , + [VIRTIO_NET_F_GUEST_UFO ] ="GUEST_UFO" , + [VIRTIO_NET_F_HOST_TSO4 ] ="HOST_TSO4" , + [VIRTIO_NET_F_HOST_TSO6 ] ="HOST_TSO6" , + [VIRTIO_NET_F_HOST_ECN ] ="HOST_ECN" , + [VIRTIO_NET_F_HOST_UFO ] ="HOST_UFO" , + [VIRTIO_NET_F_MRG_RXBUF ] ="MRG_RXBUF" , + [VIRTIO_NET_F_STATUS ] ="STATUS" , + [VIRTIO_NET_F_CTRL_VQ ] ="CTRL_VQ" , + [VIRTIO_NET_F_CTRL_RX ] ="CTRL_RX" , + [VIRTIO_NET_F_CTRL_VLAN ] ="CTRL_VLAN" , + [VIRTIO_NET_F_CTRL_RX_EXTRA ] ="CTRL_RX_EXTRA" , + [VIRTIO_NET_F_GUEST_ANNOUNCE ] ="GUEST_ANNOUNCE" , + [VIRTIO_NET_F_MQ ] ="MQ" , + [VIRTIO_F_NOTIFY_ON_EMPTY ] ="NOTIFY_ON_EMPTY" , + [VIRTIO_NET_F_CTRL_MAC_ADDR ] ="CTRL_MAC_ADDR" ,
Quoted 9 lines
vdpa/vdpa.c static const char *parse_class(int num) · line 430
Quoted 4 lines
vdpa/vdpa.c +4
-0+ [VIRTIO_F_ANY_LAYOUT] = "ANY_LAYOUT", + [VIRTIO_NET_F_RSC_EXT] = "RSC_EXT", + [VIRTIO_NET_F_STANDBY] = "STANDBY", +};It seems we are still missing things that are already supported in the Linux uapi. I think it's better to support them. E.g the RSS and
SPEED_DUPLEXetc.
Will do.
Quoted 26 lines
Quoted 26 lines
vdpa/vdpa.c +26
-0+ +#define VDPA_EXT_FEATURES_SZ (VIRTIO_DEV_INDEPENDENT_F_END - \ + VIRTIO_DEV_INDEPENDENT_F_START + 1) + +static const char *const ext_feature_strs[VDPA_EXT_FEATURES_SZ ] = { + [VIRTIO_F_RING_INDIRECT_DESC -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_INDIRECT_DESC" , + [VIRTIO_F_RING_EVENT_IDX -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_EVENT_IDX" , + [VIRTIO_F_VERSION_1 -VIRTIO_DEV_INDEPENDENT_F_START ] ="VERSION_1" , + [VIRTIO_F_ACCESS_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ACCESS_PLATFORM" , + [VIRTIO_F_RING_PACKED -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_PACKED" , + [VIRTIO_F_IN_ORDER -VIRTIO_DEV_INDEPENDENT_F_START ] ="IN_ORDER" , + [VIRTIO_F_ORDER_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ORDER_PLATFORM" , + [VIRTIO_F_SR_IOV -VIRTIO_DEV_INDEPENDENT_F_START ] ="SR_IOV" , + [VIRTIO_F_NOTIFICATION_DATA -VIRTIO_DEV_INDEPENDENT_F_START ] ="NOTIFICATION_DATA" , +}; + +static void print_net_features (struct vdpa *vdpa,uint64_t features,bool maxf) +{ +const char *s; +int i; + +if (maxf) +pr_out_array_start (vdpa,"dev_features" ); +else +pr_out_array_start (vdpa,"negotiated_features" ); +
Quoted 8 lines
vdpa/vdpa.c static const char *parse_class(int num) · line 461
Quoted 5 lines
vdpa/vdpa.c +5
-0+for (i =0 ; i <64 ; i++) { +if (!(features & (1ULL << i))) +continue ; + +if (i >=VIRTIO_DEV_INDEPENDENT_F_START && i <=VIRTIO_DEV_INDEPENDENT_F_END )I don't see any issue that just use
VIRTIO_TRANSPORT_F_STARTandVIRTIO_TRANSPORT_F_END(even if END can change).
I don't get you
Quoted 29 lines
Quoted 29 lines
vdpa/vdpa.c +21
-0+ s = ext_feature_strs[i -VIRTIO_DEV_INDEPENDENT_F_START ]; + else + s = net_feature_strs[i]; + +if (!s) +print_uint (PRINT_ANY ,NULL ," unrecognized_bit_%d" , i); +else +print_string (PRINT_ANY ,NULL ," %s" , s); + } +pr_out_array_end (vdpa); +} +static void pr_out_mgmtdev_show (struct vdpa *vdpa,const struct nlmsghdr *nlh,struct nlattr **tb) {@@ -408,6 +494,22 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,pr_out_array_end (vdpa); } +if (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]) { +uint16_t num_vqs; + +if (!vdpa->json_output) +printf ("\n" ); + num_vqs =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]); +print_uint (PRINT_ANY ,"max_supported_vqs" ," max_supported_vqs %d" , num_vqs); + } +
Quoted 8 lines
vdpa/vdpa.c static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh, · line 510
Quoted 5 lines
vdpa/vdpa.c +5
-0+if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]) { +uint64_t features; + + features =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]); +print_net_features (vdpa, features, true);Do we need to check whether it's a networking device before trying to print the feature
Yes, will fix
Quoted 3 lines
and for other type devices we can simply print the bit number as a startup?
Why not add proper support (e.g. strings) for other types of devices when intoduced?
Quoted 52 lines
Thanks
Quoted 49 lines
vdpa/vdpa.c +10
-4+ } +pr_out_handle_end (vdpa); }@@ -557,7 +659,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv) NLM_F_REQUEST | NLM_F_ACK); err =vdpa_argv_parse_put (nlh, vdpa, argc, argv,VDPA_OPT_VDEV_MGMTDEV_HANDLE |VDPA_OPT_VDEV_NAME , -VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU ); +VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU |VDPA_OPT_MAX_VQP );if (err)return err;@@ -579,9 +681,10 @@ static int cmd_dev_del(struct vdpa *vdpa, int argc, char **argv)return mnlu_gen_socket_sndrcv (&vdpa->nlg, nlh,NULL ,NULL ); } -static void pr_out_dev_net_config (struct nlattr **tb) +static void pr_out_dev_net_config (struct vdpa *vdpa,struct nlattr **tb) {SPRINT_BUF (macaddr); +uint64_t val_u64;uint16_t val_u16;if (tb[VDPA_ATTR_DEV_NET_CFG_MACADDR ]) {@@ -610,6 +713,10 @@ static void pr_out_dev_net_config(struct nlattr **tb) val_u16 =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_NET_CFG_MTU ]);print_uint (PRINT_ANY ,"mtu" ,"mtu %d " , val_u16); } +if (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]) { + val_u64 =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]); +print_net_features (vdpa, val_u64, false); + } }static void pr_out_dev_config (struct vdpa *vdpa,struct nlattr **tb)@@ -619,7 +726,7 @@ static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)pr_out_vdev_handle_start (vdpa, tb);switch (device_id) {case VIRTIO_ID_NET : -pr_out_dev_net_config (tb); +pr_out_dev_net_config (vdpa, tb);break ;default :break ; --2.34.1
Re: [PATCH 3/3] vdpa: Add support to configure max number of VQs
Quoted 34 lines · Eli Cohen
Quoted 32 lines · Jason Wang
Quoted 30 lines · Eli Cohen
Add support to configure max supported virtqueue pairs for a vdpa device. For this to be possible, add support for reading management device's capabilities. Management device capabilities give the user a hint as to how many virtqueue pairs at most he can ask for. Using this information the user can choose a valid number of virtqueue pairs when creating the device.
Examples:
- Show management device capabiliteis:$ vdpa mgmtdev show 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_PLATFORMA user can now create a device based on the above information. In the above case 128 virtqueue pairs at most. The other VQ being for the control virtqueue.
- Add a vdpa device with 16 data virtqueue pairs
$ vdpa dev add name vdpa-a mgmtdev auxiliary/mlx5_core.sf.1 max_vqp 16After feature negotiation has been completed, one can read the vdpa configuration using:
$ vdpa dev config show 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
Quoted 6 lines
Quoted 2 lines
I wonder if lower case is better.
I thought the capital letters will emphasize the fact that these are flag bits. Also, note the matching kernel patches have this documented in the change log with capital letters.
Ok, that's fine.
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- vdpa/include/uapi/linux/vdpa.h | 4 ++ vdpa/vdpa.c | 113 ++++++++++++++++++++++++++++++++- 2 files changed, 114 insertions(+), 3 deletions(-)vdpa/include/uapi/linux/vdpa.h +0
-0@@ -40,6 +40,10 @@ enum vdpa_attr {VDPA_ATTR_DEV_NET_CFG_MAX_VQP ,/* u16 */ VDPA_ATTR_DEV_NET_CFG_MTU, /* u16 */
Quoted 8 lines
Quoted 6 lines
vdpa/include/uapi/linux/vdpa.h enum vdpa_attr { · line 45
Quoted 3 lines
vdpa/include/uapi/linux/vdpa.h +3
-0+VDPA_ATTR_DEV_NEGOTIATED_FEATURES ,/* u64 */ +VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ,/* u32 */ + VDPA_ATTR_DEV_SUPPORTED_FEATURES, /* u64 */I wonder if it's better to split the patches into three where the above command could be implemented separately.
I already sent three. You mean split the third patch into three?
Yes, since it introduces three functions
1) specify max_vqp
2) get supported features
3) get negotiated features
(Or at least two, 2 and 3 can be merged somehow)
Quoted 135 lines
Quoted 88 lines
Quoted 88 lines
vdpa/include/uapi/linux/vdpa.h +1
-0+/* new attributes must be added above here */ VDPA_ATTR_MAX, };vdpa/vdpa.c +39
-0@@ -23,6 +23,7 @@#define VDPA_OPT_VDEV_HANDLE BIT(3)#define VDPA_OPT_VDEV_MAC BIT(4)#define VDPA_OPT_VDEV_MTU BIT(5) +#define VDPA_OPT_MAX_VQP BIT(6)struct vdpa_opts {uint64_t present;/* flags of present items */ @@ -32,6 +33,7 @@ struct vdpa_opts {unsigned int device_id;char mac[ETH_ALEN ];uint16_t mtu; +uint16_t max_vqp; };struct vdpa {@@ -78,6 +80,9 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = { [VDPA_ATTR_DEV_VENDOR_ID] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQS] = MNL_TYPE_U32, [VDPA_ATTR_DEV_MAX_VQ_SIZE] = MNL_TYPE_U16, + [VDPA_ATTR_DEV_NEGOTIATED_FEATURES] = MNL_TYPE_U64, + [VDPA_ATTR_DEV_MGMTDEV_MAX_VQS] = MNL_TYPE_U32, + [VDPA_ATTR_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64, };static int attr_cb (const struct nlattr *attr,void *data)@@ -219,6 +224,8 @@ static void vdpa_opts_put(struct nlmsghdr *nlh, struct vdpa *vdpa) sizeof(opts->mac), opts->mac);if (opts->present &VDPA_OPT_VDEV_MTU )mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MTU , opts->mtu); +if (opts->present &VDPA_OPT_MAX_VQP ) +mnl_attr_put_u16 (nlh,VDPA_ATTR_DEV_NET_CFG_MAX_VQP , opts->max_vqp); } static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,@@ -287,6 +294,14 @@ static int vdpa_argv_parse(struct vdpa *vdpa, int argc, char **argv,NEXT_ARG_FWD (); o_found |=VDPA_OPT_VDEV_MTU ; + }else if ((matches (*argv,"max_vqp" ) ==0 ) && (o_optional &VDPA_OPT_MAX_VQP )) { +NEXT_ARG_FWD (); + err =vdpa_argv_u16 (vdpa, argc, argv, &opts->max_vqp); +if (err) +return err; + +NEXT_ARG_FWD (); + o_found |=VDPA_OPT_MAX_VQP ; }else {fprintf (stderr,"Unknown option \"%s\"\n" , *argv);return -EINVAL ;@@ -385,6 +400,77 @@ static const char *parse_class(int num)return class ? class :"< unknown class >" ; } +static const char *const net_feature_strs[64 ] = { + [VIRTIO_NET_F_CSUM ] ="CSUM" , + [VIRTIO_NET_F_GUEST_CSUM ] ="GUEST_CSUM" , + [VIRTIO_NET_F_CTRL_GUEST_OFFLOADS ] ="CTRL_GUEST_OFFLOADS" , + [VIRTIO_NET_F_MTU ] ="MTU" , + [VIRTIO_NET_F_MAC ] ="MAC" , + [VIRTIO_NET_F_GUEST_TSO4 ] ="GUEST_TSO4" , + [VIRTIO_NET_F_GUEST_TSO6 ] ="GUEST_TSO6" , + [VIRTIO_NET_F_GUEST_ECN ] ="GUEST_ECN" , + [VIRTIO_NET_F_GUEST_UFO ] ="GUEST_UFO" , + [VIRTIO_NET_F_HOST_TSO4 ] ="HOST_TSO4" , + [VIRTIO_NET_F_HOST_TSO6 ] ="HOST_TSO6" , + [VIRTIO_NET_F_HOST_ECN ] ="HOST_ECN" , + [VIRTIO_NET_F_HOST_UFO ] ="HOST_UFO" , + [VIRTIO_NET_F_MRG_RXBUF ] ="MRG_RXBUF" , + [VIRTIO_NET_F_STATUS ] ="STATUS" , + [VIRTIO_NET_F_CTRL_VQ ] ="CTRL_VQ" , + [VIRTIO_NET_F_CTRL_RX ] ="CTRL_RX" , + [VIRTIO_NET_F_CTRL_VLAN ] ="CTRL_VLAN" , + [VIRTIO_NET_F_CTRL_RX_EXTRA ] ="CTRL_RX_EXTRA" , + [VIRTIO_NET_F_GUEST_ANNOUNCE ] ="GUEST_ANNOUNCE" , + [VIRTIO_NET_F_MQ ] ="MQ" , + [VIRTIO_F_NOTIFY_ON_EMPTY ] ="NOTIFY_ON_EMPTY" , + [VIRTIO_NET_F_CTRL_MAC_ADDR ] ="CTRL_MAC_ADDR" ,Quoted 9 lines
vdpa/vdpa.c static const char *parse_class(int num) · line 430
Quoted 4 lines
vdpa/vdpa.c +4
-0+ [VIRTIO_F_ANY_LAYOUT] = "ANY_LAYOUT", + [VIRTIO_NET_F_RSC_EXT] = "RSC_EXT", + [VIRTIO_NET_F_STANDBY] = "STANDBY", +};It seems we are still missing things that are already supported in the Linux uapi. I think it's better to support them. E.g the RSS and
SPEED_DUPLEXetc.Will do.
Quoted 26 lines
Quoted 26 lines
vdpa/vdpa.c +26
-0+ +#define VDPA_EXT_FEATURES_SZ (VIRTIO_DEV_INDEPENDENT_F_END - \ + VIRTIO_DEV_INDEPENDENT_F_START + 1) + +static const char *const ext_feature_strs[VDPA_EXT_FEATURES_SZ ] = { + [VIRTIO_F_RING_INDIRECT_DESC -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_INDIRECT_DESC" , + [VIRTIO_F_RING_EVENT_IDX -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_EVENT_IDX" , + [VIRTIO_F_VERSION_1 -VIRTIO_DEV_INDEPENDENT_F_START ] ="VERSION_1" , + [VIRTIO_F_ACCESS_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ACCESS_PLATFORM" , + [VIRTIO_F_RING_PACKED -VIRTIO_DEV_INDEPENDENT_F_START ] ="RING_PACKED" , + [VIRTIO_F_IN_ORDER -VIRTIO_DEV_INDEPENDENT_F_START ] ="IN_ORDER" , + [VIRTIO_F_ORDER_PLATFORM -VIRTIO_DEV_INDEPENDENT_F_START ] ="ORDER_PLATFORM" , + [VIRTIO_F_SR_IOV -VIRTIO_DEV_INDEPENDENT_F_START ] ="SR_IOV" , + [VIRTIO_F_NOTIFICATION_DATA -VIRTIO_DEV_INDEPENDENT_F_START ] ="NOTIFICATION_DATA" , +}; + +static void print_net_features (struct vdpa *vdpa,uint64_t features,bool maxf) +{ +const char *s; +int i; + +if (maxf) +pr_out_array_start (vdpa,"dev_features" ); +else +pr_out_array_start (vdpa,"negotiated_features" ); +Quoted 8 lines
vdpa/vdpa.c static const char *parse_class(int num) · line 461
Quoted 5 lines
vdpa/vdpa.c +5
-0+for (i =0 ; i <64 ; i++) { +if (!(features & (1ULL << i))) +continue ; + +if (i >=VIRTIO_DEV_INDEPENDENT_F_START && i <=VIRTIO_DEV_INDEPENDENT_F_END )I don't see any issue that just use
VIRTIO_TRANSPORT_F_STARTandVIRTIO_TRANSPORT_F_END(even if END can change).
Quoted 1 line
I don't get you
I meant any reason we can't simply use VIRTIO_TRANSPORT_F_START/END?
Quoted 39 lines
Quoted 30 lines
Quoted 30 lines
vdpa/vdpa.c +21
-0+ s = ext_feature_strs[i -VIRTIO_DEV_INDEPENDENT_F_START ]; + else + s = net_feature_strs[i]; + +if (!s) +print_uint (PRINT_ANY ,NULL ," unrecognized_bit_%d" , i); +else +print_string (PRINT_ANY ,NULL ," %s" , s); + } +pr_out_array_end (vdpa); +} +static void pr_out_mgmtdev_show (struct vdpa *vdpa,const struct nlmsghdr *nlh,struct nlattr **tb) {@@ -408,6 +494,22 @@ static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh,pr_out_array_end (vdpa); } +if (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]) { +uint16_t num_vqs; + +if (!vdpa->json_output) +printf ("\n" ); + num_vqs =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_MGMTDEV_MAX_VQS ]); +print_uint (PRINT_ANY ,"max_supported_vqs" ," max_supported_vqs %d" , num_vqs); + } +Quoted 8 lines
vdpa/vdpa.c static void pr_out_mgmtdev_show(struct vdpa *vdpa, const struct nlmsghdr *nlh, · line 510
Quoted 5 lines
vdpa/vdpa.c +5
-0+if (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]) { +uint64_t features; + + features =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_SUPPORTED_FEATURES ]); +print_net_features (vdpa, features, true);Do we need to check whether it's a networking device before trying to print the feature
Quoted 7 lines
Yes, will fix
Quoted 3 lines
and for other type devices we can simply print the bit number as a startup?
Why not add proper support (e.g. strings) for other types of devices when intoduced?
Then the vdpa tool won't show any features which seems sub-optimal. Note that we've already had virtio-blk parent:
IFCVF, simulator and VDUSE.
Thanks
Quoted 54 lines
Quoted 53 lines
Thanks
Quoted 49 lines
vdpa/vdpa.c +10
-4+ } +pr_out_handle_end (vdpa); }@@ -557,7 +659,7 @@ static int cmd_dev_add(struct vdpa *vdpa, int argc, char **argv) NLM_F_REQUEST | NLM_F_ACK); err =vdpa_argv_parse_put (nlh, vdpa, argc, argv,VDPA_OPT_VDEV_MGMTDEV_HANDLE |VDPA_OPT_VDEV_NAME , -VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU ); +VDPA_OPT_VDEV_MAC |VDPA_OPT_VDEV_MTU |VDPA_OPT_MAX_VQP );if (err)return err;@@ -579,9 +681,10 @@ static int cmd_dev_del(struct vdpa *vdpa, int argc, char **argv)return mnlu_gen_socket_sndrcv (&vdpa->nlg, nlh,NULL ,NULL ); } -static void pr_out_dev_net_config (struct nlattr **tb) +static void pr_out_dev_net_config (struct vdpa *vdpa,struct nlattr **tb) {SPRINT_BUF (macaddr); +uint64_t val_u64;uint16_t val_u16;if (tb[VDPA_ATTR_DEV_NET_CFG_MACADDR ]) {@@ -610,6 +713,10 @@ static void pr_out_dev_net_config(struct nlattr **tb) val_u16 =mnl_attr_get_u16 (tb[VDPA_ATTR_DEV_NET_CFG_MTU ]);print_uint (PRINT_ANY ,"mtu" ,"mtu %d " , val_u16); } +if (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]) { + val_u64 =mnl_attr_get_u64 (tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES ]); +print_net_features (vdpa, val_u64, false); + } }static void pr_out_dev_config (struct vdpa *vdpa,struct nlattr **tb)@@ -619,7 +726,7 @@ static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)pr_out_vdev_handle_start (vdpa, tb);switch (device_id) {case VIRTIO_ID_NET : -pr_out_dev_net_config (tb); +pr_out_dev_net_config (vdpa, tb);break ;default :break ; --2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
In reply to Jason WangQuoted 52 lines · Jason Wang
Quoted 51 lines · Eli Cohen
Quoted 21 lines · Jason Wang
Quoted 20 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 15 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 9 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?
Quoted 3 lines
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.I meant just copy the
virtio_ring.hin the linux tree. It seems cleaner.
I will still miss VIRTIO_F_ORDER_PLATFORM and VIRTIO_F_NOTIFICATION_DATA which are only defined in drivers/net/ethernet/sfc/mcdi_pcol.h for block devices only.
What would you suggest to do with them? Maybe define them in vdpa.c?
Quoted 15 lines
Thanks
Quoted 11 lines
Quoted 10 lines
Thanks
Quoted 6 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
Quoted 47 lines · Eli Cohen
Quoted 46 lines · Jason Wang
Quoted 45 lines · Eli Cohen
Quoted 20 lines · Jason Wang
Quoted 19 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 14 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 8 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.I meant just copy the
virtio_ring.hin the linux tree. It seems cleaner.I will still miss
VIRTIO_F_ORDER_PLATFORMandVIRTIO_F_NOTIFICATION_DATAwhich are only defined indrivers/net/ethernet/sfc/mcdi_pcol.hfor block devices only.What would you suggest to do with them? Maybe define them in
vdpa.c?
I meant maybe we need a full synchronization from the current Linux uapi headers for virtio_config.h and and add virtio_ring.h here.
Thanks
Quoted 10 lines
Quoted 10 lines
Thanks
Quoted 7 lines
Quoted 7 lines
Thanks
Quoted 5 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
Quoted 55 lines · Jason Wang
Quoted 53 lines · Eli Cohen
Quoted 46 lines · Jason Wang
Quoted 45 lines · Eli Cohen
Quoted 20 lines · Jason Wang
Quoted 19 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 14 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 8 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?Quoted 2 lines
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.I meant just copy the
virtio_ring.hin the linux tree. It seems cleaner.I will still miss
VIRTIO_F_ORDER_PLATFORMandVIRTIO_F_NOTIFICATION_DATAwhich are only defined indrivers/net/ethernet/sfc/mcdi_pcol.hfor block devices only.
Quoted 6 lines
Quoted 1 line
What would you suggest to do with them? Maybe define them in
vdpa.c?I meant maybe we need a full synchronization from the current Linux uapi headers for
virtio_config.hand and addvirtio_ring.hhere.
virtio_config.h is updatd already and virtio_ring.h does not add any flag definition that we're missing.
The flags I was missing are
+#define VIRTIO_F_IN_ORDER 35
+#define VIRTIO_F_NOTIFICATION_DATA 38
and both of these do not appear in the linux headers. They appear as block specific flags:
drivers/net/ethernet/sfc/mcdi_pcol.h:21471:#define VIRTIO_BLK_CONFIG_VIRTIO_F_IN_ORDER_LBN 35 drivers/net/ethernet/sfc/mcdi_pcol.h:21480:#define VIRTIO_BLK_CONFIG_VIRTIO_F_NOTIFICATION_DATA_LBN 38
So I just defined these two in vdpa.c (in patch v1).
Quoted 14 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Thanks
Quoted 7 lines
Quoted 7 lines
Thanks
Quoted 5 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
Quoted 68 lines · Eli Cohen
Quoted 55 lines · Jason Wang
Quoted 53 lines · Eli Cohen
Quoted 46 lines · Jason Wang
Quoted 45 lines · Eli Cohen
Quoted 20 lines · Jason Wang
Quoted 19 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 14 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 8 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?Quoted 2 lines
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.I meant just copy the
virtio_ring.hin the linux tree. It seems cleaner.I will still miss
VIRTIO_F_ORDER_PLATFORMandVIRTIO_F_NOTIFICATION_DATAwhich are only defined indrivers/net/ethernet/sfc/mcdi_pcol.hfor block devices only.Quoted 6 lines
Quoted 1 line
What would you suggest to do with them? Maybe define them in
vdpa.c?I meant maybe we need a full synchronization from the current Linux uapi headers for
virtio_config.hand and addvirtio_ring.hhere.
virtio_config.his updatd already andvirtio_ring.hdoes not add any flag definition that we're missing.The flags I was missing are
Review
Quoted 2 lines
(quoted diff) +2
-0+#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38
Right, so Gautam posted a path for _F_IN_ORDER [1].
We probably need another patch for NOTIFICATION_DATA.
Quoted 8 lines
and both of these do not appear in the linux headers. They appear as block specific flags:
drivers/net/ethernet/sfc/mcdi_pcol.h:21471:#define
VIRTIO_BLK_CONFIG_VIRTIO_F_IN_ORDER_LBN35 drivers/net/ethernet/sfc/mcdi_pcol.h:21480:#defineVIRTIO_BLK_CONFIG_VIRTIO_F_NOTIFICATION_DATA_LBN38So I just defined these two in
vdpa.c(in patch v1).
Fine, but we need to remove them if we get update from linux kernel uapi headers
[1] https://lkml.org/lkml/2022/2/15/43
Thanks
Quoted 16 lines
Quoted 15 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Thanks
Quoted 7 lines
Quoted 7 lines
Thanks
Quoted 5 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1
Re: [PATCH 2/3] virtio: Define bit numbers for device independent features
Quoted 68 lines · Jason Wang
Quoted 67 lines · Eli Cohen
Quoted 55 lines · Jason Wang
Quoted 53 lines · Eli Cohen
Quoted 46 lines · Jason Wang
Quoted 45 lines · Eli Cohen
Quoted 20 lines · Jason Wang
Quoted 19 lines · Eli Cohen
Define bit fields for device independent feature bits. We need them in a follow up patch.
Also, define macros for start and end of these feature bits.
Reviewed-by Jianbo Liu <[email protected]>Signed-off-by Eli Cohen <[email protected]>--- include/uapi/linux/virtio_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)include/uapi/linux/virtio_config.h +0
-0@@ -45,14 +45,14 @@/* We've given up on this device. */ #define VIRTIO_CONFIG_S_FAILED 0x80Quoted 14 lines
include/uapi/linux/virtio_config.h line 50
Quoted 11 lines
include/uapi/linux/virtio_config.h +3
-8-/* -* Virtio feature bits VIRTIO_TRANSPORT_F_START through -* VIRTIO_TRANSPORT_F_END are reserved for the transport -* being used (e.g. virtio_ring, virtio_pci etc.), the -* rest are per-device feature bits. -*/ -#define VIRTIO_TRANSPORT_F_START 28 -#define VIRTIO_TRANSPORT_F_END 38 +/* Device independent features per virtio spec 1.1 range from 28 to 38 */ +#define VIRTIO_DEV_INDEPENDENT_F_START 28 +#define VIRTIO_DEV_INDEPENDENT_F_END 38Haven't gone through patch 3 but I think it's probably better not touch uapi stuff. Or we can define those macros in other place?
I can put it in
vdpa.cQuoted 8 lines
include/uapi/linux/virtio_config.h line 55
Quoted 5 lines
include/uapi/linux/virtio_config.h +5
-0+ +#define VIRTIO_F_RING_INDIRECT_DESC 28 +#define VIRTIO_F_RING_EVENT_IDX 29 +#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38This part belongs to the
virtio_ring.hany reason not pull that file instead of squashing those intovirtio_config.h?Quoted 2 lines
Quoted 1 line
Not sure what you mean here. I can't find
virtio_ring.hin my tree.I meant just copy the
virtio_ring.hin the linux tree. It seems cleaner.I will still miss
VIRTIO_F_ORDER_PLATFORMandVIRTIO_F_NOTIFICATION_DATAwhich are only defined indrivers/net/ethernet/sfc/mcdi_pcol.hfor block devices only.Quoted 6 lines
Quoted 1 line
What would you suggest to do with them? Maybe define them in
vdpa.c?I meant maybe we need a full synchronization from the current Linux uapi headers for
virtio_config.hand and addvirtio_ring.hhere.
virtio_config.his updatd already andvirtio_ring.hdoes not add any flag definition that we're missing.
Quoted 8 lines
Review
Quoted 3 lines
The flags I was missing are
(quoted diff) +2
-0+#define VIRTIO_F_IN_ORDER 35 +#define VIRTIO_F_NOTIFICATION_DATA 38Right, so Gautam posted a path for
_F_IN_ORDER[1].We probably need another patch for
NOTIFICATION_DATA.
OK, I will send a patch NOTIFICATION_DATA. Once they are accepted, I will follow up with a patch to remove from iproute2.
Quoted 33 lines
Quoted 9 lines
and both of these do not appear in the linux headers. They appear as block specific flags:
drivers/net/ethernet/sfc/mcdi_pcol.h:21471:#define
VIRTIO_BLK_CONFIG_VIRTIO_F_IN_ORDER_LBN35 drivers/net/ethernet/sfc/mcdi_pcol.h:21480:#defineVIRTIO_BLK_CONFIG_VIRTIO_F_NOTIFICATION_DATA_LBN38So I just defined these two in
vdpa.c(in patch v1).Fine, but we need to remove them if we get update from linux kernel uapi headers
[1] https://lkml.org/lkml/2022/2/15/43
Thanks
Quoted 16 lines
Quoted 15 lines
Thanks
Quoted 10 lines
Quoted 10 lines
Thanks
Quoted 7 lines
Quoted 7 lines
Thanks
Quoted 5 lines
include/uapi/linux/virtio_config.h +0
-1#ifndef VIRTIO_CONFIG_NO_LEGACY /* Do we get callbacks when the ring is completely used, even if we've -- 2.34.1