drivers/net/ethernet/aquantia/atlantic/aq_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/aquantia/atlantic/aq_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/aquantia/atlantic/aq_main.c- Extension
.c- Size
- 12306 bytes
- Lines
- 508
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
aq_main.haq_nic.haq_pci_func.haq_ethtool.haq_ptp.haq_filters.haq_hw_utils.haq_vec.hlinux/netdevice.hlinux/module.hlinux/ip.hlinux/ipv6.hlinux/udp.hnet/pkt_cls.hlinux/ptp_classify.hnet/pkt_sched.hlinux/filter.h
Detected Declarations
function aq_ndev_schedule_workfunction aq_ndev_openfunction aq_ndev_closefunction aq_ndev_start_xmitfunction aq_ndev_change_mtufunction aq_ndev_set_featuresfunction aq_ndev_fix_featuresfunction aq_ndev_set_mac_addressfunction aq_ndev_set_multicast_settingsfunction aq_ndev_hwtstamp_setfunction aq_ndev_hwtstamp_getfunction aq_ndo_vlan_rx_add_vidfunction aq_ndo_vlan_rx_kill_vidfunction aq_validate_mqprio_optfunction aq_ndo_setup_tcfunction aq_xdp_setupfunction aq_xdpfunction aq_ndev_init_modulefunction aq_ndev_exit_modulemodule init aq_ndev_init_moduleexport aq_xdp_locking_key
Annotated Snippet
static const struct net_device_ops aq_ndev_ops;
static struct workqueue_struct *aq_ndev_wq;
void aq_ndev_schedule_work(struct work_struct *work)
{
queue_work(aq_ndev_wq, work);
}
struct net_device *aq_ndev_alloc(void)
{
struct net_device *ndev = NULL;
struct aq_nic_s *aq_nic = NULL;
ndev = alloc_etherdev_mq(sizeof(struct aq_nic_s), AQ_HW_QUEUES_MAX);
if (!ndev)
return NULL;
aq_nic = netdev_priv(ndev);
aq_nic->ndev = ndev;
ndev->netdev_ops = &aq_ndev_ops;
ndev->ethtool_ops = &aq_ethtool_ops;
return ndev;
}
int aq_ndev_open(struct net_device *ndev)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
int err = 0;
err = aq_nic_init(aq_nic);
if (err < 0)
goto err_exit;
err = aq_nic_start(aq_nic);
if (err < 0) {
aq_nic_stop(aq_nic);
goto err_exit;
}
err_exit:
if (err < 0)
aq_nic_deinit(aq_nic, true);
return err;
}
int aq_ndev_close(struct net_device *ndev)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
int err = 0;
err = aq_nic_stop(aq_nic);
aq_nic_deinit(aq_nic, true);
return err;
}
static netdev_tx_t aq_ndev_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
struct aq_nic_s *aq_nic = netdev_priv(ndev);
#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
if (unlikely(aq_utils_obj_test(&aq_nic->flags, AQ_NIC_PTP_DPATH_UP))) {
/* Hardware adds the Timestamp for PTPv2 802.AS1
* and PTPv2 IPv4 UDP.
* We have to push even general 320 port messages to the ptp
* queue explicitly. This is a limitation of current firmware
* and hardware PTP design of the chip. Otherwise ptp stream
* will fail to sync
*/
if (unlikely(skb->protocol == htons(ETH_P_IP) &&
ip_hdr(skb)->protocol == IPPROTO_UDP &&
(udp_hdr(skb)->dest == htons(PTP_EV_PORT) ||
udp_hdr(skb)->dest == htons(PTP_GEN_PORT))))
return aq_ptp_xmit(aq_nic, skb);
/* PTP over IPv6 does not use extension headers */
if (unlikely(skb->protocol == htons(ETH_P_IPV6) &&
ipv6_hdr(skb)->nexthdr == IPPROTO_UDP &&
(udp_hdr(skb)->dest == htons(PTP_EV_PORT) ||
udp_hdr(skb)->dest == htons(PTP_GEN_PORT))))
return aq_ptp_xmit(aq_nic, skb);
if (unlikely(eth_hdr(skb)->h_proto == htons(ETH_P_1588)))
return aq_ptp_xmit(aq_nic, skb);
}
#endif
Annotation
- Immediate include surface: `aq_main.h`, `aq_nic.h`, `aq_pci_func.h`, `aq_ethtool.h`, `aq_ptp.h`, `aq_filters.h`, `aq_hw_utils.h`, `aq_vec.h`.
- Detected declarations: `function aq_ndev_schedule_work`, `function aq_ndev_open`, `function aq_ndev_close`, `function aq_ndev_start_xmit`, `function aq_ndev_change_mtu`, `function aq_ndev_set_features`, `function aq_ndev_fix_features`, `function aq_ndev_set_mac_address`, `function aq_ndev_set_multicast_settings`, `function aq_ndev_hwtstamp_set`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
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.