net/mlx5e: Split open/close channels to stages
authorSaeed Mahameed <saeedm@mellanox.com>
Tue, 20 Dec 2016 20:48:19 +0000 (22:48 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 27 Mar 2017 12:08:17 +0000 (15:08 +0300)
commitacc6c5953af1949fc17c09cacd4842f149b4569d
treee5eb0bc271127579e5ca61df9064fba889926c86
parentb676f653896aaf6b32b496709bd9ebbc771d7ed7
net/mlx5e: Split open/close channels to stages

As a foundation for safe config flow, a simple clear API such as
(Open then Activate) where the "Open" handles the heavy unsafe
creation operation and the "activate" will be fast and fail safe,
to enable the newly created channels.

For this we split the RQs/TXQ SQs and channels open/close flows to
open => activate, deactivate => close.

This will simplify the ability to have fail safe configuration changes
in downstream patches as follows:

make_new_config(new_params)
{
     old_channels = current_active_channels;
     new_channels = create_channels(new_params);
     if (!new_channels)
              return "Failed, but current channels still active :)"
     deactivate_channels(old_channels); /* Can't fail */
     activate_channels(new_channels); /* Can't fail */
     close_channels(old_channels);
     current_active_channels = new_channels;

     return "SUCCESS";
}

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c