Commit 4b5539c0 authored by Magnus Karlsson's avatar Magnus Karlsson Committed by Tony Nguyen

i40e: eliminate division in napi_poll data path

Eliminate a division in the napi_poll data path. This division is
executed even though it is only needed in the rare case when there are
not enough interrupt lines so they have to be shared between queue
pairs. Instead, just test for this case and only execute the division
if needed. The code has been lifted from the ice driver.
Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
parent 5574ff7b
...@@ -2595,10 +2595,16 @@ int i40e_napi_poll(struct napi_struct *napi, int budget) ...@@ -2595,10 +2595,16 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
if (budget <= 0) if (budget <= 0)
goto tx_only; goto tx_only;
/* We attempt to distribute budget to each Rx queue fairly, but don't /* normally we have 1 Rx ring per q_vector */
* allow the budget to go below 1 because that would exit polling early. if (unlikely(q_vector->num_ringpairs > 1))
*/ /* We attempt to distribute budget to each Rx queue fairly, but
budget_per_ring = max(budget/q_vector->num_ringpairs, 1); * don't allow the budget to go below 1 because that would exit
* polling early.
*/
budget_per_ring = max_t(int, budget / q_vector->num_ringpairs, 1);
else
/* Max of 1 Rx ring in this q_vector so give it the budget */
budget_per_ring = budget;
i40e_for_each_ring(ring, q_vector->rx) { i40e_for_each_ring(ring, q_vector->rx) {
int cleaned = ring->xsk_umem ? int cleaned = ring->xsk_umem ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment