1c1191a19SLeon Romanovsky /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2fc385b7aSMark Bloch /* 3fc385b7aSMark Bloch * Copyright (c) 2018 Mellanox Technologies. All rights reserved. 4fc385b7aSMark Bloch */ 5fc385b7aSMark Bloch 6fc385b7aSMark Bloch #ifndef __MLX5_IB_REP_H__ 7fc385b7aSMark Bloch #define __MLX5_IB_REP_H__ 8fc385b7aSMark Bloch 9fc385b7aSMark Bloch #include <linux/mlx5/eswitch.h> 10fc385b7aSMark Bloch #include "mlx5_ib.h" 11fc385b7aSMark Bloch 12fc385b7aSMark Bloch #ifdef CONFIG_MLX5_ESWITCH 13f0666f1fSBodong Wang extern const struct mlx5_ib_profile uplink_rep_profile; 14f0666f1fSBodong Wang 15fc385b7aSMark Bloch u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw); 16fc385b7aSMark Bloch struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, 17fc385b7aSMark Bloch int vport_index); 18b5ca15adSMark Bloch struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw); 19fc385b7aSMark Bloch struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, 20fc385b7aSMark Bloch int vport_index); 21f0666f1fSBodong Wang void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev); 22f0666f1fSBodong Wang void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev); 23d5ed8ac3SMark Bloch struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, 24d5ed8ac3SMark Bloch struct mlx5_ib_sq *sq, 25d5ed8ac3SMark Bloch u16 port); 26bcf87f1dSMark Bloch struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, 27bcf87f1dSMark Bloch int vport_index); 28fc385b7aSMark Bloch #else /* CONFIG_MLX5_ESWITCH */ 29fc385b7aSMark Bloch static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw) 30fc385b7aSMark Bloch { 31f6455de0SBodong Wang return MLX5_ESWITCH_NONE; 32fc385b7aSMark Bloch } 33fc385b7aSMark Bloch 34fc385b7aSMark Bloch static inline 35fc385b7aSMark Bloch struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, 36fc385b7aSMark Bloch int vport_index) 37fc385b7aSMark Bloch { 38fc385b7aSMark Bloch return NULL; 39fc385b7aSMark Bloch } 40fc385b7aSMark Bloch 41fc385b7aSMark Bloch static inline 42b5ca15adSMark Bloch struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) 43b5ca15adSMark Bloch { 44b5ca15adSMark Bloch return NULL; 45b5ca15adSMark Bloch } 46b5ca15adSMark Bloch 47b5ca15adSMark Bloch static inline 48fc385b7aSMark Bloch struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, 49fc385b7aSMark Bloch int vport_index) 50fc385b7aSMark Bloch { 51fc385b7aSMark Bloch return NULL; 52fc385b7aSMark Bloch } 53fc385b7aSMark Bloch 54f0666f1fSBodong Wang static inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {} 55f0666f1fSBodong Wang static inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {} 56d5ed8ac3SMark Bloch static inline 57d5ed8ac3SMark Bloch struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, 58d5ed8ac3SMark Bloch struct mlx5_ib_sq *sq, 59d5ed8ac3SMark Bloch u16 port) 60b96c9ddeSMark Bloch { 61d5ed8ac3SMark Bloch return NULL; 62b96c9ddeSMark Bloch } 63b96c9ddeSMark Bloch 64bcf87f1dSMark Bloch static inline 65bcf87f1dSMark Bloch struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, 66bcf87f1dSMark Bloch int vport_index) 67bcf87f1dSMark Bloch { 68bcf87f1dSMark Bloch return NULL; 69bcf87f1dSMark Bloch } 70fc385b7aSMark Bloch #endif 71fc385b7aSMark Bloch 72fc385b7aSMark Bloch static inline 73fc385b7aSMark Bloch struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) 74fc385b7aSMark Bloch { 758693115aSParav Pandit return rep->rep_data[REP_IB].priv; 76fc385b7aSMark Bloch } 77fc385b7aSMark Bloch #endif /* __MLX5_IB_REP_H__ */ 78