DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mana: set the correct queue state
@ 2023-07-07 18:53 longli
  2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
  2023-10-16 11:52 ` [PATCH] net/mana: " Ferruh Yigit
  0 siblings, 2 replies; 9+ messages in thread
From: longli @ 2023-07-07 18:53 UTC (permalink / raw)
  To: Ferruh Yigit, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

From: Long Li <longli@microsoft.com>

Set the queue state when queue is started/stopped

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/net/mana/rx.c | 15 +++++++++++++++
 drivers/net/mana/tx.c | 13 +++++++++++++
 2 files changed, 28 insertions(+)

diff --git a/drivers/net/mana/rx.c b/drivers/net/mana/rx.c
index 220b372b15..1047ac1743 100644
--- a/drivers/net/mana/rx.c
+++ b/drivers/net/mana/rx.c
@@ -131,6 +131,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev)
 	struct mana_priv *priv = dev->data->dev_private;
 	int ret, i;
 
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED)
+			return -EINVAL;
+
 	if (priv->rwq_qp) {
 		ret = ibv_destroy_qp(priv->rwq_qp);
 		if (ret)
@@ -187,7 +191,10 @@ mana_stop_rx_queues(struct rte_eth_dev *dev)
 
 		memset(&rxq->gdma_rq, 0, sizeof(rxq->gdma_rq));
 		memset(&rxq->gdma_cq, 0, sizeof(rxq->gdma_cq));
+
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
+
 	return 0;
 }
 
@@ -199,6 +206,11 @@ mana_start_rx_queues(struct rte_eth_dev *dev)
 	struct ibv_wq *ind_tbl[priv->num_queues];
 
 	DRV_LOG(INFO, "start rx queues");
+
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->rx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_rxq *rxq = dev->data->rx_queues[i];
 		struct ibv_wq_init_attr wq_attr = {};
@@ -373,6 +385,9 @@ mana_start_rx_queues(struct rte_eth_dev *dev)
 			goto fail;
 	}
 
+	for (i = 0; i < priv->num_queues; i++)
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+
 	return 0;
 
 fail:
diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c
index 5947efbe8d..eb4b60cc10 100644
--- a/drivers/net/mana/tx.c
+++ b/drivers/net/mana/tx.c
@@ -15,6 +15,10 @@ mana_stop_tx_queues(struct rte_eth_dev *dev)
 	struct mana_priv *priv = dev->data->dev_private;
 	int i, ret;
 
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STOPPED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_txq *txq = dev->data->tx_queues[i];
 
@@ -51,6 +55,8 @@ mana_stop_tx_queues(struct rte_eth_dev *dev)
 
 		memset(&txq->gdma_sq, 0, sizeof(txq->gdma_sq));
 		memset(&txq->gdma_cq, 0, sizeof(txq->gdma_cq));
+
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
 	}
 
 	return 0;
@@ -63,6 +69,11 @@ mana_start_tx_queues(struct rte_eth_dev *dev)
 	int ret, i;
 
 	/* start TX queues */
+
+	for (i = 0; i < priv->num_queues; i++)
+		if (dev->data->tx_queue_state[i] == RTE_ETH_QUEUE_STATE_STARTED)
+			return -EINVAL;
+
 	for (i = 0; i < priv->num_queues; i++) {
 		struct mana_txq *txq;
 		struct ibv_qp_init_attr qp_attr = { 0 };
@@ -142,6 +153,8 @@ mana_start_tx_queues(struct rte_eth_dev *dev)
 			txq->gdma_cq.id, txq->gdma_cq.buffer,
 			txq->gdma_cq.count, txq->gdma_cq.size,
 			txq->gdma_cq.head);
+
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
 	}
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] net/netvsc: set the correct queue state
  2023-07-07 18:53 [PATCH] net/mana: set the correct queue state longli
@ 2023-07-07 18:53 ` longli
  2023-07-07 20:16   ` Stephen Hemminger
  2023-08-29 18:29   ` [Patch v2] " longli
  2023-10-16 11:52 ` [PATCH] net/mana: " Ferruh Yigit
  1 sibling, 2 replies; 9+ messages in thread
From: longli @ 2023-07-07 18:53 UTC (permalink / raw)
  To: Ferruh Yigit, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

From: Long Li <longli@microsoft.com>

Set the queue state when queue is started/stopped.

Signed-off-by: Long Li <longli@microsoft.com>
---
 drivers/net/netvsc/hn_ethdev.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d0bbc0a4c0..0c15f9f826 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -1017,6 +1017,11 @@ hn_dev_start(struct rte_eth_dev *dev)
 	if (error == 0)
 		hn_dev_link_update(dev, 0);
 
+	for (int i = 0; i < hv->num_queues; i++) {
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+	}
+
 	return error;
 }
 
@@ -1024,13 +1029,21 @@ static int
 hn_dev_stop(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
 
 	rte_dev_event_callback_unregister(NULL, netvsc_hotadd_callback, hv);
 	hn_rndis_set_rxfilter(hv, 0);
-	return hn_vf_stop(dev);
+	ret = hn_vf_stop(dev);
+
+	for (int i = 0; i < hv->num_queues; i++) {
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+	}
+
+	return ret;
 }
 
 static int
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net/netvsc: set the correct queue state
  2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
@ 2023-07-07 20:16   ` Stephen Hemminger
  2023-07-07 20:43     ` Long Li
  2023-08-29 18:29   ` [Patch v2] " longli
  1 sibling, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2023-07-07 20:16 UTC (permalink / raw)
  To: longli; +Cc: Ferruh Yigit, Andrew Rybchenko, dev, Ajay Sharma, Long Li

On Fri,  7 Jul 2023 11:53:16 -0700
longli@linuxonhyperv.com wrote:

> From: Long Li <longli@microsoft.com>
> 
> Set the queue state when queue is started/stopped.
> 
> Signed-off-by: Long Li <longli@microsoft.com>
> ---
>  drivers/net/netvsc/hn_ethdev.c | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)

Interesting that not all drivers do this.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>

The ones not doing it.
af_packet
af_xdp
avp
axgbe
bnx2x
bonding
dpaa
dpaa2
e1000
ena
enetfec
gve
hinic
igc
ipn3ke
kni
liquidio
mana
memif
mlx4
netvsc
nfp
null
octeon_ep
pfe
ring
softnic
vdev_netvsc
vhost
virtio
vmxnet3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH] net/netvsc: set the correct queue state
  2023-07-07 20:16   ` Stephen Hemminger
@ 2023-07-07 20:43     ` Long Li
  2023-07-08  1:52       ` Stephen Hemminger
  0 siblings, 1 reply; 9+ messages in thread
From: Long Li @ 2023-07-07 20:43 UTC (permalink / raw)
  To: Stephen Hemminger, longli
  Cc: Ferruh Yigit, Andrew Rybchenko, dev, Ajay Sharma

> Subject: Re: [PATCH] net/netvsc: set the correct queue state
> 
> On Fri,  7 Jul 2023 11:53:16 -0700
> longli@linuxonhyperv.com wrote:
> 
> > From: Long Li <longli@microsoft.com>
> >
> > Set the queue state when queue is started/stopped.
> >
> > Signed-off-by: Long Li <longli@microsoft.com>
> > ---
> >  drivers/net/netvsc/hn_ethdev.c | 15 ++++++++++++++-
> >  1 file changed, 14 insertions(+), 1 deletion(-)
> 
> Interesting that not all drivers do this.
> 
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> 
> The ones not doing it.
> af_packet
> af_xdp
> avp
> axgbe
> bnx2x
> bonding
> dpaa
> dpaa2
> e1000
> ena
> enetfec
> gve
> hinic
> igc
> ipn3ke
> kni
> liquidio
> mana
> memif
> mlx4
> netvsc
> nfp
> null
> octeon_ep
> pfe
> ring
> softnic
> vdev_netvsc
> vhost
> virtio
> vmxnet3

Testpmd added the check for stopped queues:
3c4426db54 app/testpmd: do not poll stopped queues

To pass testpmd, PMD needs to set queue state.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net/netvsc: set the correct queue state
  2023-07-07 20:43     ` Long Li
@ 2023-07-08  1:52       ` Stephen Hemminger
  2023-07-10  8:34         ` Ferruh Yigit
  0 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2023-07-08  1:52 UTC (permalink / raw)
  To: Long Li; +Cc: longli, Ferruh Yigit, Andrew Rybchenko, dev, Ajay Sharma

On Fri, 7 Jul 2023 20:43:51 +0000
Long Li <longli@microsoft.com> wrote:

> > Subject: Re: [PATCH] net/netvsc: set the correct queue state
> > 
> > On Fri,  7 Jul 2023 11:53:16 -0700
> > longli@linuxonhyperv.com wrote:
> >   
> > > From: Long Li <longli@microsoft.com>
> > >
> > > Set the queue state when queue is started/stopped.
> > >
> > > Signed-off-by: Long Li <longli@microsoft.com>
> > > ---
> > >  drivers/net/netvsc/hn_ethdev.c | 15 ++++++++++++++-
> > >  1 file changed, 14 insertions(+), 1 deletion(-)  
> > 
> > Interesting that not all drivers do this.
> > 
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> > 
> > The ones not doing it.
> > af_packet
> > af_xdp
> > avp
> > axgbe
> > bnx2x
> > bonding
> > dpaa
> > dpaa2
> > e1000
> > ena
> > enetfec
> > gve
> > hinic
> > igc
> > ipn3ke
> > kni
> > liquidio
> > mana
> > memif
> > mlx4
> > netvsc
> > nfp
> > null
> > octeon_ep
> > pfe
> > ring
> > softnic
> > vdev_netvsc
> > vhost
> > virtio
> > vmxnet3  
> 
> Testpmd added the check for stopped queues:
> 3c4426db54 app/testpmd: do not poll stopped queues
> 
> To pass testpmd, PMD needs to set queue state.

So there are 20 drivers broken by that change!
Sounds like it needs to be reverted.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net/netvsc: set the correct queue state
  2023-07-08  1:52       ` Stephen Hemminger
@ 2023-07-10  8:34         ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2023-07-10  8:34 UTC (permalink / raw)
  To: Stephen Hemminger, Long Li
  Cc: longli, Ferruh Yigit, Andrew Rybchenko, dev, Ajay Sharma

On 7/8/2023 2:52 AM, Stephen Hemminger wrote:
> On Fri, 7 Jul 2023 20:43:51 +0000
> Long Li <longli@microsoft.com> wrote:
> 
>>> Subject: Re: [PATCH] net/netvsc: set the correct queue state
>>>
>>> On Fri,  7 Jul 2023 11:53:16 -0700
>>> longli@linuxonhyperv.com wrote:
>>>   
>>>> From: Long Li <longli@microsoft.com>
>>>>
>>>> Set the queue state when queue is started/stopped.
>>>>
>>>> Signed-off-by: Long Li <longli@microsoft.com>
>>>> ---
>>>>  drivers/net/netvsc/hn_ethdev.c | 15 ++++++++++++++-
>>>>  1 file changed, 14 insertions(+), 1 deletion(-)  
>>>
>>> Interesting that not all drivers do this.
>>>
>>> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>>>
>>> The ones not doing it.
>>> af_packet
>>> af_xdp
>>> avp
>>> axgbe
>>> bnx2x
>>> bonding
>>> dpaa
>>> dpaa2
>>> e1000
>>> ena
>>> enetfec
>>> gve
>>> hinic
>>> igc
>>> ipn3ke
>>> kni
>>> liquidio
>>> mana
>>> memif
>>> mlx4
>>> netvsc
>>> nfp
>>> null
>>> octeon_ep
>>> pfe
>>> ring
>>> softnic
>>> vdev_netvsc
>>> vhost
>>> virtio
>>> vmxnet3  
>>
>> Testpmd added the check for stopped queues:
>> 3c4426db54 app/testpmd: do not poll stopped queues
>>
>> To pass testpmd, PMD needs to set queue state.
> 
> So there are 20 drivers broken by that change!
> Sounds like it needs to be reverted.
>

testpmd change is already reverted in the next-net, but planned to merge
it back in next release, and we need driver changes in next release.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Patch v2] net/netvsc: set the correct queue state
  2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
  2023-07-07 20:16   ` Stephen Hemminger
@ 2023-08-29 18:29   ` longli
  2023-10-16 12:02     ` Ferruh Yigit
  1 sibling, 1 reply; 9+ messages in thread
From: longli @ 2023-08-29 18:29 UTC (permalink / raw)
  To: Ferruh Yigit, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

From: Long Li <longli@microsoft.com>

Set the queue state when queue is started/stopped.

Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
Change since v1:
Fixed the following building error
error: 'for' loop initial declarations are only allowed in C99 mode

 drivers/net/netvsc/hn_ethdev.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d0bbc0a4c0..a6a51088b8 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -990,7 +990,7 @@ static int
 hn_dev_start(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
-	int error;
+	int i, error;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1017,6 +1017,11 @@ hn_dev_start(struct rte_eth_dev *dev)
 	if (error == 0)
 		hn_dev_link_update(dev, 0);
 
+	for (i = 0; i < hv->num_queues; i++) {
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
+	}
+
 	return error;
 }
 
@@ -1024,13 +1029,21 @@ static int
 hn_dev_stop(struct rte_eth_dev *dev)
 {
 	struct hn_data *hv = dev->data->dev_private;
+	int i, ret;
 
 	PMD_INIT_FUNC_TRACE();
 	dev->data->dev_started = 0;
 
 	rte_dev_event_callback_unregister(NULL, netvsc_hotadd_callback, hv);
 	hn_rndis_set_rxfilter(hv, 0);
-	return hn_vf_stop(dev);
+	ret = hn_vf_stop(dev);
+
+	for (i = 0; i < hv->num_queues; i++) {
+		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STOPPED;
+	}
+
+	return ret;
 }
 
 static int
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] net/mana: set the correct queue state
  2023-07-07 18:53 [PATCH] net/mana: set the correct queue state longli
  2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
@ 2023-10-16 11:52 ` Ferruh Yigit
  1 sibling, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2023-10-16 11:52 UTC (permalink / raw)
  To: longli, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

On 7/7/2023 7:53 PM, longli@linuxonhyperv.com wrote:
> From: Long Li <longli@microsoft.com>
> 
> Set the queue state when queue is started/stopped
> 
> Signed-off-by: Long Li <longli@microsoft.com>
> 

Applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Patch v2] net/netvsc: set the correct queue state
  2023-08-29 18:29   ` [Patch v2] " longli
@ 2023-10-16 12:02     ` Ferruh Yigit
  0 siblings, 0 replies; 9+ messages in thread
From: Ferruh Yigit @ 2023-10-16 12:02 UTC (permalink / raw)
  To: longli, Andrew Rybchenko; +Cc: dev, Ajay Sharma, Long Li

On 8/29/2023 7:29 PM, longli@linuxonhyperv.com wrote:
> From: Long Li <longli@microsoft.com>
> 
> Set the queue state when queue is started/stopped.
> 
> Signed-off-by: Long Li <longli@microsoft.com>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> 

Applied to dpdk-next-net/main, thanks.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-10-16 12:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-07 18:53 [PATCH] net/mana: set the correct queue state longli
2023-07-07 18:53 ` [PATCH] net/netvsc: " longli
2023-07-07 20:16   ` Stephen Hemminger
2023-07-07 20:43     ` Long Li
2023-07-08  1:52       ` Stephen Hemminger
2023-07-10  8:34         ` Ferruh Yigit
2023-08-29 18:29   ` [Patch v2] " longli
2023-10-16 12:02     ` Ferruh Yigit
2023-10-16 11:52 ` [PATCH] net/mana: " Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).