drivers/net/ethernet/aquantia/atlantic/aq_nic.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/aq_nic.c- Extension
.c- Size
- 43630 bytes
- Lines
- 1736
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
aq_nic.haq_ring.haq_vec.haq_hw.haq_pci_func.haq_macsec.haq_main.haq_phy.haq_ptp.haq_filters.hlinux/moduleparam.hlinux/netdevice.hlinux/etherdevice.hlinux/timer.hlinux/cpu.hlinux/ip.hlinux/tcp.hnet/ip.hnet/pkt_cls.h
Detected Declarations
function aq_nic_rss_initfunction aq_nic_cfg_update_num_vecsfunction aq_nic_cfg_startfunction aq_nic_update_link_statusfunction aq_linkstate_threaded_isrfunction aq_nic_service_taskfunction aq_nic_service_timer_cbfunction aq_nic_polling_timer_cbfunction aq_nic_hw_preparefunction aq_nic_is_valid_ether_addrfunction aq_nic_ndev_registerfunction aq_nic_ndev_initfunction aq_nic_set_tx_ringfunction aq_nic_initfunction aq_nic_startfunction aq_nic_map_xdpfunction aq_nic_map_skbfunction aq_ptp_ringfunction aq_nic_xmit_xdpffunction aq_nic_xmitfunction AQ_NIC_RING2QMAPfunction aq_nic_update_interrupt_moderation_settingsfunction aq_nic_set_packet_filterfunction aq_nic_set_multicast_listfunction netdev_for_each_uc_addrfunction netdev_for_each_mc_addrfunction aq_nic_set_mtufunction aq_nic_set_macfunction aq_nic_get_link_speedfunction aq_nic_get_regsfunction aq_nic_get_regs_countfunction aq_nic_update_ndev_statsfunction aq_nic_get_link_ksettingsfunction aq_nic_set_link_ksettingsfunction aq_nic_get_fw_versionfunction aq_nic_set_loopbackfunction aq_nic_stopfunction aq_nic_set_powerfunction aq_nic_deinitfunction likelyfunction aq_nic_free_vectorsfunction aq_nic_realloc_vectorsfunction aq_nic_shutdownfunction aq_nic_reserve_filterfunction aq_nic_release_filterfunction aq_nic_set_downshiftfunction aq_nic_set_media_detectfunction aq_nic_setup_tc_mqprio
Annotated Snippet
if (self->aq_ptp) {
/* AQC113 TSG requires >= 100 Mbps full-duplex: below 100 Mbps
* timestamp resolution is insufficient for IEEE 1588, and
* half-duplex collision domains make TX/RX correlation unreliable.
*/
bool ptp_link_good = (self->aq_hw->aq_link_status.mbps >= 100 &&
self->aq_hw->aq_link_status.full_duplex);
aq_ptp_clock_init(self, ptp_link_good ? AQ_PTP_LINK_UP : AQ_PTP_NO_LINK);
aq_ptp_tm_offset_set(self,
self->aq_hw->aq_link_status.mbps);
aq_ptp_link_change(self);
}
/* Driver has to update flow control settings on RX block
* on any link event.
* We should query FW whether it negotiated FC.
*/
if (self->aq_hw_ops->hw_set_fc)
self->aq_hw_ops->hw_set_fc(self->aq_hw, fc, 0);
}
self->link_status = self->aq_hw->aq_link_status;
if (!netif_carrier_ok(self->ndev) && self->link_status.mbps) {
aq_utils_obj_set(&self->flags,
AQ_NIC_FLAG_STARTED);
aq_utils_obj_clear(&self->flags,
AQ_NIC_LINK_DOWN);
netif_carrier_on(self->ndev);
#if IS_ENABLED(CONFIG_MACSEC)
aq_macsec_enable(self);
#endif
if (self->aq_hw_ops->hw_tc_rate_limit_set)
self->aq_hw_ops->hw_tc_rate_limit_set(self->aq_hw);
netif_tx_wake_all_queues(self->ndev);
}
if (netif_carrier_ok(self->ndev) && !self->link_status.mbps) {
netif_carrier_off(self->ndev);
netif_tx_disable(self->ndev);
aq_utils_obj_set(&self->flags, AQ_NIC_LINK_DOWN);
}
return 0;
}
static irqreturn_t aq_linkstate_threaded_isr(int irq, void *private)
{
struct aq_nic_s *self = private;
if (!self)
return IRQ_NONE;
aq_nic_update_link_status(self);
self->aq_hw_ops->hw_irq_enable(self->aq_hw,
BIT(self->aq_nic_cfg.link_irq_vec));
return IRQ_HANDLED;
}
static void aq_nic_service_task(struct work_struct *work)
{
struct aq_nic_s *self = container_of(work, struct aq_nic_s,
service_task);
int err;
aq_ptp_service_task(self);
if (aq_utils_obj_test(&self->flags, AQ_NIC_FLAGS_IS_NOT_READY))
return;
err = aq_nic_update_link_status(self);
if (err)
return;
#if IS_ENABLED(CONFIG_MACSEC)
aq_macsec_work(self);
#endif
mutex_lock(&self->fwreq_mutex);
if (self->aq_fw_ops->update_stats)
self->aq_fw_ops->update_stats(self->aq_hw);
mutex_unlock(&self->fwreq_mutex);
aq_nic_update_ndev_stats(self);
}
static void aq_nic_service_timer_cb(struct timer_list *t)
{
Annotation
- Immediate include surface: `aq_nic.h`, `aq_ring.h`, `aq_vec.h`, `aq_hw.h`, `aq_pci_func.h`, `aq_macsec.h`, `aq_main.h`, `aq_phy.h`.
- Detected declarations: `function aq_nic_rss_init`, `function aq_nic_cfg_update_num_vecs`, `function aq_nic_cfg_start`, `function aq_nic_update_link_status`, `function aq_linkstate_threaded_isr`, `function aq_nic_service_task`, `function aq_nic_service_timer_cb`, `function aq_nic_polling_timer_cb`, `function aq_nic_hw_prepare`, `function aq_nic_is_valid_ether_addr`.
- 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.