0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032 #ifndef __MLX5_VXLAN_H__
0033 #define __MLX5_VXLAN_H__
0034
0035 #include <linux/mlx5/driver.h>
0036
0037 struct mlx5_vxlan;
0038 struct mlx5_vxlan_port;
0039
0040 static inline u8 mlx5_vxlan_max_udp_ports(struct mlx5_core_dev *mdev)
0041 {
0042 return MLX5_CAP_ETH(mdev, max_vxlan_udp_ports) ?: 4;
0043 }
0044
0045 static inline bool mlx5_vxlan_allowed(struct mlx5_vxlan *vxlan)
0046 {
0047
0048
0049
0050 return !IS_ERR_OR_NULL(vxlan);
0051 }
0052
0053 #if IS_ENABLED(CONFIG_VXLAN)
0054 struct mlx5_vxlan *mlx5_vxlan_create(struct mlx5_core_dev *mdev);
0055 void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan);
0056 int mlx5_vxlan_add_port(struct mlx5_vxlan *vxlan, u16 port);
0057 int mlx5_vxlan_del_port(struct mlx5_vxlan *vxlan, u16 port);
0058 bool mlx5_vxlan_lookup_port(struct mlx5_vxlan *vxlan, u16 port);
0059 void mlx5_vxlan_reset_to_default(struct mlx5_vxlan *vxlan);
0060 #else
0061 static inline struct mlx5_vxlan*
0062 mlx5_vxlan_create(struct mlx5_core_dev *mdev) { return ERR_PTR(-EOPNOTSUPP); }
0063 static inline void mlx5_vxlan_destroy(struct mlx5_vxlan *vxlan) { return; }
0064 static inline int mlx5_vxlan_add_port(struct mlx5_vxlan *vxlan, u16 port) { return -EOPNOTSUPP; }
0065 static inline int mlx5_vxlan_del_port(struct mlx5_vxlan *vxlan, u16 port) { return -EOPNOTSUPP; }
0066 static inline bool mlx5_vxlan_lookup_port(struct mlx5_vxlan *vxlan, u16 port) { return false; }
0067 static inline void mlx5_vxlan_reset_to_default(struct mlx5_vxlan *vxlan) { return; }
0068 #endif
0069
0070 #endif