drivers/net/ethernet/mellanox/mlx5/core/lag/shared_fdb.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lag/shared_fdb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lag/shared_fdb.c- Extension
.c- Size
- 8069 bytes
- Lines
- 307
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/netdevice.hlinux/mlx5/driver.hlinux/mlx5/eswitch.hmlx5_core.hlag.heswitch.h
Detected Declarations
function mlx5_lag_shared_fdb_supported_filterfunction mlx5_lag_shared_fdb_supportedfunction mlx5_lag_create_single_fdb_filterfunction mlx5_lag_create_vport_lagfunction mlx5_lag_for_eachfunction mlx5_lag_destroy_vport_lagfunction mlx5_lag_for_eachfunction mlx5_lag_destroy_single_fdb_filterfunction mlx5_lag_create_single_fdbfunction mlx5_lag_destroy_single_fdbfunction groupfunction mlx5_lag_for_eachfunction mlx5_lag_for_eachfunction mlx5_lag_shared_fdb_destroyfunction mlx5_lag_for_each
Annotated Snippet
if (err) {
mlx5_core_warn(dev0,
"Failed to create LAG in shared FDB mode (%d)\n",
err);
goto err_add_devices;
}
} else {
err = mlx5_lag_create_single_fdb_filter(ldev, group_id);
if (err) {
mlx5_core_warn(dev0,
"Failed to create SD shared FDB (%d)\n",
err);
goto err_add_devices;
}
mlx5_lag_for_each(i, 0, ldev, filter) {
pf = mlx5_lag_pf(ldev, i);
pf->sd_fdb_active = true;
}
BLOCKING_INIT_NOTIFIER_HEAD(&dev0->priv.lag_nh);
}
mlx5_lag_rescan_dev_locked(ldev, dev0, true);
err = mlx5_lag_reload_ib_reps_from_locked(ldev, 0, filter, false);
if (err) {
mlx5_core_err(dev0, "Failed to enable lag\n");
goto err_rescan_drivers;
}
if (filter == MLX5_LAG_FILTER_PORTS || filter == MLX5_LAG_FILTER_ALL)
mlx5_lag_set_vports_agg_speed(ldev);
return 0;
err_rescan_drivers:
mlx5_lag_rescan_dev_locked(ldev, dev0, false);
if (filter == MLX5_LAG_FILTER_PORTS || filter == MLX5_LAG_FILTER_ALL) {
mlx5_deactivate_lag(ldev);
} else {
mlx5_lag_for_each(i, 0, ldev, filter) {
pf = mlx5_lag_pf(ldev, i);
pf->sd_fdb_active = false;
}
mlx5_lag_destroy_single_fdb_filter(ldev, group_id);
}
err_add_devices:
mlx5_lag_add_devices_filter(ldev, filter);
mlx5_lag_reload_ib_reps_from_locked(ldev, 0, filter, true);
return err;
}
void mlx5_lag_shared_fdb_destroy(struct mlx5_lag *ldev, u32 group_id)
{
u32 filter = group_id ? group_id : MLX5_LAG_FILTER_ALL;
struct lag_func *pf;
int err;
int i;
mlx5_lag_remove_devices_filter(ldev, filter);
if (filter == MLX5_LAG_FILTER_PORTS || filter == MLX5_LAG_FILTER_ALL) {
err = mlx5_deactivate_lag(ldev);
if (err)
return;
} else {
mlx5_lag_for_each(i, 0, ldev, filter) {
pf = mlx5_lag_pf(ldev, i);
pf->sd_fdb_active = false;
}
mlx5_lag_destroy_single_fdb_filter(ldev, group_id);
mlx5_lag_unload_reps_from_locked(ldev, filter);
}
mlx5_lag_add_devices_filter(ldev, filter);
mlx5_lag_reload_ib_reps_from_locked(ldev,
MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV,
filter, true);
}
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/mlx5/driver.h`, `linux/mlx5/eswitch.h`, `mlx5_core.h`, `lag.h`, `eswitch.h`.
- Detected declarations: `function mlx5_lag_shared_fdb_supported_filter`, `function mlx5_lag_shared_fdb_supported`, `function mlx5_lag_create_single_fdb_filter`, `function mlx5_lag_create_vport_lag`, `function mlx5_lag_for_each`, `function mlx5_lag_destroy_vport_lag`, `function mlx5_lag_for_each`, `function mlx5_lag_destroy_single_fdb_filter`, `function mlx5_lag_create_single_fdb`, `function mlx5_lag_destroy_single_fdb`.
- 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.