[v3,5/5] ethdev: fix dev state when stop

Message ID 20220503100217.46203-6-humin29@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series bugfix for bonding |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing warning Testing issues
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

humin (Q) May 3, 2022, 10:02 a.m. UTC
  Currently, 'dev_started' is always set to be 0 when dev stop, whether
it succeeded or failed. This is unreasonable and this patch fixed it.

Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
Cc: stable@dpdk.org

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 lib/ethdev/rte_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit May 25, 2022, 5:44 p.m. UTC | #1
On 5/3/2022 11:02 AM, Min Hu (Connor) wrote:
> Currently, 'dev_started' is always set to be 0 when dev stop, whether
> it succeeded or failed. This is unreasonable and this patch fixed it.
> 
> Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> ---
>   lib/ethdev/rte_ethdev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> index 29a3d80466..e0011372aa 100644
> --- a/lib/ethdev/rte_ethdev.c
> +++ b/lib/ethdev/rte_ethdev.c
> @@ -1533,8 +1533,9 @@ rte_eth_dev_stop(uint16_t port_id)
>   	/* point fast-path functions to dummy ones */
>   	eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
>   
> -	dev->data->dev_started = 0;
>   	ret = (*dev->dev_ops->dev_stop)(dev);
> +	if (ret == 0)
> +		dev->data->dev_started = 0;
>   	rte_ethdev_trace_stop(port_id, ret);
>   
>   	return ret;

Change looks good to me, I checked for possible unexpected side effect 
but I did not see any.

@Andrew, @Thomas, if you also don't see/remember any issue related 
change, I will push it soon.
  
Thomas Monjalon May 26, 2022, 10:21 a.m. UTC | #2
25/05/2022 19:44, Ferruh Yigit:
> On 5/3/2022 11:02 AM, Min Hu (Connor) wrote:
> > Currently, 'dev_started' is always set to be 0 when dev stop, whether
> > it succeeded or failed. This is unreasonable and this patch fixed it.
> > 
> > Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
> > ---
> >   lib/ethdev/rte_ethdev.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
> > index 29a3d80466..e0011372aa 100644
> > --- a/lib/ethdev/rte_ethdev.c
> > +++ b/lib/ethdev/rte_ethdev.c
> > @@ -1533,8 +1533,9 @@ rte_eth_dev_stop(uint16_t port_id)
> >   	/* point fast-path functions to dummy ones */
> >   	eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
> >   
> > -	dev->data->dev_started = 0;
> >   	ret = (*dev->dev_ops->dev_stop)(dev);
> > +	if (ret == 0)
> > +		dev->data->dev_started = 0;
> >   	rte_ethdev_trace_stop(port_id, ret);
> >   
> >   	return ret;
> 
> Change looks good to me, I checked for possible unexpected side effect 
> but I did not see any.
> 
> @Andrew, @Thomas, if you also don't see/remember any issue related 
> change, I will push it soon.

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  
Ferruh Yigit May 30, 2022, 12:04 p.m. UTC | #3
On 5/26/2022 11:21 AM, Thomas Monjalon wrote:
> [CAUTION: External Email]
> 
> 25/05/2022 19:44, Ferruh Yigit:
>> On 5/3/2022 11:02 AM, Min Hu (Connor) wrote:
>>> Currently, 'dev_started' is always set to be 0 when dev stop, whether
>>> it succeeded or failed. This is unreasonable and this patch fixed it.
>>>
>>> Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
>>> ---
>>>    lib/ethdev/rte_ethdev.c | 3 ++-
>>>    1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
>>> index 29a3d80466..e0011372aa 100644
>>> --- a/lib/ethdev/rte_ethdev.c
>>> +++ b/lib/ethdev/rte_ethdev.c
>>> @@ -1533,8 +1533,9 @@ rte_eth_dev_stop(uint16_t port_id)
>>>      /* point fast-path functions to dummy ones */
>>>      eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
>>>
>>> -   dev->data->dev_started = 0;
>>>      ret = (*dev->dev_ops->dev_stop)(dev);
>>> +   if (ret == 0)
>>> +           dev->data->dev_started = 0;
>>>      rte_ethdev_trace_stop(port_id, ret);
>>>
>>>      return ret;
>>
>> Change looks good to me, I checked for possible unexpected side effect
>> but I did not see any.
>>
>> @Andrew, @Thomas, if you also don't see/remember any issue related
>> change, I will push it soon.
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> 

Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>

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

Patch

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 29a3d80466..e0011372aa 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1533,8 +1533,9 @@  rte_eth_dev_stop(uint16_t port_id)
 	/* point fast-path functions to dummy ones */
 	eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id);
 
-	dev->data->dev_started = 0;
 	ret = (*dev->dev_ops->dev_stop)(dev);
+	if (ret == 0)
+		dev->data->dev_started = 0;
 	rte_ethdev_trace_stop(port_id, ret);
 
 	return ret;