drivers/net/dsa/hirschmann/hellcreek.c
Source file repositories/reference/linux-study-clean/drivers/net/dsa/hirschmann/hellcreek.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/dsa/hirschmann/hellcreek.c- Extension
.c- Size
- 54565 bytes
- Lines
- 2114
- 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/kernel.hlinux/module.hlinux/device.hlinux/of.hlinux/of_mdio.hlinux/platform_device.hlinux/bitops.hlinux/if_bridge.hlinux/if_vlan.hlinux/etherdevice.hlinux/random.hlinux/iopoll.hlinux/mutex.hlinux/delay.hnet/dsa.hhellcreek.hhellcreek_ptp.hhellcreek_hwtstamp.h
Detected Declarations
function hellcreek_readfunction hellcreek_read_ctrlfunction hellcreek_read_statfunction hellcreek_writefunction hellcreek_select_portfunction hellcreek_select_priofunction hellcreek_select_port_priofunction hellcreek_select_counterfunction hellcreek_select_vlanfunction hellcreek_select_tgdfunction hellcreek_wait_until_readyfunction hellcreek_wait_until_transitionedfunction hellcreek_wait_fdb_readyfunction hellcreek_detectfunction hellcreek_feature_detectfunction hellcreek_get_tag_protocolfunction hellcreek_port_enablefunction hellcreek_port_disablefunction hellcreek_get_stringsfunction hellcreek_get_sset_countfunction hellcreek_get_ethtool_statsfunction hellcreek_private_vidfunction hellcreek_vlan_preparefunction hellcreek_select_vlan_paramsfunction hellcreek_apply_vlanfunction hellcreek_unapply_vlanfunction hellcreek_vlan_addfunction hellcreek_vlan_delfunction hellcreek_port_stp_state_setfunction hellcreek_setup_ingressfltfunction hellcreek_setup_vlan_awarenessfunction hellcreek_setup_vlan_membershipfunction hellcreek_port_set_ucast_floodfunction hellcreek_port_set_mcast_floodfunction hellcreek_pre_bridge_flagsfunction hellcreek_bridge_flagsfunction hellcreek_port_bridge_joinfunction hellcreek_port_bridge_leavefunction __hellcreek_fdb_addfunction __hellcreek_fdb_delfunction hellcreek_populate_fdb_entryfunction hellcreek_fdb_getfunction hellcreek_fdb_addfunction hellcreek_fdb_delfunction hellcreek_fdb_dumpfunction hellcreek_vlan_filteringfunction hellcreek_enable_ip_corefunction hellcreek_setup_cpu_and_tunnel_port
Annotated Snippet
if (vlan->vid == restricted_vid) {
NL_SET_ERR_MSG_MOD(extack, "VID restricted by driver");
return -EBUSY;
}
}
return 0;
}
static void hellcreek_select_vlan_params(struct hellcreek *hellcreek, int port,
int *shift, int *mask)
{
switch (port) {
case 0:
*shift = HR_VIDMBRCFG_P0MBR_SHIFT;
*mask = HR_VIDMBRCFG_P0MBR_MASK;
break;
case 1:
*shift = HR_VIDMBRCFG_P1MBR_SHIFT;
*mask = HR_VIDMBRCFG_P1MBR_MASK;
break;
case 2:
*shift = HR_VIDMBRCFG_P2MBR_SHIFT;
*mask = HR_VIDMBRCFG_P2MBR_MASK;
break;
case 3:
*shift = HR_VIDMBRCFG_P3MBR_SHIFT;
*mask = HR_VIDMBRCFG_P3MBR_MASK;
break;
default:
*shift = *mask = 0;
dev_err(hellcreek->dev, "Unknown port %d selected!\n", port);
}
}
static void hellcreek_apply_vlan(struct hellcreek *hellcreek, int port, u16 vid,
bool pvid, bool untagged)
{
int shift, mask;
u16 val;
dev_dbg(hellcreek->dev, "Apply VLAN: port=%d vid=%u pvid=%d untagged=%d",
port, vid, pvid, untagged);
mutex_lock(&hellcreek->reg_lock);
hellcreek_select_port(hellcreek, port);
hellcreek_select_vlan(hellcreek, vid, pvid);
/* Setup port vlan membership */
hellcreek_select_vlan_params(hellcreek, port, &shift, &mask);
val = hellcreek->vidmbrcfg[vid];
val &= ~mask;
if (untagged)
val |= HELLCREEK_VLAN_UNTAGGED_MEMBER << shift;
else
val |= HELLCREEK_VLAN_TAGGED_MEMBER << shift;
hellcreek_write(hellcreek, val, HR_VIDMBRCFG);
hellcreek->vidmbrcfg[vid] = val;
mutex_unlock(&hellcreek->reg_lock);
}
static void hellcreek_unapply_vlan(struct hellcreek *hellcreek, int port,
u16 vid)
{
int shift, mask;
u16 val;
dev_dbg(hellcreek->dev, "Unapply VLAN: port=%d vid=%u\n", port, vid);
mutex_lock(&hellcreek->reg_lock);
hellcreek_select_vlan(hellcreek, vid, false);
/* Setup port vlan membership */
hellcreek_select_vlan_params(hellcreek, port, &shift, &mask);
val = hellcreek->vidmbrcfg[vid];
val &= ~mask;
val |= HELLCREEK_VLAN_NO_MEMBER << shift;
hellcreek_write(hellcreek, val, HR_VIDMBRCFG);
hellcreek->vidmbrcfg[vid] = val;
mutex_unlock(&hellcreek->reg_lock);
}
static int hellcreek_vlan_add(struct dsa_switch *ds, int port,
const struct switchdev_obj_port_vlan *vlan,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/device.h`, `linux/of.h`, `linux/of_mdio.h`, `linux/platform_device.h`, `linux/bitops.h`, `linux/if_bridge.h`.
- Detected declarations: `function hellcreek_read`, `function hellcreek_read_ctrl`, `function hellcreek_read_stat`, `function hellcreek_write`, `function hellcreek_select_port`, `function hellcreek_select_prio`, `function hellcreek_select_port_prio`, `function hellcreek_select_counter`, `function hellcreek_select_vlan`, `function hellcreek_select_tgd`.
- 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.