Skip to content

Commit 37d8b4e

Browse files
author
Mamatha Inamdar
committed
ibmveth: Optimize poll rescheduling process
JIRA: https://issues.redhat.com/browse/RHEL-52913 commit f128c7c Author: Nick Child <nnac123@linux.ibm.com> Date: Thu Aug 1 16:12:14 2024 -0500 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 <nnac123@linux.ibm.com> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com> Link: https://patch.msgid.link/20240801211215.128101-2-nnac123@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
1 parent 1e629b3 commit 37d8b4e

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
@@ -1342,6 +1342,7 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
13421342
unsigned long lpar_rc;
13431343
u16 mss = 0;
13441344

1345+
restart_poll:
13451346
while (frames_processed < budget) {
13461347
if (!ibmveth_rxq_pending_buffer(adapter))
13471348
break;
@@ -1425,24 +1426,25 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
14251426

14261427
ibmveth_replenish_task(adapter);
14271428

1428-
if (frames_processed < budget) {
1429-
napi_complete_done(napi, frames_processed);
1429+
if (frames_processed == budget)
1430+
goto out;
14301431

1431-
/* We think we are done - reenable interrupts,
1432-
* then check once more to make sure we are done.
1433-
*/
1434-
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1435-
VIO_IRQ_ENABLE);
1432+
if (!napi_complete_done(napi, frames_processed))
1433+
goto out;
14361434

1437-
BUG_ON(lpar_rc != H_SUCCESS);
1435+
/* We think we are done - reenable interrupts,
1436+
* then check once more to make sure we are done.
1437+
*/
1438+
lpar_rc = h_vio_signal(adapter->vdev->unit_address, VIO_IRQ_ENABLE);
1439+
BUG_ON(lpar_rc != H_SUCCESS);
14381440

1439-
if (ibmveth_rxq_pending_buffer(adapter) &&
1440-
napi_schedule(napi)) {
1441-
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1442-
VIO_IRQ_DISABLE);
1443-
}
1441+
if (ibmveth_rxq_pending_buffer(adapter) && napi_schedule(napi)) {
1442+
lpar_rc = h_vio_signal(adapter->vdev->unit_address,
1443+
VIO_IRQ_DISABLE);
1444+
goto restart_poll;
14441445
}
14451446

1447+
out:
14461448
return frames_processed;
14471449
}
14481450

0 commit comments

Comments
 (0)