Skip to contentSkip to conversation

iproute2/vdpa: Add support for reading device features

PATCH In review Zhu Lingshan 2 participants 11 messages Oct 14, 2022 – Oct 18, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iproute2/vdpa: Add support for reading device features

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
  negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
  dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
---
 vdpa/vdpa.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -2
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
 	[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,
+	[VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+	[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
 };
 
 static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
 #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
 			   uint16_t dev_id)
 {
 	const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
 	if (dev_id < ARRAY_SIZE(dev_to_feature_str))
 		feature_strs = dev_to_feature_str[dev_id];
 
-	if (mgmtdevf)
+	if (devf)
 		pr_out_array_start(vdpa, "dev_features");
 	else
 		pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
 		val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
 		print_features(vdpa, val_u64, false, dev_id);
 	}
+	if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+		uint16_t dev_id = 0;
+
+		if (tb[VDPA_ATTR_DEV_ID])
+			dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+		val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+		print_features(vdpa, val_u64, true, dev_id);
+	}
 }
 
 static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
Signature · 1 line
2.31.1
#1 lore raw
Quoted 11 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
  negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
  dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM

Note that Si Wei proposed to unify the two new attributes:

Quoted 54 lines
---
 vdpa/vdpa.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
        [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
 };
 
 static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
 #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                           uint16_t dev_id)
 {
        const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
        if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                pr_out_array_start(vdpa, "dev_features");
        else
                pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                print_features(vdpa, val_u64, false, dev_id);
        }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
 }
 
 static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#2 lore raw
Quoted 12 lines · Jason Wang
Quoted 10 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
  negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
  dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 3 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

Thanks

Quoted 52 lines
Quoted 52 lines

---
 vdpa/vdpa.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -2
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
        [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
 };
 
 static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
 #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                           uint16_t dev_id)
 {
        const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
        if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                pr_out_array_start(vdpa, "dev_features");
        else
                pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                print_features(vdpa, val_u64, false, dev_id);
        }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
 }
 
Quoted 4 lines
Quoted 4 lines
vdpa/vdpa.c +0 -1
 static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#3 lore raw
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
   negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
   dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

Thanks

Quoted 58 lines

Thanks

Quoted 55 lines
Quoted 55 lines
---
  vdpa/vdpa.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
         [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
  };
 
  static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
  #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                            uint16_t dev_id)
  {
         const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
         if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                 feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                 pr_out_array_start(vdpa, "dev_features");
         else
                 pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                 val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                 print_features(vdpa, val_u64, false, dev_id);
         }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
  }
 
  static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#4 lore raw
Quoted 15 lines · Lingshan
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
   negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
   dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

Thanks

Quoted 56 lines

Thanks

Quoted 54 lines

Thanks

Quoted 51 lines
Quoted 51 lines
---
  vdpa/vdpa.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -2
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
         [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
  };
 
  static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
  #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                            uint16_t dev_id)
  {
         const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
         if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                 feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                 pr_out_array_start(vdpa, "dev_features");
         else
                 pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                 val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                 print_features(vdpa, val_u64, false, dev_id);
         }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
  }
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
vdpa/vdpa.c +0 -1
  static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#5 lore raw
Quoted 16 lines · Jason Wang
Quoted 15 lines · Lingshan
Quoted 12 lines · Jason Wang
Quoted 11 lines · Jason Wang
Quoted 10 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
    negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
    dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Thanks

Quoted 60 lines

Thanks

Quoted 57 lines

Thanks

Quoted 56 lines

Thanks

Quoted 54 lines
Quoted 54 lines
---
   vdpa/vdpa.c | 15 +++++++++++++--
   1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
          [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
   };
 
   static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
   #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                             uint16_t dev_id)
   {
          const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
          if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                  feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                  pr_out_array_start(vdpa, "dev_features");
          else
                  pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                  val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                  print_features(vdpa, val_u64, false, dev_id);
          }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
   }
 
   static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#6 lore raw
Quoted 22 lines · Lingshan
Quoted 18 lines · Jason Wang
Quoted 17 lines · Lingshan
Quoted 14 lines · Jason Wang
Quoted 4 lines · Jason Wang
Quoted 3 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Quoted 8 lines
Quoted 7 lines

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
    negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
    dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Yes, anything wrong with this? The device features could be provisioned via netlink.

Thanks

Quoted 58 lines

Thanks

Quoted 56 lines

Thanks

Quoted 53 lines

Thanks

Quoted 52 lines

Thanks

Quoted 50 lines
Quoted 50 lines
---
   vdpa/vdpa.c | 15 +++++++++++++--
   1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -2
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
          [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
   };
 
   static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
   #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                             uint16_t dev_id)
   {
          const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
          if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                  feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                  pr_out_array_start(vdpa, "dev_features");
          else
                  pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                  val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                  print_features(vdpa, val_u64, false, dev_id);
          }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
   }
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
vdpa/vdpa.c +0 -1
   static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#7 lore raw
Quoted 25 lines · Jason Wang
Quoted 24 lines · Lingshan
Quoted 21 lines · Jason Wang
Quoted 20 lines · Lingshan
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
     negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
     dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

I suggest going through the above patch, both attributes are for the vDPA device only.

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Yes, anything wrong with this? The device features could be provisioned via netlink.

I think the best netlink practice is to let every attr has its own
and unique purpose, to prevent potential bugs. I think we have discussed this before that re-using an attr does not save any resource.

And iprout2 has already updated the uapi header.

Thanks

Quoted 63 lines

Thanks

Quoted 60 lines

Thanks

Quoted 59 lines

Thanks

Quoted 57 lines

Thanks

Quoted 56 lines

Thanks

Quoted 54 lines
Quoted 54 lines
---
    vdpa/vdpa.c | 15 +++++++++++++--
    1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
           [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
    };
 
    static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
    #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                              uint16_t dev_id)
    {
           const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
           if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                   feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                   pr_out_array_start(vdpa, "dev_features");
           else
                   pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                   val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                   print_features(vdpa, val_u64, false, dev_id);
           }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
    }
 
    static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#8 lore raw
Quoted 31 lines · Lingshan
Quoted 27 lines · Jason Wang
Quoted 26 lines · Lingshan
Quoted 23 lines · Jason Wang
Quoted 13 lines · Lingshan
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
     negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
     dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Yes, anything wrong with this? The device features could be provisioned via netlink.

I think the best netlink practice is to let every attr has its own and unique purpose, to prevent potential bugs. I think we have discussed this before that re-using
an attr does not save any resource.

They have exactly the same semantic which is the device features for vDPA.

VDPA_ATTR_DEV_FEATURES is introduced by my features provisioning series, which is used for the userspace to "set" the device features. VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES is introduced in one of your previous patches, which is used for userspace to "get" the device features.

Quoted 2 lines

And iprout2 has already updated the uapi header.

Yes, but iproute2 has the same schedule as kernel release, so it's not too late to fix.

Thanks

Quoted 66 lines

Thanks

Quoted 63 lines

Thanks

Quoted 60 lines

Thanks

Quoted 59 lines

Thanks

Quoted 57 lines

Thanks

Quoted 56 lines

Thanks

Quoted 54 lines
Quoted 54 lines
---
    vdpa/vdpa.c | 15 +++++++++++++--
    1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
           [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
    };
 
    static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
    #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                              uint16_t dev_id)
    {
           const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
           if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                   feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                   pr_out_array_start(vdpa, "dev_features");
           else
                   pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                   val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                   print_features(vdpa, val_u64, false, dev_id);
           }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
    }
 
    static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#9 lore raw
Quoted 37 lines · Jason Wang
Quoted 28 lines · Lingshan
Quoted 25 lines · Jason Wang
Quoted 24 lines · Lingshan
Quoted 22 lines · Jason Wang
Quoted 12 lines · Lingshan
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
      negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
      dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Yes, anything wrong with this? The device features could be provisioned via netlink.

I think the best netlink practice is to let every attr has its own and unique purpose, to prevent potential bugs. I think we have discussed this before that re-using
an attr does not save any resource.

Quoted 7 lines

They have exactly the same semantic which is the device features for vDPA.

VDPA_ATTR_DEV_FEATURES is introduced by my features provisioning series, which is used for the userspace to "set" the device features. VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES is introduced in one of your previous patches, which is used for userspace to "get" the device features.

so basically we are just combining and renaming the attr, if so, fine with me, get and set may never conflict and in totally different netlink contexts.

Thanks

Quoted 70 lines
Quoted 2 lines

And iprout2 has already updated the uapi header.

Yes, but iproute2 has the same schedule as kernel release, so it's not too late to fix.

Thanks

Quoted 63 lines

Thanks

Quoted 62 lines

Thanks

Quoted 60 lines

Thanks

Quoted 59 lines

Thanks

Quoted 57 lines

Thanks

Quoted 56 lines

Thanks

Quoted 54 lines
Quoted 54 lines
---
     vdpa/vdpa.c | 15 +++++++++++++--
     1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -3
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
            [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
     };
 
     static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
     #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                               uint16_t dev_id)
     {
            const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
            if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                    feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                    pr_out_array_start(vdpa, "dev_features");
            else
                    pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                    val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                    print_features(vdpa, val_u64, false, dev_id);
            }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
     }
 
     static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

#10 lore raw
Quoted 43 lines · Lingshan
Quoted 39 lines · Jason Wang
Quoted 28 lines · Lingshan
Quoted 25 lines · Jason Wang
Quoted 24 lines · Lingshan
Quoted 22 lines · Jason Wang
Quoted 12 lines · Lingshan
Quoted 11 lines · Jason Wang
Quoted 10 lines · Jason Wang
Quoted 9 lines · Zhu Lingshan

This commit implements support for reading vdpa device features in iproute2.

Example:

$ vdpa dev config show vdpa0
vdpa0: mac 00:e8:ca:11:be:05 link up link_announce false max_vq_pairs 4 mtu 1500
      negotiated_features MRG_RXBUF CTRL_VQ MQ VERSION_1 ACCESS_PLATFORM
      dev_features MTU MAC MRG_RXBUF CTRL_VQ MQ ANY_LAYOUT VERSION_1 ACCESS_PLATFORM
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line

Note that Si Wei proposed to unify the two new attributes:

https://patchew.org/linux/[email protected]/

I think we have discussed this before, there should be two netlink attributes to report management device features and vDPA device features, they are different type of devices, this unification introduces unnecessary couplings

I suggest going through the above patch, both attributes are for the vDPA device only.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It seems not vDPA device only, from above patch, we see it re-uses VDPA_ATTR_DEV_FEATURES for reporting vDPA device features

Yes, anything wrong with this? The device features could be provisioned via netlink.

I think the best netlink practice is to let every attr has its own and unique purpose, to prevent potential bugs. I think we have discussed this before that re-using
an attr does not save any resource.

They have exactly the same semantic which is the device features for vDPA.

Quoted 8 lines
Quoted 5 lines

VDPA_ATTR_DEV_FEATURES is introduced by my features provisioning series, which is used for the userspace to "set" the device features. VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES is introduced in one of your previous patches, which is used for userspace to "get" the device features.

so basically we are just combining and renaming the attr, if so, fine with me, get and set may never conflict and in totally different netlink contexts.

Yes, I think so.

Thanks

Quoted 68 lines

Thanks

Quoted 66 lines
Quoted 2 lines

And iprout2 has already updated the uapi header.

Yes, but iproute2 has the same schedule as kernel release, so it's not too late to fix.

Thanks

Quoted 59 lines

Thanks

Quoted 58 lines

Thanks

Quoted 56 lines

Thanks

Quoted 55 lines

Thanks

Quoted 53 lines

Thanks

Quoted 52 lines

Thanks

Quoted 50 lines
Quoted 50 lines
---
     vdpa/vdpa.c | 15 +++++++++++++--
     1 file changed, 13 insertions(+), 2 deletions(-)
vdpa/vdpa.c +13 -2
index b73e40b4..89844e92 100644
@@ -87,6 +87,8 @@ static const enum mnl_attr_data_type vdpa_policy[VDPA_ATTR_MAX + 1] = {
            [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,
+       [VDPA_ATTR_DEV_FEATURES] = MNL_TYPE_U64,
+       [VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES] = MNL_TYPE_U64,
     };
 
     static int attr_cb(const struct nlattr *attr, void *data)
@@ -482,7 +484,7 @@ static const char * const *dev_to_feature_str[] = {
 
     #define NUM_FEATURE_BITS 64
 
-static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
+static void print_features(struct vdpa *vdpa, uint64_t features, bool devf,
                               uint16_t dev_id)
     {
            const char * const *feature_strs = NULL;
@@ -492,7 +494,7 @@ static void print_features(struct vdpa *vdpa, uint64_t features, bool mgmtdevf,
            if (dev_id < ARRAY_SIZE(dev_to_feature_str))
                    feature_strs = dev_to_feature_str[dev_id];
 
-       if (mgmtdevf)
+       if (devf)
                    pr_out_array_start(vdpa, "dev_features");
            else
                    pr_out_array_start(vdpa, "negotiated_features");
@@ -771,6 +773,15 @@ static void pr_out_dev_net_config(struct vdpa *vdpa, struct nlattr **tb)
                    val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_DEV_NEGOTIATED_FEATURES]);
                    print_features(vdpa, val_u64, false, dev_id);
            }
+       if (tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]) {
+               uint16_t dev_id = 0;
+
+               if (tb[VDPA_ATTR_DEV_ID])
+                       dev_id = mnl_attr_get_u32(tb[VDPA_ATTR_DEV_ID]);
+
+               val_u64 = mnl_attr_get_u64(tb[VDPA_ATTR_VDPA_DEV_SUPPORTED_FEATURES]);
+               print_features(vdpa, val_u64, true, dev_id);
+       }
     }
 
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
vdpa/vdpa.c +0 -1
     static void pr_out_dev_config(struct vdpa *vdpa, struct nlattr **tb)
--

2.31.1

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization