Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
0002 /* Copyright (c) 2018 Mellanox Technologies. All rights reserved */
0003 
0004 #ifndef _MLXSW_SPECTRUM_NVE_H
0005 #define _MLXSW_SPECTRUM_NVE_H
0006 
0007 #include <linux/netlink.h>
0008 #include <linux/rhashtable.h>
0009 
0010 #include "spectrum.h"
0011 
0012 struct mlxsw_sp_nve_config {
0013     enum mlxsw_sp_nve_type type;
0014     u8 ttl;
0015     u8 learning_en:1;
0016     __be16 udp_dport;
0017     __be32 flowlabel;
0018     u32 ul_tb_id;
0019     enum mlxsw_sp_l3proto ul_proto;
0020     union mlxsw_sp_l3addr ul_sip;
0021 };
0022 
0023 struct mlxsw_sp_nve {
0024     struct mlxsw_sp_nve_config config;
0025     struct rhashtable mc_list_ht;
0026     struct rhashtable ipv6_ht;
0027     struct list_head ipv6_addr_list; /* Saves hash table nodes. */
0028     struct mlxsw_sp *mlxsw_sp;
0029     const struct mlxsw_sp_nve_ops **nve_ops_arr;
0030     unsigned int num_nve_tunnels;   /* Protected by RTNL */
0031     unsigned int num_max_mc_entries[MLXSW_SP_L3_PROTO_MAX];
0032     u32 tunnel_index;
0033     u16 ul_rif_index;   /* Reserved for Spectrum */
0034 };
0035 
0036 struct mlxsw_sp_nve_ops {
0037     enum mlxsw_sp_nve_type type;
0038     bool (*can_offload)(const struct mlxsw_sp_nve *nve,
0039                 const struct mlxsw_sp_nve_params *params,
0040                 struct netlink_ext_ack *extack);
0041     void (*nve_config)(const struct mlxsw_sp_nve *nve,
0042                const struct mlxsw_sp_nve_params *params,
0043                struct mlxsw_sp_nve_config *config);
0044     int (*init)(struct mlxsw_sp_nve *nve,
0045             const struct mlxsw_sp_nve_config *config);
0046     void (*fini)(struct mlxsw_sp_nve *nve);
0047     int (*fdb_replay)(const struct net_device *nve_dev, __be32 vni,
0048               struct netlink_ext_ack *extack);
0049     void (*fdb_clear_offload)(const struct net_device *nve_dev, __be32 vni);
0050 };
0051 
0052 extern const struct mlxsw_sp_nve_ops mlxsw_sp1_nve_vxlan_ops;
0053 extern const struct mlxsw_sp_nve_ops mlxsw_sp2_nve_vxlan_ops;
0054 
0055 #endif