Skip to contentSkip to conversation

net/iavf: fix vector mapping with queue

PATCH Superseded Jingjing Wu 3 participants 5 messages Jan 28, 2021 – Jan 29, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: fix vector mapping with queue

Fix the vector mapping with queue by changing the recircle when exceeds RX_VEC_START + nb_msix;

Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
---
 drivers/net/iavf/iavf_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_ethdev.c +2 -2
index cf6ea0b15..eb800771d 100644
@@ -612,7 +612,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
 			/* If Rx interrupt is reuquired, and we can use
 			 * multi interrupts, then the vec is from 1
 			 */
-			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors,
+			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors - 1,
 					      intr_handle->nb_efd);
 			vf->msix_base = IAVF_RX_VEC_START;
 			vec = IAVF_RX_VEC_START;
@@ -620,7 +620,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
 				qv_map[i].queue_id = i;
 				qv_map[i].vector_id = vec;
 				intr_handle->intr_vec[i] = vec++;
-				if (vec >= vf->nb_msix)
+				if (vec >= vf->nb_msix + IAVF_RX_VEC_START)
 					vec = IAVF_RX_VEC_START;
 			}
 			vf->qv_map = qv_map;
Signature · 1 line
2.21.1
Acked-by on v1 1/1
#1 lore raw
Quoted 43 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, January 28, 2021 10:37 AM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Subject: [PATCH] net/iavf: fix vector mapping with queue

Fix the vector mapping with queue by changing the recircle when exceeds RX_VEC_START + nb_msix;

Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
---
 drivers/net/iavf/iavf_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_ethdev.c +1 -1
index cf6ea0b15..eb800771d 100644
@@ -612,7 +612,7 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 			/* If Rx interrupt is reuquired, and we can use
 			 * multi interrupts, then the vec is from 1
 			 */
-			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors,
+			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors - 1,
 					      intr_handle->nb_efd);
 			vf->msix_base = IAVF_RX_VEC_START;
drivers/net/iavf/iavf_ethdev.c +1 -1
 			vec = IAVF_RX_VEC_START;
@@ -620,7 +620,7 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 				qv_map[i].queue_id = i;
 				qv_map[i].vector_id = vec;
 				intr_handle->intr_vec[i] = vec++;
-				if (vec >= vf->nb_msix)
+				if (vec >= vf->nb_msix + IAVF_RX_VEC_START)
 					vec = IAVF_RX_VEC_START;
 			}
Quoted 3 lines

vf->qv_map = qv_map;
--
2.21.1

#2 lore raw
Quoted 49 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Xing, Beilei
Sent: Thursday, January 28, 2021 11:32 AM
To: Wu, Jingjing <[email protected]>; [email protected]
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH] net/iavf: fix vector mapping with queue

Quoted 38 lines

-----Original Message-----
From: Wu, Jingjing <[email protected]>
Sent: Thursday, January 28, 2021 10:37 AM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Subject: [PATCH] net/iavf: fix vector mapping with queue

Fix the vector mapping with queue by changing the recircle when exceeds RX_VEC_START + nb_msix;

Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")
---
 drivers/net/iavf/iavf_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/iavf/iavf_ethdev.c index cf6ea0b15..eb800771d 100644

drivers/net/iavf/iavf_ethdev.c +1 -1
@@ -612,7 +612,7 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 			/* If Rx interrupt is reuquired, and we can use
 			 * multi interrupts, then the vec is from 1
 			 */
-			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors,
+			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors - 1,
 					      intr_handle->nb_efd);
 			vf->msix_base = IAVF_RX_VEC_START;
drivers/net/iavf/iavf_ethdev.c +0 -1
 			vec = IAVF_RX_VEC_START;
@@ -620,7 +620,7 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 				qv_map[i].queue_id = i;
 				qv_map[i].vector_id = vec;
 				intr_handle->intr_vec[i] = vec++;
-				if (vec >= vf->nb_msix)
Quoted 8 lines
Quoted 6 lines
drivers/net/iavf/iavf_ethdev.c +1 -0
+				if (vec >= vf->nb_msix + IAVF_RX_VEC_START)
 					vec = IAVF_RX_VEC_START;
 			}

vf->qv_map = qv_map;
--
2.21.1

The patch has some compile warning need to be fixed.

[1/23] Compiling C object drivers/libtmp_rte_net_iavf.a.p/net_iavf_iavf_ethdev.c.o In file included from ../lib/librte_eal/x86/include/rte_byteorder.h:13,

                 from ../drivers/net/iavf/iavf_ethdev.c:13:

../drivers/net/iavf/iavf_ethdev.c: In function 'iavf_config_rx_queues_irqs':
../lib/librte_eal/include/rte_common.h:577:6: warning: comparison of integer expressions of different signedness: 'int' and 'uint32_t' {aka 'unsigned int'} [-Wsign-compare]
577 | _a < _b ? _a : _b; \
| ^
../drivers/net/iavf/iavf_ethdev.c:613:18: note: in expansion of macro 'RTE_MIN'
613 | vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors - 1,

      |                  ^~~~~~~

../lib/librte_eal/include/rte_common.h:577:13: warning: operand of '?:' changes signedness from 'int' to 'uint32_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
577 | _a < _b ? _a : _b; \
| ^~
../drivers/net/iavf/iavf_ethdev.c:613:18: note: in expansion of macro 'RTE_MIN'
613 | vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors - 1,

      |                  ^~~~~~~

[23/23] Linking target app/dpdk-test-regex

Regards
Qi

#3 lore raw

PATCH v2 1/1 net/iavf: fix vector mapping with queue

In reply to Jingjing Wu

Fix the vector mapping with queue by changing the recircle when exceeds RX_VEC_START + nb_msix;

Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")

---
v2:
- fix compile warning.

 drivers/net/iavf/iavf_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/iavf/iavf_ethdev.c +3 -3
index cf6ea0b15..744904e6e 100644
@@ -612,15 +612,15 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev,
 			/* If Rx interrupt is reuquired, and we can use
 			 * multi interrupts, then the vec is from 1
 			 */
-			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors,
-					      intr_handle->nb_efd);
+			vf->nb_msix = RTE_MIN(intr_handle->nb_efd,
+				 (uint16_t)(vf->vf_res->max_vectors - 1));
 			vf->msix_base = IAVF_RX_VEC_START;
 			vec = IAVF_RX_VEC_START;
 			for (i = 0; i < dev->data->nb_rx_queues; i++) {
 				qv_map[i].queue_id = i;
 				qv_map[i].vector_id = vec;
 				intr_handle->intr_vec[i] = vec++;
-				if (vec >= vf->nb_msix)
+				if (vec >= vf->nb_msix + IAVF_RX_VEC_START)
 					vec = IAVF_RX_VEC_START;
 			}
 			vf->qv_map = qv_map;
Signature · 1 line
2.21.1
Applied
#4 lore raw
Quoted 46 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Jingjing Wu
Sent: Thursday, January 28, 2021 11:00 PM
To: [email protected]
Cc: Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v2] net/iavf: fix vector mapping with queue

Fix the vector mapping with queue by changing the recircle when exceeds RX_VEC_START + nb_msix;

Fixes d6bde6b5eae9 ("net/avf: enable Rx interrupt")

---
v2:
- fix compile warning.

 drivers/net/iavf/iavf_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/iavf/iavf_ethdev.c index renamed from drivers/net/iavf/iavf_ethdev.c +0 -0

cf6ea0b15..744904e6e 100644

drivers/net/iavf/iavf_ethdev.c +3 -3
@@ -612,15 +612,15 @@ static int iavf_config_rx_queues_irqs(struct
 rte_eth_dev *dev,
 			/* If Rx interrupt is reuquired, and we can use
 			 * multi interrupts, then the vec is from 1
 			 */
-			vf->nb_msix = RTE_MIN(vf->vf_res->max_vectors,
-					      intr_handle->nb_efd);
+			vf->nb_msix = RTE_MIN(intr_handle->nb_efd,
+				 (uint16_t)(vf->vf_res->max_vectors - 1));
 			vf->msix_base = IAVF_RX_VEC_START;
 			vec = IAVF_RX_VEC_START;
 			for (i = 0; i < dev->data->nb_rx_queues; i++) {
 				qv_map[i].queue_id = i;
 				qv_map[i].vector_id = vec;
 				intr_handle->intr_vec[i] = vec++;
-				if (vec >= vf->nb_msix)
+				if (vec >= vf->nb_msix + IAVF_RX_VEC_START)
 					vec = IAVF_RX_VEC_START;
 			}
Quoted 3 lines

vf->qv_map = qv_map;
--
2.21.1

Applied to dpdk-next-net-intel.

Thanks
Qi