drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c- Extension
.c- Size
- 78103 bytes
- Lines
- 2731
- 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.
- 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.
- 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
pch_gbe.hpch_gbe_phy.hlinux/gpio/consumer.hlinux/gpio/machine.hlinux/iopoll.hlinux/module.hlinux/net_tstamp.hlinux/ptp_classify.hlinux/ptp_pch.hlinux/gpio.h
Detected Declarations
function pch_ptp_matchfunction pch_rx_timestampfunction pch_tx_timestampfunction pch_gbe_hwtstamp_setfunction pch_gbe_hwtstamp_getfunction pch_gbe_mac_load_mac_addrfunction pch_gbe_mac_read_mac_addrfunction pch_gbe_wait_clr_bitfunction pch_gbe_mac_mar_setfunction pch_gbe_mac_reset_hwfunction pch_gbe_disable_mac_rxfunction pch_gbe_enable_mac_rxfunction pch_gbe_mac_init_rx_addrsfunction pch_gbe_mac_force_mac_fcfunction pch_gbe_mac_set_wol_eventfunction pch_gbe_mac_ctrl_miimfunction pch_gbe_mac_set_pause_packetfunction pch_gbe_alloc_queuesfunction pch_gbe_init_statsfunction pch_gbe_init_phyfunction pch_gbe_mdio_readfunction pch_gbe_mdio_writefunction pch_gbe_reset_taskfunction pch_gbe_reinit_lockedfunction pch_gbe_resetfunction pch_gbe_free_irqfunction pch_gbe_irq_disablefunction pch_gbe_irq_enablefunction pch_gbe_setup_tctlfunction pch_gbe_configure_txfunction pch_gbe_setup_rctlfunction pch_gbe_configure_rxfunction pch_gbe_unmap_and_free_tx_resourcefunction pch_gbe_unmap_and_free_rx_resourcefunction pch_gbe_clean_tx_ringfunction pch_gbe_clean_rx_ringfunction pch_gbe_set_rgmii_ctrlfunction pch_gbe_set_modefunction pch_gbe_watchdogfunction pch_gbe_tx_queuefunction pch_gbe_update_statsfunction pch_gbe_disable_dma_rxfunction pch_gbe_enable_dma_rxfunction pch_gbe_intrfunction pch_gbe_alloc_rx_buffersfunction pch_gbe_alloc_rx_buffers_poolfunction pch_gbe_alloc_tx_buffersfunction pch_gbe_clean_tx
Annotated Snippet
static const struct net_device_ops pch_gbe_netdev_ops = {
.ndo_open = pch_gbe_open,
.ndo_stop = pch_gbe_stop,
.ndo_start_xmit = pch_gbe_xmit_frame,
.ndo_set_mac_address = pch_gbe_set_mac,
.ndo_tx_timeout = pch_gbe_tx_timeout,
.ndo_change_mtu = pch_gbe_change_mtu,
.ndo_set_features = pch_gbe_set_features,
.ndo_eth_ioctl = pch_gbe_ioctl,
.ndo_set_rx_mode = pch_gbe_set_multi,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = pch_gbe_netpoll,
#endif
.ndo_hwtstamp_get = pch_gbe_hwtstamp_get,
.ndo_hwtstamp_set = pch_gbe_hwtstamp_set,
};
static pci_ers_result_t pch_gbe_io_error_detected(struct pci_dev *pdev,
pci_channel_state_t state)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
netif_device_detach(netdev);
if (netif_running(netdev))
pch_gbe_down(adapter);
pci_disable_device(pdev);
/* Request a slot slot reset. */
return PCI_ERS_RESULT_NEED_RESET;
}
static pci_ers_result_t pch_gbe_io_slot_reset(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_hw *hw = &adapter->hw;
if (pci_enable_device(pdev)) {
netdev_err(netdev, "Cannot re-enable PCI device after reset\n");
return PCI_ERS_RESULT_DISCONNECT;
}
pci_set_master(pdev);
pci_enable_wake(pdev, PCI_D0, 0);
pch_gbe_phy_power_up(hw);
pch_gbe_reset(adapter);
/* Clear wake up status */
pch_gbe_mac_set_wol_event(hw, 0);
return PCI_ERS_RESULT_RECOVERED;
}
static void pch_gbe_io_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
if (netif_running(netdev)) {
if (pch_gbe_up(adapter)) {
netdev_dbg(netdev,
"can't bring device back up after reset\n");
return;
}
}
netif_device_attach(netdev);
}
static int __pch_gbe_suspend(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
struct pch_gbe_adapter *adapter = netdev_priv(netdev);
struct pch_gbe_hw *hw = &adapter->hw;
u32 wufc = adapter->wake_up_evt;
netif_device_detach(netdev);
if (netif_running(netdev))
pch_gbe_down(adapter);
if (wufc) {
pch_gbe_set_multi(netdev);
pch_gbe_setup_rctl(adapter);
pch_gbe_configure_rx(adapter);
pch_gbe_set_rgmii_ctrl(adapter, hw->mac.link_speed,
hw->mac.link_duplex);
pch_gbe_set_mode(adapter, hw->mac.link_speed,
hw->mac.link_duplex);
pch_gbe_mac_set_wol_event(hw, wufc);
pci_disable_device(pdev);
} else {
pch_gbe_phy_power_down(hw);
pch_gbe_mac_set_wol_event(hw, wufc);
pci_disable_device(pdev);
Annotation
- Immediate include surface: `pch_gbe.h`, `pch_gbe_phy.h`, `linux/gpio/consumer.h`, `linux/gpio/machine.h`, `linux/iopoll.h`, `linux/module.h`, `linux/net_tstamp.h`, `linux/ptp_classify.h`.
- Detected declarations: `function pch_ptp_match`, `function pch_rx_timestamp`, `function pch_tx_timestamp`, `function pch_gbe_hwtstamp_set`, `function pch_gbe_hwtstamp_get`, `function pch_gbe_mac_load_mac_addr`, `function pch_gbe_mac_read_mac_addr`, `function pch_gbe_wait_clr_bit`, `function pch_gbe_mac_mar_set`, `function pch_gbe_mac_reset_hw`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.