diff mbox series

[net,1/2] ionic: Fix napi case where budget == 0

Message ID 20240813234122.53083-2-brett.creeley@amd.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series ionic: Small fixes | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 7 this patch: 7
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 29 this patch: 29
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 29 this patch: 29
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest warning net-next-2024-08-14--09-00 (tests: 708)

Commit Message

Brett Creeley Aug. 13, 2024, 11:41 p.m. UTC
The change in the fixes allowed the ionic_tx_cq_service() function
to be called when budget == 0, but no packet completions will
actually be serviced since it returns immediately when budget is
passed in as 0. Fix this by not checking budget before entering
the completion servicing while loop. This will allow a single
cq entry to be processed since ++work_done will always be greater
than work_to_do.

With this change a simple netconsole test as described in
Documentation/networking/netconsole.txt works as expected.

Fixes: 2f74258d997c ("ionic: minimal work with 0 budget")
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
---
 drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Joe Damato Aug. 14, 2024, 11:33 a.m. UTC | #1
On Tue, Aug 13, 2024 at 04:41:21PM -0700, Brett Creeley wrote:
> The change in the fixes allowed the ionic_tx_cq_service() function
> to be called when budget == 0, but no packet completions will
> actually be serviced since it returns immediately when budget is
> passed in as 0. Fix this by not checking budget before entering
> the completion servicing while loop. This will allow a single
> cq entry to be processed since ++work_done will always be greater
> than work_to_do.
> 
> With this change a simple netconsole test as described in
> Documentation/networking/netconsole.txt works as expected.
> 
> Fixes: 2f74258d997c ("ionic: minimal work with 0 budget")
> Signed-off-by: Brett Creeley <brett.creeley@amd.com>
> ---
>  drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 3 ---
>  1 file changed, 3 deletions(-)

I think fixes may need to CC stable, but in either case:

Reviewed-by: Joe Damato <jdamato@fastly.com>
Brett Creeley Aug. 14, 2024, 6:01 p.m. UTC | #2
On 8/14/2024 4:33 AM, Joe Damato wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Tue, Aug 13, 2024 at 04:41:21PM -0700, Brett Creeley wrote:
>> The change in the fixes allowed the ionic_tx_cq_service() function
>> to be called when budget == 0, but no packet completions will
>> actually be serviced since it returns immediately when budget is
>> passed in as 0. Fix this by not checking budget before entering
>> the completion servicing while loop. This will allow a single
>> cq entry to be processed since ++work_done will always be greater
>> than work_to_do.
>>
>> With this change a simple netconsole test as described in
>> Documentation/networking/netconsole.txt works as expected.
>>
>> Fixes: 2f74258d997c ("ionic: minimal work with 0 budget")
>> Signed-off-by: Brett Creeley <brett.creeley@amd.com>
>> ---
>>   drivers/net/ethernet/pensando/ionic/ionic_txrx.c | 3 ---
>>   1 file changed, 3 deletions(-)
> 
> I think fixes may need to CC stable, but in either case:
> 
> Reviewed-by: Joe Damato <jdamato@fastly.com>

Thanks for the reminder and review. I will CC stable if I end up needing 
to re-push a v2.

Brett
Jakub Kicinski Aug. 15, 2024, 12:27 a.m. UTC | #3
On Tue, 13 Aug 2024 16:41:21 -0700 Brett Creeley wrote:
> The change in the fixes allowed the ionic_tx_cq_service() function
> to be called when budget == 0, but no packet completions will
> actually be serviced since it returns immediately when budget is
> passed in as 0. Fix this by not checking budget before entering
> the completion servicing while loop. This will allow a single
> cq entry to be processed since ++work_done will always be greater
> than work_to_do.
> 
> With this change a simple netconsole test as described in
> Documentation/networking/netconsole.txt works as expected.

I think I see a call to XDP cleanup as part of Tx processing.
XDP can't be handled with budget of 0 :(
Brett Creeley Aug. 15, 2024, 12:59 a.m. UTC | #4
On 8/14/2024 5:27 PM, Jakub Kicinski wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
> 
> 
> On Tue, 13 Aug 2024 16:41:21 -0700 Brett Creeley wrote:
>> The change in the fixes allowed the ionic_tx_cq_service() function
>> to be called when budget == 0, but no packet completions will
>> actually be serviced since it returns immediately when budget is
>> passed in as 0. Fix this by not checking budget before entering
>> the completion servicing while loop. This will allow a single
>> cq entry to be processed since ++work_done will always be greater
>> than work_to_do.
>>
>> With this change a simple netconsole test as described in
>> Documentation/networking/netconsole.txt works as expected.
> 
> I think I see a call to XDP cleanup as part of Tx processing.
> XDP can't be handled with budget of 0 :(

Well that's unfortunate to say the least. I will look at how to fix this 
as well and send a v2.

Thanks,

Brett
> --
> pw-bot: cr
diff mbox series

Patch

diff --git a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
index fc79baad4561..8557d672d269 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_txrx.c
@@ -1261,9 +1261,6 @@  unsigned int ionic_tx_cq_service(struct ionic_cq *cq,
 	unsigned int bytes = 0;
 	unsigned int pkts = 0;
 
-	if (work_to_do == 0)
-		return 0;
-
 	while (ionic_tx_service(cq, &pkts, &bytes, in_napi)) {
 		if (cq->tail_idx == cq->num_descs - 1)
 			cq->done_color = !cq->done_color;