Skip to contentSkip to conversation

net/i40e: fix FDIR check programming status error

PATCH Superseded Wei Zhao 2 participants 8 messages Jul 11, 2018 – Jul 13, 2018 Network drivers

lore
Share & tools
lore

Wei Zhao

author
#0 lore raw

PATCH 1/1 net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return 0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")
---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c +2 -1
index d41601a..b958bf6 100644
@@ -1315,7 +1315,7 @@ i40e_check_fdir_programming_status(struct i40e_rx_queue *rxq)
 	uint32_t rx_status;
 	uint32_t len, id;
 	uint32_t error;
-	int ret = 0;
+	int ret = -1;
 
 	rxdp = &rxq->rx_ring[rxq->rx_tail];
 	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
@@ -1360,6 +1360,7 @@ i40e_check_fdir_programming_status(struct i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+		ret = 0;
 	}
 
 	return ret;
Signature · 1 line
2.7.5
#1 lore raw
Quoted 38 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, July 11, 2018 4:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return
0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")
---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c index renamed from drivers/net/i40e/i40e_fdir.c +0 -0

d41601a..b958bf6 100644

drivers/net/i40e/i40e_fdir.c +1 -1
@@ -1315,7 +1315,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 	uint32_t rx_status;
 	uint32_t len, id;
 	uint32_t error;
-	int ret = 0;
+	int ret = -1;
 
 	rxdp = &rxq->rx_ring[rxq->rx_tail];
drivers/net/i40e/i40e_fdir.c +0 -0
 	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);

drivers/net/i40e/i40e_fdir.c i40e_check_fdir_programming_status(struct · line 1364

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -1360,6 +1360,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+		ret = 0;

Is it possible to overwrite previous ret = -1 which is not what we want?

I would prefer

int ret = 0;

If (dd bit is set) {

	If xxx
		Ret = -1;
	If xxx 
		Ret = -1;
} else {
	ret = -1;
}

return ret;

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	}
 

return ret;
--
2.7.5

author
#2 lore raw

This code change is ok also, but it seems need to add more Judging branch? IF you think it is almost the same, I WILL commit a new v2.

Quoted 75 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, July 13, 2018 11:06 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

Quoted 37 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, July 11, 2018 4:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return 0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")
---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
d41601a..b958bf6 100644

drivers/net/i40e/i40e_fdir.c +1 -1
@@ -1315,7 +1315,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 	uint32_t rx_status;
 	uint32_t len, id;
 	uint32_t error;
-	int ret = 0;
+	int ret = -1;
 
 	rxdp = &rxq->rx_ring[rxq->rx_tail];
drivers/net/i40e/i40e_fdir.c +0 -0
 	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);

drivers/net/i40e/i40e_fdir.c i40e_check_fdir_programming_status(struct · line 1365

Quoted 6 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -1360,6 +1360,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq-
 nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+		ret = 0;

Is it possible to overwrite previous ret = -1 which is not what we want?

I would prefer

int ret = 0;

If (dd bit is set) {

	If xxx
		Ret = -1;
	If xxx
		Ret = -1;
} else {
	ret = -1;
}

return ret;

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	}

return ret;
--
2.7.5

#3 lore raw
Quoted 10 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, July 13, 2018 11:12 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

This code change is ok also,

I don't think so, with your change, it will always return 0 if DD bit is set, but we still need to return -1 if there is any error in descriptor, right?

but it seems need to add more Judging branch?

Quoted 77 lines

IF you think it is almost the same, I WILL commit a new v2.

Quoted 74 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, July 13, 2018 11:06 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

Quoted 37 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, July 11, 2018 4:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return 0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")
---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
d41601a..b958bf6 100644

drivers/net/i40e/i40e_fdir.c +1 -1
@@ -1315,7 +1315,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 	uint32_t rx_status;
 	uint32_t len, id;
 	uint32_t error;
-	int ret = 0;
+	int ret = -1;
 
 	rxdp = &rxq->rx_ring[rxq->rx_tail];
drivers/net/i40e/i40e_fdir.c +0 -0
 	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);

drivers/net/i40e/i40e_fdir.c i40e_check_fdir_programming_status(struct · line 1364

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +1 -0
@@ -1360,6 +1360,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq- nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+		ret = 0;

Is it possible to overwrite previous ret = -1 which is not what we want?

I would prefer

int ret = 0;

If (dd bit is set) {

	If xxx
		Ret = -1;
	If xxx
		Ret = -1;
} else {
	ret = -1;
}

return ret;

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	}
 

return ret;
--
2.7.5

author
#4 lore raw
Quoted 18 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, July 13, 2018 11:16 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

Quoted 7 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, July 13, 2018 11:12 AM
To: Zhang, Qi Z <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

Quoted 4 lines
Quoted 1 line

This code change is ok also,

I don't think so, with your change, it will always return 0 if DD bit is set, but we still need to return -1 if there is any error in descriptor, right?

Yes, you are right!
I will commit v2!!
I find a bug but give out an error fix patch, orz....

Quoted 82 lines

but it seems need to add more Judging branch?

Quoted 48 lines

IF you think it is almost the same, I WILL commit a new v2.

Quoted 45 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Friday, July 13, 2018 11:06 AM
To: Zhao1, Wei <[email protected]>; [email protected]
Cc: [email protected]
Subject: RE: [PATCH] net/i40e: fix FDIR check programming status error

Quoted 35 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Wednesday, July 11, 2018 4:25 PM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Zhao1, Wei <[email protected]>
Subject: [PATCH] net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return
0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")
---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_fdir.c index
d41601a..b958bf6 100644

drivers/net/i40e/i40e_fdir.c +1 -1
@@ -1315,7 +1315,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 	uint32_t rx_status;
 	uint32_t len, id;
 	uint32_t error;
-	int ret = 0;
+	int ret = -1;
 
Quoted 5 lines
Quoted 5 lines

drivers/net/i40e/i40e_fdir.c i40e_check_fdir_programming_status(struct · line 1361

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	rxdp = &rxq->rx_ring[rxq->rx_tail];
drivers/net/i40e/i40e_fdir.c +0 -0
 	qword1 = rte_le_to_cpu_64(rxdp->wb.qword1.status_error_len);
@@ -1360,6 +1360,7 @@ i40e_check_fdir_programming_status(struct
 i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq- nb_rx_desc

- 1);

Quoted 26 lines
Quoted 26 lines

drivers/net/i40e/i40e_fdir.c i40e_check_fdir_programming_status(struct i40e_rx_queue *rxq) · line 1363

Quoted 3 lines
drivers/net/i40e/i40e_fdir.c +1 -0
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+		ret = 0;

Is it possible to overwrite previous ret = -1 which is not what we want?

I would prefer

int ret = 0;

If (dd bit is set) {

	If xxx
		Ret = -1;
	If xxx
		Ret = -1;
} else {
	ret = -1;
}

return ret;

Quoted 5 lines
drivers/net/i40e/i40e_fdir.c +0 -0
 	}
 

return ret;
--
2.7.5

author
#5 lore raw

PATCH v2 1/1 net/i40e: fix FDIR check programming status error

In reply to Wei Zhao

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return 0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")

---

v2:
-fix patch error in ret value set.

---
 drivers/net/i40e/i40e_fdir.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/i40e/i40e_fdir.c +2 -1
index d41601a..a4c8722 100644
@@ -1360,7 +1360,8 @@ i40e_check_fdir_programming_status(struct i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
-	}
+	} else
+		ret = -1;
 
 	return ret;
 }
Signature · 1 line
2.7.5
author
#6 lore raw

PATCH v3 1/1 net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return 0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Fixes 05999aab4ca6 ("i40e: add or delete flow director")

---

v2:
-fix patch error in ret value set.

v3:
-fix patch check warning.

---
 drivers/net/i40e/i40e_fdir.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/i40e/i40e_fdir.c +2 -0
index d41601a..2b299c7 100644
@@ -1360,6 +1360,8 @@ i40e_check_fdir_programming_status(struct i40e_rx_queue *rxq)
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1);
 		else
 			I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_tail - 1);
+	} else {
+		ret = -1;
 	}
 
 	return ret;
Signature · 1 line
2.7.5
Acked-by on v3 1/1 Applied
#7 lore raw
Quoted 17 lines

-----Original Message-----
From: Zhao1, Wei
Sent: Friday, July 13, 2018 11:17 AM
To: [email protected]
Cc: Zhang, Qi Z <[email protected]>; [email protected]; Zhao1, Wei <[email protected]>
Subject: [PATCH v3] net/i40e: fix FDIR check programming status error

In i40e FDIR PMD code for checking programming status function i40e_check_fdir_programming_status(), the initial value of return value ret should be set to -1 not 0, because if DD bit of I40E_RX_DESC_STATUS_DD is not write back, this function will return
0 to upper function, this give an error info to upper function, the fact for this is it is time out for DD write back and it should return -1.

Quoted 2 lines
Fixes 05999aab4ca6 ("i40e: add or delete flow director")

Applied to dpdk-next-net-intel.

Thanks!
Qi