Loading...
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
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
12extern const struct mlx5_ib_profile raw_eth_profile;
13
14#ifdef CONFIG_MLX5_ESWITCH
15int mlx5r_rep_init(void);
16void mlx5r_rep_cleanup(void);
17struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
18 struct mlx5_ib_sq *sq,
19 u32 port);
20struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
21 u16 vport_num);
22#else /* CONFIG_MLX5_ESWITCH */
23static inline int mlx5r_rep_init(void) { return 0; }
24static inline void mlx5r_rep_cleanup(void) {}
25static inline
26struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
27 struct mlx5_ib_sq *sq,
28 u32 port)
29{
30 return NULL;
31}
32
33static inline
34struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
35 u16 vport_num)
36{
37 return NULL;
38}
39#endif
40#endif /* __MLX5_IB_REP_H__ */
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
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
13extern const struct mlx5_ib_profile uplink_rep_profile;
14
15u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
16struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
17 u16 vport_num);
18struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
19struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
20 u16 vport_num);
21void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
22void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
23struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
24 struct mlx5_ib_sq *sq,
25 u16 port);
26struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
27 u16 vport_num);
28#else /* CONFIG_MLX5_ESWITCH */
29static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
30{
31 return MLX5_ESWITCH_NONE;
32}
33
34static inline
35struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
36 u16 vport_num)
37{
38 return NULL;
39}
40
41static inline
42struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
43{
44 return NULL;
45}
46
47static inline
48struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
49 u16 vport_num)
50{
51 return NULL;
52}
53
54static inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {}
55static inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {}
56static inline
57struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
58 struct mlx5_ib_sq *sq,
59 u16 port)
60{
61 return NULL;
62}
63
64static inline
65struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
66 u16 vport_num)
67{
68 return NULL;
69}
70#endif
71
72static inline
73struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
74{
75 return rep->rep_data[REP_IB].priv;
76}
77#endif /* __MLX5_IB_REP_H__ */