Leon Romanovsky | c1191a1 | 2018-06-05 07:53:53 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2018 Mellanox Technologies. All rights reserved. |
| 4 | */ |
| 5 | |
| 6 | #ifndef __MLX5_IB_REP_H__ |
| 7 | #define __MLX5_IB_REP_H__ |
| 8 | |
| 9 | #include <linux/mlx5/eswitch.h> |
| 10 | #include "mlx5_ib.h" |
| 11 | |
| 12 | #ifdef CONFIG_MLX5_ESWITCH |
Bodong Wang | f0666f1 | 2019-02-12 22:55:34 -0800 | [diff] [blame] | 13 | extern const struct mlx5_ib_profile uplink_rep_profile; |
| 14 | |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 15 | u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw); |
| 16 | struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 17 | u16 vport_num); |
Mark Bloch | b5ca15a | 2018-01-23 11:16:30 +0000 | [diff] [blame] | 18 | struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw); |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 19 | struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 20 | u16 vport_num); |
Bodong Wang | f0666f1 | 2019-02-12 22:55:34 -0800 | [diff] [blame] | 21 | void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev); |
| 22 | void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev); |
Mark Bloch | d5ed8ac | 2019-03-28 15:27:38 +0200 | [diff] [blame] | 23 | struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, |
| 24 | struct mlx5_ib_sq *sq, |
| 25 | u16 port); |
Mark Bloch | bcf87f1 | 2018-01-16 15:02:36 +0000 | [diff] [blame] | 26 | struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 27 | u16 vport_num); |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 28 | #else /* CONFIG_MLX5_ESWITCH */ |
| 29 | static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw) |
| 30 | { |
Bodong Wang | f6455de | 2019-06-28 22:36:15 +0000 | [diff] [blame] | 31 | return MLX5_ESWITCH_NONE; |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | static inline |
| 35 | struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 36 | u16 vport_num) |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 37 | { |
| 38 | return NULL; |
| 39 | } |
| 40 | |
| 41 | static inline |
Mark Bloch | b5ca15a | 2018-01-23 11:16:30 +0000 | [diff] [blame] | 42 | struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw) |
| 43 | { |
| 44 | return NULL; |
| 45 | } |
| 46 | |
| 47 | static inline |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 48 | struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 49 | u16 vport_num) |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 50 | { |
| 51 | return NULL; |
| 52 | } |
| 53 | |
Bodong Wang | f0666f1 | 2019-02-12 22:55:34 -0800 | [diff] [blame] | 54 | static inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {} |
| 55 | static inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {} |
Mark Bloch | d5ed8ac | 2019-03-28 15:27:38 +0200 | [diff] [blame] | 56 | static inline |
| 57 | struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev, |
| 58 | struct mlx5_ib_sq *sq, |
| 59 | u16 port) |
Mark Bloch | b96c9dd | 2018-01-29 10:40:37 +0000 | [diff] [blame] | 60 | { |
Mark Bloch | d5ed8ac | 2019-03-28 15:27:38 +0200 | [diff] [blame] | 61 | return NULL; |
Mark Bloch | b96c9dd | 2018-01-29 10:40:37 +0000 | [diff] [blame] | 62 | } |
| 63 | |
Mark Bloch | bcf87f1 | 2018-01-16 15:02:36 +0000 | [diff] [blame] | 64 | static inline |
| 65 | struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw, |
Parav Pandit | 02f3afd | 2019-04-05 01:07:19 -0500 | [diff] [blame] | 66 | u16 vport_num) |
Mark Bloch | bcf87f1 | 2018-01-16 15:02:36 +0000 | [diff] [blame] | 67 | { |
| 68 | return NULL; |
| 69 | } |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 70 | #endif |
| 71 | |
| 72 | static inline |
| 73 | struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep) |
| 74 | { |
Parav Pandit | 8693115 | 2019-05-29 22:50:41 +0000 | [diff] [blame] | 75 | return rep->rep_data[REP_IB].priv; |
Mark Bloch | fc385b7 | 2018-01-16 14:34:48 +0000 | [diff] [blame] | 76 | } |
| 77 | #endif /* __MLX5_IB_REP_H__ */ |