From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4EC435A397; Sat, 16 May 2026 05:57:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778911064; cv=none; b=ntYX4QwNCWVaQpU1vuoNZilucGiekF08Xy4mQwXVNid1xile6XrGfA/gUkXnRANYag5AoroJONA6aNRdw3Xeop8Q89nrJKCzVwQD+gjfA1bRq6soUI0j7xDVbsmomru6cZeQ0ZPkzSe+QYPaQBBYXGKuAcVgNH2QVPjKPMB4o2I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778911064; c=relaxed/simple; bh=6Fir9ytMAXGOzy4M+9ywv77d1EhUmB6stxIm/ZYCQVc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Bho6YRpLbl5j4S2bGrbq4X7hpKfqZwWSd8y0oYXvx0gQaSfhZVuLujQDFdx3SaB1MB2a/iVbqKWPoFaN6sXkbhq01wgMG5MJXIirXY9uW1y9TQsjxQ6U1C1qMDf9Wytg8WlXhI52X1JAVgWaAT/fzQYHq8BwSK7b6SqxUcVXI0s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=N7RcPokN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="N7RcPokN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43C02C2BCB7; Sat, 16 May 2026 05:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778911064; bh=6Fir9ytMAXGOzy4M+9ywv77d1EhUmB6stxIm/ZYCQVc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=N7RcPokNOcewyy1aS/BbfH9M1/ZRxWOLECiBl53qQnpt6tDsGj6FZ+uua/xJlwjPp 4h4Kb2sDTcSOEXASl5JD5sP5F0tM68fQucJrU2bRlm5P2ZLBnt8pixSfjYylwWYJuL /jTVccJDjZ8Yz+dbYC/G6dXOR3LhNhAwbQHDaCh8ihH6t+fRRcpcoh6HGyx+J4CLCL g/T7c5xXLjk30MISsohI2oBUPHly7j04C6lmU+tHiHx/gSG5J9TICotaKNP195VCHi 6nn5hfdY9M5YCnFK3toWBRnzRJfX0d+DNeI3OSrSIHb/bYd9r/mbv4Iy95DpQMEVUf nCfsvbyoAq+CA== From: Lorenzo Bianconi Date: Sat, 16 May 2026 07:57:08 +0200 Subject: [PATCH net-next v7 06/10] net: airoha: Move {cpu,fwd}_tx_packets in airoha_gdm_dev struct Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260516-airoha-eth-multi-serdes-v7-6-99e0093303e2@kernel.org> References: <20260516-airoha-eth-multi-serdes-v7-0-99e0093303e2@kernel.org> In-Reply-To: <20260516-airoha-eth-multi-serdes-v7-0-99e0093303e2@kernel.org> To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Lorenzo Bianconi Cc: Christian Marangi , Benjamin Larsson , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, devicetree@vger.kernel.org X-Mailer: b4 0.14.3 Since now multiple net_devices connected to different QDMA blocks can share the same GDM port, cpu_tx_packets and fwd_tx_packets fields can be overwritten with the value from a different QDMA block. In order to fix the issue move cpu_tx_packets and fwd_tx_packets fields from airoha_gdm_port struct to airoha_gdm_dev one. Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/airoha/airoha_eth.c | 16 +++++++--------- drivers/net/ethernet/airoha/airoha_eth.h | 7 +++---- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c index 2a2a30dbad27..9d765973aae5 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c @@ -2310,19 +2310,17 @@ static int airoha_qdma_get_tx_ets_stats(struct net_device *netdev, int channel, struct tc_ets_qopt_offload *opt) { struct airoha_gdm_dev *dev = netdev_priv(netdev); - struct airoha_gdm_port *port = dev->port; + struct airoha_qdma *qdma = dev->qdma; - u64 cpu_tx_packets = airoha_qdma_rr(dev->qdma, - REG_CNTR_VAL(channel << 1)); - u64 fwd_tx_packets = airoha_qdma_rr(dev->qdma, + u64 cpu_tx_packets = airoha_qdma_rr(qdma, REG_CNTR_VAL(channel << 1)); + u64 fwd_tx_packets = airoha_qdma_rr(qdma, REG_CNTR_VAL((channel << 1) + 1)); - u64 tx_packets = (cpu_tx_packets - port->cpu_tx_packets) + - (fwd_tx_packets - port->fwd_tx_packets); + u64 tx_packets = (cpu_tx_packets - dev->cpu_tx_packets) + + (fwd_tx_packets - dev->fwd_tx_packets); _bstats_update(opt->stats.bstats, 0, tx_packets); - - port->cpu_tx_packets = cpu_tx_packets; - port->fwd_tx_packets = fwd_tx_packets; + dev->cpu_tx_packets = cpu_tx_packets; + dev->fwd_tx_packets = fwd_tx_packets; return 0; } diff --git a/drivers/net/ethernet/airoha/airoha_eth.h b/drivers/net/ethernet/airoha/airoha_eth.h index a308a770116b..fbb50dc73af8 100644 --- a/drivers/net/ethernet/airoha/airoha_eth.h +++ b/drivers/net/ethernet/airoha/airoha_eth.h @@ -544,6 +544,9 @@ struct airoha_gdm_dev { struct airoha_eth *eth; DECLARE_BITMAP(qos_sq_bmap, AIROHA_NUM_QOS_CHANNELS); + /* qos stats counters */ + u64 cpu_tx_packets; + u64 fwd_tx_packets; }; struct airoha_gdm_port { @@ -553,10 +556,6 @@ struct airoha_gdm_port { struct airoha_hw_stats stats; - /* qos stats counters */ - u64 cpu_tx_packets; - u64 fwd_tx_packets; - struct metadata_dst *dsa_meta[AIROHA_MAX_DSA_PORTS]; }; -- 2.54.0