18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2018 Mellanox Technologies. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __MLX5_IB_REP_H__
78c2ecf20Sopenharmony_ci#define __MLX5_IB_REP_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/mlx5/eswitch.h>
108c2ecf20Sopenharmony_ci#include "mlx5_ib.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciextern const struct mlx5_ib_profile raw_eth_profile;
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifdef CONFIG_MLX5_ESWITCH
158c2ecf20Sopenharmony_ciu8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw);
168c2ecf20Sopenharmony_cistruct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
178c2ecf20Sopenharmony_ci					  u16 vport_num);
188c2ecf20Sopenharmony_cistruct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw);
198c2ecf20Sopenharmony_cistruct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
208c2ecf20Sopenharmony_ci					   u16 vport_num);
218c2ecf20Sopenharmony_civoid mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev);
228c2ecf20Sopenharmony_civoid mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev);
238c2ecf20Sopenharmony_cistruct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
248c2ecf20Sopenharmony_ci						   struct mlx5_ib_sq *sq,
258c2ecf20Sopenharmony_ci						   u16 port);
268c2ecf20Sopenharmony_cistruct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
278c2ecf20Sopenharmony_ci					  u16 vport_num);
288c2ecf20Sopenharmony_ci#else /* CONFIG_MLX5_ESWITCH */
298c2ecf20Sopenharmony_cistatic inline u8 mlx5_ib_eswitch_mode(struct mlx5_eswitch *esw)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci	return MLX5_ESWITCH_NONE;
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic inline
358c2ecf20Sopenharmony_cistruct mlx5_ib_dev *mlx5_ib_get_rep_ibdev(struct mlx5_eswitch *esw,
368c2ecf20Sopenharmony_ci					  u16 vport_num)
378c2ecf20Sopenharmony_ci{
388c2ecf20Sopenharmony_ci	return NULL;
398c2ecf20Sopenharmony_ci}
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistatic inline
428c2ecf20Sopenharmony_cistruct mlx5_ib_dev *mlx5_ib_get_uplink_ibdev(struct mlx5_eswitch *esw)
438c2ecf20Sopenharmony_ci{
448c2ecf20Sopenharmony_ci	return NULL;
458c2ecf20Sopenharmony_ci}
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cistatic inline
488c2ecf20Sopenharmony_cistruct mlx5_eswitch_rep *mlx5_ib_vport_rep(struct mlx5_eswitch *esw,
498c2ecf20Sopenharmony_ci					   u16 vport_num)
508c2ecf20Sopenharmony_ci{
518c2ecf20Sopenharmony_ci	return NULL;
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic inline void mlx5_ib_register_vport_reps(struct mlx5_core_dev *mdev) {}
558c2ecf20Sopenharmony_cistatic inline void mlx5_ib_unregister_vport_reps(struct mlx5_core_dev *mdev) {}
568c2ecf20Sopenharmony_cistatic inline
578c2ecf20Sopenharmony_cistruct mlx5_flow_handle *create_flow_rule_vport_sq(struct mlx5_ib_dev *dev,
588c2ecf20Sopenharmony_ci						   struct mlx5_ib_sq *sq,
598c2ecf20Sopenharmony_ci						   u16 port)
608c2ecf20Sopenharmony_ci{
618c2ecf20Sopenharmony_ci	return NULL;
628c2ecf20Sopenharmony_ci}
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_cistatic inline
658c2ecf20Sopenharmony_cistruct net_device *mlx5_ib_get_rep_netdev(struct mlx5_eswitch *esw,
668c2ecf20Sopenharmony_ci					  u16 vport_num)
678c2ecf20Sopenharmony_ci{
688c2ecf20Sopenharmony_ci	return NULL;
698c2ecf20Sopenharmony_ci}
708c2ecf20Sopenharmony_ci#endif
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_cistatic inline
738c2ecf20Sopenharmony_cistruct mlx5_ib_dev *mlx5_ib_rep_to_dev(struct mlx5_eswitch_rep *rep)
748c2ecf20Sopenharmony_ci{
758c2ecf20Sopenharmony_ci	return rep->rep_data[REP_IB].priv;
768c2ecf20Sopenharmony_ci}
778c2ecf20Sopenharmony_ci#endif /* __MLX5_IB_REP_H__ */
78