net/mlx5: Cache the system image guid
authorAlaa Hleihel <alaa@mellanox.com>
Wed, 5 Sep 2018 14:06:37 +0000 (17:06 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Mon, 1 Oct 2018 18:32:47 +0000 (11:32 -0700)
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 <alaa@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/vport.c
include/linux/mlx5/driver.h
include/linux/mlx5/vport.h

index 9fed54017659de3b0f58a1287a7eff605c077f6c..82723a0e509a960d7c82f4e702dc8d71cd71a673 100644 (file)
@@ -2040,8 +2040,8 @@ static bool same_hw_devs(struct mlx5e_priv *priv, struct mlx5e_priv *peer_priv)
        fmdev = priv->mdev;
        pmdev = peer_priv->mdev;
 
-       mlx5_query_nic_vport_system_image_guid(fmdev, &fsystem_guid);
-       mlx5_query_nic_vport_system_image_guid(pmdev, &psystem_guid);
+       fsystem_guid = mlx5_query_nic_system_image_guid(fmdev);
+       psystem_guid = mlx5_query_nic_system_image_guid(pmdev);
 
        return (fsystem_guid == psystem_guid);
 }
index b02af317c1255698b5ee09e49451006315b86f3c..cfbea66b48798ba495c510ed6470619e6c6ff253 100644 (file)
@@ -1201,3 +1201,12 @@ int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev)
        return err;
 }
 EXPORT_SYMBOL_GPL(mlx5_nic_vport_unaffiliate_multiport);
+
+u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev)
+{
+       if (!mdev->sys_image_guid)
+               mlx5_query_nic_vport_system_image_guid(mdev, &mdev->sys_image_guid);
+
+       return mdev->sys_image_guid;
+}
+EXPORT_SYMBOL_GPL(mlx5_query_nic_system_image_guid);
index ed73b51f6697bd5b79c4c991114835227ffc572d..26a92462f4ce885e9717cc7da7130f7d1194e619 100644 (file)
@@ -838,6 +838,7 @@ struct mlx5_core_dev {
                u32 fpga[MLX5_ST_SZ_DW(fpga_cap)];
                u32 qcam[MLX5_ST_SZ_DW(qcam_reg)];
        } caps;
+       u64                     sys_image_guid;
        phys_addr_t             iseg_base;
        struct mlx5_init_seg __iomem *iseg;
        enum mlx5_device_state  state;
index 7e7c6dfcfb0900b8f15d691779f1d014e8d9ce21..9c694808c212b9cbd6e127378412f46598083026 100644 (file)
@@ -121,4 +121,6 @@ int mlx5_nic_vport_query_local_lb(struct mlx5_core_dev *mdev, bool *status);
 int mlx5_nic_vport_affiliate_multiport(struct mlx5_core_dev *master_mdev,
                                       struct mlx5_core_dev *port_mdev);
 int mlx5_nic_vport_unaffiliate_multiport(struct mlx5_core_dev *port_mdev);
+
+u64 mlx5_query_nic_system_image_guid(struct mlx5_core_dev *mdev);
 #endif /* __MLX5_VPORT_H__ */