drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c- Extension
.c- Size
- 16813 bytes
- Lines
- 595
- 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/netdevice.hlinux/if_bridge.hnet/netevent.hnet/switchdev.hbridge.hesw/bridge.hen_rep.h
Detected Declarations
struct mlx5_bridge_switchdev_fdb_workfunction mlx5_esw_bridge_dev_same_eswfunction mlx5_esw_bridge_dev_same_hwfunction mlx5_esw_bridge_lag_rep_getfunction netdev_for_each_lower_devfunction mlx5_esw_bridge_rep_vport_num_vhca_id_getfunction mlx5_esw_bridge_lower_rep_vport_num_vhca_id_getfunction netdev_for_each_lower_devfunction mlx5_esw_bridge_is_localfunction mlx5_esw_bridge_port_changeupperfunction mlx5_esw_bridge_changeupper_validate_netdevfunction netdev_for_each_lower_devfunction mlx5_esw_bridge_switchdev_port_eventfunction mlx5_esw_bridge_port_obj_addfunction mlx5_esw_bridge_port_obj_delfunction mlx5_esw_bridge_port_obj_attr_setfunction mlx5_esw_bridge_event_blockingfunction mlx5_esw_bridge_cleanup_switchdev_fdb_workfunction mlx5_esw_bridge_switchdev_fdb_event_workfunction mlx5_esw_bridge_init_switchdev_fdb_workfunction mlx5_esw_bridge_switchdev_eventfunction mlx5_esw_bridge_update_workfunction mlx5e_rep_bridge_initfunction mlx5e_rep_bridge_cleanup
Annotated Snippet
struct mlx5_bridge_switchdev_fdb_work {
struct work_struct work;
struct switchdev_notifier_fdb_info fdb_info;
struct net_device *dev;
struct mlx5_esw_bridge_offloads *br_offloads;
bool add;
};
static bool mlx5_esw_bridge_dev_same_esw(struct net_device *dev, struct mlx5_eswitch *esw)
{
struct mlx5e_priv *priv = netdev_priv(dev);
return esw == priv->mdev->priv.eswitch;
}
static bool mlx5_esw_bridge_dev_same_hw(struct net_device *dev, struct mlx5_eswitch *esw)
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5_core_dev *mdev, *esw_mdev;
mdev = priv->mdev;
esw_mdev = esw->dev;
return mlx5_same_hw_devs(mdev, esw_mdev);
}
static struct net_device *
mlx5_esw_bridge_lag_rep_get(struct net_device *dev, struct mlx5_eswitch *esw)
{
struct net_device *lower;
struct list_head *iter;
netdev_for_each_lower_dev(dev, lower, iter) {
if (!mlx5e_eswitch_rep(lower))
continue;
if (mlx5_esw_bridge_dev_same_esw(lower, esw))
return lower;
}
return NULL;
}
static struct net_device *
mlx5_esw_bridge_rep_vport_num_vhca_id_get(struct net_device *dev, struct mlx5_eswitch *esw,
u16 *vport_num, u16 *esw_owner_vhca_id)
{
struct mlx5e_rep_priv *rpriv;
struct mlx5e_priv *priv;
if (netif_is_lag_master(dev))
dev = mlx5_esw_bridge_lag_rep_get(dev, esw);
if (!dev || !mlx5e_eswitch_rep(dev) || !mlx5_esw_bridge_dev_same_hw(dev, esw))
return NULL;
priv = netdev_priv(dev);
if (!priv->mdev->priv.eswitch->br_offloads)
return NULL;
rpriv = priv->ppriv;
*vport_num = rpriv->rep->vport;
*esw_owner_vhca_id = MLX5_CAP_GEN(priv->mdev, vhca_id);
return dev;
}
static struct net_device *
mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(struct net_device *dev, struct mlx5_eswitch *esw,
u16 *vport_num, u16 *esw_owner_vhca_id)
{
struct net_device *lower_dev;
struct list_head *iter;
if (netif_is_lag_master(dev) || mlx5e_eswitch_rep(dev))
return mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, esw, vport_num,
esw_owner_vhca_id);
netdev_for_each_lower_dev(dev, lower_dev, iter) {
struct net_device *rep;
if (netif_is_bridge_master(lower_dev))
continue;
rep = mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(lower_dev, esw, vport_num,
esw_owner_vhca_id);
if (rep)
return rep;
}
Annotation
- Immediate include surface: `linux/netdevice.h`, `linux/if_bridge.h`, `net/netevent.h`, `net/switchdev.h`, `bridge.h`, `esw/bridge.h`, `en_rep.h`.
- Detected declarations: `struct mlx5_bridge_switchdev_fdb_work`, `function mlx5_esw_bridge_dev_same_esw`, `function mlx5_esw_bridge_dev_same_hw`, `function mlx5_esw_bridge_lag_rep_get`, `function netdev_for_each_lower_dev`, `function mlx5_esw_bridge_rep_vport_num_vhca_id_get`, `function mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get`, `function netdev_for_each_lower_dev`, `function mlx5_esw_bridge_is_local`, `function mlx5_esw_bridge_port_changeupper`.
- 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.