net/mlx5: Properly check applicability of devlink eswitch commands
authorOr Gerlitz <ogerlitz@mellanox.com>
Sun, 4 Jun 2017 16:36:17 +0000 (19:36 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 15 Jun 2017 20:27:46 +0000 (23:27 +0300)
commit9d1cef196b2687e9338c4268a3aa0ca521686bc9
treed23200f1fd611f390f4201c9363215d9662bc02a
parent5f195c2c5cba60241004146cd12d71451d6b0fc4
net/mlx5: Properly check applicability of devlink eswitch commands

Currently we don't check that the link type is Eth and hence crash
on IB ports when attempting to deref esw->xxx, fix that.

To avoid repeating this check over and over, put the existing
checks and the one on link type in a single helper.

Fixes: 7768d1971de6 ('net/mlx5: E-Switch, Add control for encapsulation')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reported-by: Mohamad Badarnah <mohamadb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c