spectrum_nve.h (1694B)
1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */ 2/* Copyright (c) 2018 Mellanox Technologies. All rights reserved */ 3 4#ifndef _MLXSW_SPECTRUM_NVE_H 5#define _MLXSW_SPECTRUM_NVE_H 6 7#include <linux/netlink.h> 8#include <linux/rhashtable.h> 9 10#include "spectrum.h" 11 12struct mlxsw_sp_nve_config { 13 enum mlxsw_sp_nve_type type; 14 u8 ttl; 15 u8 learning_en:1; 16 __be16 udp_dport; 17 __be32 flowlabel; 18 u32 ul_tb_id; 19 enum mlxsw_sp_l3proto ul_proto; 20 union mlxsw_sp_l3addr ul_sip; 21}; 22 23struct mlxsw_sp_nve { 24 struct mlxsw_sp_nve_config config; 25 struct rhashtable mc_list_ht; 26 struct rhashtable ipv6_ht; 27 struct list_head ipv6_addr_list; /* Saves hash table nodes. */ 28 struct mlxsw_sp *mlxsw_sp; 29 const struct mlxsw_sp_nve_ops **nve_ops_arr; 30 unsigned int num_nve_tunnels; /* Protected by RTNL */ 31 unsigned int num_max_mc_entries[MLXSW_SP_L3_PROTO_MAX]; 32 u32 tunnel_index; 33 u16 ul_rif_index; /* Reserved for Spectrum */ 34}; 35 36struct mlxsw_sp_nve_ops { 37 enum mlxsw_sp_nve_type type; 38 bool (*can_offload)(const struct mlxsw_sp_nve *nve, 39 const struct mlxsw_sp_nve_params *params, 40 struct netlink_ext_ack *extack); 41 void (*nve_config)(const struct mlxsw_sp_nve *nve, 42 const struct mlxsw_sp_nve_params *params, 43 struct mlxsw_sp_nve_config *config); 44 int (*init)(struct mlxsw_sp_nve *nve, 45 const struct mlxsw_sp_nve_config *config); 46 void (*fini)(struct mlxsw_sp_nve *nve); 47 int (*fdb_replay)(const struct net_device *nve_dev, __be32 vni, 48 struct netlink_ext_ack *extack); 49 void (*fdb_clear_offload)(const struct net_device *nve_dev, __be32 vni); 50}; 51 52extern const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops; 53extern const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops; 54 55#endif