@@ -113,6 +113,7 @@ struct iavf_q_vector {
bool arm_wb_state;
cpumask_t affinity_mask;
struct irq_affinity_notify affinity_notify;
+ unsigned int irq_num;
};
/* Helper macros to switch between ints/sec and what the register uses.
@@ -565,7 +565,8 @@ iavf_request_traffic_irqs(struct iavf_adapter *adapter, char *basename)
{
unsigned int vector, q_vectors;
unsigned int rx_int_idx = 0, tx_int_idx = 0;
- int irq_num, err;
+ unsigned int irq_num;
+ int err;
int cpu;
iavf_irq_disable(adapter);
@@ -601,6 +602,7 @@ iavf_request_traffic_irqs(struct iavf_adapter *adapter, char *basename)
"Request_irq failed, error: %d\n", err);
goto free_queue_irqs;
}
+ q_vector->irq_num = irq_num;
/* register for affinity change notifications */
q_vector->affinity_notify.notify = iavf_irq_affinity_notify;
q_vector->affinity_notify.release =
@@ -1408,8 +1408,6 @@ int iavf_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
@@ -1417,7 +1415,7 @@ int iavf_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);
Use napi_affinity_no_change instead of iavf's internal implementation, simplifying and centralizing the logic. To support this, struct iavf_q_vector has been extended to store the IRQ number, and irq_num's type is changed to unsigned int. Signed-off-by: Joe Damato <jdamato@fastly.com> --- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 4 +++- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 4 +--- 3 files changed, 5 insertions(+), 4 deletions(-)