linux/drivers/net/ethernet/marvell/prestera/prestera_router_hw.c

// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0
/* Copyright (c) 2019-2021 Marvell International Ltd. All rights reserved */

#include <linux/rhashtable.h>

#include "prestera.h"
#include "prestera_hw.h"
#include "prestera_router_hw.h"
#include "prestera_acl.h"

/*                                Nexthop is pointed
 *                                to port (not rif)
 *                                +-------+
 *                              +>|nexthop|
 *                              | +-------+
 *                              |
 *            +--+        +-----++
 *   +------->|vr|<-+   +>|nh_grp|
 *   |        +--+  |   | +------+
 *   |              |   |
 * +-+-------+   +--+---+-+
 * |rif_entry|   |fib_node|
 * +---------+   +--------+
 *  Rif is        Fib - is exit point
 *  used as
 *  entry point
 *  for vr in hw
 */

#define PRESTERA_NHGR_UNUSED
#define PRESTERA_NHGR_DROP
/* Need to merge it with router_manager */
#define PRESTERA_NH_ACTIVE_JIFFER_FILTER

static const struct rhashtable_params __prestera_fib_ht_params =;

static const struct rhashtable_params __prestera_nh_neigh_ht_params =;

static const struct rhashtable_params __prestera_nexthop_group_ht_params =;

static int prestera_nexthop_group_set(struct prestera_switch *sw,
				      struct prestera_nexthop_group *nh_grp);
static bool
prestera_nexthop_group_util_hw_state(struct prestera_switch *sw,
				     struct prestera_nexthop_group *nh_grp);
static void prestera_fib_node_destroy_ht_cb(void *ptr, void *arg);

/* TODO: move to router.h as macros */
static bool prestera_nh_neigh_key_is_valid(struct prestera_nh_neigh_key *key)
{}

int prestera_router_hw_init(struct prestera_switch *sw)
{}

void prestera_router_hw_fini(struct prestera_switch *sw)
{}

static struct prestera_vr *__prestera_vr_find(struct prestera_switch *sw,
					      u32 tb_id)
{}

static struct prestera_vr *__prestera_vr_create(struct prestera_switch *sw,
						u32 tb_id,
						struct netlink_ext_ack *extack)
{}

static void __prestera_vr_destroy(struct prestera_switch *sw,
				  struct prestera_vr *vr)
{}

static struct prestera_vr *prestera_vr_get(struct prestera_switch *sw, u32 tb_id,
					   struct netlink_ext_ack *extack)
{}

static void prestera_vr_put(struct prestera_switch *sw, struct prestera_vr *vr)
{}

/* iface is overhead struct. vr_id also can be removed. */
static int
__prestera_rif_entry_key_copy(const struct prestera_rif_entry_key *in,
			      struct prestera_rif_entry_key *out)
{}

struct prestera_rif_entry *
prestera_rif_entry_find(const struct prestera_switch *sw,
			const struct prestera_rif_entry_key *k)
{}

void prestera_rif_entry_destroy(struct prestera_switch *sw,
				struct prestera_rif_entry *e)
{}

struct prestera_rif_entry *
prestera_rif_entry_create(struct prestera_switch *sw,
			  struct prestera_rif_entry_key *k,
			  u32 tb_id, const unsigned char *addr)
{}

static void __prestera_nh_neigh_destroy(struct prestera_switch *sw,
					struct prestera_nh_neigh *neigh)
{}

static struct prestera_nh_neigh *
__prestera_nh_neigh_create(struct prestera_switch *sw,
			   struct prestera_nh_neigh_key *key)
{}

struct prestera_nh_neigh *
prestera_nh_neigh_find(struct prestera_switch *sw,
		       struct prestera_nh_neigh_key *key)
{}

struct prestera_nh_neigh *
prestera_nh_neigh_get(struct prestera_switch *sw,
		      struct prestera_nh_neigh_key *key)
{}

void prestera_nh_neigh_put(struct prestera_switch *sw,
			   struct prestera_nh_neigh *neigh)
{}

/* Updates new prestera_neigh_info */
int prestera_nh_neigh_set(struct prestera_switch *sw,
			  struct prestera_nh_neigh *neigh)
{}

bool prestera_nh_neigh_util_hw_state(struct prestera_switch *sw,
				     struct prestera_nh_neigh *nh_neigh)
{}

static struct prestera_nexthop_group *
__prestera_nexthop_group_create(struct prestera_switch *sw,
				struct prestera_nexthop_group_key *key)
{}

static void
__prestera_nexthop_group_destroy(struct prestera_switch *sw,
				 struct prestera_nexthop_group *nh_grp)
{}

static struct prestera_nexthop_group *
__prestera_nexthop_group_find(struct prestera_switch *sw,
			      struct prestera_nexthop_group_key *key)
{}

static struct prestera_nexthop_group *
prestera_nexthop_group_get(struct prestera_switch *sw,
			   struct prestera_nexthop_group_key *key)
{}

static void prestera_nexthop_group_put(struct prestera_switch *sw,
				       struct prestera_nexthop_group *nh_grp)
{}

/* Updates with new nh_neigh's info */
static int prestera_nexthop_group_set(struct prestera_switch *sw,
				      struct prestera_nexthop_group *nh_grp)
{}

static bool
prestera_nexthop_group_util_hw_state(struct prestera_switch *sw,
				     struct prestera_nexthop_group *nh_grp)
{}

struct prestera_fib_node *
prestera_fib_node_find(struct prestera_switch *sw, struct prestera_fib_key *key)
{}

static void __prestera_fib_node_destruct(struct prestera_switch *sw,
					 struct prestera_fib_node *fib_node)
{}

void prestera_fib_node_destroy(struct prestera_switch *sw,
			       struct prestera_fib_node *fib_node)
{}

static void prestera_fib_node_destroy_ht_cb(void *ptr, void *arg)
{}

struct prestera_fib_node *
prestera_fib_node_create(struct prestera_switch *sw,
			 struct prestera_fib_key *key,
			 enum prestera_fib_type fib_type,
			 struct prestera_nexthop_group_key *nh_grp_key)
{}