1 /* SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0 */
2 /* Copyright (c) 2019-2021 Marvell International Ltd. All rights reserved. */
3 
4 #ifndef _PRESTERA_ROUTER_HW_H_
5 #define _PRESTERA_ROUTER_HW_H_
6 
7 struct prestera_vr {
8 	struct list_head router_node;
9 	refcount_t refcount;
10 	u32 tb_id;			/* key (kernel fib table id) */
11 	u16 hw_vr_id;			/* virtual router ID */
12 	u8 __pad[2];
13 };
14 
15 struct prestera_rif_entry {
16 	struct prestera_rif_entry_key {
17 		struct prestera_iface iface;
18 	} key;
19 	struct prestera_vr *vr;
20 	unsigned char addr[ETH_ALEN];
21 	u16 hw_id; /* rif_id */
22 	struct list_head router_node; /* ht */
23 };
24 
25 struct prestera_rif_entry *
26 prestera_rif_entry_find(const struct prestera_switch *sw,
27 			const struct prestera_rif_entry_key *k);
28 void prestera_rif_entry_destroy(struct prestera_switch *sw,
29 				struct prestera_rif_entry *e);
30 struct prestera_rif_entry *
31 prestera_rif_entry_create(struct prestera_switch *sw,
32 			  struct prestera_rif_entry_key *k,
33 			  u32 tb_id, const unsigned char *addr);
34 int prestera_router_hw_init(struct prestera_switch *sw);
35 void prestera_router_hw_fini(struct prestera_switch *sw);
36 
37 #endif /* _PRESTERA_ROUTER_HW_H_ */
38