linux/drivers/net/ethernet/mellanox/mlxsw/spectrum_ipip.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
   2/* Copyright (c) 2017-2018 Mellanox Technologies. All rights reserved */
   3
   4#ifndef _MLXSW_IPIP_H_
   5#define _MLXSW_IPIP_H_
   6
   7#include "spectrum_router.h"
   8#include <net/ip_fib.h>
   9#include <linux/if_tunnel.h>
  10
  11struct ip_tunnel_parm
  12mlxsw_sp_ipip_netdev_parms4(const struct net_device *ol_dev);
  13struct __ip6_tnl_parm
  14mlxsw_sp_ipip_netdev_parms6(const struct net_device *ol_dev);
  15
  16union mlxsw_sp_l3addr
  17mlxsw_sp_ipip_netdev_saddr(enum mlxsw_sp_l3proto proto,
  18                           const struct net_device *ol_dev);
  19
  20bool mlxsw_sp_l3addr_is_zero(union mlxsw_sp_l3addr addr);
  21
  22enum mlxsw_sp_ipip_type {
  23        MLXSW_SP_IPIP_TYPE_GRE4,
  24        MLXSW_SP_IPIP_TYPE_MAX,
  25};
  26
  27struct mlxsw_sp_ipip_entry {
  28        enum mlxsw_sp_ipip_type ipipt;
  29        struct net_device *ol_dev; /* Overlay. */
  30        struct mlxsw_sp_rif_ipip_lb *ol_lb;
  31        struct mlxsw_sp_fib_entry *decap_fib_entry;
  32        struct list_head ipip_list_node;
  33        union {
  34                struct ip_tunnel_parm parms4;
  35        };
  36};
  37
  38struct mlxsw_sp_ipip_ops {
  39        int dev_type;
  40        enum mlxsw_sp_l3proto ul_proto; /* Underlay. */
  41
  42        int (*nexthop_update)(struct mlxsw_sp *mlxsw_sp, u32 adj_index,
  43                              struct mlxsw_sp_ipip_entry *ipip_entry,
  44                              bool force, char *ratr_pl);
  45
  46        bool (*can_offload)(const struct mlxsw_sp *mlxsw_sp,
  47                            const struct net_device *ol_dev);
  48
  49        /* Return a configuration for creating an overlay loopback RIF. */
  50        struct mlxsw_sp_rif_ipip_lb_config
  51        (*ol_loopback_config)(struct mlxsw_sp *mlxsw_sp,
  52                              const struct net_device *ol_dev);
  53
  54        int (*decap_config)(struct mlxsw_sp *mlxsw_sp,
  55                            struct mlxsw_sp_ipip_entry *ipip_entry,
  56                            u32 tunnel_index);
  57
  58        int (*ol_netdev_change)(struct mlxsw_sp *mlxsw_sp,
  59                                struct mlxsw_sp_ipip_entry *ipip_entry,
  60                                struct netlink_ext_ack *extack);
  61};
  62
  63extern const struct mlxsw_sp_ipip_ops *mlxsw_sp_ipip_ops_arr[];
  64
  65#endif /* _MLXSW_IPIP_H_*/
  66