drivers/net/ethernet/marvell/prestera/prestera_router_hw.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/prestera/prestera_router_hw.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/marvell/prestera/prestera_router_hw.h
Extension
.h
Size
4875 bytes
Lines
156
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct prestera_vr {
	struct list_head router_node;
	refcount_t refcount;
	u32 tb_id;			/* key (kernel fib table id) */
	u16 hw_vr_id;			/* virtual router ID */
	u8 __pad[2];
};

struct prestera_rif_entry {
	struct prestera_rif_entry_key {
		struct prestera_iface iface;
	} key;
	struct prestera_vr *vr;
	unsigned char addr[ETH_ALEN];
	u16 hw_id; /* rif_id */
	struct list_head router_node; /* ht */
};

struct prestera_ip_addr {
	union {
		__be32 ipv4;
		struct in6_addr ipv6;
	} u;
	enum {
		PRESTERA_IPV4 = 0,
		PRESTERA_IPV6
	} v;
#define PRESTERA_IP_ADDR_PLEN(V) ((V) == PRESTERA_IPV4 ? 32 : \
				  /* (V) == PRESTERA_IPV6 ? */ 128 /* : 0 */)
};

struct prestera_nh_neigh_key {
	struct prestera_ip_addr addr;
	/* Seems like rif is obsolete, because there is iface in info ?
	 * Key can contain functional fields, or fields, which is used to
	 * filter duplicate objects on logical level (before you pass it to
	 * HW)... also key can be used to cover hardware restrictions.
	 * In our case rif - is logical interface (even can be VLAN), which
	 * is used in combination with IP address (which is also not related to
	 * hardware nexthop) to provide logical compression of created nexthops.
	 * You even can imagine, that rif+IPaddr is just cookie.
	 */
	/* struct prestera_rif *rif; */
	/* Use just as cookie, to divide ARP domains (in order with addr) */
	void *rif;
};

/* Used for hw call */
struct prestera_neigh_info {
	struct prestera_iface iface;
	unsigned char ha[ETH_ALEN];
	u8 connected; /* bool. indicate, if mac/oif valid */
	u8 __pad[1];
};

/* Used to notify nh about neigh change */
struct prestera_nh_neigh {
	struct prestera_nh_neigh_key key;
	struct prestera_neigh_info info;
	struct rhash_head ht_node; /* node of prestera_vr */
	struct list_head nexthop_group_list;
};

#define PRESTERA_NHGR_SIZE_MAX 4

struct prestera_nexthop_group {
	struct prestera_nexthop_group_key {
		struct prestera_nh_neigh_key neigh[PRESTERA_NHGR_SIZE_MAX];
	} key;
	/* Store intermediate object here.
	 * This prevent overhead kzalloc call.
	 */
	/* nh_neigh is used only to notify nexthop_group */
	struct prestera_nh_neigh_head {
		struct prestera_nexthop_group *this;
		struct list_head head;
		/* ptr to neigh is not necessary.
		 * It used to prevent lookup of nh_neigh by key (n) on destroy
		 */
		struct prestera_nh_neigh *neigh;
	} nh_neigh_head[PRESTERA_NHGR_SIZE_MAX];
	struct rhash_head ht_node; /* node of prestera_vr */
	refcount_t refcount;
	u32 grp_id; /* hw */
};

struct prestera_fib_key {
	struct prestera_ip_addr addr;
	u32 prefix_len;
	u32 tb_id;

Annotation

Implementation Notes