drivers/net/ethernet/intel/idpf/idpf_ptp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/idpf/idpf_ptp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/idpf/idpf_ptp.c- Extension
.c- Size
- 27944 bytes
- Lines
- 1025
- 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.
- 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
idpf.hidpf_ptp.h
Detected Declarations
function idpf_ptp_get_accessfunction idpf_ptp_get_features_accessfunction idpf_ptp_enable_shtimefunction idpf_ptp_read_src_clk_reg_directfunction idpf_ptp_read_src_clk_reg_mailboxfunction idpf_ptp_read_src_clk_regfunction idpf_ptp_get_sync_device_time_directfunction idpf_ptp_get_sync_device_time_mailboxfunction idpf_ptp_get_sync_device_timefunction idpf_ptp_get_crosststampfunction idpf_ptp_gettimex64function idpf_ptp_update_phctime_rxq_grpfunction idpf_ptp_update_cached_phctimefunction idpf_for_each_vportfunction idpf_ptp_settime64function idpf_ptp_adjtime_nonatomicfunction idpf_ptp_adjtimefunction idpf_ptp_adjfinefunction idpf_ptp_verify_pinfunction idpf_ptp_gpio_enablefunction idpf_ptp_tstamp_extend_32b_to_64bfunction idpf_ptp_extend_tsfunction idpf_ptp_request_tsfunction idpf_ptp_set_rx_tstampfunction idpf_ptp_set_timestamp_modefunction idpf_tstamp_taskfunction idpf_ptp_do_aux_workfunction idpf_ptp_set_capsfunction idpf_ptp_create_clockfunction idpf_ptp_release_vport_tstampfunction idpf_ptp_release_tstampfunction idpf_ptp_get_txq_tstamp_capabilityfunction idpf_ptp_initfunction idpf_ptp_release
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2024 Intel Corporation */
#include "idpf.h"
#include "idpf_ptp.h"
/**
* idpf_ptp_get_access - Determine the access type of the PTP features
* @adapter: Driver specific private structure
* @direct: Capability that indicates the direct access
* @mailbox: Capability that indicates the mailbox access
*
* Return: the type of supported access for the PTP feature.
*/
static enum idpf_ptp_access
idpf_ptp_get_access(const struct idpf_adapter *adapter, u32 direct, u32 mailbox)
{
if (adapter->ptp->caps & direct)
return IDPF_PTP_DIRECT;
else if (adapter->ptp->caps & mailbox)
return IDPF_PTP_MAILBOX;
else
return IDPF_PTP_NONE;
}
/**
* idpf_ptp_get_features_access - Determine the access type of PTP features
* @adapter: Driver specific private structure
*
* Fulfill the adapter structure with type of the supported PTP features
* access.
*/
void idpf_ptp_get_features_access(const struct idpf_adapter *adapter)
{
struct idpf_ptp *ptp = adapter->ptp;
u32 direct, mailbox;
/* Get the device clock time */
direct = VIRTCHNL2_CAP_PTP_GET_DEVICE_CLK_TIME;
mailbox = VIRTCHNL2_CAP_PTP_GET_DEVICE_CLK_TIME_MB;
ptp->get_dev_clk_time_access = idpf_ptp_get_access(adapter,
direct,
mailbox);
/* Get the cross timestamp */
direct = VIRTCHNL2_CAP_PTP_GET_CROSS_TIME;
mailbox = VIRTCHNL2_CAP_PTP_GET_CROSS_TIME_MB;
ptp->get_cross_tstamp_access = idpf_ptp_get_access(adapter,
direct,
mailbox);
/* Set the device clock time */
direct = VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME;
mailbox = VIRTCHNL2_CAP_PTP_SET_DEVICE_CLK_TIME_MB;
ptp->set_dev_clk_time_access = idpf_ptp_get_access(adapter,
direct,
mailbox);
/* Adjust the device clock time */
direct = VIRTCHNL2_CAP_PTP_ADJ_DEVICE_CLK;
mailbox = VIRTCHNL2_CAP_PTP_ADJ_DEVICE_CLK_MB;
ptp->adj_dev_clk_time_access = idpf_ptp_get_access(adapter,
direct,
mailbox);
/* Tx timestamping */
direct = VIRTCHNL2_CAP_PTP_TX_TSTAMPS;
mailbox = VIRTCHNL2_CAP_PTP_TX_TSTAMPS_MB;
ptp->tx_tstamp_access = idpf_ptp_get_access(adapter,
direct,
mailbox);
}
/**
* idpf_ptp_enable_shtime - Enable shadow time and execute a command
* @adapter: Driver specific private structure
*/
static void idpf_ptp_enable_shtime(struct idpf_adapter *adapter)
{
u32 shtime_enable, exec_cmd;
/* Get offsets */
shtime_enable = adapter->ptp->cmd.shtime_enable_mask;
exec_cmd = adapter->ptp->cmd.exec_cmd_mask;
/* Set the shtime en and the sync field */
writel(shtime_enable, adapter->ptp->dev_clk_regs.cmd_sync);
writel(exec_cmd | shtime_enable, adapter->ptp->dev_clk_regs.cmd_sync);
}
Annotation
- Immediate include surface: `idpf.h`, `idpf_ptp.h`.
- Detected declarations: `function idpf_ptp_get_access`, `function idpf_ptp_get_features_access`, `function idpf_ptp_enable_shtime`, `function idpf_ptp_read_src_clk_reg_direct`, `function idpf_ptp_read_src_clk_reg_mailbox`, `function idpf_ptp_read_src_clk_reg`, `function idpf_ptp_get_sync_device_time_direct`, `function idpf_ptp_get_sync_device_time_mailbox`, `function idpf_ptp_get_sync_device_time`, `function idpf_ptp_get_crosststamp`.
- 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.