Skip to content

Commit 4063af2

Browse files
azaki1kuba-moo
authored andcommitted
ice: use napi's irq affinity and rmap IRQ notifiers
Delete the driver CPU affinity and aRFS rmap info, use the core's API instead. Signed-off-by: Ahmed Zaki <ahmed.zaki@intel.com> Link: https://patch.msgid.link/20250224232228.990783-5-ahmed.zaki@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 30b78ba commit 4063af2

File tree

6 files changed

+6
-93
lines changed

6 files changed

+6
-93
lines changed

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,9 +475,6 @@ struct ice_q_vector {
475475
struct ice_ring_container rx;
476476
struct ice_ring_container tx;
477477

478-
cpumask_t affinity_mask;
479-
struct irq_affinity_notify affinity_notify;
480-
481478
struct ice_channel *ch;
482479

483480
char name[ICE_INT_NAME_STR_LEN];

drivers/net/ethernet/intel/ice/ice_arfs.c

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -570,25 +570,6 @@ void ice_clear_arfs(struct ice_vsi *vsi)
570570
vsi->arfs_fltr_cntrs = NULL;
571571
}
572572

573-
/**
574-
* ice_free_cpu_rx_rmap - free setup CPU reverse map
575-
* @vsi: the VSI to be forwarded to
576-
*/
577-
void ice_free_cpu_rx_rmap(struct ice_vsi *vsi)
578-
{
579-
struct net_device *netdev;
580-
581-
if (!vsi || vsi->type != ICE_VSI_PF)
582-
return;
583-
584-
netdev = vsi->netdev;
585-
if (!netdev || !netdev->rx_cpu_rmap)
586-
return;
587-
588-
free_irq_cpu_rmap(netdev->rx_cpu_rmap);
589-
netdev->rx_cpu_rmap = NULL;
590-
}
591-
592573
/**
593574
* ice_set_cpu_rx_rmap - setup CPU reverse map for each queue
594575
* @vsi: the VSI to be forwarded to
@@ -597,7 +578,6 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)
597578
{
598579
struct net_device *netdev;
599580
struct ice_pf *pf;
600-
int i;
601581

602582
if (!vsi || vsi->type != ICE_VSI_PF)
603583
return 0;
@@ -610,18 +590,7 @@ int ice_set_cpu_rx_rmap(struct ice_vsi *vsi)
610590
netdev_dbg(netdev, "Setup CPU RMAP: vsi type 0x%x, ifname %s, q_vectors %d\n",
611591
vsi->type, netdev->name, vsi->num_q_vectors);
612592

613-
netdev->rx_cpu_rmap = alloc_irq_cpu_rmap(vsi->num_q_vectors);
614-
if (unlikely(!netdev->rx_cpu_rmap))
615-
return -EINVAL;
616-
617-
ice_for_each_q_vector(vsi, i)
618-
if (irq_cpu_rmap_add(netdev->rx_cpu_rmap,
619-
vsi->q_vectors[i]->irq.virq)) {
620-
ice_free_cpu_rx_rmap(vsi);
621-
return -EINVAL;
622-
}
623-
624-
return 0;
593+
return netif_enable_cpu_rmap(netdev, vsi->num_q_vectors);
625594
}
626595

627596
/**

drivers/net/ethernet/intel/ice/ice_arfs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int
4545
ice_rx_flow_steer(struct net_device *netdev, const struct sk_buff *skb,
4646
u16 rxq_idx, u32 flow_id);
4747
void ice_clear_arfs(struct ice_vsi *vsi);
48-
void ice_free_cpu_rx_rmap(struct ice_vsi *vsi);
4948
void ice_init_arfs(struct ice_vsi *vsi);
5049
void ice_sync_arfs_fltrs(struct ice_pf *pf);
5150
int ice_set_cpu_rx_rmap(struct ice_vsi *vsi);
@@ -56,7 +55,6 @@ ice_is_arfs_using_perfect_flow(struct ice_hw *hw,
5655
enum ice_fltr_ptype flow_type);
5756
#else
5857
static inline void ice_clear_arfs(struct ice_vsi *vsi) { }
59-
static inline void ice_free_cpu_rx_rmap(struct ice_vsi *vsi) { }
6058
static inline void ice_init_arfs(struct ice_vsi *vsi) { }
6159
static inline void ice_sync_arfs_fltrs(struct ice_pf *pf) { }
6260
static inline void ice_remove_arfs(struct ice_pf *pf) { }

drivers/net/ethernet/intel/ice/ice_base.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,6 @@ static int ice_vsi_alloc_q_vector(struct ice_vsi *vsi, u16 v_idx)
147147
q_vector->reg_idx = q_vector->irq.index;
148148
q_vector->vf_reg_idx = q_vector->irq.index;
149149

150-
/* only set affinity_mask if the CPU is online */
151-
if (cpu_online(v_idx))
152-
cpumask_set_cpu(v_idx, &q_vector->affinity_mask);
153-
154150
/* This will not be called in the driver load path because the netdev
155151
* will not be created yet. All other cases with register the NAPI
156152
* handler here (i.e. resume, reset/rebuild, etc.)
@@ -276,7 +272,8 @@ static void ice_cfg_xps_tx_ring(struct ice_tx_ring *ring)
276272
if (test_and_set_bit(ICE_TX_XPS_INIT_DONE, ring->xps_state))
277273
return;
278274

279-
netif_set_xps_queue(ring->netdev, &ring->q_vector->affinity_mask,
275+
netif_set_xps_queue(ring->netdev,
276+
&ring->q_vector->napi.config->affinity_mask,
280277
ring->q_index);
281278
}
282279

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2592,7 +2592,6 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)
25922592
return;
25932593

25942594
vsi->irqs_ready = false;
2595-
ice_free_cpu_rx_rmap(vsi);
25962595

25972596
ice_for_each_q_vector(vsi, i) {
25982597
int irq_num;
@@ -2605,12 +2604,6 @@ void ice_vsi_free_irq(struct ice_vsi *vsi)
26052604
vsi->q_vectors[i]->num_ring_rx))
26062605
continue;
26072606

2608-
/* clear the affinity notifier in the IRQ descriptor */
2609-
if (!IS_ENABLED(CONFIG_RFS_ACCEL))
2610-
irq_set_affinity_notifier(irq_num, NULL);
2611-
2612-
/* clear the affinity_hint in the IRQ descriptor */
2613-
irq_update_affinity_hint(irq_num, NULL);
26142607
synchronize_irq(irq_num);
26152608
devm_free_irq(ice_pf_to_dev(pf), irq_num, vsi->q_vectors[i]);
26162609
}

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2527,34 +2527,6 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset)
25272527
return 0;
25282528
}
25292529

2530-
/**
2531-
* ice_irq_affinity_notify - Callback for affinity changes
2532-
* @notify: context as to what irq was changed
2533-
* @mask: the new affinity mask
2534-
*
2535-
* This is a callback function used by the irq_set_affinity_notifier function
2536-
* so that we may register to receive changes to the irq affinity masks.
2537-
*/
2538-
static void
2539-
ice_irq_affinity_notify(struct irq_affinity_notify *notify,
2540-
const cpumask_t *mask)
2541-
{
2542-
struct ice_q_vector *q_vector =
2543-
container_of(notify, struct ice_q_vector, affinity_notify);
2544-
2545-
cpumask_copy(&q_vector->affinity_mask, mask);
2546-
}
2547-
2548-
/**
2549-
* ice_irq_affinity_release - Callback for affinity notifier release
2550-
* @ref: internal core kernel usage
2551-
*
2552-
* This is a callback function used by the irq_set_affinity_notifier function
2553-
* to inform the current notification subscriber that they will no longer
2554-
* receive notifications.
2555-
*/
2556-
static void ice_irq_affinity_release(struct kref __always_unused *ref) {}
2557-
25582530
/**
25592531
* ice_vsi_ena_irq - Enable IRQ for the given VSI
25602532
* @vsi: the VSI being configured
@@ -2618,19 +2590,6 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
26182590
err);
26192591
goto free_q_irqs;
26202592
}
2621-
2622-
/* register for affinity change notifications */
2623-
if (!IS_ENABLED(CONFIG_RFS_ACCEL)) {
2624-
struct irq_affinity_notify *affinity_notify;
2625-
2626-
affinity_notify = &q_vector->affinity_notify;
2627-
affinity_notify->notify = ice_irq_affinity_notify;
2628-
affinity_notify->release = ice_irq_affinity_release;
2629-
irq_set_affinity_notifier(irq_num, affinity_notify);
2630-
}
2631-
2632-
/* assign the mask for this irq */
2633-
irq_update_affinity_hint(irq_num, &q_vector->affinity_mask);
26342593
}
26352594

26362595
err = ice_set_cpu_rx_rmap(vsi);
@@ -2646,9 +2605,6 @@ static int ice_vsi_req_irq_msix(struct ice_vsi *vsi, char *basename)
26462605
free_q_irqs:
26472606
while (vector--) {
26482607
irq_num = vsi->q_vectors[vector]->irq.virq;
2649-
if (!IS_ENABLED(CONFIG_RFS_ACCEL))
2650-
irq_set_affinity_notifier(irq_num, NULL);
2651-
irq_update_affinity_hint(irq_num, NULL);
26522608
devm_free_irq(dev, irq_num, &vsi->q_vectors[vector]);
26532609
}
26542610
return err;
@@ -3675,6 +3631,9 @@ void ice_set_netdev_features(struct net_device *netdev)
36753631
*/
36763632
netdev->hw_features |= NETIF_F_RXFCS;
36773633

3634+
/* Allow core to manage IRQs affinity */
3635+
netif_set_affinity_auto(netdev);
3636+
36783637
netif_set_tso_max_size(netdev, ICE_MAX_TSO_SIZE);
36793638
}
36803639

0 commit comments

Comments
 (0)