net/netvsc: set the correct queue state

Message ID 1688755996-25172-2-git-send-email-longli@linuxonhyperv.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/netvsc: set the correct queue state |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-x86_64-compile-testing fail Testing issues
ci/intel-Testing success Testing PASS
ci/iol-abi-testing warning Testing issues
ci/github-robot: build success github build: passed
ci/iol-aarch-unit-testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-unit-testing fail Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Long Li July 7, 2023, 6:53 p.m. UTC
  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(-)
  

Comments

Stephen Hemminger July 7, 2023, 8:16 p.m. UTC | #1
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
  
Long Li July 7, 2023, 8:43 p.m. UTC | #2
> 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.
  
Stephen Hemminger July 8, 2023, 1:52 a.m. UTC | #3
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.
  
Ferruh Yigit July 10, 2023, 8:34 a.m. UTC | #4
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.
  

Patch

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