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 9D67AA0A02 for ; Mon, 17 May 2021 18:11:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9670740041; Mon, 17 May 2021 18:11:11 +0200 (CEST) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 1673440041 for ; Mon, 17 May 2021 18:11:10 +0200 (CEST) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1lifpl-0007Yl-RX; Mon, 17 May 2021 16:11:09 +0000 From: Christian Ehrhardt To: Nipun Gupta Cc: Hemant Agrawal , dpdk stable Date: Mon, 17 May 2021 18:07:20 +0200 Message-Id: <20210517161039.3132619-11-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> References: <20210517161039.3132619-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'bus/dpaa: fix statistics reading' has been queued to stable release 19.11.9 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/19/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/fa5027dd6968fbf19a82602ac4d155de4dd49eeb Thanks. Christian Ehrhardt --- >From fa5027dd6968fbf19a82602ac4d155de4dd49eeb Mon Sep 17 00:00:00 2001 From: Nipun Gupta Date: Wed, 24 Feb 2021 18:12:50 +0530 Subject: [PATCH] bus/dpaa: fix statistics reading [ upstream commit e62a3f4183f14a91f0dd63e9ea39e749406b5653 ] Reading of word un-aligned values after reading word aligned values lead to corruption of memory. This patch make changes such that word aligned access is made, before making an un-aligned access Fixes: 6d6b4f49a155 ("bus/dpaa: add FMAN hardware operations") Signed-off-by: Nipun Gupta Acked-by: Hemant Agrawal --- drivers/bus/dpaa/base/fman/fman_hw.c | 33 ++++++++++++++-------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/drivers/bus/dpaa/base/fman/fman_hw.c b/drivers/bus/dpaa/base/fman/fman_hw.c index 9ab8e835dc..d28ed0bb8a 100644 --- a/drivers/bus/dpaa/base/fman/fman_hw.c +++ b/drivers/bus/dpaa/base/fman/fman_hw.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: BSD-3-Clause * - * Copyright 2017 NXP + * Copyright 2017,2020 NXP * */ @@ -219,20 +219,20 @@ fman_if_stats_get(struct fman_if *p, struct rte_eth_stats *stats) struct memac_regs *regs = m->ccsr_map; /* read recved packet count */ - stats->ipackets = ((u64)in_be32(®s->rfrm_u)) << 32 | - in_be32(®s->rfrm_l); - stats->ibytes = ((u64)in_be32(®s->roct_u)) << 32 | - in_be32(®s->roct_l); - stats->ierrors = ((u64)in_be32(®s->rerr_u)) << 32 | - in_be32(®s->rerr_l); + stats->ipackets = (u64)in_be32(®s->rfrm_l) | + ((u64)in_be32(®s->rfrm_u)) << 32; + stats->ibytes = (u64)in_be32(®s->roct_l) | + ((u64)in_be32(®s->roct_u)) << 32; + stats->ierrors = (u64)in_be32(®s->rerr_l) | + ((u64)in_be32(®s->rerr_u)) << 32; /* read xmited packet count */ - stats->opackets = ((u64)in_be32(®s->tfrm_u)) << 32 | - in_be32(®s->tfrm_l); - stats->obytes = ((u64)in_be32(®s->toct_u)) << 32 | - in_be32(®s->toct_l); - stats->oerrors = ((u64)in_be32(®s->terr_u)) << 32 | - in_be32(®s->terr_l); + stats->opackets = (u64)in_be32(®s->tfrm_l) | + ((u64)in_be32(®s->tfrm_u)) << 32; + stats->obytes = (u64)in_be32(®s->toct_l) | + ((u64)in_be32(®s->toct_u)) << 32; + stats->oerrors = (u64)in_be32(®s->terr_l) | + ((u64)in_be32(®s->terr_u)) << 32; } void @@ -244,10 +244,9 @@ fman_if_stats_get_all(struct fman_if *p, uint64_t *value, int n) uint64_t base_offset = offsetof(struct memac_regs, reoct_l); for (i = 0; i < n; i++) - value[i] = ((u64)in_be32((char *)regs - + base_offset + 8 * i + 4)) << 32 | - ((u64)in_be32((char *)regs - + base_offset + 8 * i)); + value[i] = (((u64)in_be32((char *)regs + base_offset + 8 * i) | + (u64)in_be32((char *)regs + base_offset + + 8 * i + 4)) << 32); } void -- 2.31.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-05-17 17:40:30.000110084 +0200 +++ 0011-bus-dpaa-fix-statistics-reading.patch 2021-05-17 17:40:29.103808941 +0200 @@ -1 +1 @@ -From e62a3f4183f14a91f0dd63e9ea39e749406b5653 Mon Sep 17 00:00:00 2001 +From fa5027dd6968fbf19a82602ac4d155de4dd49eeb Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit e62a3f4183f14a91f0dd63e9ea39e749406b5653 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -21 +22 @@ -index 4ab49f7853..af9bac76c2 100644 +index 9ab8e835dc..d28ed0bb8a 100644