drivers/net/dsa/sja1105/sja1105_main.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/sja1105/sja1105_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/sja1105/sja1105_main.c- Extension
.c- Size
- 97710 bytes
- Lines
- 3413
- 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/delay.hlinux/module.hlinux/printk.hlinux/spi/spi.hlinux/errno.hlinux/gpio/consumer.hlinux/phylink.hlinux/of.hlinux/of_net.hlinux/of_mdio.hlinux/netdev_features.hlinux/netdevice.hlinux/if_bridge.hlinux/if_ether.hlinux/dsa/8021q.hlinux/units.hsja1105.hsja1105_tas.h
Detected Declarations
function Copyrightfunction sja1105_port_allow_trafficfunction sja1105_can_forwardfunction sja1105_is_vlan_configuredfunction sja1105_drop_untaggedfunction sja1105_pvid_applyfunction sja1105_commit_pvidfunction sja1105_init_mac_settingsfunction list_for_each_entryfunction sja1105_init_mii_settingsfunction sja1105_init_static_fdbfunction sja1105_init_l2_lookup_paramsfunction routesfunction sja1105_init_l2_forwardingfunction list_for_each_entryfunction sja1110_init_pcp_remappingfunction sja1105_init_l2_forwarding_paramsfunction sja1105_frame_memory_partitioningfunction sja1110_select_tdmaconfigidxfunction sja1105_init_topologyfunction sja1105_init_general_paramsfunction sja1105_init_avb_paramsfunction classfunction sja1105_static_config_loadfunction sja1105_parse_rgmii_delaysfunction sja1105_parse_ports_nodefunction for_each_available_child_of_node_scopedfunction sja1105_parse_dtfunction sja1105_set_port_speedfunction sja1105_mac_select_pcsfunction sja1105_mac_configfunction sja1105_mac_link_upfunction sja1105_phylink_get_capsfunction sja1105_find_static_fdb_entryfunction sja1105_static_fdb_changefunction sja1105et_fdb_indexfunction sja1105et_is_fdb_entry_in_binfunction sja1105et_fdb_addfunction sja1105et_fdb_delfunction sja1105pqrs_fdb_addfunction sja1105pqrs_fdb_delfunction sja1105_fdb_addfunction __sja1105_fdb_delfunction sja1105_fdb_delfunction sja1105_fdb_dumpfunction sja1105_fast_agefunction sja1105_mdb_addfunction sja1105_mdb_del
Annotated Snippet
switch (priv->phy_mode[i]) {
case PHY_INTERFACE_MODE_INTERNAL:
if (priv->info->internal_phy[i] == SJA1105_NO_PHY)
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_MII;
if (priv->info->internal_phy[i] == SJA1105_PHY_BASE_TX)
mii->special[i] = true;
break;
case PHY_INTERFACE_MODE_REVMII:
role = XMII_PHY;
fallthrough;
case PHY_INTERFACE_MODE_MII:
if (!priv->info->supports_mii[i])
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_MII;
break;
case PHY_INTERFACE_MODE_REVRMII:
role = XMII_PHY;
fallthrough;
case PHY_INTERFACE_MODE_RMII:
if (!priv->info->supports_rmii[i])
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_RMII;
break;
case PHY_INTERFACE_MODE_RGMII:
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
if (!priv->info->supports_rgmii[i])
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_RGMII;
break;
case PHY_INTERFACE_MODE_SGMII:
if (!priv->info->supports_sgmii[i])
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_SGMII;
mii->special[i] = true;
break;
case PHY_INTERFACE_MODE_2500BASEX:
if (!priv->info->supports_2500basex[i])
goto unsupported;
mii->xmii_mode[i] = XMII_MODE_SGMII;
mii->special[i] = true;
break;
unsupported:
default:
dev_err(dev, "Unsupported PHY mode %s on port %d!\n",
phy_modes(priv->phy_mode[i]), i);
return -EINVAL;
}
mii->phy_mac[i] = role;
}
return 0;
}
static int sja1105_init_static_fdb(struct sja1105_private *priv)
{
struct sja1105_l2_lookup_entry *l2_lookup;
struct sja1105_table *table;
int port;
table = &priv->static_config.tables[BLK_IDX_L2_LOOKUP];
/* We only populate the FDB table through dynamic L2 Address Lookup
* entries, except for a special entry at the end which is a catch-all
* for unknown multicast and will be used to control flooding domain.
*/
if (table->entry_count) {
kfree(table->entries);
table->entry_count = 0;
}
if (!priv->info->can_limit_mcast_flood)
return 0;
table->entries = kcalloc(1, table->ops->unpacked_entry_size,
GFP_KERNEL);
if (!table->entries)
return -ENOMEM;
table->entry_count = 1;
l2_lookup = table->entries;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/printk.h`, `linux/spi/spi.h`, `linux/errno.h`, `linux/gpio/consumer.h`, `linux/phylink.h`, `linux/of.h`.
- Detected declarations: `function Copyright`, `function sja1105_port_allow_traffic`, `function sja1105_can_forward`, `function sja1105_is_vlan_configured`, `function sja1105_drop_untagged`, `function sja1105_pvid_apply`, `function sja1105_commit_pvid`, `function sja1105_init_mac_settings`, `function list_for_each_entry`, `function sja1105_init_mii_settings`.
- 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.