On 5/28/24 11:11, Shay Drory wrote:
Expose the sysfs files for the IRQs that the mlx5 PCI SFs are using.
These entries are similar to PCI PFs and VFs in 'msi_irqs' directory.
Reviewed-by: Parav Pandit <parav@xxxxxxxxxx>
Signed-off-by: Shay Drory <shayd@xxxxxxxxxx>
---
v2->v3:
- fix mlx5 sfnum SF sysfs
---
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 6 +++---
.../ethernet/mellanox/mlx5/core/irq_affinity.c | 15 ++++++++++++++-
.../net/ethernet/mellanox/mlx5/core/mlx5_core.h | 6 ++++++
.../net/ethernet/mellanox/mlx5/core/mlx5_irq.h | 12 ++++++++----
.../net/ethernet/mellanox/mlx5/core/pci_irq.c | 12 +++++++++---
.../net/ethernet/mellanox/mlx5/core/sf/dev/dev.c | 16 +++++++---------
6 files changed, 47 insertions(+), 20 deletions(-)
[...]
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
index 612e666ec263..5c36aa3c57e0 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
@@ -112,15 +112,18 @@ irq_pool_find_least_loaded(struct mlx5_irq_pool *pool, const struct cpumask *req
/**
* mlx5_irq_affinity_request - request an IRQ according to the given mask.
+ * @dev: mlx5 core device which is requesting the IRQ.
* @pool: IRQ pool to request from.
* @af_desc: affinity descriptor for this IRQ.
*
* This function returns a pointer to IRQ, or ERR_PTR in case of error.
*/
struct mlx5_irq *
-mlx5_irq_affinity_request(struct mlx5_irq_pool *pool, struct irq_affinity_desc *af_desc)
+mlx5_irq_affinity_request(struct mlx5_core_dev *dev, struct mlx5_irq_pool *pool,
+ struct irq_affinity_desc *af_desc)
{
struct mlx5_irq *least_loaded_irq, *new_irq;
+ int ret;
mutex_lock(&pool->lock);
least_loaded_irq = irq_pool_find_least_loaded(pool, &af_desc->mask);
@@ -152,6 +155,13 @@ mlx5_irq_affinity_request(struct mlx5_irq_pool *pool, struct irq_affinity_desc *
mlx5_irq_get_index(least_loaded_irq)), pool->name,
mlx5_irq_read_locked(least_loaded_irq) / MLX5_EQ_REFS_PER_IRQ);
unlock:
+ if (mlx5_irq_pool_is_sf_pool(pool)) {
+ ret = auxiliary_device_sysfs_irq_add(mlx5_sf_coredev_to_adev(dev),
+ mlx5_irq_get_irq(least_loaded_irq));
+ if (ret)
+ mlx5_core_err(dev, "Failed to create sysfs entry for irq %d, ret = %d\n",
+ mlx5_irq_get_irq(least_loaded_irq), ret);
you are handling the error by logging a message, then ignoring it
this is clearly not an ERROR, just a WARN or INFO.
+ }
mutex_unlock(&pool->lock);
return least_loaded_irq;
}
[...]