diff mbox series

[net-next] net: cxgb3: simplify logic for rspq_check_napi

Message ID 20231012091429.2048-1-ansuelsmth@gmail.com (mailing list archive)
State Accepted
Commit 101c6032031f4dba72b91e6c766e958a5e429622
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: cxgb3: simplify logic for rspq_check_napi | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1365 this patch: 1365
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 1386 this patch: 1386
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 No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1390 this patch: 1390
netdev/checkpatch warning WARNING: line length of 81 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Christian Marangi Oct. 12, 2023, 9:14 a.m. UTC
Simplify logic for rspq_check_napi.
Drop redundant and wrong napi_is_scheduled call as it's not race free
and directly use the output of napi_schedule to understand if a napi is
pending or not.

rspq_check_napi main logic is to check if is_new_response is true and
check if a napi is not scheduled. The result of this function is then
used to detect if we are missing some interrupt and act on top of
this... With this knowing, we can rework and simplify the logic and make
it less problematic with testing an internal bit for napi.

Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/net/ethernet/chelsio/cxgb3/sge.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 16, 2023, 8:10 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Thu, 12 Oct 2023 11:14:29 +0200 you wrote:
> Simplify logic for rspq_check_napi.
> Drop redundant and wrong napi_is_scheduled call as it's not race free
> and directly use the output of napi_schedule to understand if a napi is
> pending or not.
> 
> rspq_check_napi main logic is to check if is_new_response is true and
> check if a napi is not scheduled. The result of this function is then
> used to detect if we are missing some interrupt and act on top of
> this... With this knowing, we can rework and simplify the logic and make
> it less problematic with testing an internal bit for napi.
> 
> [...]

Here is the summary with links:
  - [net-next] net: cxgb3: simplify logic for rspq_check_napi
    https://git.kernel.org/netdev/net-next/c/101c6032031f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/chelsio/cxgb3/sge.c b/drivers/net/ethernet/chelsio/cxgb3/sge.c
index 2e9a74fe0970..dfe4e0102960 100644
--- a/drivers/net/ethernet/chelsio/cxgb3/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb3/sge.c
@@ -2674,12 +2674,7 @@  static int rspq_check_napi(struct sge_qset *qs)
 {
 	struct sge_rspq *q = &qs->rspq;
 
-	if (!napi_is_scheduled(&qs->napi) &&
-	    is_new_response(&q->desc[q->cidx], q)) {
-		napi_schedule(&qs->napi);
-		return 1;
-	}
-	return 0;
+	return is_new_response(&q->desc[q->cidx], q) && napi_schedule(&qs->napi);
 }
 
 /*