drivers/net/dsa/netc/netc_switch.h

Source file repositories/reference/linux-study-clean/drivers/net/dsa/netc/netc_switch.h

File Facts

System
Linux kernel
Corpus path
drivers/net/dsa/netc/netc_switch.h
Extension
.h
Size
5633 bytes
Lines
207
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 netc_switch_info {
	u32 num_ports;
	void (*phylink_get_caps)(int port, struct phylink_config *config);
};

struct netc_port_caps {
	u32 half_duplex:1; /* indicates whether the port support half-duplex */
	u32 pmac:1;	  /* indicates whether the port has preemption MAC */
	u32 pseudo_link:1;
};

enum netc_host_reason {
	/* Software defined host reasons */
	NETC_HR_HOST_FLOOD = 8,
};

struct netc_port {
	void __iomem *iobase;
	struct netc_switch *switch_priv;
	struct netc_port_caps caps;
	struct dsa_port *dp;
	struct clk *ref_clk; /* RGMII/RMII reference clock */
	struct mii_bus *emdio;
	int ett_offset;

	u16 enable:1;
	u16 uc:1;
	u16 mc:1;
	u16 pvid;
	struct ipft_entry_data *host_flood;
};

struct netc_switch_regs {
	void __iomem *base;
	void __iomem *port;
	void __iomem *global;
};

struct netc_fdb_entry {
	u32 entry_id;
	struct fdbt_cfge_data cfge;
	struct fdbt_keye_data keye;
	struct hlist_node node;
};

struct netc_vlan_entry {
	u16 vid;
	u32 ect_gid;
	u32 untagged_port_bitmap;
	struct vft_cfge_data cfge;
	struct hlist_node node;
};

struct netc_port_stat {
	int reg;
	char name[ETH_GSTRING_LEN] __nonstring;
};

struct netc_switch {
	struct pci_dev *pdev;
	struct device *dev;
	struct dsa_switch *ds;
	u16 revision;

	const struct netc_switch_info *info;
	struct netc_switch_regs regs;
	struct netc_port **ports;
	u32 port_bitmap; /* bitmap of available ports */

	struct ntmp_user ntmp;
	struct hlist_head fdb_list;
	struct mutex fdbt_lock; /* FDB table lock */
	struct delayed_work fdbt_ageing_work;
	/* (fdbt_ageing_delay * NETC_FDBT_AGEING_THRESH) is ageing time */
	unsigned long fdbt_ageing_delay;
	atomic_t br_cnt;
	struct hlist_head vlan_list;
	struct mutex vft_lock; /* VLAN filter table lock */

	/* Switch hardware capabilities */
	u32 htmcapr_num_words;
	u32 num_bp;

	struct bpt_cfge_data *bpt_list;
};

#define NETC_PRIV(ds)			((struct netc_switch *)((ds)->priv))
#define NETC_PORT(ds, port_id)		(NETC_PRIV(ds)->ports[(port_id)])

/* Write/Read Switch base registers */

Annotation

Implementation Notes