drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/aq_ptp.c- Extension
.c- Size
- 42695 bytes
- Lines
- 1718
- 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/ptp_clock_kernel.hlinux/ptp_classify.hlinux/interrupt.hlinux/clocksource.haq_nic.haq_ptp.haq_ring.haq_phy.haq_filters.h
Detected Declarations
struct ptp_skb_ringstruct ptp_tx_timeoutstruct ptp_tm_offsetstruct aq_ptp_senum ptp_speed_offsetsfunction aq_ptp_tm_offset_setfunction __aq_ptp_skb_putfunction aq_ptp_skb_putfunction aq_ptp_skb_buf_lenfunction aq_ptp_skb_ring_initfunction aq_ptp_skb_ring_cleanfunction aq_ptp_skb_ring_releasefunction aq_ptp_tx_timeout_initfunction aq_ptp_tx_timeout_startfunction aq_ptp_tx_timeout_updatefunction aq_ptp_tx_timeout_checkfunction aq_ptp_tx_skb_drop_headfunction aq_ptp_adjfinefunction aq_ptp_adjtimefunction aq_ptp_gettimefunction aq_ptp_settimefunction aq_ptp_convert_to_hwtstampfunction aq_ptp_hw_pin_conffunction aq_ptp_perout_pin_configurefunction aq_ptp_pps_pin_configurefunction aq_ptp_extts_pin_ctrlfunction aq_ptp_extts_pin_configurefunction aq_ptp_gpio_feature_enablefunction aq_ptp_verifyfunction aq_ptp_tx_hwtstampfunction aq_ptp_fill_udpv4_mcfunction aq_ptp_fill_udpv6_mcfunction aq_ptp_add_a2_filterfunction aq_ptp_dpath_enablefunction aq_ptp_rx_hwtstampfunction aq_ptp_hwtstamp_config_getfunction aq_ptp_parse_rx_filtersfunction aq_ptp_hwtstamp_config_setfunction aq_ptp_ringfunction aq_ptp_extract_tsfunction aq_ptp_pollfunction aq_ptp_isrfunction aq_ptp_xmitfunction aq_ptp_service_taskfunction aq_ptp_irq_allocfunction aq_ptp_irq_freefunction aq_ptp_ring_initfunction aq_ptp_ring_start
Annotated Snippet
struct ptp_skb_ring {
struct sk_buff **buff;
spinlock_t lock;
unsigned int size;
unsigned int head;
unsigned int tail;
};
struct ptp_tx_timeout {
spinlock_t lock;
bool active;
unsigned long tx_start;
};
struct ptp_tm_offset {
unsigned int mbps;
int egress;
int ingress;
};
struct aq_ptp_s {
struct aq_nic_s *aq_nic;
struct kernel_hwtstamp_config hwtstamp_config;
spinlock_t ptp_lock;
spinlock_t ptp_ring_lock;
struct mutex ptp_filter_lock; /* serializes aq_ptp_dpath_enable() */
struct ptp_clock *ptp_clock;
struct ptp_clock_info ptp_info;
atomic_t offset_egress;
atomic_t offset_ingress;
struct aq_ring_param_s ptp_ring_param;
struct ptp_tx_timeout ptp_tx_timeout;
unsigned int idx_ptp_vector;
struct napi_struct napi;
struct aq_ring_s ptp_tx;
struct aq_ring_s ptp_rx;
struct aq_ring_s hwts_rx;
struct ptp_skb_ring skb_ring;
struct aq_rx_filter_l3l4 udp_filter[PTP_UDP_FILTERS_CNT];
struct aq_rx_filter_l2 eth_type_filter;
struct delayed_work poll_sync;
u32 poll_timeout_ms;
bool extts_pin_enabled;
u64 last_sync1588_ts;
/* TSG clock selection: 0 - PTP, 1 - PTM */
u32 ptp_clock_sel;
bool a1_ptp;
bool a2_ptp;
struct ptp_tm_offset ptp_offset[6];
};
void aq_ptp_tm_offset_set(struct aq_nic_s *aq_nic, unsigned int mbps)
{
struct aq_ptp_s *aq_ptp = aq_nic->aq_ptp;
int i, egress, ingress;
if (!aq_ptp)
return;
egress = 0;
ingress = 0;
for (i = 0; i < ARRAY_SIZE(aq_ptp->ptp_offset); i++) {
if (mbps == aq_ptp->ptp_offset[i].mbps) {
egress = aq_ptp->ptp_offset[i].egress;
ingress = aq_ptp->ptp_offset[i].ingress;
break;
}
}
atomic_set(&aq_ptp->offset_egress, egress);
atomic_set(&aq_ptp->offset_ingress, ingress);
}
static int __aq_ptp_skb_put(struct ptp_skb_ring *ring, struct sk_buff *skb)
{
unsigned int next_head = (ring->head + 1) % ring->size;
if (next_head == ring->tail)
Annotation
- Immediate include surface: `linux/ptp_clock_kernel.h`, `linux/ptp_classify.h`, `linux/interrupt.h`, `linux/clocksource.h`, `aq_nic.h`, `aq_ptp.h`, `aq_ring.h`, `aq_phy.h`.
- Detected declarations: `struct ptp_skb_ring`, `struct ptp_tx_timeout`, `struct ptp_tm_offset`, `struct aq_ptp_s`, `enum ptp_speed_offsets`, `function aq_ptp_tm_offset_set`, `function __aq_ptp_skb_put`, `function aq_ptp_skb_put`, `function aq_ptp_skb_buf_len`, `function aq_ptp_skb_ring_init`.
- 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.