drivers/net/ethernet/intel/ice/ice_eswitch_br.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/ice/ice_eswitch_br.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/ice/ice_eswitch_br.c- Extension
.c- Size
- 32433 bytes
- Lines
- 1356
- 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
ice.hice_eswitch_br.hice_repr.hice_switch.hice_vlan.hice_vf_vsi_vlan_ops.hice_trace.h
Detected Declarations
function ice_eswitch_br_is_dev_validfunction ice_eswitch_br_get_uplink_from_lagfunction netdev_for_each_lower_devfunction ice_eswitch_br_netdev_to_portfunction ice_eswitch_br_ingress_rule_setupfunction ice_eswitch_br_egress_rule_setupfunction ice_eswitch_br_rule_deletefunction ice_eswitch_br_get_lkups_cntfunction ice_eswitch_br_add_vlan_lkupfunction ice_eswitch_br_fwd_rule_createfunction ice_eswitch_br_guard_rule_createfunction ice_eswitch_br_flow_createfunction ice_eswitch_br_fdb_findfunction ice_eswitch_br_flow_deletefunction ice_esw_br_port_vlan_lookupfunction ice_eswitch_br_fdb_entry_deletefunction ice_eswitch_br_fdb_offload_notifyfunction ice_eswitch_br_fdb_entry_notify_and_cleanupfunction ice_eswitch_br_fdb_entry_find_and_deletefunction ice_eswitch_br_fdb_entry_createfunction ice_eswitch_br_fdb_work_deallocfunction ice_eswitch_br_fdb_event_workfunction ice_eswitch_br_fdb_work_allocfunction ice_eswitch_br_switchdev_eventfunction ice_eswitch_br_fdb_flushfunction ice_eswitch_br_vlan_filtering_setfunction ice_eswitch_br_clear_pvidfunction ice_eswitch_br_vlan_cleanupfunction list_for_each_entry_safefunction ice_eswitch_br_port_vlans_flushfunction ice_eswitch_br_set_pvidfunction ice_eswitch_br_vlan_createfunction ice_eswitch_br_port_vlan_addfunction ice_eswitch_br_port_vlan_delfunction ice_eswitch_br_port_obj_addfunction ice_eswitch_br_port_obj_delfunction ice_eswitch_br_port_obj_attr_setfunction ice_eswitch_br_event_blockingfunction ice_eswitch_br_port_deinitfunction list_for_each_entry_safefunction ice_eswitch_br_port_initfunction ice_eswitch_br_vf_repr_port_initfunction ice_eswitch_br_uplink_port_initfunction ice_eswitch_br_ports_flushfunction ice_eswitch_br_deinitfunction ice_eswitch_br_initfunction ice_eswitch_br_getfunction ice_eswitch_br_verify_deinit
Annotated Snippet
if (IS_ERR(vlan)) {
dev_err(dev, "Failed to find vlan lookup, err: %ld\n",
PTR_ERR(vlan));
return;
}
}
fdb_entry = ice_eswitch_br_fdb_find(bridge, mac, vid);
if (fdb_entry)
ice_eswitch_br_fdb_entry_notify_and_cleanup(bridge, fdb_entry);
fdb_entry = kzalloc_obj(*fdb_entry);
if (!fdb_entry) {
err = -ENOMEM;
goto err_exit;
}
flow = ice_eswitch_br_flow_create(dev, hw, br_port->vsi_idx,
br_port->type, mac, vid);
if (IS_ERR(flow)) {
err = PTR_ERR(flow);
goto err_add_flow;
}
ether_addr_copy(fdb_entry->data.addr, mac);
fdb_entry->data.vid = vid;
fdb_entry->br_port = br_port;
fdb_entry->flow = flow;
fdb_entry->dev = netdev;
fdb_entry->last_use = jiffies;
event = SWITCHDEV_FDB_ADD_TO_BRIDGE;
if (added_by_user) {
fdb_entry->flags |= ICE_ESWITCH_BR_FDB_ADDED_BY_USER;
event = SWITCHDEV_FDB_OFFLOADED;
}
err = rhashtable_insert_fast(&bridge->fdb_ht, &fdb_entry->ht_node,
ice_fdb_ht_params);
if (err)
goto err_fdb_insert;
list_add(&fdb_entry->list, &bridge->fdb_list);
trace_ice_eswitch_br_fdb_entry_create(fdb_entry);
ice_eswitch_br_fdb_offload_notify(netdev, mac, vid, event);
return;
err_fdb_insert:
ice_eswitch_br_flow_delete(pf, flow);
err_add_flow:
kfree(fdb_entry);
err_exit:
dev_err(dev, "Failed to create fdb entry, err: %d\n", err);
}
static void
ice_eswitch_br_fdb_work_dealloc(struct ice_esw_br_fdb_work *fdb_work)
{
kfree(fdb_work->fdb_info.addr);
kfree(fdb_work);
}
static void
ice_eswitch_br_fdb_event_work(struct work_struct *work)
{
struct ice_esw_br_fdb_work *fdb_work = ice_work_to_fdb_work(work);
bool added_by_user = fdb_work->fdb_info.added_by_user;
const unsigned char *mac = fdb_work->fdb_info.addr;
u16 vid = fdb_work->fdb_info.vid;
struct ice_esw_br_port *br_port;
rtnl_lock();
br_port = ice_eswitch_br_netdev_to_port(fdb_work->dev);
if (!br_port)
goto err_exit;
switch (fdb_work->event) {
case SWITCHDEV_FDB_ADD_TO_DEVICE:
ice_eswitch_br_fdb_entry_create(fdb_work->dev, br_port,
added_by_user, mac, vid);
break;
case SWITCHDEV_FDB_DEL_TO_DEVICE:
ice_eswitch_br_fdb_entry_find_and_delete(br_port->bridge,
mac, vid);
break;
default:
goto err_exit;
Annotation
- Immediate include surface: `ice.h`, `ice_eswitch_br.h`, `ice_repr.h`, `ice_switch.h`, `ice_vlan.h`, `ice_vf_vsi_vlan_ops.h`, `ice_trace.h`.
- Detected declarations: `function ice_eswitch_br_is_dev_valid`, `function ice_eswitch_br_get_uplink_from_lag`, `function netdev_for_each_lower_dev`, `function ice_eswitch_br_netdev_to_port`, `function ice_eswitch_br_ingress_rule_setup`, `function ice_eswitch_br_egress_rule_setup`, `function ice_eswitch_br_rule_delete`, `function ice_eswitch_br_get_lkups_cnt`, `function ice_eswitch_br_add_vlan_lkup`, `function ice_eswitch_br_fwd_rule_create`.
- 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.