drivers/net/ethernet/cavium/common/cavium_ptp.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/cavium/common/cavium_ptp.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/cavium/common/cavium_ptp.h- Extension
.h- Size
- 1437 bytes
- Lines
- 71
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/ptp_clock_kernel.hlinux/timecounter.h
Detected Declarations
struct cavium_ptpfunction cavium_ptp_tstamp2timefunction cavium_ptp_clock_indexfunction cavium_ptp_putfunction cavium_ptp_clock_index
Annotated Snippet
struct cavium_ptp {
struct pci_dev *pdev;
/* Serialize access to cycle_counter, time_counter and hw_registers */
spinlock_t spin_lock;
struct cyclecounter cycle_counter;
struct timecounter time_counter;
void __iomem *reg_base;
u32 clock_rate;
struct ptp_clock_info ptp_info;
struct ptp_clock *ptp_clock;
};
#if IS_REACHABLE(CONFIG_CAVIUM_PTP)
struct cavium_ptp *cavium_ptp_get(void);
void cavium_ptp_put(struct cavium_ptp *ptp);
static inline u64 cavium_ptp_tstamp2time(struct cavium_ptp *ptp, u64 tstamp)
{
unsigned long flags;
u64 ret;
spin_lock_irqsave(&ptp->spin_lock, flags);
ret = timecounter_cyc2time(&ptp->time_counter, tstamp);
spin_unlock_irqrestore(&ptp->spin_lock, flags);
return ret;
}
static inline int cavium_ptp_clock_index(struct cavium_ptp *clock)
{
return ptp_clock_index(clock->ptp_clock);
}
#else
static inline struct cavium_ptp *cavium_ptp_get(void)
{
return ERR_PTR(-ENODEV);
}
static inline void cavium_ptp_put(struct cavium_ptp *ptp) {}
static inline u64 cavium_ptp_tstamp2time(struct cavium_ptp *ptp, u64 tstamp)
{
return 0;
}
static inline int cavium_ptp_clock_index(struct cavium_ptp *clock)
{
return -1;
}
#endif
#endif
Annotation
- Immediate include surface: `linux/ptp_clock_kernel.h`, `linux/timecounter.h`.
- Detected declarations: `struct cavium_ptp`, `function cavium_ptp_tstamp2time`, `function cavium_ptp_clock_index`, `function cavium_ptp_put`, `function cavium_ptp_clock_index`.
- 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.
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.