Skip to contentSkip to conversation

vdpa: refactor vdpa_feature_bits array

PATCH Superseded Hawkins Jiawei 2 participants 6 messages Jun 30, 2023 Networking

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover vdpa: refactor vdpa_feature_bits array

This patchset removes the duplicated VIRTIO_NET_F_RSS entry in vdpa_feature_bits array and reorganizes the vdpa_feature_bits array in ascending order based on its value to avoid future duplicates.

Changelog
=========
v2:
- resolve conflicts with the master branch

v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg01583.html

Hawkins Jiawei (2):
vdpa: delete duplicated VIRTIO_NET_F_RSS in vdpa_feature_bits
vdpa: order vdpa_feature_bits array

 net/vhost-vdpa.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/2 vdpa: delete duplicated VIRTIO_NET_F_RSS in vdpa_feature_bits

This entry was duplicated on referenced commit. Removing it.

Fixes 402378407dbd ("vhost-vdpa: multiqueue support")
---
 net/vhost-vdpa.c | 1 -
 1 file changed, 1 deletion(-)
net/vhost-vdpa.c +0 -1
index e19ab063fa..0479988a79 100644
@@ -74,7 +74,6 @@ const int vdpa_feature_bits[] = {
     VIRTIO_NET_F_CTRL_RX_EXTRA,
     VIRTIO_NET_F_CTRL_VLAN,
     VIRTIO_NET_F_CTRL_MAC_ADDR,
-    VIRTIO_NET_F_RSS,
     VIRTIO_NET_F_MQ,
     VIRTIO_NET_F_CTRL_VQ,
     VIRTIO_F_IOMMU_PLATFORM,
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 2/2 vdpa: order vdpa_feature_bits array

In reply to Hawkins Jiawei

This patch reorganizes the vdpa_feature_bits array
in ascending order based on its value to avoid future duplicates.

---
v2:
- resolve conflicts with the master branch

v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg01585.html

 net/vhost-vdpa.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)
net/vhost-vdpa.c +13 -11
index 0479988a79..db7f1241af 100644
@@ -50,15 +50,12 @@ typedef struct VhostVDPAState {
     bool started;
 } VhostVDPAState;
 
+/* The array is sorted in ascending order based on its value */
 const int vdpa_feature_bits[] = {
-    VIRTIO_F_NOTIFY_ON_EMPTY,
-    VIRTIO_RING_F_INDIRECT_DESC,
-    VIRTIO_RING_F_EVENT_IDX,
-    VIRTIO_F_ANY_LAYOUT,
-    VIRTIO_F_VERSION_1,
     VIRTIO_NET_F_CSUM,
     VIRTIO_NET_F_GUEST_CSUM,
     VIRTIO_NET_F_CTRL_GUEST_OFFLOADS,
+    VIRTIO_NET_F_MTU,
     VIRTIO_NET_F_GSO,
     VIRTIO_NET_F_GUEST_TSO4,
     VIRTIO_NET_F_GUEST_TSO6,
@@ -69,19 +66,24 @@ const int vdpa_feature_bits[] = {
     VIRTIO_NET_F_HOST_ECN,
     VIRTIO_NET_F_HOST_UFO,
     VIRTIO_NET_F_MRG_RXBUF,
-    VIRTIO_NET_F_MTU,
+    VIRTIO_NET_F_STATUS,
+    VIRTIO_NET_F_CTRL_VQ,
     VIRTIO_NET_F_CTRL_RX,
-    VIRTIO_NET_F_CTRL_RX_EXTRA,
     VIRTIO_NET_F_CTRL_VLAN,
-    VIRTIO_NET_F_CTRL_MAC_ADDR,
+    VIRTIO_NET_F_CTRL_RX_EXTRA,
     VIRTIO_NET_F_MQ,
-    VIRTIO_NET_F_CTRL_VQ,
+    VIRTIO_NET_F_CTRL_MAC_ADDR,
+    VIRTIO_F_NOTIFY_ON_EMPTY,
+    VIRTIO_F_ANY_LAYOUT,
+    VIRTIO_RING_F_INDIRECT_DESC,
+    VIRTIO_RING_F_EVENT_IDX,
+    VIRTIO_F_VERSION_1,
     VIRTIO_F_IOMMU_PLATFORM,
     VIRTIO_F_RING_PACKED,
     VIRTIO_F_RING_RESET,
-    VIRTIO_NET_F_RSS,
     VIRTIO_NET_F_HASH_REPORT,
-    VIRTIO_NET_F_STATUS,
+    VIRTIO_NET_F_RSS,
+    /* VHOST_INVALID_FEATURE_BIT should always be the last entry */
     VHOST_INVALID_FEATURE_BIT
 };
 
Signature · 1 line
2.25.1
Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] vdpa: order vdpa_feature_bits array

Quoted 18 lines · Hawkins Jiawei

This patch reorganizes the vdpa_feature_bits array
in ascending order based on its value to avoid future duplicates.

---
v2:
- resolve conflicts with the master branch

v1: https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg01585.html

  net/vhost-vdpa.c | 24 +++++++++++++-----------
  1 file changed, 13 insertions(+), 11 deletions(-)
net/vhost-vdpa.c +0 -0
index 0479988a79..db7f1241af 100644

net/vhost-vdpa.c typedef struct VhostVDPAState { · line 53

Quoted 4 lines
net/vhost-vdpa.c +1 -0
@@ -50,15 +50,12 @@ typedef struct VhostVDPAState {
      bool started;
  } VhostVDPAState;
 
+/* The array is sorted in ascending order based on its value */

Alphabetically would have been simpler IMO, anyhow:

#5 lore raw

Re: [PATCH v2 2/2] vdpa: order vdpa_feature_bits array

Quoted 15 lines · Philippe Mathieu-Daudé
Quoted 14 lines · Hawkins Jiawei

This patch reorganizes the vdpa_feature_bits array
in ascending order based on its value to avoid future duplicates.

---
v2:
- resolve conflicts with the master branch

v1:
https://lists.nongnu.org/archive/html/qemu-devel/2023-06/msg01585.html

  net/vhost-vdpa.c | 24 +++++++++++++-----------
  1 file changed, 13 insertions(+), 11 deletions(-)
Quoted 10 lines

net/vhost-vdpa.c typedef struct VhostVDPAState { · line 52

Quoted 8 lines
net/vhost-vdpa.c +1 -0
index 0479988a79..db7f1241af 100644
@@ -50,15 +50,12 @@ typedef struct VhostVDPAState {
      bool started;
  } VhostVDPAState;
+/* The array is sorted in ascending order based on its value */

Alphabetically would have been simpler IMO, anyhow:

Yes, it seems that rearranging the array in alphabetical order could improve the maintainability of the code.

I will sort the features alphabetically, excluding VHOST_INVALID_FEATURE_BIT, according to your suggestion.

Thanks!

Quoted 2 lines