From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4496042C3C for ; Tue, 6 Jun 2023 08:13:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A88940A84; Tue, 6 Jun 2023 08:13:48 +0200 (CEST) Received: from dpdk.org (dpdk.org [92.243.24.197]) by mails.dpdk.org (Postfix) with ESMTP id 5702540A84 for ; Tue, 6 Jun 2023 08:13:46 +0200 (CEST) Received: by dpdk.org (Postfix, from userid 65534) id 4328512077C; Tue, 6 Jun 2023 08:13:46 +0200 (CEST) Subject: |WARNING| pw128163 [PATCH] net/cnxk: add atomic fc check in poll mode Tx path In-Reply-To: <20230606061249.833290-1-rbhansali@marvell.com> References: <20230606061249.833290-1-rbhansali@marvell.com> To: test-report@dpdk.org From: checkpatch@dpdk.org Cc: Rahul Bhansali Message-Id: <20230606061346.4328512077C@dpdk.org> Date: Tue, 6 Jun 2023 08:13:46 +0200 (CEST) X-BeenThere: test-report@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: automatic DPDK test reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: test-report-bounces@dpdk.org 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