Skip to content

Commit 1161d22

Browse files
roidayanSaeed Mahameed
authored andcommitted
net/mlx5e: E-Switch, Register devcom device with switch id key
Register devcom devices with switch id instead of guid. Devcom interface is used to sync between ports in the eswitch, e.g. Adding miss rules between the ports. New eswitch devices could have the same guid but a different switch id so its more correct to group according to switch id which is the identifier if the ports are on the same eswitch. Signed-off-by: Roi Dayan <roid@nvidia.com> Reviewed-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent 88d162b commit 1161d22

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5194,11 +5194,12 @@ void mlx5e_tc_ht_cleanup(struct rhashtable *tc_ht)
51945194
int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
51955195
{
51965196
const size_t sz_enc_opts = sizeof(struct tunnel_match_enc_opts);
5197+
struct netdev_phys_item_id ppid;
51975198
struct mlx5e_rep_priv *rpriv;
51985199
struct mapping_ctx *mapping;
51995200
struct mlx5_eswitch *esw;
52005201
struct mlx5e_priv *priv;
5201-
u64 mapping_id;
5202+
u64 mapping_id, key;
52025203
int err = 0;
52035204

52045205
rpriv = container_of(uplink_priv, struct mlx5e_rep_priv, uplink_priv);
@@ -5252,7 +5253,11 @@ int mlx5e_tc_esw_init(struct mlx5_rep_uplink_priv *uplink_priv)
52525253
goto err_action_counter;
52535254
}
52545255

5255-
mlx5_esw_offloads_devcom_init(esw);
5256+
err = dev_get_port_parent_id(priv->netdev, &ppid, false);
5257+
if (!err) {
5258+
memcpy(&key, &ppid.id, sizeof(key));
5259+
mlx5_esw_offloads_devcom_init(esw, key);
5260+
}
52565261

52575262
return 0;
52585263

drivers/net/ethernet/mellanox/mlx5/core/eswitch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs);
382382
void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw, bool clear_vf);
383383
void mlx5_eswitch_disable_locked(struct mlx5_eswitch *esw);
384384
void mlx5_eswitch_disable(struct mlx5_eswitch *esw);
385-
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw);
385+
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, u64 key);
386386
void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw);
387387
bool mlx5_esw_offloads_devcom_is_ready(struct mlx5_eswitch *esw);
388388
int mlx5_eswitch_set_vport_mac(struct mlx5_eswitch *esw,
@@ -818,7 +818,7 @@ static inline void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) {}
818818
static inline int mlx5_eswitch_enable(struct mlx5_eswitch *esw, int num_vfs) { return 0; }
819819
static inline void mlx5_eswitch_disable_sriov(struct mlx5_eswitch *esw, bool clear_vf) {}
820820
static inline void mlx5_eswitch_disable(struct mlx5_eswitch *esw) {}
821-
static inline void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw) {}
821+
static inline void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, u64 key) {}
822822
static inline void mlx5_esw_offloads_devcom_cleanup(struct mlx5_eswitch *esw) {}
823823
static inline bool mlx5_esw_offloads_devcom_is_ready(struct mlx5_eswitch *esw) { return false; }
824824
static inline bool mlx5_eswitch_is_funcs_handler(struct mlx5_core_dev *dev) { return false; }

drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,9 +2886,8 @@ static int mlx5_esw_offloads_devcom_event(int event,
28862886
return err;
28872887
}
28882888

2889-
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw)
2889+
void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw, u64 key)
28902890
{
2891-
u64 guid;
28922891
int i;
28932892

28942893
for (i = 0; i < MLX5_MAX_PORTS; i++)
@@ -2902,12 +2901,10 @@ void mlx5_esw_offloads_devcom_init(struct mlx5_eswitch *esw)
29022901
return;
29032902

29042903
xa_init(&esw->paired);
2905-
guid = mlx5_query_nic_system_image_guid(esw->dev);
2906-
29072904
esw->num_peers = 0;
29082905
esw->devcom = mlx5_devcom_register_component(esw->dev->priv.devc,
29092906
MLX5_DEVCOM_ESW_OFFLOADS,
2910-
guid,
2907+
key,
29112908
mlx5_esw_offloads_devcom_event,
29122909
esw);
29132910
if (IS_ERR_OR_NULL(esw->devcom))

0 commit comments

Comments
 (0)