net/mlx5: E-Switch, Add state to eswitch vport representors
authorBodong Wang <bodong@mellanox.com>
Wed, 30 Jan 2019 03:48:31 +0000 (21:48 -0600)
committerSaeed Mahameed <saeedm@mellanox.com>
Sat, 16 Feb 2019 01:25:57 +0000 (17:25 -0800)
commitf121e0ea9586b2c937bf1ff9a0b682dc6424ce1d
tree76cb5a569231bb309c2f4050f84576397f790ba7
parent879c8f84e3602961e441723aaaac372a44dfe588
net/mlx5: E-Switch, Add state to eswitch vport representors

Currently the eswitch vport reps have a valid indicator, which is
set on register and unset on unregister. However, a rep can be loaded
or not loaded when doing unregister, current driver checks if the
vport of that rep is enabled as a flag to imply the rep is loaded.
However, for ECPF, this is not valid as the host PF will enable the
vports for its VFs instead.

Add three states: {unregistered, registered, loaded}, with the
following state changes across different operations:

create: (none)       -> unregistered
reg:    unregistered -> registered
load:   registered   -> loaded
unload: loaded       -> registered
unreg:  registered   -> unregistered

Note that the state shall only be updated inside eswitch driver rather
than individual drivers such as ETH or IB.

Signed-off-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Suggested-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
include/linux/mlx5/eswitch.h