@@ -1657,7 +1657,8 @@ static void enic_set_rx_cpu_rmap(struct enic *enic)
return;
for (i = 0; i < enic->rq_count; i++) {
res = irq_cpu_rmap_add(enic->netdev->rx_cpu_rmap,
- enic->msix_entry[i].vector);
+ enic->msix_entry[i].vector,
+ NULL, NULL);
if (unlikely(res)) {
enic_free_rx_cpu_rmap(enic);
return;
@@ -697,7 +697,7 @@ static int hns3_set_rx_cpu_rmap(struct net_device *netdev)
for (i = 0; i < priv->vector_num; i++) {
tqp_vector = &priv->tqp_vector[i];
ret = irq_cpu_rmap_add(netdev->rx_cpu_rmap,
- tqp_vector->vector_irq);
+ tqp_vector->vector_irq, NULL, NULL);
if (ret) {
hns3_free_rx_cpu_rmap(netdev);
return ret;
@@ -1243,7 +1243,7 @@ int mlx4_init_eq_table(struct mlx4_dev *dev)
}
err = irq_cpu_rmap_add(
- info->rmap, eq->irq);
+ info->rmap, eq->irq, NULL, NULL);
if (err)
mlx4_warn(dev, "Failed adding irq rmap\n");
}
@@ -285,7 +285,7 @@ struct mlx5_irq *mlx5_irq_alloc(struct mlx5_irq_pool *pool, int i,
if (i && rmap && *rmap) {
#ifdef CONFIG_RFS_ACCEL
- err = irq_cpu_rmap_add(*rmap, irq->map.virq);
+ err = irq_cpu_rmap_add(*rmap, irq->map.virq, NULL, NULL);
if (err)
goto err_irq_rmap;
#endif
@@ -122,7 +122,7 @@ int efx_nic_init_interrupt(struct efx_nic *efx)
if (efx->interrupt_mode == EFX_INT_MODE_MSIX &&
channel->channel < efx->n_rx_channels) {
rc = irq_cpu_rmap_add(efx->net_dev->rx_cpu_rmap,
- channel->irq);
+ channel->irq, NULL, NULL);
if (rc)
goto fail2;
}
@@ -11,6 +11,15 @@
#include <linux/gfp.h>
#include <linux/slab.h>
#include <linux/kref.h>
+#include <linux/interrupt.h>
+
+/* Glue between IRQ affinity notifiers and CPU rmaps */
+struct irq_glue {
+ struct irq_affinity_notify notify;
+ struct cpu_rmap *rmap;
+ void *data;
+ u16 index;
+};
/**
* struct cpu_rmap - CPU affinity reverse-map
@@ -61,6 +70,8 @@ static inline struct cpu_rmap *alloc_irq_cpu_rmap(unsigned int size)
extern void free_irq_cpu_rmap(struct cpu_rmap *rmap);
int irq_cpu_rmap_remove(struct cpu_rmap *rmap, int irq);
-extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq);
+extern int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq, void *data,
+ void (*notify)(struct irq_affinity_notify *notify,
+ const cpumask_t *mask));
#endif /* __LINUX_CPU_RMAP_H */
@@ -220,14 +220,6 @@ int cpu_rmap_update(struct cpu_rmap *rmap, u16 index,
}
EXPORT_SYMBOL(cpu_rmap_update);
-/* Glue between IRQ affinity notifiers and CPU rmaps */
-
-struct irq_glue {
- struct irq_affinity_notify notify;
- struct cpu_rmap *rmap;
- u16 index;
-};
-
/**
* free_irq_cpu_rmap - free a CPU affinity reverse-map used for IRQs
* @rmap: Reverse-map allocated with alloc_irq_cpu_map(), or %NULL
@@ -300,6 +292,8 @@ EXPORT_SYMBOL(irq_cpu_rmap_remove);
* irq_cpu_rmap_add - add an IRQ to a CPU affinity reverse-map
* @rmap: The reverse-map
* @irq: The IRQ number
+ * @data: Generic data
+ * @notify: Callback function to update the CPU-IRQ rmap
*
* This adds an IRQ affinity notifier that will update the reverse-map
* automatically.
@@ -307,16 +301,22 @@ EXPORT_SYMBOL(irq_cpu_rmap_remove);
* Must be called in process context, after the IRQ is allocated but
* before it is bound with request_irq().
*/
-int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq)
+int irq_cpu_rmap_add(struct cpu_rmap *rmap, int irq, void *data,
+ void (*notify)(struct irq_affinity_notify *notify,
+ const cpumask_t *mask))
{
struct irq_glue *glue = kzalloc(sizeof(*glue), GFP_KERNEL);
int rc;
if (!glue)
return -ENOMEM;
- glue->notify.notify = irq_cpu_rmap_notify;
+
+ if (!notify)
+ notify = irq_cpu_rmap_notify;
+ glue->notify.notify = notify;
glue->notify.release = irq_cpu_rmap_release;
glue->rmap = rmap;
+ glue->data = data;
cpu_rmap_get(rmap);
rc = cpu_rmap_add(rmap, glue);
if (rc < 0)
Allow the rmap users to pass a notifier callback function that can be called instead of irq_cpu_rmap_notify(). Two modifications are made: * make struct irg_glue visible in cpu_rmap.h * pass a new "void* data" parameter that can be used by the cb function. Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com> --- drivers/net/ethernet/cisco/enic/enic_main.c | 3 ++- .../net/ethernet/hisilicon/hns3/hns3_enet.c | 2 +- drivers/net/ethernet/mellanox/mlx4/eq.c | 2 +- .../net/ethernet/mellanox/mlx5/core/pci_irq.c | 2 +- drivers/net/ethernet/sfc/nic.c | 2 +- include/linux/cpu_rmap.h | 13 +++++++++++- lib/cpu_rmap.c | 20 +++++++++---------- 7 files changed, 28 insertions(+), 16 deletions(-)