OSDN Git Service

net/mlx5: Bridge, identify port by vport_num+esw_owner_vhca_id pair
authorVlad Buslov <vladbu@nvidia.com>
Thu, 17 Jun 2021 15:07:29 +0000 (18:07 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Mon, 16 Aug 2021 23:17:30 +0000 (16:17 -0700)
commit3ee6233e61a1f95426101cfc35f35f7ed0e7ed66
treebfa2b33fb53ae0a2e17b6ef80a9acf70168bbf53
parenta514d17350597dea242c5486ef70a9ec013c1182
net/mlx5: Bridge, identify port by vport_num+esw_owner_vhca_id pair

Following patches in series allow traffic between vports of different
eswitch instances, which requires addressing bridge port by
vport_num+esw_owner_vhca_id pair since vport_num is only unique
per-eswitch. As a preparation, extend struct mlx5_esw_bridge_port with
'esw_owner_vhca_id' field and use it as part of key for
mlx5_esw_bridge->vports xarray.

With this change we can't rely on switchdev_handle_port_obj_add() helper to
get mlx5 representor from stacked device because we need specifically
representor from parent eswitch that registered the callback to obtain
correct esw_owner_vhca_id. The helper doesn't allow passing additional
parameters to predicate function and doesn't provide access to the notifier
block to obtain eswitch through br_offloads. Implement custom helpers to
obtain mlx5 representor and use them in
mlx5_esw_bridge_port_obj_{add|del|attr_set}() implementations.

Remove direct pointer to parent bridge from struct mlx5_vport as it is no
longer needed.

Signed-off-by: Vlad Buslov <vladbu@nvidia.com>
Reviewed-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.h
drivers/net/ethernet/mellanox/mlx5/core/esw/bridge_priv.h
drivers/net/ethernet/mellanox/mlx5/core/esw/diag/bridge_tracepoint.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h