2018-06-05 07:53:53 +03:00
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2018-01-16 14:34:48 +00:00
/*
* 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
2019-02-12 22:55:34 -08:00
extern const struct mlx5_ib_profile uplink_rep_profile ;
2018-01-16 14:34:48 +00:00
u8 mlx5_ib_eswitch_mode ( struct mlx5_eswitch * esw ) ;
struct mlx5_ib_dev * mlx5_ib_get_rep_ibdev ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num ) ;
2018-01-23 11:16:30 +00:00
struct mlx5_ib_dev * mlx5_ib_get_uplink_ibdev ( struct mlx5_eswitch * esw ) ;
2018-01-16 14:34:48 +00:00
struct mlx5_eswitch_rep * mlx5_ib_vport_rep ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num ) ;
2019-02-12 22:55:34 -08:00
void mlx5_ib_register_vport_reps ( struct mlx5_core_dev * mdev ) ;
void mlx5_ib_unregister_vport_reps ( struct mlx5_core_dev * mdev ) ;
2019-03-28 15:27:38 +02:00
struct mlx5_flow_handle * create_flow_rule_vport_sq ( struct mlx5_ib_dev * dev ,
struct mlx5_ib_sq * sq ,
u16 port ) ;
2018-01-16 15:02:36 +00:00
struct net_device * mlx5_ib_get_rep_netdev ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num ) ;
2018-01-16 14:34:48 +00:00
# else /* CONFIG_MLX5_ESWITCH */
static inline u8 mlx5_ib_eswitch_mode ( struct mlx5_eswitch * esw )
{
2019-06-28 22:36:15 +00:00
return MLX5_ESWITCH_NONE ;
2018-01-16 14:34:48 +00:00
}
static inline
struct mlx5_ib_dev * mlx5_ib_get_rep_ibdev ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num )
2018-01-16 14:34:48 +00:00
{
return NULL ;
}
2018-01-23 11:16:30 +00:00
static inline
struct mlx5_ib_dev * mlx5_ib_get_uplink_ibdev ( struct mlx5_eswitch * esw )
{
return NULL ;
}
2018-01-16 14:34:48 +00:00
static inline
struct mlx5_eswitch_rep * mlx5_ib_vport_rep ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num )
2018-01-16 14:34:48 +00:00
{
return NULL ;
}
2019-02-12 22:55:34 -08:00
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 ) { }
2019-03-28 15:27:38 +02:00
static inline
struct mlx5_flow_handle * create_flow_rule_vport_sq ( struct mlx5_ib_dev * dev ,
struct mlx5_ib_sq * sq ,
u16 port )
2018-01-29 10:40:37 +00:00
{
2019-03-28 15:27:38 +02:00
return NULL ;
2018-01-29 10:40:37 +00:00
}
2018-01-16 15:02:36 +00:00
static inline
struct net_device * mlx5_ib_get_rep_netdev ( struct mlx5_eswitch * esw ,
2019-04-05 01:07:19 -05:00
u16 vport_num )
2018-01-16 15:02:36 +00:00
{
return NULL ;
}
2018-01-16 14:34:48 +00:00
# endif
static inline
struct mlx5_ib_dev * mlx5_ib_rep_to_dev ( struct mlx5_eswitch_rep * rep )
{
2019-05-29 22:50:41 +00:00
return rep - > rep_data [ REP_IB ] . priv ;
2018-01-16 14:34:48 +00:00
}
# endif /* __MLX5_IB_REP_H__ */