OSDN Git Service

net/mlx5e: Improve set features ndo resiliency
authorGal Pressman <galp@mellanox.com>
Sun, 24 Apr 2016 19:51:51 +0000 (22:51 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Apr 2016 19:58:01 +0000 (15:58 -0400)
commit0e405443e803a3ce9ba22f11be37e2a74f3fb9ad
treead96efd1444a28d148f59e60ad85a714b78a4ee9
parent121fcdc84d8240d4dfe1f737befd5814b12623ee
net/mlx5e: Improve set features ndo resiliency

In current mlx5e ndo_set_features implementation, setting some features
can success while others can fail. Today, we return one error code which
doesn't reflect the current features status of the netdev at the end of
the ndo callback.

Set netdev->features with features which were successfully set in order
to keep the current status in case of failure. For this purpose, define
new Macro to set/unset specific feature in netdev->features.

This patch introduces a mechanism that uses feature handlers for each
feature.
Set features will call a generic handler, which will then call a specific
handler in his turn and update netdev->features according to it's return
value. Each specific handler is responsible to perform driver specific
actions, and updating params if needed.

Signed-off-by: Gal Pressman <galp@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_main.c