net/bonding: fix flow flush order on bonded device close

Message ID 20220911122221.3993511-1-ivan.malov@oktetlabs.ru (mailing list archive)
State Superseded, archived
Delegated to: Andrew Rybchenko
Headers
Series net/bonding: fix flow flush order on bonded device close |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Ivan Malov Sept. 11, 2022, 12:22 p.m. UTC
  The current code first removes all back-end devices of
the bonded device and then invokes flush operation to
remove flows in such back-end devices, which makes no
sense. Fix that by re-ordering the steps accordingly.

Fixes: 49dad9028e2a ("net/bonding: support flow API")
Cc: stable@dpdk.org

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Andrew Rybchenko Oct. 17, 2022, 8:41 a.m. UTC | #1
Chas, Cornor, could you review the patch, please.

Thanks,
Andrew.

On 9/11/22 15:22, Ivan Malov wrote:
> The current code first removes all back-end devices of
> the bonded device and then invokes flush operation to
> remove flows in such back-end devices, which makes no
> sense. Fix that by re-ordering the steps accordingly.
> 
> Fixes: 49dad9028e2a ("net/bonding: support flow API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> ---
>   drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index a5429f5e97..d01c954296 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -2155,6 +2155,10 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>   		return 0;
>   
>   	RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
> +
> +	/* Flush flows in all back-end devices before removing them */
> +	bond_flow_ops.flush(dev, &ferror);
> +
>   	while (internals->slave_count != skipped) {
>   		uint16_t port_id = internals->slaves[skipped].port_id;
>   
> @@ -2172,7 +2176,6 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>   			skipped++;
>   		}
>   	}
> -	bond_flow_ops.flush(dev, &ferror);
>   	bond_ethdev_free_queues(dev);
>   	rte_bitmap_reset(internals->vlan_filter_bmp);
>   	rte_bitmap_free(internals->vlan_filter_bmp);
  
Chas Williams Oct. 17, 2022, 12:34 p.m. UTC | #2
This appears to be correct, but it needs to be coordinated with the
proposed changes in net/bonding: make bonded device configure method re-entrant


On 10/17/22 04:41, Andrew Rybchenko wrote:
> Chas, Cornor, could you review the patch, please.
> 
> Thanks,
> Andrew.
> 
> On 9/11/22 15:22, Ivan Malov wrote:
>> The current code first removes all back-end devices of
>> the bonded device and then invokes flush operation to
>> remove flows in such back-end devices, which makes no
>> sense. Fix that by re-ordering the steps accordingly.
>>
>> Fixes: 49dad9028e2a ("net/bonding: support flow API")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>> ---
>>   drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++++-
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>> index a5429f5e97..d01c954296 100644
>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>> @@ -2155,6 +2155,10 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>           return 0;
>>       RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
>> +
>> +    /* Flush flows in all back-end devices before removing them */
>> +    bond_flow_ops.flush(dev, &ferror);
>> +
>>       while (internals->slave_count != skipped) {
>>           uint16_t port_id = internals->slaves[skipped].port_id;
>> @@ -2172,7 +2176,6 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>               skipped++;
>>           }
>>       }
>> -    bond_flow_ops.flush(dev, &ferror);
>>       bond_ethdev_free_queues(dev);
>>       rte_bitmap_reset(internals->vlan_filter_bmp);
>>       rte_bitmap_free(internals->vlan_filter_bmp);
>
  
Andrew Rybchenko Oct. 19, 2022, 10:29 a.m. UTC | #3
On 10/17/22 15:34, Chas Williams wrote:
> This appears to be correct, but it needs to be coordinated with the
> proposed changes in net/bonding: make bonded device configure method 
> re-entrant

Ivan, could you comment and send rebased v2 version anyway.

> 
> 
> On 10/17/22 04:41, Andrew Rybchenko wrote:
>> Chas, Cornor, could you review the patch, please.
>>
>> Thanks,
>> Andrew.
>>
>> On 9/11/22 15:22, Ivan Malov wrote:
>>> The current code first removes all back-end devices of
>>> the bonded device and then invokes flush operation to
>>> remove flows in such back-end devices, which makes no
>>> sense. Fix that by re-ordering the steps accordingly.
>>>
>>> Fixes: 49dad9028e2a ("net/bonding: support flow API")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>>> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>>> ---
>>>   drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++++-
>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> index a5429f5e97..d01c954296 100644
>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>>> @@ -2155,6 +2155,10 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>>           return 0;
>>>       RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
>>> +
>>> +    /* Flush flows in all back-end devices before removing them */
>>> +    bond_flow_ops.flush(dev, &ferror);
>>> +
>>>       while (internals->slave_count != skipped) {
>>>           uint16_t port_id = internals->slaves[skipped].port_id;
>>> @@ -2172,7 +2176,6 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>>               skipped++;
>>>           }
>>>       }
>>> -    bond_flow_ops.flush(dev, &ferror);
>>>       bond_ethdev_free_queues(dev);
>>>       rte_bitmap_reset(internals->vlan_filter_bmp);
>>>       rte_bitmap_free(internals->vlan_filter_bmp);
>>
  
Ivan Malov Oct. 19, 2022, 11:27 a.m. UTC | #4
Hi Chas, Andrew,

On Wed, 19 Oct 2022, Andrew Rybchenko wrote:

> On 10/17/22 15:34, Chas Williams wrote:
>> This appears to be correct, but it needs to be coordinated with the
>> proposed changes in net/bonding: make bonded device configure method 
>> re-entrant

Needs to be coordinated - in which way? Are you looking to reorder
the patches? If yes, v2 should be OK with this regard.

>
> Ivan, could you comment and send rebased v2 version anyway.

Please see 
https://patches.dpdk.org/project/dpdk/patch/20221019111805.1070381-1-ivan.malov@oktetlabs.ru/ 
.
>
>> 
>> 
>> On 10/17/22 04:41, Andrew Rybchenko wrote:
>>> Chas, Cornor, could you review the patch, please.
>>> 
>>> Thanks,
>>> Andrew.
>>> 
>>> On 9/11/22 15:22, Ivan Malov wrote:
>>>> The current code first removes all back-end devices of
>>>> the bonded device and then invokes flush operation to
>>>> remove flows in such back-end devices, which makes no
>>>> sense. Fix that by re-ordering the steps accordingly.
>>>> 
>>>> Fixes: 49dad9028e2a ("net/bonding: support flow API")
>>>> Cc: stable@dpdk.org
>>>> 
>>>> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
>>>> Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>>>> ---
>>>>   drivers/net/bonding/rte_eth_bond_pmd.c | 5 ++++-
>>>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>>> 
>>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c 
>>>> b/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> index a5429f5e97..d01c954296 100644
>>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
>>>> @@ -2155,6 +2155,10 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>>>           return 0;
>>>>       RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
>>>> +
>>>> +    /* Flush flows in all back-end devices before removing them */
>>>> +    bond_flow_ops.flush(dev, &ferror);
>>>> +
>>>>       while (internals->slave_count != skipped) {
>>>>           uint16_t port_id = internals->slaves[skipped].port_id;
>>>> @@ -2172,7 +2176,6 @@ bond_ethdev_close(struct rte_eth_dev *dev)
>>>>               skipped++;
>>>>           }
>>>>       }
>>>> -    bond_flow_ops.flush(dev, &ferror);
>>>>       bond_ethdev_free_queues(dev);
>>>>       rte_bitmap_reset(internals->vlan_filter_bmp);
>>>>       rte_bitmap_free(internals->vlan_filter_bmp);
>>> 
>
>
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index a5429f5e97..d01c954296 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -2155,6 +2155,10 @@  bond_ethdev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	RTE_BOND_LOG(INFO, "Closing bonded device %s", dev->device->name);
+
+	/* Flush flows in all back-end devices before removing them */
+	bond_flow_ops.flush(dev, &ferror);
+
 	while (internals->slave_count != skipped) {
 		uint16_t port_id = internals->slaves[skipped].port_id;
 
@@ -2172,7 +2176,6 @@  bond_ethdev_close(struct rte_eth_dev *dev)
 			skipped++;
 		}
 	}
-	bond_flow_ops.flush(dev, &ferror);
 	bond_ethdev_free_queues(dev);
 	rte_bitmap_reset(internals->vlan_filter_bmp);
 	rte_bitmap_free(internals->vlan_filter_bmp);