net/mlx5: E-Switch, Make vport number u16
authorParav Pandit <parav@nvidia.com>
Tue, 2 Mar 2021 19:27:47 +0000 (21:27 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 14 Apr 2021 18:02:32 +0000 (11:02 -0700)
Vport number is 16-bit field in hardware. Make it u16.

Move location of vport in the structure so that it reduces a hole
in the structure.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
include/linux/mlx5/eswitch.h

index c7a73dbd64b4964a908f057ea7a6e9254719b4be..a4b9f78bf4d6811921124b4f3cf3290ac7782793 100644 (file)
@@ -152,7 +152,6 @@ enum mlx5_eswitch_vport_event {
 
 struct mlx5_vport {
        struct mlx5_core_dev    *dev;
-       int                     vport;
        struct hlist_head       uc_list[MLX5_L2_ADDR_HASH_SIZE];
        struct hlist_head       mc_list[MLX5_L2_ADDR_HASH_SIZE];
        struct mlx5_flow_handle *promisc_rule;
@@ -174,6 +173,7 @@ struct mlx5_vport {
                u32 max_rate;
        } qos;
 
+       u16 vport;
        bool                    enabled;
        enum mlx5_eswitch_vport_event enabled_events;
        struct devlink_port *dl_port;
index 1f58e84bdfc64b12f6dc14559fefc8a95295280b..bbb707117296ec10e91b834d637e7e0f61d20691 100644 (file)
@@ -986,12 +986,13 @@ static void mlx5_eswitch_del_send_to_vport_meta_rules(struct mlx5_eswitch *esw)
 static int
 mlx5_eswitch_add_send_to_vport_meta_rules(struct mlx5_eswitch *esw)
 {
-       int num_vfs, vport_num, rule_idx = 0, err = 0;
        struct mlx5_flow_destination dest = {};
        struct mlx5_flow_act flow_act = {0};
+       int num_vfs, rule_idx = 0, err = 0;
        struct mlx5_flow_handle *flow_rule;
        struct mlx5_flow_handle **flows;
        struct mlx5_flow_spec *spec;
+       u16 vport_num;
 
        num_vfs = esw->esw_funcs.num_vfs;
        flows = kvzalloc(num_vfs * sizeof(*flows), GFP_KERNEL);
index 429a710c5a99807f8b03f1d727dfd17d53f69795..9cf1da2883c67a0904e198efd7ac826c91f00c71 100644 (file)
@@ -152,8 +152,7 @@ mlx5_eswitch_vport_match_metadata_enabled(const struct mlx5_eswitch *esw)
 };
 
 static inline u32
-mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw,
-                                         int vport_num)
+mlx5_eswitch_get_vport_metadata_for_match(struct mlx5_eswitch *esw, u16 vport_num)
 {
        return 0;
 };