drivers/net/ethernet/pensando/ionic/ionic_phc.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/pensando/ionic/ionic_phc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/pensando/ionic/ionic_phc.c- Extension
.c- Size
- 17838 bytes
- Lines
- 662
- 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
linux/netdevice.hlinux/etherdevice.hionic.hionic_bus.hionic_lif.hionic_ethtool.h
Detected Declarations
function ionic_hwstamp_tx_modefunction ionic_hwstamp_rx_filtfunction ionic_lif_hwstamp_set_ts_configfunction ionic_hwstamp_setfunction ionic_lif_hwstamp_replayfunction ionic_lif_hwstamp_recreate_queuesfunction ionic_hwstamp_getfunction ionic_hwstamp_readfunction ionic_cc_readfunction ionic_setphc_cmdfunction ionic_phc_adjfinefunction ionic_phc_adjtimefunction ionic_phc_settime64function ionic_phc_gettimex64function ionic_phc_aux_workfunction ionic_lif_phc_ktimefunction ionic_lif_register_phcfunction ionic_lif_unregister_phcfunction ionic_lif_alloc_phcfunction ionic_lif_free_phc
Annotated Snippet
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"Error creating TX timestamp queue");
goto err_queues;
}
}
if (rx_filt) {
err = ionic_lif_create_hwstamp_rxq(lif);
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"Error creating RX timestamp queue");
goto err_queues;
}
}
if (tx_mode != lif->phc->ts_config_tx_mode) {
err = ionic_lif_set_hwstamp_txmode(lif, tx_mode);
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"Error enabling TX timestamp mode");
goto err_txmode;
}
}
if (rx_filt != lif->phc->ts_config_rx_filt) {
err = ionic_lif_set_hwstamp_rxfilt(lif, rx_filt);
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"Error enabling RX timestamp mode");
goto err_rxfilt;
}
}
if (rx_all != (lif->phc->ts_config.rx_filter == HWTSTAMP_FILTER_ALL)) {
err = ionic_lif_config_hwstamp_rxq_all(lif, rx_all);
if (err) {
NL_SET_ERR_MSG_MOD(extack,
"Error enabling RX timestamp mode");
goto err_rxall;
}
}
memcpy(&lif->phc->ts_config, config, sizeof(*config));
lif->phc->ts_config_rx_filt = rx_filt;
lif->phc->ts_config_tx_mode = tx_mode;
mutex_unlock(&lif->phc->config_lock);
return 0;
err_rxall:
if (rx_filt != lif->phc->ts_config_rx_filt) {
rx_filt = lif->phc->ts_config_rx_filt;
err2 = ionic_lif_set_hwstamp_rxfilt(lif, rx_filt);
if (err2)
dev_err(ionic->dev,
"Failed to revert rx timestamp filter: %d\n", err2);
}
err_rxfilt:
if (tx_mode != lif->phc->ts_config_tx_mode) {
tx_mode = lif->phc->ts_config_tx_mode;
err2 = ionic_lif_set_hwstamp_txmode(lif, tx_mode);
if (err2)
dev_err(ionic->dev,
"Failed to revert tx timestamp mode: %d\n", err2);
}
err_txmode:
/* special queues remain allocated, just unused */
err_queues:
mutex_unlock(&lif->phc->config_lock);
return err;
}
int ionic_hwstamp_set(struct net_device *netdev,
struct kernel_hwtstamp_config *config,
struct netlink_ext_ack *extack)
{
struct ionic_lif *lif = netdev_priv(netdev);
int err;
if (!lif->phc || !lif->phc->ptp)
return -EOPNOTSUPP;
mutex_lock(&lif->queue_lock);
err = ionic_lif_hwstamp_set_ts_config(lif, config, extack);
mutex_unlock(&lif->queue_lock);
if (err) {
netdev_info(lif->netdev, "hwstamp set failed: %d\n", err);
return err;
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/etherdevice.h`, `ionic.h`, `ionic_bus.h`, `ionic_lif.h`, `ionic_ethtool.h`.
- Detected declarations: `function ionic_hwstamp_tx_mode`, `function ionic_hwstamp_rx_filt`, `function ionic_lif_hwstamp_set_ts_config`, `function ionic_hwstamp_set`, `function ionic_lif_hwstamp_replay`, `function ionic_lif_hwstamp_recreate_queues`, `function ionic_hwstamp_get`, `function ionic_hwstamp_read`, `function ionic_cc_read`, `function ionic_setphc_cmd`.
- 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.