in build/gve_main.c [442:504]
int gve_napi_poll_dqo(struct napi_struct *napi, int budget)
{
struct gve_notify_block *block =
container_of(napi, struct gve_notify_block, napi);
struct gve_priv *priv = block->priv;
bool reschedule = false;
int work_done = 0;
if (block->tx)
reschedule |= gve_tx_poll_dqo(block, /*do_clean=*/true);
if (!budget)
return 0;
if (block->rx) {
work_done = gve_rx_poll_dqo(block, budget);
reschedule |= work_done == budget;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0))
if (reschedule) {
/* Reschedule by returning budget only if already on the correct
* cpu.
*/
if (likely(gve_is_napi_on_home_cpu(priv, block->irq)))
return budget;
/* If not on the cpu with which this queue's irq has affinity
* with, we avoid rescheduling napi and arm the irq instead so
* that napi gets rescheduled back eventually onto the right
* cpu.
*/
if (work_done == budget)
work_done--;
}
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) */
if (reschedule) {
return budget;
}
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(5,11,0)) */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 5)
if (likely(napi_complete_done(napi, work_done)))
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 3)
napi_complete_done(napi, work_done);
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) || RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(7, 3) */
napi_complete(napi);
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(7, 5) */
{
/* Enable interrupts again.
*
* We don't need to repoll afterwards because HW supports the
* PCI MSI-X PBA feature.
*
* Another interrupt would be triggered if a new event came in
* since the last one.
*/
gve_write_irq_doorbell_dqo(priv, block,
GVE_ITR_NO_UPDATE_DQO | GVE_ITR_ENABLE_BIT_DQO);
}
return work_done;
}