Skip to content

Commit f128c7c

Browse files
Nick Childkuba-moo
authored andcommitted
ibmveth: Optimize poll rescheduling process
When the ibmveth driver processes less than the budget, it must call napi_complete_done() to release the instance. This function will return false if the driver should avoid rearming interrupts. Previously, the driver was ignoring the return code of napi_complete_done(). As a result, there were unnecessary calls to enable the veth irq. Therefore, use the return code napi_complete_done() to determine if irq rearm is necessary. Additionally, in the event that new data is received immediately after rearming interrupts, rather than just rescheduling napi, also jump back to the poll processing loop since we are already in the poll function (and know that we did not expense all of budget). This slight tweak results in a 15% increase in TCP_RR transaction rate (320k to 370k txns). We can see the ftrace data supports this: PREV: ibmveth_poll = 8818014.0 us / 182802.0 hits = AVG 48.24 NEW: ibmveth_poll = 8082398.0 us / 191413.0 hits = AVG 42.22 Signed-off-by: Nick Child <[email protected]> Reviewed-by: Shannon Nelson <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7e1d512 commit f128c7c

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

drivers/net/ethernet/ibm/ibmveth.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,6 +1337,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
13371337
unsigned long lpar_rc;
13381338
u16 mss = 0;
13391339

1340+
restart_poll:
13401341
while (frames_processed < budget) {
13411342
if (!ibmveth_rxq_pending_buffer(adapter))
13421343
break;
@@ -1420,24 +1421,25 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
14201421

14211422
ibmveth_replenish_task(adapter);
14221423

1423-
if (frames_processed < budget) {
1424-
napi_complete_done(napi, frames_processed);
1424+
if (frames_processed == budget)
1425+
goto out;
14251426

1426-
/* We think we are done - reenable interrupts,
1427-
* then check once more to make sure we are done.
1428-
*/
1429-
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1430-
VIO_IRQ_ENABLE);
1427+
if (!napi_complete_done(napi, frames_processed))
1428+
goto out;
14311429

1432-
BUG_ON(lpar_rc != H_SUCCESS);
1430+
/* We think we are done - reenable interrupts,
1431+
* then check once more to make sure we are done.
1432+
*/
1433+
lpar_rc = h_vio_signal(adapter->vdev->unit_address, VIO_IRQ_ENABLE);
1434+
BUG_ON(lpar_rc != H_SUCCESS);
14331435

1434-
if (ibmveth_rxq_pending_buffer(adapter) &&
1435-
napi_schedule(napi)) {
1436-
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1437-
VIO_IRQ_DISABLE);
1438-
}
1436+
if (ibmveth_rxq_pending_buffer(adapter) && napi_schedule(napi)) {
1437+
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1438+
VIO_IRQ_DISABLE);
1439+
goto restart_poll;
14391440
}
14401441

1442+
out:
14411443
return frames_processed;
14421444
}
14431445

0 commit comments

Comments
 (0)