drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.h- Extension
.h- Size
- 9991 bytes
- Lines
- 318
- 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/debugfs.hlinux/errno.hlinux/xarray.hlinux/mlx5/fs.hmlx5_core.hmp.hport_sel.hmpesw.h
Detected Declarations
struct lag_funcstruct lag_trackerstruct mlx5_lagenum mlx5_lag_modefunction mlx5_lag_devfunction mlx5_lag_pffunction mlx5_lag_xa_to_dev_idxfunction mlx5_lag_pf_by_dev_idxfunction xa_for_eachfunction mlx5_lag_pf_by_devfunction xa_for_eachfunction __mlx5_lag_is_sdfunction __mlx5_lag_dev_is_portfunction __mlx5_lag_is_activefunction mlx5_lag_is_readyfunction mlx5_lag_shared_fdb_createfunction mlx5_lag_shared_fdb_destroyfunction mlx5_lag_destroy_vport_lagfunction mlx5_lag_create_single_fdbfunction mlx5_lag_destroy_single_fdbfunction mlx5_lag_set_vports_agg_speed
Annotated Snippet
struct lag_func {
struct mlx5_core_dev *dev;
struct net_device *netdev;
bool has_drop;
unsigned int idx; /* xarray index assigned by LAG */
struct mlx5_nb port_change_nb;
u32 group_id; /* SD group ID, 0 = not SD */
bool sd_fdb_active; /* set on all SD group members */
/* Lag demux resources - only populated on master devices */
struct mlx5_flow_table *lag_demux_ft;
struct mlx5_flow_group *lag_demux_fg;
struct xarray lag_demux_rules;
};
/* Used for collection of netdev event info. */
struct lag_tracker {
enum netdev_lag_tx_type tx_type;
struct netdev_lag_lower_state_info netdev_state[MLX5_MAX_PORTS];
unsigned int is_bonded:1;
unsigned int has_inactive:1;
enum netdev_lag_hash hash_type;
u32 bond_speed_mbps;
};
/* LAG data of a ConnectX card.
* It serves both its phys functions.
*/
struct mlx5_lag {
enum mlx5_lag_mode mode;
unsigned long mode_flags;
unsigned long state_flags;
u8 ports;
u8 buckets;
int mode_changes_in_progress;
u8 v2p_map[MLX5_MAX_PORTS * MLX5_LAG_MAX_HASH_BUCKETS];
struct kref ref;
struct xarray pfs;
struct lag_tracker tracker;
struct workqueue_struct *wq;
struct delayed_work bond_work;
struct work_struct speed_update_work;
struct notifier_block nb;
possible_net_t net;
struct lag_mp lag_mp;
struct mlx5_lag_port_sel port_sel;
/* Protect lag fields/state changes */
struct mutex lock;
struct lag_mpesw lag_mpesw;
};
static inline struct mlx5_lag *
mlx5_lag_dev(struct mlx5_core_dev *dev)
{
return dev->priv.lag;
}
static inline struct lag_func *
mlx5_lag_pf(struct mlx5_lag *ldev, unsigned int idx)
{
return xa_load(&ldev->pfs, idx);
}
/* Get device index (mlx5_get_dev_index) from xarray index */
static inline int mlx5_lag_xa_to_dev_idx(struct mlx5_lag *ldev, int xa_idx)
{
struct lag_func *pf = mlx5_lag_pf(ldev, xa_idx);
return pf ? mlx5_get_dev_index(pf->dev) : -ENOENT;
}
/* Find lag_func by device index (reverse lookup from mlx5_get_dev_index) */
static inline struct lag_func *
mlx5_lag_pf_by_dev_idx(struct mlx5_lag *ldev, int dev_idx)
{
struct lag_func *pf;
unsigned long idx;
xa_for_each(&ldev->pfs, idx, pf) {
if (mlx5_get_dev_index(pf->dev) == dev_idx)
return pf;
}
return NULL;
}
/* Find lag_func by mlx5_core_dev pointer */
static inline struct lag_func *
mlx5_lag_pf_by_dev(struct mlx5_lag *ldev, struct mlx5_core_dev *dev)
{
struct lag_func *pf;
unsigned long idx;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/errno.h`, `linux/xarray.h`, `linux/mlx5/fs.h`, `mlx5_core.h`, `mp.h`, `port_sel.h`, `mpesw.h`.
- Detected declarations: `struct lag_func`, `struct lag_tracker`, `struct mlx5_lag`, `enum mlx5_lag_mode`, `function mlx5_lag_dev`, `function mlx5_lag_pf`, `function mlx5_lag_xa_to_dev_idx`, `function mlx5_lag_pf_by_dev_idx`, `function xa_for_each`, `function mlx5_lag_pf_by_dev`.
- 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.