On 7/13/22 10:14, Roi Dayan wrote:
> 
> 
> On 2022-07-04 4:46 PM, Roi Dayan wrote:
>>
>>
>> On 2022-06-30 11:34 AM, Tao Liu wrote:
>>> When netdev first opened by netdev_open(..., NULL, ...), netdev_class sets
>>> to system by default, and auto_classified sets to true.
>>>
>>> If netdev reopens by netdev_open(..., "system", ...), auto_classified
>>> should be cleared. This will be used in next patch to fix lag issue.
>>>
>>> Fixes: 8c2c225e481d ("netdev: Fix netdev_open() to track and recreate 
>>> classless interfaces")
>>> Signed-off-by: Tao Liu <thomas....@ucloud.cn>
>>> ---
>>>   lib/netdev.c | 41 +++++++++++++++++++++++------------------
>>>   1 file changed, 23 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/lib/netdev.c b/lib/netdev.c
>>> index 8305f6c..b97408b 100644
>>> --- a/lib/netdev.c
>>> +++ b/lib/netdev.c
>>> @@ -387,25 +387,30 @@ netdev_open(const char *name, const char *type, 
>>> struct netdev **netdevp)
>>>       ovs_mutex_lock(&netdev_mutex);
>>>       netdev = shash_find_data(&netdev_shash, name);
>>> -    if (netdev &&
>>> -        type && type[0] && strcmp(type, netdev->netdev_class->type)) {
>>> -
>>> -        if (netdev->auto_classified) {
>>> -            /* If this device was first created without a classification 
>>> type,
>>> -             * for example due to routing or tunneling code, and they keep 
>>> a
>>> -             * reference, a "classified" call to open will fail. In this 
>>> case
>>> -             * we remove the classless device, and re-add it below. We 
>>> remove
>>> -             * the netdev from the shash, and change the sequence, so 
>>> owners of
>>> -             * the old classless device can release/cleanup. */
>>> -            if (netdev->node) {
>>> -                shash_delete(&netdev_shash, netdev->node);
>>> -                netdev->node = NULL;
>>> -                netdev_change_seq_changed(netdev);
>>> -            }
>>> +    if (netdev && type && type[0]) {
>>> +        if (strcmp(type, netdev->netdev_class->type)) {
>>> +
>>> +            if (netdev->auto_classified) {
>>> +                /* If this device was first created without a 
>>> classification
>>> +                 * type, for example due to routing or tunneling code, and 
>>> they
>>> +                 * keep a reference, a "classified" call to open will fail.
>>> +                 * In this case we remove the classless device, and re-add 
>>> it
>>> +                 * below. We remove the netdev from the shash, and change 
>>> the
>>> +                 * sequence, so owners of the old classless device can
>>> +                 * release/cleanup. */
>>> +                if (netdev->node) {
>>> +                    shash_delete(&netdev_shash, netdev->node);
>>> +                    netdev->node = NULL;
>>> +                    netdev_change_seq_changed(netdev);
>>> +                }
>>> -            netdev = NULL;
>>> -        } else {
>>> -            error = EEXIST;
>>> +                netdev = NULL;
>>> +            } else {
>>> +                error = EEXIST;
>>> +            }
>>> +        } else if (netdev->auto_classified) {
>>> +            /* If netdev reopens of type "system", clear auto_classified */
>>> +            netdev->auto_classified = false;
>>>           }
>>>       }
>>
>> this fix you issue with lag?
>> netdev_open() is not being called more than once?
>>
>> i'll take a little bit more this week and test a bit before acking.
> 
> this is ok by me. didnt hit an issue.
> 
> Acked-by: Roi Dayan <r...@nvidia.com>

Thanks!  Applied and backported down to 2.13.

Best regards, Ilya Maximets.
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to