Use napi_affinity_no_change instead of i40e's internal implementation,
simplifying and centralizing the logic. To facilitate this, fix the type
of irq_num to be unsigned int.

Signed-off-by: Joe Damato <[email protected]>
---
 drivers/net/ethernet/intel/i40e/i40e.h      | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 4 +---
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e.h 
b/drivers/net/ethernet/intel/i40e/i40e.h
index d546567e0286..326bb7ffab26 100644
--- a/drivers/net/ethernet/intel/i40e/i40e.h
+++ b/drivers/net/ethernet/intel/i40e/i40e.h
@@ -955,7 +955,7 @@ struct i40e_q_vector {
        char name[I40E_INT_NAME_STR_LEN];
        bool arm_wb_state;
        bool in_busy_poll;
-       int irq_num;            /* IRQ assigned to this q_vector */
+       unsigned int irq_num;   /* IRQ assigned to this q_vector */
 } ____cacheline_internodealigned_in_smp;
 
 /* lan device */
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c 
b/drivers/net/ethernet/intel/i40e/i40e_main.c
index cbcfada7b357..a120fdd87c3e 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4137,10 +4137,10 @@ static int i40e_vsi_request_irq_msix(struct i40e_vsi 
*vsi, char *basename)
        int q_vectors = vsi->num_q_vectors;
        struct i40e_pf *pf = vsi->back;
        int base = vsi->base_vector;
+       unsigned int irq_num;
        int rx_int_idx = 0;
        int tx_int_idx = 0;
        int vector, err;
-       int irq_num;
        int cpu;
 
        for (vector = 0; vector < q_vectors; vector++) {
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c 
b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index c006f716a3bd..8fc39cf4c5d3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2810,8 +2810,6 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
 
        /* If work not completed, return budget and polling will return */
        if (!clean_complete) {
-               int cpu_id = smp_processor_id();
-
                /* It is possible that the interrupt affinity has changed but,
                 * if the cpu is pegged at 100%, polling will never exit while
                 * traffic continues and the interrupt will be stuck on this
@@ -2819,7 +2817,7 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
                 * continue to poll, otherwise we must stop polling so the
                 * interrupt can move to the correct cpu.
                 */
-               if (!cpumask_test_cpu(cpu_id, &q_vector->affinity_mask)) {
+               if (!napi_affinity_no_change(q_vector->irq_num)) {
                        /* Tell napi that we are done polling */
                        napi_complete_done(napi, work_done);
 
-- 
2.25.1

Reply via email to