Skip to contentSkip to conversation

examples/vhost: remove async inflight packet counter

PATCH Applied Cheng Jiang 2 participants 9 messages Feb 2, 2021 – Feb 3, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v3 1/1 examples/vhost: remove async inflight packet counter

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------
 examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h +1 -1
index 0a1dbb811..1aa28ed6a 100644
@@ -11,7 +11,7 @@
 
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define MAX_ENQUEUED_SIZE 4096
 
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c +1 -9
index e74fc8750..ca73e7086 100644
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl, MAX_PKT_BURST);
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts, complete_count,
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid, VIRTIO_RXQ,
 					m, nr_xmit, m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret - cpu_cpl_nr,
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
@@ -1210,9 +1205,6 @@ drain_eth_rx(struct vhost_dev *vdev)
 		enqueue_count = rte_vhost_submit_enqueue_burst(vdev->vid,
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
 
examples/vhost/main.h +0 -1
index 2d6c05fd7..0ccdce4b4 100644
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;

--
2.29.2

#2 lore raw
Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Is that an optimization or a fix?

If the former, let's move it to v21.05.

Quoted 19 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------
 examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h +0 -0
index 0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h line 14

Quoted 5 lines
examples/vhost/ioat.h +1 -1
@@ -11,7 +11,7 @@
 
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define MAX_ENQUEUED_SIZE 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Quoted 54 lines
examples/vhost/ioat.h +0 -0
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c +1 -9
index e74fc8750..ca73e7086 100644
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl, MAX_PKT_BURST);
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts, complete_count,
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid, VIRTIO_RXQ,
 					m, nr_xmit, m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret - cpu_cpl_nr,
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
@@ -1210,9 +1205,6 @@ drain_eth_rx(struct vhost_dev *vdev)
 		enqueue_count = rte_vhost_submit_enqueue_burst(vdev->vid,
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
 
examples/vhost/main.h +0 -2
index 2d6c05fd7..0ccdce4b4 100644
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

#3 lore raw

Hi,

Quoted 12 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:52 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 9 lines
Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Is that an optimization or a fix?

If the former, let's move it to v21.05.

I think it's a fix since there is no need to keep the inflight packet counter, sorry I forget adding the fixes, I can submit a v4 to fix it.

Quoted 19 lines
Quoted 19 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------  examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h index renamed from examples/vhost/ioat.h +0 -0

0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h +0 -0
@@ -11,7 +11,7 @@
 
Quoted 8 lines

examples/vhost/ioat.h line 14

Quoted 4 lines
examples/vhost/ioat.h +1 -1
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define MAX_ENQUEUED_SIZE 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Yes, it's a the size of packet tracking ring, and it should be no less then IOAT_RING_SIZE for some corner cases. I'm not sure I understand what you mean by saying It might be further simplified then.

Thanks,
Cheng

Quoted 60 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 833

Quoted 11 lines
examples/vhost/ioat.h +0 -0
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

e74fc8750..ca73e7086 100644

examples/vhost/main.c +0 -0
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl,

MAX_PKT_BURST);

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 835

Quoted 2 lines
examples/vhost/main.c +0 -2
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts,

complete_count,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 876

Quoted 10 lines
examples/vhost/main.c +1 -2
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid,

VIRTIO_RXQ,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 877

Quoted 1 line
examples/vhost/main.c +0 -0
 					m, nr_xmit, m_cpu_cpl,

&cpu_cpl_nr);

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 881

Quoted 1 line
examples/vhost/main.c +0 -1
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret -

cpu_cpl_nr,

Quoted 30 lines
examples/vhost/main.c +0 -4
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
@@ -1210,9 +1205,6 @@ drain_eth_rx(struct vhost_dev *vdev)
 		enqueue_count = rte_vhost_submit_enqueue_burst(vdev-
 vid,
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
examples/vhost/main.h index renamed from examples/vhost/main.h +0 -0

2d6c05fd7..0ccdce4b4 100644

examples/vhost/main.h +0 -2
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

#4 lore raw
Quoted 19 lines · On 2/3/21 1:11 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 17 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:52 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Quoted 6 lines
Quoted 4 lines

Is that an optimization or a fix?

If the former, let's move it to v21.05.

I think it's a fix since there is no need to keep the inflight packet counter, sorry I forget adding the fixes, I can submit a v4 to fix it.

OK

Quoted 28 lines
Quoted 19 lines
Quoted 19 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------  examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h index renamed from examples/vhost/ioat.h +0 -0

0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h +0 -0
@@ -11,7 +11,7 @@
 
Quoted 8 lines

examples/vhost/ioat.h line 14

Quoted 4 lines
examples/vhost/ioat.h +1 -1
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define MAX_ENQUEUED_SIZE 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Quoted 2 lines

Yes, it's a the size of packet tracking ring, and it should be no less then IOAT_RING_SIZE for some corner cases. I'm not sure I understand what you mean by saying It might be further simplified then.

I meant maybe in this case just use IOAT_RING_SIZE?

Quoted 64 lines

Thanks,
Cheng

Quoted 60 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 833

Quoted 11 lines
examples/vhost/ioat.h +0 -0
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

e74fc8750..ca73e7086 100644

examples/vhost/main.c +0 -0
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl,

MAX_PKT_BURST);

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 835

Quoted 2 lines
examples/vhost/main.c +0 -2
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts,

complete_count,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 876

Quoted 10 lines
examples/vhost/main.c +1 -2
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid,

VIRTIO_RXQ,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 877

Quoted 1 line
examples/vhost/main.c +0 -0
 					m, nr_xmit, m_cpu_cpl,

&cpu_cpl_nr);

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 881

Quoted 1 line
examples/vhost/main.c +0 -1
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret -

cpu_cpl_nr,

Quoted 30 lines
examples/vhost/main.c +0 -4
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
@@ -1210,9 +1205,6 @@ drain_eth_rx(struct vhost_dev *vdev)
 		enqueue_count = rte_vhost_submit_enqueue_burst(vdev-
 vid,
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
examples/vhost/main.h index renamed from examples/vhost/main.h +0 -0

2d6c05fd7..0ccdce4b4 100644

examples/vhost/main.h +0 -2
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

#5 lore raw
Quoted 34 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 8:55 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 19 lines · On 2/3/21 1:11 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 17 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:52 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Is that an optimization or a fix?

If the former, let's move it to v21.05.

I think it's a fix since there is no need to keep the inflight packet counter,

sorry I forget adding the fixes, I can submit a v4 to fix it. OK

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

Oh, I got fixes here, sorry for the miss.

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
Quoted 16 lines

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------  examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h index renamed from examples/vhost/ioat.h +0 -0

0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h line 14

Quoted 5 lines
examples/vhost/ioat.h +1 -1
@@ -11,7 +11,7 @@
 
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define It might be further simplified then 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Quoted 6 lines
Quoted 1 line

Yes, it's a the size of packet tracking ring, and it should be no less then

IOAT_RING_SIZE for some corner cases.

Quoted 1 line

I'm not sure I understand what you mean by saying It might be further

simplified then.

I meant maybe in this case just use IOAT_RING_SIZE?

I have thought about it before I use MAX_ENQUEUED_SIZE.
But actually MAX_ENQUEUED_SIZE is used to for packet tracking ring, and IOAT_RING_SIZE is for ioat ring. Using IOAT_RING_SIZE for packet tracking ring, I think maybe it's not so logical and a little bit confusing. What do you think?

Thanks,
Cheng

Quoted 66 lines
Quoted 30 lines

Thanks,
Cheng

Quoted 26 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 833

Quoted 11 lines
examples/vhost/ioat.h +0 -0
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

e74fc8750..ca73e7086 100644

examples/vhost/main.c +0 -0
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl,

MAX_PKT_BURST);

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 835

Quoted 2 lines
examples/vhost/main.c +0 -2
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts,

complete_count,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 876

Quoted 10 lines
examples/vhost/main.c +1 -2
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid,

VIRTIO_RXQ,

Quoted 8 lines
Quoted 8 lines

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 877

Quoted 1 line
examples/vhost/main.c +0 -0
 					m, nr_xmit, m_cpu_cpl,

&cpu_cpl_nr);

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 881

Quoted 1 line
examples/vhost/main.c +0 -1
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret -

cpu_cpl_nr,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev)

Quoted 4 lines
examples/vhost/main.c +0 -1
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr); @@ -1210,9

+1205,6 @@

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines

drain_eth_rx(struct vhost_dev *vdev)
enqueue_count = rte_vhost_submit_enqueue_burst(vdev-
vid,

examples/vhost/main.c +0 -3
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
examples/vhost/main.h index renamed from examples/vhost/main.h +0 -0

2d6c05fd7..0ccdce4b4 100644

examples/vhost/main.h +0 -2
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

#6 lore raw
Quoted 75 lines · On 2/3/21 2:42 PM, Jiang, Cheng1 wrote:
Quoted 34 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 8:55 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 19 lines · On 2/3/21 1:11 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 17 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:52 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Quoted 10 lines
Quoted 6 lines
Quoted 4 lines

Is that an optimization or a fix?

If the former, let's move it to v21.05.

I think it's a fix since there is no need to keep the inflight packet counter,

sorry I forget adding the fixes, I can submit a v4 to fix it. OK

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

Oh, I got fixes here, sorry for the miss.

Quoted 28 lines
Quoted 26 lines
Quoted 17 lines
Quoted 17 lines

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------  examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h index renamed from examples/vhost/ioat.h +0 -0

0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h +0 -0
@@ -11,7 +11,7 @@
 
Quoted 8 lines

examples/vhost/ioat.h

Quoted 4 lines
examples/vhost/ioat.h +1 -1
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define It might be further simplified then 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Quoted 1 line

Yes, it's a the size of packet tracking ring, and it should be no less then

IOAT_RING_SIZE for some corner cases.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

I'm not sure I understand what you mean by saying It might be further

simplified then.

I meant maybe in this case just use IOAT_RING_SIZE?

I have thought about it before I use MAX_ENQUEUED_SIZE.
But actually MAX_ENQUEUED_SIZE is used to for packet tracking ring, and IOAT_RING_SIZE is for ioat ring. Using IOAT_RING_SIZE for packet tracking ring, I think maybe it's not so logical and a little bit confusing. What do you think?

OK, let's keep it as is then.

Thanks,
Maxime

Quoted 70 lines

Thanks,
Cheng

Quoted 66 lines
Quoted 30 lines

Thanks,
Cheng

Quoted 26 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 833

Quoted 11 lines
examples/vhost/ioat.h +0 -0
 struct dma_info {
 	struct rte_pci_addr addr;
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

e74fc8750..ca73e7086 100644

examples/vhost/main.c +0 -0
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev *vdev)
 
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl,

MAX_PKT_BURST);

examples/vhost/main.c complete_async_pkts(struct vhost_dev *vdev) · line 835

Quoted 2 lines
examples/vhost/main.c +0 -2
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts,

complete_count,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 876

Quoted 10 lines
examples/vhost/main.c +1 -2
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid,

VIRTIO_RXQ,

Quoted 8 lines
Quoted 8 lines

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 877

Quoted 1 line
examples/vhost/main.c +0 -0
 					m, nr_xmit, m_cpu_cpl,

&cpu_cpl_nr);

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 881

Quoted 1 line
examples/vhost/main.c +0 -1
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret -

cpu_cpl_nr,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev)

Quoted 4 lines
examples/vhost/main.c +0 -1
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr); @@ -1210,9

+1205,6 @@

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines

drain_eth_rx(struct vhost_dev *vdev)
enqueue_count = rte_vhost_submit_enqueue_burst(vdev-
vid,

examples/vhost/main.c +0 -3
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
examples/vhost/main.h index renamed from examples/vhost/main.h +0 -0

2d6c05fd7..0ccdce4b4 100644

examples/vhost/main.h +0 -2
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

#7 lore raw
Quoted 99 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 10:21 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 84 lines · On 2/3/21 2:42 PM, Jiang, Cheng1 wrote:
Quoted 36 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 8:55 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 21 lines · On 2/3/21 1:11 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 19 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:52 PM
To: Jiang, Cheng1 <[email protected]>; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; Yang, YvonneX <[email protected]>; Wang, Yinan <[email protected]>
Subject: Re: [PATCH v3] examples/vhost: remove async inflight packet counter

Quoted 3 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Is that an optimization or a fix?

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

If the former, let's move it to v21.05.

I think it's a fix since there is no need to keep the inflight packet counter,

sorry I forget adding the fixes, I can submit a v4 to fix it. OK

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

Oh, I got fixes here, sorry for the miss.

Quoted 35 lines
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines

---
v3: fixed fixes commit id in git log

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------  examples/vhost/main.h |  1
(quoted diff) +0 -1
-
 3 files changed, 2 insertions(+), 11 deletions(-)
examples/vhost/ioat.h index renamed from examples/vhost/ioat.h +0 -0

0a1dbb811..1aa28ed6a 100644

examples/vhost/ioat.h +0 -0
@@ -11,7 +11,7 @@
 
Quoted 8 lines

examples/vhost/ioat.h

Quoted 4 lines
examples/vhost/ioat.h +1 -1
 #define MAX_VHOST_DEVICE 1024
 #define IOAT_RING_SIZE 4096
-#define MAX_ENQUEUED_SIZE 512
+#define It might be further simplified then 4096

Basically, this the size of the ring size, correct? It might be further simplified then.

Quoted 2 lines

Yes, it's a the size of packet tracking ring, and it should be no less then

IOAT_RING_SIZE for some corner cases.

Quoted 2 lines

I'm not sure I understand what you mean by saying It might be further

simplified then.

I meant maybe in this case just use IOAT_RING_SIZE?

Quoted 7 lines
Quoted 2 lines

I have thought about it before I use MAX_ENQUEUED_SIZE.
But actually MAX_ENQUEUED_SIZE is used to for packet tracking ring, and

IOAT_RING_SIZE is for ioat ring.

Quoted 1 line

Using IOAT_RING_SIZE for packet tracking ring, I think maybe it's not so

logical and a little bit confusing. What do you think?

OK, let's keep it as is then.

Sure, then this is the last version of this patch.

Thanks,
Cheng

Quoted 75 lines

Thanks,
Maxime

Quoted 8 lines

Thanks,
Cheng

Quoted 5 lines
Quoted 5 lines

Thanks,
Cheng

Quoted 1 line
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev

Quoted 7 lines

struct dma_info {

examples/vhost/ioat.h +0 -0
 	struct rte_pci_addr addr;
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

e74fc8750..ca73e7086 100644

examples/vhost/main.c +0 -0
@@ -831,11 +831,8 @@ complete_async_pkts(struct vhost_dev

*vdev)

Quoted 55 lines
Quoted 54 lines
Quoted 18 lines
Quoted 18 lines

examples/vhost/main.c complete_async_pkts(struct vhost_dev · line 832

Quoted 3 lines
examples/vhost/main.c +0 -0
 	complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
 					VIRTIO_RXQ, p_cpl,

MAX_PKT_BURST);

examples/vhost/main.c complete_async_pkts(struct vhost_dev · line 834

Quoted 2 lines
examples/vhost/main.c +0 -2
-	if (complete_count) {
-		__atomic_sub_fetch(&vdev->nr_async_pkts,

complete_count,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 876

Quoted 10 lines
examples/vhost/main.c +1 -2
-			__ATOMIC_SEQ_CST);
+	if (complete_count)
 		free_pkts(p_cpl, complete_count);
-	}
 }
 
 static __rte_always_inline void
@@ -878,8 +875,6 @@ drain_vhost(struct vhost_dev *vdev)
 		complete_async_pkts(vdev);
 		ret = rte_vhost_submit_enqueue_burst(vdev->vid,

VIRTIO_RXQ,

Quoted 8 lines
Quoted 8 lines

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 877

Quoted 1 line
examples/vhost/main.c +0 -0
 					m, nr_xmit, m_cpu_cpl,

&cpu_cpl_nr);

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev) · line 881

Quoted 1 line
examples/vhost/main.c +0 -1
-		__atomic_add_fetch(&vdev->nr_async_pkts, ret -

cpu_cpl_nr,

examples/vhost/main.c drain_vhost(struct vhost_dev *vdev)

Quoted 4 lines
examples/vhost/main.c +0 -1
-				__ATOMIC_SEQ_CST);
 
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr); @@ -1210,9

+1205,6 @@

Quoted 27 lines
Quoted 26 lines
Quoted 26 lines

drain_eth_rx(struct vhost_dev *vdev)
enqueue_count = rte_vhost_submit_enqueue_burst(vdev-
vid,

examples/vhost/main.c +0 -3
 					VIRTIO_RXQ, pkts, rx_count,
 					m_cpu_cpl, &cpu_cpl_nr);
-		__atomic_add_fetch(&vdev->nr_async_pkts,
-					enqueue_count - cpu_cpl_nr,
-					__ATOMIC_SEQ_CST);
 		if (cpu_cpl_nr)
 			free_pkts(m_cpu_cpl, cpu_cpl_nr);
examples/vhost/main.h index renamed from examples/vhost/main.h +0 -0

2d6c05fd7..0ccdce4b4 100644

examples/vhost/main.h +0 -2
@@ -51,7 +51,6 @@ struct vhost_dev {
 	uint64_t features;
 	size_t hdr_len;
 	uint16_t nr_vrings;
-	uint64_t nr_async_pkts;
 	struct rte_vhost_memory *mem;
 	struct device_statistics stats;
 	TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--

2.29.2

Reviewed-by on v3 1/1
#8 lore raw
In reply to Cheng Jiang
Quoted 10 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

Quoted 7 lines

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------
 examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)

Thanks,
Maxime

#9 lore raw
Quoted 21 lines · Maxime Coquelin
Quoted 10 lines · Cheng Jiang

Remove async inflight packet counter since there is no need to keep tracking it. Increase MAX_ENQUEUED_SIZE to prevent packet segment number tracking ring from being exhausted.

Fixes a68ba8e0a6b6 ("examples/vhost: refactor vhost data path")

---
v3: fixed fixes commit id in git log

Quoted 7 lines

v2: fixed a typo

 examples/vhost/ioat.h |  2 +-
 examples/vhost/main.c | 10 +---------
 examples/vhost/main.h |  1 -
 3 files changed, 2 insertions(+), 11 deletions(-)
Quoted 5 lines

Thanks,
Maxime

Applied to dpdk-next-virtio/main.

Thanks,
Maxime