Skip to contentSkip to conversation

examples/vhost: add error propagation in ioat ops

PATCH Applied Maxime Coquelin 2 participants 7 messages 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
Quoted 20 lines · Cheng Jiang

It makes more sense to add error propagation for rte_ioat_completed_ops.

---
 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c +0 -1
index dbad28d43..60b73be93 100644
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 5 lines
examples/vhost/ioat.c +1 -1
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)
 {
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;

This change from uint16_t to int does not seem related to the purpose of this patch. Is it?

Quoted 24 lines
examples/vhost/ioat.c +9 -2
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT device %u",
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;
#2 lore raw

Hi,

Quoted 34 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:49 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] examples/vhost: add error propagation in ioat ops

Quoted 20 lines · Cheng Jiang

It makes more sense to add error propagation for rte_ioat_completed_ops.

---
 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c index renamed from examples/vhost/ioat.c +0 -0

dbad28d43..60b73be93 100644

examples/vhost/ioat.c +0 -1
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 128

Quoted 1 line
examples/vhost/ioat.c +0 -0
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)

{

Quoted 8 lines

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +0 -1
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 +

VIRTIO_RXQ].dev_id;

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +2 -0
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 +
+VIRTIO_RXQ].dev_id;

This change from uint16_t to int does not seem related to the purpose of this patch. Is it?

Yes, this change has nothing to do with adding the log, I just noticed uint16_t is more appropriate and changed here. I can only add the log if you think change the type of dev_id here is not ok.

Thanks.
Cheng

Quoted 27 lines

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid,

Quoted 5 lines
examples/vhost/ioat.c +0 -0
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid,

uint16_t queue_id,

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid, · line 190

Quoted 12 lines
examples/vhost/ioat.c +5 -2
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT

device %u",

Quoted 8 lines
examples/vhost/ioat.c +4 -0
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;
#3 lore raw
Quoted 39 lines · On 2/3/21 12:52 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 37 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:49 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] examples/vhost: add error propagation in ioat ops

Quoted 20 lines · Cheng Jiang

It makes more sense to add error propagation for rte_ioat_completed_ops.

---
 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c index renamed from examples/vhost/ioat.c +0 -0

dbad28d43..60b73be93 100644

examples/vhost/ioat.c +0 -1
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 128

Quoted 1 line
examples/vhost/ioat.c +0 -0
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)

{

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +0 -1
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 +

VIRTIO_RXQ].dev_id;

Quoted 8 lines
Quoted 5 lines

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +2 -0
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 +
+VIRTIO_RXQ].dev_id;

This change from uint16_t to int does not seem related to the purpose of this patch. Is it?

Yes, this change has nothing to do with adding the log, I just noticed uint16_t is more appropriate and changed here. I can only add the log if you think change the type of dev_id here is not ok.

Better to have two commits since these are two different changes. At least please mention it in the commit message.

Thanks,
Maxime

Quoted 31 lines

Thanks.
Cheng

Quoted 27 lines

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid,

Quoted 5 lines
examples/vhost/ioat.c +0 -0
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid,

uint16_t queue_id,

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid, · line 190

Quoted 12 lines
examples/vhost/ioat.c +5 -2
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT

device %u",

Quoted 8 lines
examples/vhost/ioat.c +4 -0
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;
#4 lore raw
Quoted 61 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 8:49 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] examples/vhost: add error propagation in ioat ops

Quoted 16 lines · On 2/3/21 12:52 PM, Jiang, Cheng1 wrote:

Hi,

Quoted 14 lines

-----Original Message-----
From: Maxime Coquelin <[email protected]>
Sent: Wednesday, February 3, 2021 5:49 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] examples/vhost: add error propagation in ioat ops

Quoted 1 line · Cheng Jiang

It makes more sense to add error propagation for

rte_ioat_completed_ops.

Quoted 30 lines
Quoted 29 lines
Quoted 19 lines
---
 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c index renamed from examples/vhost/ioat.c +0 -0

dbad28d43..60b73be93 100644

examples/vhost/ioat.c +0 -1
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 128

Quoted 1 line
examples/vhost/ioat.c +0 -0
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)

{

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +0 -1
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 +

VIRTIO_RXQ].dev_id;

examples/vhost/ioat.c ioat_transfer_data_cb(int vid, uint16_t queue_id, · line 131

Quoted 2 lines
examples/vhost/ioat.c +2 -0
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 +
+VIRTIO_RXQ].dev_id;

This change from uint16_t to int does not seem related to the purpose of this patch. Is it?

Quoted 6 lines
Quoted 1 line

Yes, this change has nothing to do with adding the log, I just noticed

uint16_t is more appropriate and changed here.

Quoted 1 line

I can only add the log if you think change the type of dev_id here is not ok.

Better to have two commits since these are two different changes. At least please mention it in the commit message.

Sure, I'll mention it in the commit message.

Thanks,
Cheng

Quoted 36 lines

Thanks,
Maxime

Quoted 31 lines

Thanks.
Cheng

Quoted 27 lines

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid,

Quoted 5 lines
examples/vhost/ioat.c +0 -0
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid,

uint16_t queue_id,

examples/vhost/ioat.c ioat_check_completed_copies_cb(int vid, · line 190

Quoted 12 lines
examples/vhost/ioat.c +5 -2
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT

device %u",

Quoted 8 lines
examples/vhost/ioat.c +4 -0
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;
#5 lore raw

PATCH v2 1/1 examples/vhost: add error propagation in ioat ops

In reply to a message not in the archive

It makes more sense to add error propagation for rte_ioat_completed_ops. And change the type of dev_id from int to uint16_t.

---
v2: mentioned dev_id type changes in git log

 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c +10 -4
index dbad28d43..60b73be93 100644
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)
 {
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT device %u",
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;

--
2.29.2

author Reviewed-by on v2 1/1
#6 lore raw
Quoted 2 lines · Cheng Jiang

It makes more sense to add error propagation for rte_ioat_completed_ops. And change the type of dev_id from int to uint16_t.

I would reword it to:

"
This patch adds add error propagation for rte_ioat_completed_ops call, and also changes dev_id type from int to uint16_t.
"

Quoted 52 lines

---
v2: mentioned dev_id type changes in git log

 examples/vhost/ioat.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
examples/vhost/ioat.c +10 -5
index dbad28d43..60b73be93 100644
@@ -22,7 +22,6 @@ struct packet_tracker {
 
 struct packet_tracker cb_tracker[MAX_VHOST_DEVICE];
 
-
 int
 open_ioat(const char *value)
 {
@@ -129,7 +128,7 @@ ioat_transfer_data_cb(int vid, uint16_t queue_id,
 		struct rte_vhost_async_status *opaque_data, uint16_t count)
 {
 	uint32_t i_desc;
-	int dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;
+	uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id;
 	struct rte_vhost_iov_iter *src = NULL;
 	struct rte_vhost_iov_iter *dst = NULL;
 	unsigned long i_seg;
@@ -182,10 +181,17 @@ ioat_check_completed_copies_cb(int vid, uint16_t queue_id,
 		unsigned short mask = MAX_ENQUEUED_SIZE - 1;
 		unsigned short i;
 
-		int dev_id = dma_bind[vid].dmas[queue_id * 2
+		uint16_t dev_id = dma_bind[vid].dmas[queue_id * 2
 				+ VIRTIO_RXQ].dev_id;
 		n_seg = rte_ioat_completed_ops(dev_id, 255, dump, dump);
-		if (n_seg <= 0)
+		if (n_seg < 0) {
+			RTE_LOG(ERR,
+				VHOST_DATA,
+				"fail to poll completed buf on IOAT device %u",
+				dev_id);
+			return 0;
+		}
+		if (n_seg == 0)
 			return 0;
 
 		cb_tracker[dev_id].ioat_space += n_seg;
--

2.29.2

author Applied
#7 lore raw
In reply to Cheng Jiang
Quoted 5 lines · Cheng Jiang

|It makes more sense to add error propagation for rte_ioat_completed_ops. And change the type of dev_id from int to uint16_t. Signed-off-by: Cheng Jiang <[email protected]> --- v2:
mentioned dev_id type changes in git log examples/vhost/ioat.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)|

Applied to dpdk-next-virtio/main with commit message fixed.

Thanks,
Maxime