Merge tag 'mt76-for-kvalo-2021-01-29' of https://github.com/nbd168/wireless
[linux-2.6-microblaze.git] / drivers / net / ethernet / mellanox / mlx5 / core / pci_irq.c
index 6fd9749..a61e09a 100644 (file)
@@ -30,6 +30,9 @@ int mlx5_irq_table_init(struct mlx5_core_dev *dev)
 {
        struct mlx5_irq_table *irq_table;
 
+       if (mlx5_core_is_sf(dev))
+               return 0;
+
        irq_table = kvzalloc(sizeof(*irq_table), GFP_KERNEL);
        if (!irq_table)
                return -ENOMEM;
@@ -40,6 +43,9 @@ int mlx5_irq_table_init(struct mlx5_core_dev *dev)
 
 void mlx5_irq_table_cleanup(struct mlx5_core_dev *dev)
 {
+       if (mlx5_core_is_sf(dev))
+               return;
+
        kvfree(dev->priv.irq_table);
 }
 
@@ -268,6 +274,9 @@ int mlx5_irq_table_create(struct mlx5_core_dev *dev)
        int nvec;
        int err;
 
+       if (mlx5_core_is_sf(dev))
+               return 0;
+
        nvec = MLX5_CAP_GEN(dev, num_ports) * num_online_cpus() +
               MLX5_IRQ_VEC_COMP_BASE;
        nvec = min_t(int, nvec, num_eqs);
@@ -319,6 +328,9 @@ void mlx5_irq_table_destroy(struct mlx5_core_dev *dev)
        struct mlx5_irq_table *table = dev->priv.irq_table;
        int i;
 
+       if (mlx5_core_is_sf(dev))
+               return;
+
        /* free_irq requires that affinity and rmap will be cleared
         * before calling it. This is why there is asymmetry with set_rmap
         * which should be called after alloc_irq but before request_irq.
@@ -332,3 +344,11 @@ void mlx5_irq_table_destroy(struct mlx5_core_dev *dev)
        kfree(table->irq);
 }
 
+struct mlx5_irq_table *mlx5_irq_table_get(struct mlx5_core_dev *dev)
+{
+#ifdef CONFIG_MLX5_SF
+       if (mlx5_core_is_sf(dev))
+               return dev->priv.parent_mdev->priv.irq_table;
+#endif
+       return dev->priv.irq_table;
+}