]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5e: Fix wrong features assignment in case of error
authorGal Pressman <gal@nvidia.com>
Mon, 29 Nov 2021 09:08:41 +0000 (11:08 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 29 Dec 2021 06:42:50 +0000 (22:42 -0800)
commitfe10c82af7d8e8baa6f6e185baa676d3ea23d042
treea0ef3b96b3ebf86bd954300b9d8504936bf0266f
parentde0889c74229cf35cf98d3a2d0d828f55d413c0a
net/mlx5e: Fix wrong features assignment in case of error

In case of an error in mlx5e_set_features(), 'netdev->features' must be
updated with the correct state of the device to indicate which features
were updated successfully.
To do that we maintain a copy of 'netdev->features' and update it after
successful feature changes, so we can assign it to back to
'netdev->features' if needed.

However, since not all netdev features are handled by the driver (e.g.
GRO/TSO/etc), some features may not be updated correctly in case of an
error updating another feature.

For example, while requesting to disable TSO (feature which is not
handled by the driver) and enable HW-GRO, if an error occurs during
HW-GRO enable, 'oper_features' will be assigned with 'netdev->features'
and HW-GRO turned off. TSO will remain enabled in such case, which is a
bug.

To solve that, instead of using 'netdev->features' as the baseline of
'oper_features' and changing it on set feature success, use 'features'
instead and update it in case of errors.

Fixes: 4cd16cf0f7c6 ("net/mlx5e: Don't override netdev features field unless in error flow")
Signed-off-by: Gal Pressman <gal@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c