net/virtio: packed ring notification data feature support
This patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
--- drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 15 ++++++++++++++- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \
drivers/net/virtio/virtio_pci.c +14 -1
@@ -418,7 +418,20 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq)static void modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) + notify_data = ((((uint32_t )vq->vq_packed.used_wrap_counter <<15 ) | + vq->vq_avail_idx) <<16 ) | vq->vq_queue_index; +else + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {
drivers/net/virtio/virtio_pci.h +6 -0
@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick
Signature · 1 line
2.17.1
Quoted 42 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 04, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Signed-off-by Cheng Jiang <[email protected]>--- drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 15 ++++++++++++++- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-1@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \drivers/net/virtio/virtio_pci.c +0
-0
drivers/net/virtio/virtio_pci.c modern_del_queue(struct virtio_hw *hw, struct · line 422
Quoted 5 lines
drivers/net/virtio/virtio_pci.c +0
-0@@ -418,7 +418,20 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq)static void modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) {
Hi Cheng,
hw pointer will be used in notify function, please remove rte_unused attribute.
Thanks,
Marvin
Quoted 40 lines
drivers/net/virtio/virtio_pci.c +9
-1-rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) + notify_data = ((((uint32_t)vq->vq_packed.used_wrap_counter <<15) |
drivers/net/virtio/virtio_pci.c +5
-0+ vq->vq_avail_idx) << 16) | vq->vq_queue_index; + else + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {drivers/net/virtio/virtio_pci.h +6
-0@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */
/* The Host publishes the avail index for which it expects a kick
--
2.17.1
Quoted 63 lines
-----Original Message-----
From: Liu, Yong
Sent: Monday, December 9, 2019 10:00 AM
To: Jiang, Cheng1 <[email protected]>; [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: RE: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportQuoted 40 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 04, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Signed-off-by Cheng Jiang <[email protected]>--- drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 15 ++++++++++++++- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-1@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \(quoted diff) +0
-0
b/drivers/net/virtio/virtio_pci.cindex4468e89cb..2462a7dab100644drivers/net/virtio/virtio_pci.c +0
-0@@ -418,7 +418,20 @@ modern_del_queue(struct virtio_hw *hw, structQuoted 4 lines
virtqueue *vq) static void modern_notify_queue(struct
virtio_hw*hw__rte_unused, struct virtqueue
*vq)
{Hi Cheng,
hw pointer will be used in notify function, please removerte_unusedattribute.
Quoted 3 lines
Thanks,
Marvin
Sure, I'll remove it in the next version.
Thanks very much!
Cheng
Quoted 41 lines
Quoted 41 lines
drivers/net/virtio/virtio_pci.c +9
-1-rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) + notify_data = ((((uint32_t)vq-vq_packed.used_wrap_counter <<
15) |drivers/net/virtio/virtio_pci.c +1
-0+ vq->vq_avail_idx) << 16) | vq-
vq_queue_index;drivers/net/virtio/virtio_pci.c +4
-0+else + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; +rte_write32 (notify_data, vq->notify_addr); } const struct virtio_pci_ops modern_ops = { diff --git
a/drivers/net/virtio/virtio_pci.hb/drivers/net/virtio/virtio_pci.hindexa38cb45ad..7433d2f08100644drivers/net/virtio/virtio_pci.h +6
-0@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */
/* The Host publishes the avail index for which it expects a kick
--
2.17.1
PATCH v2 1/1 net/virtio: packed ring notification data feature support
In reply to Cheng JiangThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
---
v2:
* Removed rte_unused attribute in *hw.
* Added some comments on notify_data.
drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 27 +++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 33 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \
drivers/net/virtio/virtio_pci.c +25 -2
@@ -416,9 +416,32 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq) }static void -modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) +modern_notify_queue (struct virtio_hw *hw,struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) { +/* +* Bit[0:15]: vq queue index +* Bit[16:30]: avail index +* Bit[31]: avail wrap counter +*/ + notify_data = ((((uint32_t )vq->vq_packed.used_wrap_counter <<15 ) | + vq->vq_avail_idx) <<16 ) | vq->vq_queue_index; + }else { +/* +* Bit[0:15]: vq queue index +* Bit[16:31]: avail index +*/ + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + } +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {
drivers/net/virtio/virtio_pci.h +6 -0
@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick
Signature · 1 line
2.17.1
Hi Jiang,
Quoted 11 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 18, 2019 4:17 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Cheng Jiang <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/virtio: packed ring notification data feature supportThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Can the commit log be more specific about the extra data? Something like "expand the notification to include the avail index and avail wrap counter, if any"?
Quoted 56 lines
Signed-off-by Cheng Jiang <[email protected]>---
v2:
* Removedrte_unusedattribute in *hw.
* Added some comments onnotify_data.drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 27 +++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 33 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-1@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \drivers/net/virtio/virtio_pci.c +15
-2@@ -416,9 +416,32 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq) }static void -modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) +modern_notify_queue (struct virtio_hw *hw,struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) { +/* +* Bit[0:15]: vq queue index +* Bit[16:30]: avail index +* Bit[31]: avail wrap counter +*/ + notify_data = ((((uint32_t)vq-
Quoted 1 line
Quoted 1 line
vq_packed.used_wrap_counter << 15) |
Why not do ' used_wrap_counter << 31' to be more straightforward and matches the above comment?
Quoted 34 lines
drivers/net/virtio/virtio_pci.c +1
-0+ vq->vq_avail_idx) << 16) | vq-Quoted 1 line
vq_queue_index;drivers/net/virtio/virtio_pci.c +9
-0+ }else { +/* +* Bit[0:15]: vq queue index +* Bit[16:31]: avail index +*/ + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + } +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {drivers/net/virtio/virtio_pci.h +6
-1@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick -- 2.17.1
Hi Gavin,
Quoted 21 lines
-----Original Message-----
From: Gavin Hu [mailto:[email protected]]
Sent: Wednesday, December 18, 2019 5:52 PM
To: Jiang, Cheng1 <[email protected]>; [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Liu, Yong <[email protected]>
Cc: [email protected]; nd <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v2] net/virtio: packed ring notification data feature supportHi Jiang,
Quoted 9 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 18, 2019 4:17 PM
To: [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; Cheng Jiang <[email protected]>
Subject: [dpdk-dev] [PATCH v2] net/virtio: packed ring notification data feature support
Quoted 5 lines
Quoted 2 lines
This patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Can the commit log be more specific about the extra data? Something like "expand the notification to include the avail index and avail wrap counter, if any"?
It makes more sense. I will add more specific commit log in the next version. Thank you.
Quoted 56 lines
Quoted 56 lines
Signed-off-by Cheng Jiang <[email protected]>---
v2:
* Removedrte_unusedattribute in *hw.
* Added some comments onnotify_data.drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 27 +++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 33 insertions(+), 3 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-1@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \(quoted diff) +0
-0
b/drivers/net/virtio/virtio_pci.cindex4468e89cb..8b4e001a1100644drivers/net/virtio/virtio_pci.c +0
-1@@ -416,9 +416,32 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq) } static void -modern_notify_queue(struct virtio_hw *hw __rte_unused, structvirtqueue
*vq)drivers/net/virtio/virtio_pci.c +15
-1+modern_notify_queue(struct virtio_hw *hw, struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); + uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) { +/* +* Bit[0:15]: vq queue index +* Bit[16:30]: avail index +* Bit[31]: avail wrap counter +*/ + notify_data = ((((uint32_t)vq-
Quoted 3 lines
Quoted 1 line
Quoted 1 line
vq_packed.used_wrap_counter << 15) |
Why not do '
used_wrap_counter<< 31' to be more straightforward and matches the above comment?
Sure, you're right. I'll modify the patch in the next version.
Thanks again.
Cheng
Quoted 35 lines
Quoted 35 lines
drivers/net/virtio/virtio_pci.c +1
-0+ vq->vq_avail_idx) << 16) | vq-Quoted 1 line
vq_queue_index;drivers/net/virtio/virtio_pci.c +9
-0+ }else { +/* +* Bit[0:15]: vq queue index +* Bit[16:31]: avail index +*/ + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + } +rte_write32 (notify_data, vq->notify_addr); } const struct virtio_pci_ops modern_ops = { diff --git
a/drivers/net/virtio/virtio_pci.hb/drivers/net/virtio/virtio_pci.hindexa38cb45ad..7433d2f08100644drivers/net/virtio/virtio_pci.h +6
-0@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */
/* The Host publishes the avail index for which it expects a kick
--
2.17.1
PATCH v3 1/1 net/virtio: packed ring notification data feature support
In reply to Cheng JiangThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications, expanding the notifications to include the avail index and avail wrap counter.
---
v3:
* Modified the commit log to make it more detailed.
* Modified the shift mode of notify_data to make it more intuitive.
v2:
* Removed rte_unused attribute in *hw.
* Added some comments on notify_data.
drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 28 ++++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 34 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \
drivers/net/virtio/virtio_pci.c +26 -2
@@ -416,9 +416,33 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq) }static void -modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) +modern_notify_queue (struct virtio_hw *hw,struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) { +/* +* Bit[0:15]: vq queue index +* Bit[16:30]: avail index +* Bit[31]: avail wrap counter +*/ + notify_data = ((uint32_t )vq->vq_packed.used_wrap_counter <<31 ) | + ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + }else { +/* +* Bit[0:15]: vq queue index +* Bit[16:31]: avail index +*/ + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + } +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {
drivers/net/virtio/virtio_pci.h +6 -0
@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick
Signature · 1 line
2.17.1
PATCH v4 1/1 net/virtio: packed ring notification data feature support
In reply to Cheng JiangThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications, expanding the notifications to include the avail index and avail wrap counter.
---
v4:
* Replaced used_wrap_counter with avail_wrap_counter.
v3:
* Modified the commit log to make it more detailed.
* Modified the shift mode of notify_data to make it more intuitive.
v2:
* Removed rte_unused attribute in *hw.
* Added some comments on notify_data.
drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 29 +++++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/net/virtio/virtio_ethdev.h +2 -1
@@ -36,7 +36,8 @@ 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_RING_PACKED | \ 1ULL << VIRTIO_F_IOMMU_PLATFORM | \ - 1ULL << VIRTIO_F_ORDER_PLATFORM) + 1ULL << VIRTIO_F_ORDER_PLATFORM | \ + 1ULL << VIRTIO_F_NOTIFICATION_DATA)#define VIRTIO_PMD_SUPPORTED_GUEST_FEATURES \ (VIRTIO_PMD_DEFAULT_GUEST_FEATURES | \
drivers/net/virtio/virtio_pci.c +27 -2
@@ -416,9 +416,34 @@ modern_del_queue(struct virtio_hw *hw, struct virtqueue *vq) }static void -modern_notify_queue(struct virtio_hw *hw __rte_unused, struct virtqueue *vq) +modern_notify_queue (struct virtio_hw *hw,struct virtqueue *vq) { -rte_write16 (vq->vq_queue_index, vq->notify_addr); +uint32_t notify_data; + +if (!vtpci_with_feature (hw,VIRTIO_F_NOTIFICATION_DATA )) { +rte_write16 (vq->vq_queue_index, vq->notify_addr); +return ; + } + +if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) { +/* +* Bit[0:15]: vq queue index +* Bit[16:30]: avail index +* Bit[31]: avail wrap counter +*/ + notify_data = ((uint32_t )(!!(vq->vq_packed.cached_flags & +VRING_PACKED_DESC_F_AVAIL )) <<31 ) | + ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + }else { +/* +* Bit[0:15]: vq queue index +* Bit[16:31]: avail index +*/ + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index; + } +rte_write32 (notify_data, vq->notify_addr); }const struct virtio_pci_ops modern_ops = {
drivers/net/virtio/virtio_pci.h +6 -0
@@ -135,6 +135,12 @@ struct virtnet_ctl;*/ #define VIRTIO_F_ORDER_PLATFORM 36 +/* +* This feature indicates that the driver passes extra data (besides +* identifying the virtqueue) in its device notifications. +*/ +#define VIRTIO_F_NOTIFICATION_DATA 38 +/* The Guest publishes the used index for which it expects an interrupt * at the end of the avail ring. Host should ignore the avail->flags field. */ /* The Host publishes the avail index for which it expects a kick
Signature · 1 line
2.17.1
Quoted 15 lines · Cheng Jiang
This patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications, expanding the notifications to include the avail index and avail wrap counter.
Signed-off-by Cheng Jiang <[email protected]>---
v4:
* Replacedused_wrap_counterwithavail_wrap_counter.v3:
* Modified the commit log to make it more detailed.
* Modified the shift mode ofnotify_datato make it more intuitive.
Quoted 9 lines
v2:
* Removedrte_unusedattribute in *hw.
* Added some comments onnotify_data.drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 29 +++++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 35 insertions(+), 3 deletions(-)
Thanks,
Maxime
Maxime Coquelin
AppliedQuoted 15 lines · Cheng Jiang
This patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications, expanding the notifications to include the avail index and avail wrap counter.
Signed-off-by Cheng Jiang <[email protected]>---
v4:
* Replacedused_wrap_counterwithavail_wrap_counter.v3:
* Modified the commit log to make it more detailed.
* Modified the shift mode ofnotify_datato make it more intuitive.
Quoted 8 lines
v2:
* Removedrte_unusedattribute in *hw.
* Added some comments onnotify_data.drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 29 +++++++++++++++++++++++++++-- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 35 insertions(+), 3 deletions(-)
Applied to dpdk-next-virtio/master
Thanks,
Maxime
Quoted 29 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 04, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Signed-off-by Cheng Jiang <[email protected]>--- drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 15 ++++++++++++++- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-0+if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) + notify_data = ((((uint32_t)vq->vq_packed.used_wrap_counter <<15) |
drivers/net/virtio/virtio_ethdev.h
Quoted 4 lines
drivers/net/virtio/virtio_ethdev.h +4
-0+ vq->vq_avail_idx) << 16) | vq->vq_queue_index; + else + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index;
Hi Cheng,
According to virtio1.1 spec, wrap counter should refer to next available descriptor. So used_wrap_counter should be replaced with avail_wrap_counter. Sorry for late noticing.
Thanks,
Marvin
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.h +1
-0+rte_write32 (notify_data, vq->notify_addr); }
Hi Marvin,
Quoted 53 lines
-----Original Message-----
From: Liu, Yong
Sent: Thursday, January 9, 2020 3:29 PM
To: Jiang, Cheng1 <[email protected]>; [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: RE: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportQuoted 31 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Cheng Jiang
Sent: Wednesday, December 04, 2019 11:03 PM
To: [email protected]
Cc: [email protected]; Bie, Tiwei <[email protected]>; Wang, Zhihong <[email protected]>; Jiang, Cheng1 <[email protected]>
Subject: [dpdk-dev] [DPDK] net/virtio: packed ring notification data feature supportThis patch supports the feature that the driver passes extra data (besides identifying the virtqueue) in its device notifications.
Signed-off-by Cheng Jiang <[email protected]>--- drivers/net/virtio/virtio_ethdev.h | 3 ++- drivers/net/virtio/virtio_pci.c | 15 ++++++++++++++- drivers/net/virtio/virtio_pci.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)drivers/net/virtio/virtio_ethdev.h +2
-0+if (vtpci_with_feature (hw,VIRTIO_F_RING_PACKED )) + notify_data = ((((uint32_t)vq-vq_packed.used_wrap_counter <<
15) |drivers/net/virtio/virtio_ethdev.h +1
-0+ vq->vq_avail_idx) << 16) | vq-
vq_queue_index;drivers/net/virtio/virtio_ethdev.h
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.h +3
-0+else + notify_data = ((uint32_t )vq->vq_avail_idx <<16 ) | + vq->vq_queue_index;Hi Cheng,
According to virtio1.1 spec, wrap counter should refer to next available descriptor.
Soused_wrap_countershould be replaced withavail_wrap_counter. Sorry for late noticing.
Quoted 3 lines
Thanks,
Marvin
Sure, I'm going to modify it in the next version.
Thanks very much.
Cheng
Quoted 3 lines
Quoted 3 lines
drivers/net/virtio/virtio_ethdev.h +1
-0+rte_write32 (notify_data, vq->notify_addr); }