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>
77 lines
2 KiB
C
77 lines
2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
|
|
/*
|
|
* Copyright (c) 2018 Mellanox Technologies. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __MLX5_IB_REP_H__
|
|
#define __MLX5_IB_REP_H__
|
|
|
|
#include <linux/mlx5/eswitch.h>
|
|
#include "mlx5_ib.h"
|
|
|
|
#ifdef CONFIG_MLX5_ESWITCH
|
|
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,
|
|
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,
|
|
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,
|
|
u16 vport_num);
|
|
#else /* CONFIG_MLX5_ESWITCH */
|
|
static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
|
|
{
|
|
return SRIOV_NONE;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
|
|
u16 vport_num)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
|
|
u16 vport_num)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {}
|
|
static inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {}
|
|
static inline
|
|
struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
|
|
struct mlx5_ib_sq *sq,
|
|
u16 port)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
|
|
u16 vport_num)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif
|
|
|
|
static inline
|
|
struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
|
|
{
|
|
return (struct mlx5_ib_dev *)rep->rep_if[REP_IB].priv;
|
|
}
|
|
#endif /* __MLX5_IB_REP_H__ */
|