treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / infiniband / hw / mlx5 / ib_rep.h
blob3b6750cba7963ae49bb6ca753a5cdd99fd989e9a
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /*
3 * Copyright (c) 2018 Mellanox Technologies. All rights reserved.
4 */
6 #ifndef __MLX5_IB_REP_H__
7 #define __MLX5_IB_REP_H__
9 #include <linux/mlx5/eswitch.h>
10 #include "mlx5_ib.h"
12 #ifdef CONFIG_MLX5_ESWITCH
13 extern const struct mlx5_ib_profile raw_eth_profile;
15 u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
16 struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
17 u16 vport_num);
18 struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
19 struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
20 u16 vport_num);
21 void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
22 void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
23 struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
24 struct mlx5_ib_sq *sq,
25 u16 port);
26 struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
27 u16 vport_num);
28 #else /* CONFIG_MLX5_ESWITCH */
29 static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
31 return MLX5_ESWITCH_NONE;
34 static inline
35 struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
36 u16 vport_num)
38 return NULL;
41 static inline
42 struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
44 return NULL;
47 static inline
48 struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
49 u16 vport_num)
51 return NULL;
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) {}
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)
61 return NULL;
64 static inline
65 struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
66 u16 vport_num)
68 return NULL;
70 #endif
72 static inline
73 struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
75 return rep->rep_data[REP_IB].priv;
77 #endif /* __MLX5_IB_REP_H__ */