From: checkpatch@dpdk.org
To: test-report@dpdk.org
Cc: Rahul Bhansali <rbhansali@marvell.com>
Subject: |WARNING| pw128163 [PATCH] net/cnxk: add atomic fc check in poll mode Tx path
Date: Tue, 6 Jun 2023 08:13:46 +0200 (CEST) [thread overview]
Message-ID: <20230606061346.4328512077C@dpdk.org> (raw)
In-Reply-To: <20230606061249.833290-1-rbhansali@marvell.com>
Test-Label: checkpatch
Test-Status: WARNING
http://dpdk.org/patch/128163
_coding style issues_
CHECK:MACRO_ARG_REUSE: Macro argument reuse 'txq' - possible side-effects?
#119: FILE: drivers/net/cnxk/cn10k_tx.h:50:
+#define NIX_XMIT_FC_OR_RETURN_MTS(txq, pkts) \
+ do { \
+ int64_t *fc_cache = &(txq)->fc_cache_pkts; \
+ uint8_t retry_count = 8; \
+ int64_t val, newval; \
+ retry: \
+ /* Reduce the cached count */ \
+ val = (int64_t)__atomic_fetch_sub(fc_cache, pkts, __ATOMIC_RELAXED); \
+ val -= pkts; \
+ /* Cached value is low, Update the fc_cache_pkts */ \
+ if (unlikely(val < 0)) { \
+ /* Multiply with sqe_per_sqb to express in pkts */ \
+ newval = txq->nb_sqb_bufs_adj - __atomic_load_n(txq->fc_mem, \
+ __ATOMIC_RELAXED); \
+ newval = (newval << (txq)->sqes_per_sqb_log2) - newval; \
+ newval -= pkts; \
+ if (!__atomic_compare_exchange_n(fc_cache, &val, newval, false, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { \
+ if (retry_count) { \
+ retry_count--; \
+ goto retry; \
+ } else \
+ return 0; \
+ } \
+ /* Update and check it again for the room */ \
+ if (unlikely(newval < 0)) \
+ return 0; \
+ } \
+ } while (0)
CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pkts' - possible side-effects?
#119: FILE: drivers/net/cnxk/cn10k_tx.h:50:
+#define NIX_XMIT_FC_OR_RETURN_MTS(txq, pkts) \
+ do { \
+ int64_t *fc_cache = &(txq)->fc_cache_pkts; \
+ uint8_t retry_count = 8; \
+ int64_t val, newval; \
+ retry: \
+ /* Reduce the cached count */ \
+ val = (int64_t)__atomic_fetch_sub(fc_cache, pkts, __ATOMIC_RELAXED); \
+ val -= pkts; \
+ /* Cached value is low, Update the fc_cache_pkts */ \
+ if (unlikely(val < 0)) { \
+ /* Multiply with sqe_per_sqb to express in pkts */ \
+ newval = txq->nb_sqb_bufs_adj - __atomic_load_n(txq->fc_mem, \
+ __ATOMIC_RELAXED); \
+ newval = (newval << (txq)->sqes_per_sqb_log2) - newval; \
+ newval -= pkts; \
+ if (!__atomic_compare_exchange_n(fc_cache, &val, newval, false, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { \
+ if (retry_count) { \
+ retry_count--; \
+ goto retry; \
+ } else \
+ return 0; \
+ } \
+ /* Update and check it again for the room */ \
+ if (unlikely(newval < 0)) \
+ return 0; \
+ } \
+ } while (0)
WARNING:MACRO_WITH_FLOW_CONTROL: Macros with flow control statements should be avoided
#119: FILE: drivers/net/cnxk/cn10k_tx.h:50:
+#define NIX_XMIT_FC_OR_RETURN_MTS(txq, pkts) \
+ do { \
+ int64_t *fc_cache = &(txq)->fc_cache_pkts; \
+ uint8_t retry_count = 8; \
+ int64_t val, newval; \
+ retry: \
+ /* Reduce the cached count */ \
+ val = (int64_t)__atomic_fetch_sub(fc_cache, pkts, __ATOMIC_RELAXED); \
+ val -= pkts; \
+ /* Cached value is low, Update the fc_cache_pkts */ \
+ if (unlikely(val < 0)) { \
+ /* Multiply with sqe_per_sqb to express in pkts */ \
+ newval = txq->nb_sqb_bufs_adj - __atomic_load_n(txq->fc_mem, \
+ __ATOMIC_RELAXED); \
+ newval = (newval << (txq)->sqes_per_sqb_log2) - newval; \
+ newval -= pkts; \
+ if (!__atomic_compare_exchange_n(fc_cache, &val, newval, false, \
+ __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { \
+ if (retry_count) { \
+ retry_count--; \
+ goto retry; \
+ } else \
+ return 0; \
+ } \
+ /* Update and check it again for the room */ \
+ if (unlikely(newval < 0)) \
+ return 0; \
+ } \
+ } while (0)
WARNING:INDENTED_LABEL: labels should not be indented
#124: FILE: drivers/net/cnxk/cn10k_tx.h:55:
+ retry: \
CHECK:MACRO_ARG_REUSE: Macro argument reuse 'txq' - possible side-effects?
#149: FILE: drivers/net/cnxk/cn10k_tx.h:80:
+#define NIX_XMIT_FC_CHECK_RETURN(txq, pkts) \
+ do { \
+ if (unlikely((txq)->flag)) \
+ NIX_XMIT_FC_OR_RETURN_MTS(txq, pkts); \
+ else { \
+ NIX_XMIT_FC_OR_RETURN(txq, pkts); \
+ /* Reduce the cached count */ \
+ txq->fc_cache_pkts -= pkts; \
+ } \
+ } while (0)
CHECK:MACRO_ARG_REUSE: Macro argument reuse 'pkts' - possible side-effects?
#149: FILE: drivers/net/cnxk/cn10k_tx.h:80:
+#define NIX_XMIT_FC_CHECK_RETURN(txq, pkts) \
+ do { \
+ if (unlikely((txq)->flag)) \
+ NIX_XMIT_FC_OR_RETURN_MTS(txq, pkts); \
+ else { \
+ NIX_XMIT_FC_OR_RETURN(txq, pkts); \
+ /* Reduce the cached count */ \
+ txq->fc_cache_pkts -= pkts; \
+ } \
+ } while (0)
total: 0 errors, 2 warnings, 4 checks, 103 lines checked
next prev parent reply other threads:[~2023-06-06 6:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230606061249.833290-1-rbhansali@marvell.com>
2023-06-06 6:02 ` |SUCCESS| " qemudev
2023-06-06 6:06 ` qemudev
2023-06-06 6:13 ` checkpatch [this message]
2023-06-06 13:34 |WARNING| " dpdklab
2023-06-08 21:33 dpdklab
2023-06-09 21:45 dpdklab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230606061346.4328512077C@dpdk.org \
--to=checkpatch@dpdk.org \
--cc=rbhansali@marvell.com \
--cc=test-report@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).