drivers/net/ethernet/broadcom/asp2/bcmasp.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/asp2/bcmasp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/asp2/bcmasp.c- Extension
.c- Size
- 40197 bytes
- Lines
- 1472
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
linux/etherdevice.hlinux/if_vlan.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/kernel.hlinux/platform_device.hlinux/of.hlinux/of_address.hlinux/of_platform.hlinux/clk.hbcmasp.hbcmasp_intf_defs.h
Detected Declarations
enum asp_netfilt_reg_typeenum asp_rx_filter_idfunction Copyrightfunction _intr2_mask_setfunction bcmasp_enable_phy_irqfunction bcmasp_enable_tx_irqfunction bcmasp_enable_rx_irqfunction bcmasp_intr2_mask_set_allfunction bcmasp_intr2_clear_allfunction bcmasp_intr2_handlingfunction bcmasp_isrfunction bcmasp_flush_rx_portfunction bcmasp_netfilt_hw_en_wakefunction bcmasp_netfilt_get_reg_offsetfunction bcmasp_netfilt_wrfunction bcmasp_netfilt_rdfunction bcmasp_netfilt_wr_m_wakefunction bcmasp_netfilt_reset_hwfunction bcmasp_netfilt_tcpip4_wrfunction bcmasp_netfilt_tcpip6_wrfunction bcmasp_netfilt_wr_to_hwfunction bcmasp_netfilt_suspendfunction bcmasp_netfilt_get_all_activefunction bcmasp_netfilt_get_activefunction bcmasp_netfilt_check_dupfunction bcmasp_netfilt_releasefunction bcmasp_addr_to_uintfunction bcmasp_set_mda_filterfunction bcmasp_en_mda_filterfunction bcmasp_total_res_mda_cntfunction bcmasp_set_promiscfunction bcmasp_set_allmultifunction bcmasp_set_broadfunction bcmasp_set_oaddrfunction bcmasp_disable_all_filtersfunction bcmasp_combine_set_filterfunction bcmasp_set_en_mda_filterfunction bcmasp_core_init_filtersfunction bcmasp_core_initfunction bcmasp_core_clock_select_manyfunction bcmasp_core_clock_select_onefunction bcmasp_core_clock_select_one_ctrl2function bcmasp_core_clock_set_llfunction bcmasp_core_clock_setfunction bcmasp_core_clock_set_intffunction bcmasp_isr_wolfunction bcmasp_get_and_request_irqfunction bcmasp_init_wol
Annotated Snippet
if (likely(napi_schedule_prep(&intf->rx_napi))) {
bcmasp_enable_rx_irq(intf, 0);
__napi_schedule_irqoff(&intf->rx_napi);
}
}
if (status & ASP_INTR2_TX_DESC(intf->channel)) {
if (likely(napi_schedule_prep(&intf->tx_napi))) {
bcmasp_enable_tx_irq(intf, 0);
__napi_schedule_irqoff(&intf->tx_napi);
}
}
if (status & ASP_INTR2_PHY_EVENT(intf->channel))
phy_mac_interrupt(intf->ndev->phydev);
}
static irqreturn_t bcmasp_isr(int irq, void *data)
{
struct bcmasp_priv *priv = data;
struct bcmasp_intf *intf;
u32 status;
status = intr2_core_rl(priv, ASP_INTR2_STATUS) &
~intr2_core_rl(priv, ASP_INTR2_MASK_STATUS);
intr2_core_wl(priv, status, ASP_INTR2_CLEAR);
if (unlikely(status == 0)) {
dev_warn(&priv->pdev->dev, "l2 spurious interrupt\n");
return IRQ_NONE;
}
/* Handle intferfaces */
list_for_each_entry(intf, &priv->intfs, list)
bcmasp_intr2_handling(intf, status);
return IRQ_HANDLED;
}
void bcmasp_flush_rx_port(struct bcmasp_intf *intf)
{
struct bcmasp_priv *priv = intf->parent;
u32 mask;
switch (intf->port) {
case 0:
mask = ASP_CTRL_UMAC0_FLUSH_MASK;
break;
case 1:
mask = ASP_CTRL_UMAC1_FLUSH_MASK;
break;
case 2:
mask = ASP_CTRL_SPB_FLUSH_MASK;
break;
default:
/* Not valid port */
return;
}
rx_ctrl_core_wl(priv, mask, ASP_RX_CTRL_FLUSH);
}
static void bcmasp_netfilt_hw_en_wake(struct bcmasp_priv *priv,
struct bcmasp_net_filter *nfilt)
{
rx_filter_core_wl(priv, ASP_RX_FILTER_NET_OFFSET_L3_1(64),
ASP_RX_FILTER_NET_OFFSET(nfilt->hw_index));
rx_filter_core_wl(priv, ASP_RX_FILTER_NET_OFFSET_L2(32) |
ASP_RX_FILTER_NET_OFFSET_L3_0(32) |
ASP_RX_FILTER_NET_OFFSET_L3_1(96) |
ASP_RX_FILTER_NET_OFFSET_L4(32),
ASP_RX_FILTER_NET_OFFSET(nfilt->hw_index + 1));
rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->ch) |
ASP_RX_FILTER_NET_CFG_EN |
ASP_RX_FILTER_NET_CFG_L2_EN |
ASP_RX_FILTER_NET_CFG_L3_EN |
ASP_RX_FILTER_NET_CFG_L4_EN |
ASP_RX_FILTER_NET_CFG_L3_FRM(2) |
ASP_RX_FILTER_NET_CFG_L4_FRM(2) |
ASP_RX_FILTER_NET_CFG_UMC(nfilt->port),
ASP_RX_FILTER_NET_CFG(nfilt->hw_index));
rx_filter_core_wl(priv, ASP_RX_FILTER_NET_CFG_CH(nfilt->ch) |
ASP_RX_FILTER_NET_CFG_EN |
ASP_RX_FILTER_NET_CFG_L2_EN |
ASP_RX_FILTER_NET_CFG_L3_EN |
ASP_RX_FILTER_NET_CFG_L4_EN |
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/if_vlan.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/of.h`.
- Detected declarations: `enum asp_netfilt_reg_type`, `enum asp_rx_filter_id`, `function Copyright`, `function _intr2_mask_set`, `function bcmasp_enable_phy_irq`, `function bcmasp_enable_tx_irq`, `function bcmasp_enable_rx_irq`, `function bcmasp_intr2_mask_set_all`, `function bcmasp_intr2_clear_all`, `function bcmasp_intr2_handling`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: integration 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.