mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 00:04:15 +08:00
net/mlx5: E-Switch, Correct type to u16 for vport_num and int for vport_index
To avoid any ambiguity between vport index and vport number,
rename functions that had vport, to vport_num or vport_index appropriately.
vport_num is u16 hence change mlx5_eswitch_index_to_vport_num() return
type to u16.
vport_index is an int in vport array. Hence change input type of vport
index in mlx5_eswitch_index_to_vport_num() to int.
Correct multiple eswitch representor interfaces use type u16 of
rep->vport as type int vport_index.
Send vport FW commands with correct eswitch u16 vport_num instead
host int vport_index.
Fixes: 5ae5162066
("net/mlx5: E-Switch, Assign a different position for uplink rep and vport")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Vu Pham <vuhuong@mellanox.com>
Reviewed-by: Bodong Wang <bodong@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
This commit is contained in:
parent
661f0312eb
commit
02f3afd975
@ -109,15 +109,15 @@ u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
|
||||
}
|
||||
|
||||
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
||||
int vport_index)
|
||||
u16 vport_num)
|
||||
{
|
||||
return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_IB);
|
||||
return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_IB);
|
||||
}
|
||||
|
||||
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
||||
int vport_index)
|
||||
u16 vport_num)
|
||||
{
|
||||
return mlx5_eswitch_get_proto_dev(esw, vport_index, REP_ETH);
|
||||
return mlx5_eswitch_get_proto_dev(esw, vport_num, REP_ETH);
|
||||
}
|
||||
|
||||
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
|
||||
@ -125,9 +125,10 @@ struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
|
||||
return mlx5_eswitch_uplink_get_proto_dev(esw, REP_IB);
|
||||
}
|
||||
|
||||
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, int vport)
|
||||
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
||||
u16 vport_num)
|
||||
{
|
||||
return mlx5_eswitch_vport_rep(esw, vport);
|
||||
return mlx5_eswitch_vport_rep(esw, vport_num);
|
||||
}
|
||||
|
||||
struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
||||
|
@ -14,17 +14,17 @@ extern const struct mlx5_ib_profile uplink_rep_profile;
|
||||
|
||||
u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
|
||||
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
||||
int vport_index);
|
||||
u16 vport_num);
|
||||
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
|
||||
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
||||
int vport_index);
|
||||
u16 vport_num);
|
||||
void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
|
||||
void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
|
||||
struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
||||
struct mlx5_ib_sq *sq,
|
||||
u16 port);
|
||||
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
||||
int vport_index);
|
||||
u16 vport_num);
|
||||
#else /* CONFIG_MLX5_ESWITCH */
|
||||
static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
|
||||
{
|
||||
@ -33,7 +33,7 @@ static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
|
||||
|
||||
static inline
|
||||
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
||||
int vport_index)
|
||||
u16 vport_num)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -46,7 +46,7 @@ struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
|
||||
|
||||
static inline
|
||||
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
||||
int vport_index)
|
||||
u16 vport_num)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -63,7 +63,7 @@ struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
||||
|
||||
static inline
|
||||
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
||||
int vport_index)
|
||||
u16 vport_num)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1526,7 +1526,7 @@ static void node_guid_gen_from_mac(u64 *node_guid, u8 mac[ETH_ALEN])
|
||||
static void esw_apply_vport_conf(struct mlx5_eswitch *esw,
|
||||
struct mlx5_vport *vport)
|
||||
{
|
||||
int vport_num = vport->vport;
|
||||
u16 vport_num = vport->vport;
|
||||
|
||||
if (esw->manager_vport == vport_num)
|
||||
return;
|
||||
@ -1915,7 +1915,7 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
|
||||
|
||||
/* Vport Administration */
|
||||
int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
|
||||
int vport, u8 mac[ETH_ALEN])
|
||||
u16 vport, u8 mac[ETH_ALEN])
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
u64 node_guid;
|
||||
@ -1959,7 +1959,7 @@ unlock:
|
||||
}
|
||||
|
||||
int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
|
||||
int vport, int link_state)
|
||||
u16 vport, int link_state)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
int err = 0;
|
||||
@ -1989,7 +1989,7 @@ unlock:
|
||||
}
|
||||
|
||||
int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
|
||||
int vport, struct ifla_vf_info *ivi)
|
||||
u16 vport, struct ifla_vf_info *ivi)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
|
||||
@ -2014,7 +2014,7 @@ int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
|
||||
}
|
||||
|
||||
int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
|
||||
int vport, u16 vlan, u8 qos, u8 set_flags)
|
||||
u16 vport, u16 vlan, u8 qos, u8 set_flags)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
int err = 0;
|
||||
@ -2047,7 +2047,7 @@ unlock:
|
||||
}
|
||||
|
||||
int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
|
||||
int vport, u16 vlan, u8 qos)
|
||||
u16 vport, u16 vlan, u8 qos)
|
||||
{
|
||||
u8 set_flags = 0;
|
||||
|
||||
@ -2058,7 +2058,7 @@ int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
|
||||
}
|
||||
|
||||
int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw,
|
||||
int vport, bool spoofchk)
|
||||
u16 vport, bool spoofchk)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
bool pschk;
|
||||
@ -2208,7 +2208,7 @@ out:
|
||||
}
|
||||
|
||||
int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw,
|
||||
int vport, bool setting)
|
||||
u16 vport, bool setting)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
|
||||
@ -2278,7 +2278,7 @@ static int normalize_vports_min_rate(struct mlx5_eswitch *esw, u32 divider)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
|
||||
int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
|
||||
u32 max_rate, u32 min_rate)
|
||||
{
|
||||
struct mlx5_vport *evport = mlx5_eswitch_get_vport(esw, vport);
|
||||
@ -2368,7 +2368,7 @@ static int mlx5_eswitch_query_vport_drop_stats(struct mlx5_core_dev *dev,
|
||||
}
|
||||
|
||||
int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
|
||||
int vport_num,
|
||||
u16 vport_num,
|
||||
struct ifla_vf_stats *vf_stats)
|
||||
{
|
||||
struct mlx5_vport *vport = mlx5_eswitch_get_vport(esw, vport_num);
|
||||
|
@ -246,23 +246,23 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw);
|
||||
int mlx5_eswitch_enable_sriov(struct mlx5_eswitch *esw, int nvfs, int mode);
|
||||
void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw);
|
||||
int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
|
||||
int vport, u8 mac[ETH_ALEN]);
|
||||
u16 vport, u8 mac[ETH_ALEN]);
|
||||
int mlx5_eswitch_set_vport_state(struct mlx5_eswitch *esw,
|
||||
int vport, int link_state);
|
||||
u16 vport, int link_state);
|
||||
int mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
|
||||
int vport, u16 vlan, u8 qos);
|
||||
u16 vport, u16 vlan, u8 qos);
|
||||
int mlx5_eswitch_set_vport_spoofchk(struct mlx5_eswitch *esw,
|
||||
int vport, bool spoofchk);
|
||||
u16 vport, bool spoofchk);
|
||||
int mlx5_eswitch_set_vport_trust(struct mlx5_eswitch *esw,
|
||||
int vport_num, bool setting);
|
||||
int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, int vport,
|
||||
u16 vport_num, bool setting);
|
||||
int mlx5_eswitch_set_vport_rate(struct mlx5_eswitch *esw, u16 vport,
|
||||
u32 max_rate, u32 min_rate);
|
||||
int mlx5_eswitch_set_vepa(struct mlx5_eswitch *esw, u8 setting);
|
||||
int mlx5_eswitch_get_vepa(struct mlx5_eswitch *esw, u8 *setting);
|
||||
int mlx5_eswitch_get_vport_config(struct mlx5_eswitch *esw,
|
||||
int vport, struct ifla_vf_info *ivi);
|
||||
u16 vport, struct ifla_vf_info *ivi);
|
||||
int mlx5_eswitch_get_vport_stats(struct mlx5_eswitch *esw,
|
||||
int vport,
|
||||
u16 vport,
|
||||
struct ifla_vf_stats *vf_stats);
|
||||
void mlx5_eswitch_del_send_to_vport_rule(struct mlx5_flow_handle *rule);
|
||||
|
||||
@ -296,7 +296,7 @@ u32
|
||||
mlx5_eswitch_get_chain_range(struct mlx5_eswitch *esw);
|
||||
|
||||
struct mlx5_flow_handle *
|
||||
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
|
||||
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, u16 vport,
|
||||
struct mlx5_flow_destination *dest);
|
||||
|
||||
enum {
|
||||
@ -366,7 +366,7 @@ int mlx5_eswitch_add_vlan_action(struct mlx5_eswitch *esw,
|
||||
int mlx5_eswitch_del_vlan_action(struct mlx5_eswitch *esw,
|
||||
struct mlx5_esw_flow_attr *attr);
|
||||
int __mlx5_eswitch_set_vport_vlan(struct mlx5_eswitch *esw,
|
||||
int vport, u16 vlan, u8 qos, u8 set_flags);
|
||||
u16 vport, u16 vlan, u8 qos, u8 set_flags);
|
||||
|
||||
static inline bool mlx5_eswitch_vlan_actions_supported(struct mlx5_core_dev *dev,
|
||||
u8 vlan_depth)
|
||||
@ -430,7 +430,7 @@ static inline int mlx5_eswitch_vport_num_to_index(struct mlx5_eswitch *esw,
|
||||
return vport_num;
|
||||
}
|
||||
|
||||
static inline int mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
|
||||
static inline u16 mlx5_eswitch_index_to_vport_num(struct mlx5_eswitch *esw,
|
||||
int index)
|
||||
{
|
||||
if (index == mlx5_eswitch_ecpf_idx(esw) &&
|
||||
|
@ -57,7 +57,7 @@
|
||||
static struct mlx5_eswitch_rep *mlx5_eswitch_get_rep(struct mlx5_eswitch *esw,
|
||||
u16 vport_num)
|
||||
{
|
||||
u16 idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
|
||||
int idx = mlx5_eswitch_vport_num_to_index(esw, vport_num);
|
||||
|
||||
WARN_ON(idx > esw->total_vports - 1);
|
||||
return &esw->offloads.vport_reps[idx];
|
||||
@ -515,7 +515,8 @@ out:
|
||||
}
|
||||
|
||||
struct mlx5_flow_handle *
|
||||
mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, int vport, u32 sqn)
|
||||
mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw, u16 vport,
|
||||
u32 sqn)
|
||||
{
|
||||
struct mlx5_flow_act flow_act = {0};
|
||||
struct mlx5_flow_destination dest = {};
|
||||
@ -1181,7 +1182,7 @@ static void esw_destroy_vport_rx_group(struct mlx5_eswitch *esw)
|
||||
}
|
||||
|
||||
struct mlx5_flow_handle *
|
||||
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, int vport,
|
||||
mlx5_eswitch_create_vport_rx_rule(struct mlx5_eswitch *esw, u16 vport,
|
||||
struct mlx5_flow_destination *dest)
|
||||
{
|
||||
struct mlx5_flow_act flow_act = {0};
|
||||
@ -2243,7 +2244,7 @@ void *mlx5_eswitch_get_uplink_priv(struct mlx5_eswitch *esw, u8 rep_type)
|
||||
}
|
||||
|
||||
void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw,
|
||||
int vport,
|
||||
u16 vport,
|
||||
u8 rep_type)
|
||||
{
|
||||
struct mlx5_eswitch_rep *rep;
|
||||
@ -2264,7 +2265,7 @@ void *mlx5_eswitch_uplink_get_proto_dev(struct mlx5_eswitch *esw, u8 rep_type)
|
||||
EXPORT_SYMBOL(mlx5_eswitch_uplink_get_proto_dev);
|
||||
|
||||
struct mlx5_eswitch_rep *mlx5_eswitch_vport_rep(struct mlx5_eswitch *esw,
|
||||
int vport)
|
||||
u16 vport)
|
||||
{
|
||||
return mlx5_eswitch_get_rep(esw, vport);
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ void mlx5_eswitch_register_vport_reps(struct mlx5_eswitch *esw,
|
||||
u8 rep_type);
|
||||
void mlx5_eswitch_unregister_vport_reps(struct mlx5_eswitch *esw, u8 rep_type);
|
||||
void *mlx5_eswitch_get_proto_dev(struct mlx5_eswitch *esw,
|
||||
int vport,
|
||||
u16 vport_num,
|
||||
u8 rep_type);
|
||||
struct mlx5_eswitch_rep *mlx5_eswitch_vport_rep(struct mlx5_eswitch *esw,
|
||||
int vport);
|
||||
u16 vport_num);
|
||||
void *mlx5_eswitch_uplink_get_proto_dev(struct mlx5_eswitch *esw, u8 rep_type);
|
||||
u8 mlx5_eswitch_mode(struct mlx5_eswitch *esw);
|
||||
struct mlx5_flow_handle *
|
||||
mlx5_eswitch_add_send_to_vport_rule(struct mlx5_eswitch *esw,
|
||||
int vport, u32 sqn);
|
||||
u16 vport_num, u32 sqn);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user