drivers/net/ethernet/sfc/ptp.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/ptp.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/sfc/ptp.c
Extension
.c
Size
67418 bytes
Lines
2239
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 efx_ptp_match {
	unsigned long expiry;
	enum ptp_packet_state state;
};

/**
 * struct efx_ptp_event_rx - A PTP receive event (from MC)
 * @link: list of events
 * @seq0: First part of (PTP) UUID
 * @seq1: Second part of (PTP) UUID and sequence number
 * @hwtimestamp: Event timestamp
 * @expiry: Time which the packet arrived
 */
struct efx_ptp_event_rx {
	struct list_head link;
	u32 seq0;
	u32 seq1;
	ktime_t hwtimestamp;
	unsigned long expiry;
};

/**
 * struct efx_ptp_timeset - Synchronisation between host and MC
 * @host_start: Host time immediately before hardware timestamp taken
 * @major: Hardware timestamp, major
 * @minor: Hardware timestamp, minor
 * @host_end: Host time immediately after hardware timestamp taken
 * @wait: Number of NIC clock ticks between hardware timestamp being read and
 *          host end time being seen
 * @window: Difference of host_end and host_start
 * @valid: Whether this timeset is valid
 */
struct efx_ptp_timeset {
	u32 host_start;
	u32 major;
	u32 minor;
	u32 host_end;
	u32 wait;
	u32 window;	/* Derived: end - start, allowing for wrap */
};

/**
 * struct efx_ptp_rxfilter - Filter for PTP packets
 * @list: Node of the list where the filter is added
 * @ether_type: Network protocol of the filter (ETHER_P_IP / ETHER_P_IPV6)
 * @loc_port: UDP port of the filter (PTP_EVENT_PORT / PTP_GENERAL_PORT)
 * @loc_host: IPv4/v6 address of the filter
 * @expiry: time when the filter expires, in jiffies
 * @handle: Handle ID for the MCDI filters table
 */
struct efx_ptp_rxfilter {
	struct list_head list;
	__be16 ether_type;
	__be16 loc_port;
	__be32 loc_host[4];
	unsigned long expiry;
	int handle;
};

/**
 * struct efx_ptp_data - Precision Time Protocol (PTP) state
 * @efx: The NIC context
 * @channel: The PTP channel (for Medford and Medford2)
 * @rxq: Receive SKB queue (awaiting timestamps)
 * @txq: Transmit SKB queue
 * @workwq: Work queue for processing pending PTP operations
 * @work: Work task
 * @cleanup_work: Work task for periodic cleanup
 * @reset_required: A serious error has occurred and the PTP task needs to be
 *                  reset (disable, enable).
 * @rxfilters_mcast: Receive filters for multicast PTP packets
 * @rxfilters_ucast: Receive filters for unicast PTP packets
 * @config: Current timestamp configuration
 * @enabled: PTP operation enabled
 * @mode: Mode in which PTP operating (PTP version)
 * @ns_to_nic_time: Function to convert from scalar nanoseconds to NIC time
 * @nic_to_kernel_time: Function to convert from NIC to kernel time
 * @nic_time: contains time details
 * @nic_time.minor_max: Wrap point for NIC minor times
 * @nic_time.sync_event_diff_min: Minimum acceptable difference between time
 * in packet prefix and last MCDI time sync event i.e. how much earlier than
 * the last sync event time a packet timestamp can be.
 * @nic_time.sync_event_diff_max: Maximum acceptable difference between time
 * in packet prefix and last MCDI time sync event i.e. how much later than
 * the last sync event time a packet timestamp can be.
 * @nic_time.sync_event_minor_shift: Shift required to make minor time from
 * field in MCDI time sync event.
 * @min_synchronisation_ns: Minimum acceptable corrected sync window
 * @capabilities: Capabilities flags from the NIC
 * @ts_corrections: contains corrections details

Annotation

Implementation Notes