]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: E-Switch, Fix the check of legal vport
authorBodong Wang <bodong@mellanox.com>
Mon, 15 Apr 2019 22:39:07 +0000 (17:39 -0500)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 1 May 2019 21:39:17 +0000 (14:39 -0700)
commit87ac2ca14d5f266466efb0ebf888721e0f63f3c5
treeb73e96dd24f0e6a5b5712ccc5f72cb213ffc0179
parentad456afb4d4e9fb2c49b843c2f090ee5fe53ea1f
net/mlx5: E-Switch, Fix the check of legal vport

The check of legal vport is to ensure the vport number falls between
0 and total number of vports. Along with the introduction of uplink
rep, enabled vports are not consecutive any more.
Therefore, rely on the eswitch vport getter function to check if it's
a valid vport.

As the getter function relies on eswitch, add the check of vport
group manager and validation the presence of eswitch structure.
Remove the redundant check in the function calls.

Since the vport array will be allocated once eswitch is initialized
and will be kept alive if eswitch presents, no need to protect it with
the state lock.

Fixes: fcc634ba25fa ("net/mlx5: E-Switch, Assign a different position for uplink rep and vport")
Signed-off-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h