drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c- Extension
.c- Size
- 50115 bytes
- Lines
- 1533
- 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
ixgbe.hlinux/ptp_classify.hlinux/clocksource.h
Detected Declarations
function shiftfunction ixgbe_ptp_setup_sdp_X550function ixgbe_ptp_read_X550function ixgbe_ptp_read_82599function ixgbe_ptp_convert_to_hwtstampfunction ixgbe_ptp_adjfine_82599function ixgbe_ptp_adjfine_X550function ixgbe_ptp_adjtimefunction ixgbe_ptp_gettimexfunction ixgbe_ptp_settimefunction enablefunction ixgbe_ptp_check_pps_eventfunction ixgbe_ptp_overflow_checkfunction ixgbe_ptp_rx_hangfunction ixgbe_ptp_clear_tx_timestampfunction ixgbe_ptp_tx_hangfunction ixgbe_ptp_tx_hwtstampfunction ixgbe_ptp_tx_hwtstamp_workfunction ixgbe_ptp_rx_pktstampfunction ixgbe_ptp_rx_rgtstampfunction ixgbe_ptp_hwtstamp_getfunction ixgbe_ptp_set_timestamp_modefunction ixgbe_ptp_hwtstamp_setfunction ixgbe_ptp_link_speed_adjustfunction ixgbe_ptp_start_cyclecounterfunction ixgbe_ptp_init_systimefunction ixgbe_ptp_resetfunction clockfunction ixgbe_ptp_initfunction ixgbe_ptp_suspendfunction ixgbe_ptp_stop
Annotated Snippet
if (hw->mac.type >= ixgbe_mac_X550) {
tsync_rx_ctl |= IXGBE_TSYNCRXCTL_TYPE_ALL;
config->rx_filter = HWTSTAMP_FILTER_ALL;
aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
break;
}
fallthrough;
default:
/*
* register RXMTRL must be set in order to do V1 packets,
* therefore it is not possible to time stamp both V1 Sync and
* Delay_Req messages and hardware does not support
* timestamping all packets => return error
*/
config->rx_filter = HWTSTAMP_FILTER_NONE;
return -ERANGE;
}
if (hw->mac.type == ixgbe_mac_82598EB) {
adapter->flags &= ~(IXGBE_FLAG_RX_HWTSTAMP_ENABLED |
IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER);
if (tsync_rx_ctl | tsync_tx_ctl)
return -ERANGE;
return 0;
}
/* Per-packet timestamping only works if the filter is set to all
* packets. Since this is desired, always timestamp all packets as long
* as any Rx filter was configured.
*/
switch (hw->mac.type) {
case ixgbe_mac_X550:
case ixgbe_mac_X550EM_x:
case ixgbe_mac_x550em_a:
case ixgbe_mac_e610:
/* enable timestamping all packets only if at least some
* packets were requested. Otherwise, play nice and disable
* timestamping
*/
if (config->rx_filter == HWTSTAMP_FILTER_NONE)
break;
tsync_rx_ctl = IXGBE_TSYNCRXCTL_ENABLED |
IXGBE_TSYNCRXCTL_TYPE_ALL |
IXGBE_TSYNCRXCTL_TSIP_UT_EN;
config->rx_filter = HWTSTAMP_FILTER_ALL;
aflags |= IXGBE_FLAG_RX_HWTSTAMP_ENABLED;
aflags &= ~IXGBE_FLAG_RX_HWTSTAMP_IN_REGISTER;
is_l2 = true;
break;
default:
break;
}
/* define ethertype filter for timestamping L2 packets */
if (is_l2)
IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588),
(IXGBE_ETQF_FILTER_EN | /* enable filter */
IXGBE_ETQF_1588 | /* enable timestamping */
ETH_P_1588)); /* 1588 eth protocol type */
else
IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588), 0);
/* enable/disable TX */
regval = IXGBE_READ_REG(hw, IXGBE_TSYNCTXCTL);
regval &= ~IXGBE_TSYNCTXCTL_ENABLED;
regval |= tsync_tx_ctl;
IXGBE_WRITE_REG(hw, IXGBE_TSYNCTXCTL, regval);
/* enable/disable RX */
regval = IXGBE_READ_REG(hw, IXGBE_TSYNCRXCTL);
regval &= ~(IXGBE_TSYNCRXCTL_ENABLED | IXGBE_TSYNCRXCTL_TYPE_MASK);
regval |= tsync_rx_ctl;
IXGBE_WRITE_REG(hw, IXGBE_TSYNCRXCTL, regval);
/* define which PTP packets are time stamped */
IXGBE_WRITE_REG(hw, IXGBE_RXMTRL, tsync_rx_mtrl);
IXGBE_WRITE_FLUSH(hw);
/* configure adapter flags only when HW is actually configured */
adapter->flags = aflags;
/* clear TX/RX time stamp registers, just to be sure */
ixgbe_ptp_clear_tx_timestamp(adapter);
IXGBE_READ_REG(hw, IXGBE_RXSTMPH);
return 0;
}
Annotation
- Immediate include surface: `ixgbe.h`, `linux/ptp_classify.h`, `linux/clocksource.h`.
- Detected declarations: `function shift`, `function ixgbe_ptp_setup_sdp_X550`, `function ixgbe_ptp_read_X550`, `function ixgbe_ptp_read_82599`, `function ixgbe_ptp_convert_to_hwtstamp`, `function ixgbe_ptp_adjfine_82599`, `function ixgbe_ptp_adjfine_X550`, `function ixgbe_ptp_adjtime`, `function ixgbe_ptp_gettimex`, `function ixgbe_ptp_settime`.
- 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.