drivers/net/dsa/hirschmann/hellcreek.h

Source file repositories/reference/linux-study-clean/drivers/net/dsa/hirschmann/hellcreek.h

File Facts

System
Linux kernel
Corpus path
drivers/net/dsa/hirschmann/hellcreek.h
Extension
.h
Size
9486 bytes
Lines
325
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 hellcreek_counter {
	u8 offset;
	const char *name;
};

struct hellcreek;

/* State flags for hellcreek_port_hwtstamp::state */
enum {
	HELLCREEK_HWTSTAMP_ENABLED,
	HELLCREEK_HWTSTAMP_TX_IN_PROGRESS,
};

/* A structure to hold hardware timestamping information per port */
struct hellcreek_port_hwtstamp {
	/* Timestamping state */
	unsigned long state;

	/* Resources for receive timestamping */
	struct sk_buff_head rx_queue; /* For synchronization messages */

	/* Resources for transmit timestamping */
	unsigned long tx_tstamp_start;
	struct sk_buff *tx_skb;

	/* Current timestamp configuration */
	struct kernel_hwtstamp_config tstamp_config;
};

struct hellcreek_port {
	struct hellcreek *hellcreek;
	unsigned long *vlan_dev_bitmap;
	int port;
	u16 ptcfg;		/* ptcfg shadow */
	u64 *counter_values;

	/* Per-port timestamping resources */
	struct hellcreek_port_hwtstamp port_hwtstamp;

	/* Per-port Qbv schedule information */
	struct tc_taprio_qopt_offload *current_schedule;
	struct delayed_work schedule_work;
};

struct hellcreek_fdb_entry {
	size_t idx;
	unsigned char mac[ETH_ALEN];
	u8 portmask;
	u8 age;
	u8 is_obt;
	u8 pass_blocked;
	u8 is_static;
	u8 reprio_tc;
	u8 reprio_en;
};

struct hellcreek {
	const struct hellcreek_platform_data *pdata;
	struct device *dev;
	struct dsa_switch *ds;
	struct ptp_clock *ptp_clock;
	struct ptp_clock_info ptp_clock_info;
	struct delayed_work overflow_work;
	struct led_classdev led_is_gm;
	struct led_classdev led_sync_good;
	struct mutex reg_lock;	/* Switch IP register lock */
	struct mutex vlan_lock;	/* VLAN bitmaps lock */
	struct mutex ptp_lock;	/* PTP IP register lock */
	struct devlink_region *vlan_region;
	struct devlink_region *fdb_region;
	void __iomem *base;
	void __iomem *ptp_base;
	u16 swcfg;		/* swcfg shadow */
	u8 *vidmbrcfg;		/* vidmbrcfg shadow */
	u64 seconds;		/* PTP seconds */
	u64 last_ts;		/* Used for overflow detection */
	u16 status_out;		/* ptp.status_out shadow */
	size_t fdb_entries;
	struct hellcreek_port ports[];
};

/* A Qbv schedule can only started up to 8 seconds in the future. If the delta
 * between the base time and the current ptp time is larger than 8 seconds, then
 * use periodic work to check for the schedule to be started. The delayed work
 * cannot be armed directly to $base_time - 8 + X, because for large deltas the
 * PTP frequency matters.
 */
#define HELLCREEK_SCHEDULE_PERIOD	(2 * HZ)
#define dw_to_hellcreek_port(dw)				\
	container_of(dw, struct hellcreek_port, schedule_work)

Annotation

Implementation Notes