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.
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ip.hlinux/udp.hlinux/time.hlinux/errno.hlinux/ktime.hlinux/module.hlinux/pps_kernel.hlinux/ptp_clock_kernel.hnet_driver.hefx.hmcdi.hmcdi_pcol.hio.htx.hnic.hefx_channels.h
Detected Declarations
struct efx_ptp_matchstruct efx_ptp_event_rxstruct efx_ptp_timesetstruct efx_ptp_rxfilterstruct efx_ptp_dataenum ptp_packet_statefunction efx_ptp_use_mac_tx_timestampsfunction efx_ptp_want_txqsfunction efx_ptp_describe_statsfunction efx_ptp_update_statsfunction efx_ptp_ns_to_s27function efx_ptp_s27_to_ktimefunction efx_ptp_s27_to_ktime_correctionfunction efx_ptp_ns_to_s_qnsfunction efx_ptp_s_qns_to_ktime_correctionfunction efx_ptp_update_channelfunction last_sync_timestamp_majorfunction efx_ptp_mac_nic_to_ktime_correctionfunction efx_ptp_nic_to_kernel_timefunction efx_ptp_get_attributesfunction efx_ptp_get_timestamp_correctionsfunction efx_ptp_enablefunction efx_ptp_disablefunction efx_ptp_deliver_rx_queuefunction efx_ptp_handle_no_channelfunction efx_ptp_send_timesfunction READ_ONCEfunction efx_ptp_read_timesetfunction efx_ptp_process_timesfunction efx_ptp_synchronizefunction efx_ptp_xmit_skb_queuefunction efx_ptp_xmit_skb_mcfunction efx_ptp_process_eventsfunction efx_ptp_process_rxfunction efx_ptp_find_filterfunction list_for_each_entryfunction efx_ptp_remove_one_filterfunction efx_ptp_remove_filtersfunction efx_ptp_init_filterfunction efx_ptp_insert_filterfunction efx_ptp_insert_ipv4_filterfunction efx_ptp_insert_ipv6_filterfunction efx_ptp_insert_eth_multicast_filterfunction efx_ptp_insert_multicast_filtersfunction efx_ptp_valid_unicast_event_pktfunction efx_ptp_insert_unicast_filterfunction efx_ptp_startfunction efx_ptp_stop
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
- Immediate include surface: `linux/ip.h`, `linux/udp.h`, `linux/time.h`, `linux/errno.h`, `linux/ktime.h`, `linux/module.h`, `linux/pps_kernel.h`, `linux/ptp_clock_kernel.h`.
- Detected declarations: `struct efx_ptp_match`, `struct efx_ptp_event_rx`, `struct efx_ptp_timeset`, `struct efx_ptp_rxfilter`, `struct efx_ptp_data`, `enum ptp_packet_state`, `function efx_ptp_use_mac_tx_timestamps`, `function efx_ptp_want_txqs`, `function efx_ptp_describe_stats`, `function efx_ptp_update_stats`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.