Skip to content

Commit 59c9d35

Browse files
alaahlSaeed Mahameed
authored andcommitted
net/mlx5: Cache the system image guid
The system image guid is a read-only field which is used by the TC offloads code to determine if two mlx5 devices belong to the same ASIC while adding flows. Read this once and save it on the core device rather than querying each time an offloaded flow is added. Signed-off-by: Alaa Hleihel <[email protected]> Reviewed-by: Or Gerlitz <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent b856df2 commit 59c9d35

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2040,8 +2040,8 @@ static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
20402040
fmdev = priv->mdev;
20412041
pmdev = peer_priv->mdev;
20422042

2043-
mlx5_query_nic_vport_system_image_guid(fmdev, &fsystem_guid);
2044-
mlx5_query_nic_vport_system_image_guid(pmdev, &psystem_guid);
2043+
fsystem_guid = mlx5_query_nic_system_image_guid(fmdev);
2044+
psystem_guid = mlx5_query_nic_system_image_guid(pmdev);
20452045

20462046
return (fsystem_guid == psystem_guid);
20472047
}

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,3 +1201,12 @@ int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev)
12011201
return err;
12021202
}
12031203
EXPORT_SYMBOL_GPL(mlx5_nic_vport_unaffiliate_multiport);
1204+
1205+
u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
1206+
{
1207+
if (!mdev->sys_image_guid)
1208+
mlx5_query_nic_vport_system_image_guid(mdev, &mdev->sys_image_guid);
1209+
1210+
return mdev->sys_image_guid;
1211+
}
1212+
EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);

include/linux/mlx5/driver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,7 @@ struct mlx5_core_dev {
838838
u32 fpga[MLX5_ST_SZ_DW(fpga_cap)];
839839
u32 qcam[MLX5_ST_SZ_DW(qcam_reg)];
840840
} caps;
841+
u64 sys_image_guid;
841842
phys_addr_t iseg_base;
842843
struct mlx5_init_seg __iomem *iseg;
843844
enum mlx5_device_state state;

include/linux/mlx5/vport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,6 @@ int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, bool *status);
121121
int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
122122
struct mlx5_core_dev *port_mdev);
123123
int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);
124+
125+
u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev);
124126
#endif /* __MLX5_VPORT_H__ */

0 commit comments

Comments
 (0)