]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5: E-Switch, Avoid magic numbers when initializing offloads mode
authorBodong Wang <bodong@mellanox.com>
Wed, 13 Feb 2019 06:55:42 +0000 (22:55 -0800)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 14 Feb 2019 20:14:42 +0000 (12:14 -0800)
commit3884569f20c655aa5ed0a2fd128616ad954b2fdb
tree38f673a16ba1f523b314da0dfdde24fbc60bab01
parent0ee5554985948d3b0b07bc365c7b82be6f00be67
net/mlx5: E-Switch, Avoid magic numbers when initializing offloads mode

When dealing with the offloads mode initialization, driver refers to
the number of VFs and add magic number one (1) to take account of the
uplink. This is not clear and will make the code less readable after
adding other vports (e.g. host PF). As these are special vports
compared to VF vports, add a helper macro to denote such special
vports and eliminate the use of magic number.

Moreover, when creating offloads flow table and groups, the driver
reserves two more slots for UC and MC miss rules. Replace this magic
number with a helper macro as well.

This patch doesn't change any functionality.

Signed-off-by: Bodong Wang <bodong@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@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_offloads.c
include/linux/mlx5/vport.h