drivers/net/ethernet/ti/icssg/icssg_switchdev.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/ti/icssg/icssg_switchdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/ti/icssg/icssg_switchdev.c- Extension
.c- Size
- 12361 bytes
- Lines
- 478
- 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.
- 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_bridge.hlinux/netdevice.hlinux/workqueue.hnet/switchdev.hicssg_prueth.hicssg_switchdev.hicssg_mii_rt.h
Detected Declarations
struct prueth_switchdev_event_workfunction prueth_switchdev_stp_state_setfunction prueth_switchdev_attr_br_flags_setfunction prueth_switchdev_attr_br_flags_pre_setfunction prueth_switchdev_attr_setfunction prueth_switchdev_fdb_offload_notifyfunction prueth_switchdev_event_workfunction prueth_switchdev_eventfunction prueth_switchdev_vlan_addfunction prueth_switchdev_vlan_delfunction prueth_switchdev_vlans_addfunction prueth_switchdev_vlans_delfunction prueth_switchdev_mdb_addfunction prueth_switchdev_mdb_delfunction prueth_switchdev_obj_addfunction prueth_switchdev_obj_delfunction prueth_switchdev_blocking_eventfunction prueth_switchdev_register_notifiersfunction prueth_switchdev_unregister_notifiers
Annotated Snippet
struct prueth_switchdev_event_work {
struct work_struct work;
struct switchdev_notifier_fdb_info fdb_info;
struct prueth_emac *emac;
unsigned long event;
};
static int prueth_switchdev_stp_state_set(struct prueth_emac *emac,
u8 state)
{
enum icssg_port_state_cmd emac_state;
int ret = 0;
switch (state) {
case BR_STATE_FORWARDING:
emac_state = ICSSG_EMAC_PORT_FORWARD;
break;
case BR_STATE_DISABLED:
emac_state = ICSSG_EMAC_PORT_DISABLE;
break;
case BR_STATE_LISTENING:
case BR_STATE_BLOCKING:
emac_state = ICSSG_EMAC_PORT_BLOCK;
break;
default:
return -EOPNOTSUPP;
}
icssg_set_port_state(emac, emac_state);
netdev_dbg(emac->ndev, "STP state: %u\n", emac_state);
return ret;
}
static int prueth_switchdev_attr_br_flags_set(struct prueth_emac *emac,
struct net_device *orig_dev,
struct switchdev_brport_flags brport_flags)
{
enum icssg_port_state_cmd emac_state;
if (brport_flags.mask & BR_MCAST_FLOOD)
emac_state = ICSSG_EMAC_PORT_MC_FLOODING_ENABLE;
else
emac_state = ICSSG_EMAC_PORT_MC_FLOODING_DISABLE;
netdev_dbg(emac->ndev, "BR_MCAST_FLOOD: %d port %u\n",
emac_state, emac->port_id);
icssg_set_port_state(emac, emac_state);
return 0;
}
static int prueth_switchdev_attr_br_flags_pre_set(struct net_device *netdev,
struct switchdev_brport_flags brport_flags)
{
if (brport_flags.mask & ~(BR_LEARNING | BR_MCAST_FLOOD))
return -EINVAL;
return 0;
}
static int prueth_switchdev_attr_set(struct net_device *ndev, const void *ctx,
const struct switchdev_attr *attr,
struct netlink_ext_ack *extack)
{
struct prueth_emac *emac = netdev_priv(ndev);
int ret;
netdev_dbg(ndev, "attr: id %u port: %u\n", attr->id, emac->port_id);
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
ret = prueth_switchdev_attr_br_flags_pre_set(ndev,
attr->u.brport_flags);
break;
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
ret = prueth_switchdev_stp_state_set(emac,
attr->u.stp_state);
netdev_dbg(ndev, "stp state: %u\n", attr->u.stp_state);
break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
ret = prueth_switchdev_attr_br_flags_set(emac, attr->orig_dev,
attr->u.brport_flags);
break;
default:
ret = -EOPNOTSUPP;
break;
}
Annotation
- Immediate include surface: `linux/etherdevice.h`, `linux/if_bridge.h`, `linux/netdevice.h`, `linux/workqueue.h`, `net/switchdev.h`, `icssg_prueth.h`, `icssg_switchdev.h`, `icssg_mii_rt.h`.
- Detected declarations: `struct prueth_switchdev_event_work`, `function prueth_switchdev_stp_state_set`, `function prueth_switchdev_attr_br_flags_set`, `function prueth_switchdev_attr_br_flags_pre_set`, `function prueth_switchdev_attr_set`, `function prueth_switchdev_fdb_offload_notify`, `function prueth_switchdev_event_work`, `function prueth_switchdev_event`, `function prueth_switchdev_vlan_add`, `function prueth_switchdev_vlan_del`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source 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.