#include <linux/mutex.h>
#include <linux/rhashtable.h>
#include <net/ipv6.h>
#include "spectrum_mr.h"
#include "spectrum_router.h"
struct mlxsw_sp_mr { … };
struct mlxsw_sp_mr_vif;
struct mlxsw_sp_mr_vif_ops { … };
struct mlxsw_sp_mr_vif { … };
struct mlxsw_sp_mr_route_vif_entry { … };
struct mlxsw_sp_mr_table;
struct mlxsw_sp_mr_table_ops { … };
struct mlxsw_sp_mr_table { … };
struct mlxsw_sp_mr_route { … };
static const struct rhashtable_params mlxsw_sp_mr_route_ht_params = …;
static bool mlxsw_sp_mr_vif_valid(const struct mlxsw_sp_mr_vif *vif)
{ … }
static bool mlxsw_sp_mr_vif_exists(const struct mlxsw_sp_mr_vif *vif)
{ … }
static bool
mlxsw_sp_mr_route_ivif_in_evifs(const struct mlxsw_sp_mr_route *mr_route)
{ … }
static int
mlxsw_sp_mr_route_valid_evifs_num(const struct mlxsw_sp_mr_route *mr_route)
{ … }
static enum mlxsw_sp_mr_route_action
mlxsw_sp_mr_route_action(const struct mlxsw_sp_mr_route *mr_route)
{ … }
static enum mlxsw_sp_mr_route_prio
mlxsw_sp_mr_route_prio(const struct mlxsw_sp_mr_route *mr_route)
{ … }
static int mlxsw_sp_mr_route_evif_link(struct mlxsw_sp_mr_route *mr_route,
struct mlxsw_sp_mr_vif *mr_vif)
{ … }
static void
mlxsw_sp_mr_route_evif_unlink(struct mlxsw_sp_mr_route_vif_entry *rve)
{ … }
static void mlxsw_sp_mr_route_ivif_link(struct mlxsw_sp_mr_route *mr_route,
struct mlxsw_sp_mr_vif *mr_vif)
{ … }
static void mlxsw_sp_mr_route_ivif_unlink(struct mlxsw_sp_mr_route *mr_route)
{ … }
static int
mlxsw_sp_mr_route_info_create(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route *mr_route,
struct mlxsw_sp_mr_route_info *route_info)
{ … }
static void
mlxsw_sp_mr_route_info_destroy(struct mlxsw_sp_mr_route_info *route_info)
{ … }
static int mlxsw_sp_mr_route_write(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route *mr_route,
bool replace)
{ … }
static void mlxsw_sp_mr_route_erase(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route *mr_route)
{ … }
static struct mlxsw_sp_mr_route *
mlxsw_sp_mr_route_create(struct mlxsw_sp_mr_table *mr_table,
struct mr_mfc *mfc)
{ … }
static void mlxsw_sp_mr_route_destroy(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route *mr_route)
{ … }
static void mlxsw_sp_mr_mfc_offload_set(struct mlxsw_sp_mr_route *mr_route,
bool offload)
{ … }
static void mlxsw_sp_mr_mfc_offload_update(struct mlxsw_sp_mr_route *mr_route)
{ … }
static void __mlxsw_sp_mr_route_del(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route *mr_route)
{ … }
int mlxsw_sp_mr_route_add(struct mlxsw_sp_mr_table *mr_table,
struct mr_mfc *mfc, bool replace)
{ … }
void mlxsw_sp_mr_route_del(struct mlxsw_sp_mr_table *mr_table,
struct mr_mfc *mfc)
{ … }
static int
mlxsw_sp_mr_route_ivif_resolve(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_vif_entry *rve)
{ … }
static void
mlxsw_sp_mr_route_ivif_unresolve(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_vif_entry *rve)
{ … }
static int
mlxsw_sp_mr_route_evif_resolve(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_vif_entry *rve)
{ … }
static void
mlxsw_sp_mr_route_evif_unresolve(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_vif_entry *rve)
{ … }
static int mlxsw_sp_mr_vif_resolve(struct mlxsw_sp_mr_table *mr_table,
struct net_device *dev,
struct mlxsw_sp_mr_vif *mr_vif,
unsigned long vif_flags,
const struct mlxsw_sp_rif *rif)
{ … }
static void mlxsw_sp_mr_vif_unresolve(struct mlxsw_sp_mr_table *mr_table,
struct net_device *dev,
struct mlxsw_sp_mr_vif *mr_vif)
{ … }
int mlxsw_sp_mr_vif_add(struct mlxsw_sp_mr_table *mr_table,
struct net_device *dev, vifi_t vif_index,
unsigned long vif_flags, const struct mlxsw_sp_rif *rif)
{ … }
void mlxsw_sp_mr_vif_del(struct mlxsw_sp_mr_table *mr_table, vifi_t vif_index)
{ … }
static struct mlxsw_sp_mr_vif *
mlxsw_sp_mr_dev_vif_lookup(struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_rif *rif)
{ … }
int mlxsw_sp_mr_rif_add(struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_rif *rif)
{ … }
void mlxsw_sp_mr_rif_del(struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_rif *rif)
{ … }
void mlxsw_sp_mr_rif_mtu_update(struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_rif *rif, int mtu)
{ … }
static bool
mlxsw_sp_mr_route4_validate(const struct mlxsw_sp_mr_table *mr_table,
const struct mr_mfc *c)
{ … }
static void mlxsw_sp_mr_route4_key(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_key *key,
struct mr_mfc *c)
{ … }
static bool mlxsw_sp_mr_route4_starg(const struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_mr_route *mr_route)
{ … }
static bool mlxsw_sp_mr_vif4_is_regular(const struct mlxsw_sp_mr_vif *vif)
{ … }
static bool
mlxsw_sp_mr_route6_validate(const struct mlxsw_sp_mr_table *mr_table,
const struct mr_mfc *c)
{ … }
static void mlxsw_sp_mr_route6_key(struct mlxsw_sp_mr_table *mr_table,
struct mlxsw_sp_mr_route_key *key,
struct mr_mfc *c)
{ … }
static bool mlxsw_sp_mr_route6_starg(const struct mlxsw_sp_mr_table *mr_table,
const struct mlxsw_sp_mr_route *mr_route)
{ … }
static bool mlxsw_sp_mr_vif6_is_regular(const struct mlxsw_sp_mr_vif *vif)
{ … }
static struct
mlxsw_sp_mr_vif_ops mlxsw_sp_mr_vif_ops_arr[] = …;
static struct
mlxsw_sp_mr_table_ops mlxsw_sp_mr_table_ops_arr[] = …;
struct mlxsw_sp_mr_table *mlxsw_sp_mr_table_create(struct mlxsw_sp *mlxsw_sp,
u32 vr_id,
enum mlxsw_sp_l3proto proto)
{ … }
void mlxsw_sp_mr_table_destroy(struct mlxsw_sp_mr_table *mr_table)
{ … }
void mlxsw_sp_mr_table_flush(struct mlxsw_sp_mr_table *mr_table)
{ … }
bool mlxsw_sp_mr_table_empty(const struct mlxsw_sp_mr_table *mr_table)
{ … }
static void mlxsw_sp_mr_route_stats_update(struct mlxsw_sp *mlxsw_sp,
struct mlxsw_sp_mr_route *mr_route)
{ … }
static void mlxsw_sp_mr_stats_update(struct work_struct *work)
{ … }
int mlxsw_sp_mr_init(struct mlxsw_sp *mlxsw_sp,
const struct mlxsw_sp_mr_ops *mr_ops)
{ … }
void mlxsw_sp_mr_fini(struct mlxsw_sp *mlxsw_sp)
{ … }