blob: de43b423bafc40e6631b2fb19ad85d8755378753 [file] [log] [blame]
Leon Romanovskyc1191a12018-06-05 07:53:53 +03001/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
Mark Blochfc385b72018-01-16 14:34:48 +00002/*
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 Wangf0666f12019-02-12 22:55:34 -080013extern const struct mlx5_ib_profile uplink_rep_profile;
14
Mark Blochfc385b72018-01-16 14:34:48 +000015u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
16struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050017 u16 vport_num);
Mark Blochb5ca15a2018-01-23 11:16:30 +000018struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
Mark Blochfc385b72018-01-16 14:34:48 +000019struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050020 u16 vport_num);
Bodong Wangf0666f12019-02-12 22:55:34 -080021void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
22void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
Mark Blochd5ed8ac2019-03-28 15:27:38 +020023struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
24 struct mlx5_ib_sq *sq,
25 u16 port);
Mark Blochbcf87f12018-01-16 15:02:36 +000026struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050027 u16 vport_num);
Mark Blochfc385b72018-01-16 14:34:48 +000028#else /* CONFIG_MLX5_ESWITCH */
29static inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
30{
Bodong Wangf6455de2019-06-28 22:36:15 +000031 return MLX5_ESWITCH_NONE;
Mark Blochfc385b72018-01-16 14:34:48 +000032}
33
34static inline
35struct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050036 u16 vport_num)
Mark Blochfc385b72018-01-16 14:34:48 +000037{
38 return NULL;
39}
40
41static inline
Mark Blochb5ca15a2018-01-23 11:16:30 +000042struct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
43{
44 return NULL;
45}
46
47static inline
Mark Blochfc385b72018-01-16 14:34:48 +000048struct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050049 u16 vport_num)
Mark Blochfc385b72018-01-16 14:34:48 +000050{
51 return NULL;
52}
53
Bodong Wangf0666f12019-02-12 22:55:34 -080054static 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) {}
Mark Blochd5ed8ac2019-03-28 15:27:38 +020056static inline
57struct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
58 struct mlx5_ib_sq *sq,
59 u16 port)
Mark Blochb96c9dd2018-01-29 10:40:37 +000060{
Mark Blochd5ed8ac2019-03-28 15:27:38 +020061 return NULL;
Mark Blochb96c9dd2018-01-29 10:40:37 +000062}
63
Mark Blochbcf87f12018-01-16 15:02:36 +000064static inline
65struct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
Parav Pandit02f3afd2019-04-05 01:07:19 -050066 u16 vport_num)
Mark Blochbcf87f12018-01-16 15:02:36 +000067{
68 return NULL;
69}
Mark Blochfc385b72018-01-16 14:34:48 +000070#endif
71
72static inline
73struct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
74{
Parav Pandit86931152019-05-29 22:50:41 +000075 return rep->rep_data[REP_IB].priv;
Mark Blochfc385b72018-01-16 14:34:48 +000076}
77#endif /* __MLX5_IB_REP_H__ */