From patchwork Wed Feb 9 09:23:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12739911 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEB2BC433EF for ; Wed, 9 Feb 2022 09:26:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234661AbiBIJ0V (ORCPT ); Wed, 9 Feb 2022 04:26:21 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:48672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiBIJ0T (ORCPT ); Wed, 9 Feb 2022 04:26:19 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on061c.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::61c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E47E01D5E1 for ; Wed, 9 Feb 2022 01:26:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R8rBmSoauhr/PasxH15iGOHtl4p5TrTjQlvxODgVz4ppr1C465srhvQoUpxip/o8gpg2kMYs3o+2sZhgnKyb6j1NeSwaA8P7eHMGiWsDJbuYcZPj9SjxsLyQvp93ZEkoML3pBWTwgHZuzLhSGZoj9SsYFb9n9yXtAnXnar33hHZZJpe+VUNHhPw+ZCgfmnku3cXrboG/n0qp3AbGFft9alHvZU6QJtKgOiRJmvyerHJKvP1UvJao2WzeNJl9snNxmafnxGdPvH1PmV4PNYhP8vM0j7kO5eohm8LOWLA/DOxVF2nwGYjiARZifNL6kufSTL9Q74gfssLh0TDjXLmRmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HBRvrC5HV19StHSkA7eYj1O1NylUgmjqtq3L9xgUOfo=; b=egyTcxKSF424qOuBaxxEzLx0G9049OoM65BkEwl+2mt0vdFBLvw2SLnk8PSm+gEiFTsbk57jpJ1ePQAyH2PUVljb6pMMDKpDnqPSha0q7CP3q/kadW782wkVaV+Faivs8Y8tI5/yLZRtGTmeKGV9rsPl2fQIDq3/S28PSFikDf9YBtIVesvS5VEPaIf7BdJ6Ej0rOFkbCEHOKFhVdkvTSqRT+WoCa59YrswhDDKPaMP7zab6I+xQfc/1gSzcUFKECaHoq/RMVRoXJCPPHN+cRwibseyzxBJecvUJDSSl8D1cYtPpmvI+mRRv7f6XtL1XIG/TH6xZfXrcnwsAG2+7Eg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HBRvrC5HV19StHSkA7eYj1O1NylUgmjqtq3L9xgUOfo=; b=OvTpG4+kYdaa4BvekXVShpyOmq8QseMfWWipXN+uoLimfEM9bU/633ss1wm+Rw6t8Gg5Cmu/MGKJcryM1eNhd/Xmqvdzu+p0Bw/1ijQ4cqM/FBO2gjDb/oaVT+GZBI8l8wvYLAMKGxegCjmjucypKXnwIqdMdbAYp1LemlbfgV8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by AM0PR04MB5972.eurprd04.prod.outlook.com (2603:10a6:208:120::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Wed, 9 Feb 2022 09:24:05 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::5df9:5bf0:7ac1:a793]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::5df9:5bf0:7ac1:a793%9]) with mapi id 15.20.4975.011; Wed, 9 Feb 2022 09:24:05 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: youri.querry_1@nxp.com, leoyang.li@nxp.com, Ioana Ciornei Subject: [PATCH net-next 7/7] soc: fsl: dpio: read the consumer index from the cache inhibited area Date: Wed, 9 Feb 2022 11:23:35 +0200 Message-Id: <20220209092335.3064731-8-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220209092335.3064731-1-ioana.ciornei@nxp.com> References: <20220209092335.3064731-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AM0PR03CA0037.eurprd03.prod.outlook.com (2603:10a6:208::14) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 567d8c67-8642-4611-6742-08d9ebadeb33 X-MS-TrafficTypeDiagnostic: AM0PR04MB5972:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tJf/uioi/kcYMDUwslTJEotxDoIBeaq1tqjmWY2/mt5eQeaJDNKwDuJhCwfxN/vGNhE7uiGSCfuK8LC5OOlQdnoIR2t1bx/uQwYbbkx0DfY8pJOegSjUY4gVegfP7J+kLU1+GRDNpuZGSlLmF4YAKUwfBU6ej1zBZGbcb38YnVotMIXSEL5ZDZJqIUT/FDgNR+OFaR5sGziFW/JQInrp5oGvVbfmD7PycEXzcyYplJKCgznusuxSP0XwWIxVa3zQdgKlqGlrovekNyRNkz8xhkp/3Zp+zqAIjZn90FDK3FbupQUmldkKt7546rw+qTzfhXmNJ+knaPn26e9LIa0OouQfZBBvXjkLoGwxCfnMqEVgXLFrf/7xRYgZVBnQM+zXKT9Xpk+oUSwKl1wCH+eUYkT9gnDxgVTh1kAGow+wYs2t59poA+zJ2KswnPvqrf4QDNSW3l9ZfUomalaaGRZCINLJGDSxX5LRVfN7vTX80k1tOlpOuxFDcgSypy8wmOcrCg81fcvGs2Ei8rhExhuc2KgOCw14UMuc2WXcL5/HAhmNpTTmWgGDnL6uCX50FaqPb6ac4OdobYBm5Anl6L8ODjkwtqx8b5hMC7B0AFRqvbL9qs98t5WlKpRQJvPvnVY+ES1jRjJx4yO7S19PDndSwzErXMyPwTtiZRN1DrsYvqvkK1WDawQNgIusHh+ZcWZRC+xKbQCFVjnybyu4q4y2Xw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8555.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(8936002)(38100700002)(2906002)(2616005)(5660300002)(38350700002)(44832011)(83380400001)(52116002)(6506007)(6512007)(36756003)(186003)(6666004)(1076003)(316002)(86362001)(66946007)(66556008)(508600001)(4326008)(66476007)(8676002)(26005)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HBMaCA4cDWvc1PIx76sukwVieoQpIZc24V13NKnQ48ECr3u6xAChKmJKtfjbNSqBNaAYnNjX1NXxvDkJIMBEVOpq67X3NHU5DHJ8/Cr5Zi2KzRKzLm4au2pt5hNMoyo8rxhi2DvXqYB8WQcXtbrJrr1dJsGdI6NeLzwVtgmtp60uoVcgHlYt/My7AW2tt+vk2FjclAnCBUM+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JdZlAarBaS/AB/x+OwLBmYJrJFK/F2q2sThwDRNbS4FhxnlOQH1GIM27X16HTVzuF5xQYiYEX8FlU3nL+RK7qA30Epg0OsG+iIbT6jH0t+w1ej0pokqbU1Y4Tiv2fofWVFEmEAjWMMdbtQdxtLpEqqP8n3ONjoV0wfgzcdkaAz+UQOIXurzjoAk50AE0jV2lt5iyQHp4zpRAZvRFI/I3TxSq+Q/koX4z76QPCw2uwY7sUXMXHkD9v7wuxVnQ5sQ9yoaUtH6gHkfnvOrVoqymQtvQ+aOHj98gEKkAhiPXNxyVrl8UC1U5D02WG73vLDIbgjktsmmCnu/wwp8iebs6OMx+eCkGIkuq3/eClRzr+otwZY= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 567d8c67-8642-4611-6742-08d9ebadeb33 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2022 09:24:05.8769 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8qDj0YtTo+92/q5G3/0Cx1rmSOm60ElJl7hyYIxfH0sWEWYQYJWiPDeqmFRovIuXAEw+4DunP5M0EPs9FMcZWA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB5972 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Once we added support in the dpaa2-eth for driver level software TSO we observed the following situation: if the EQCR CI (consumer index) is read from the cache-enabled area we sometimes end up with a computed value of available enqueue entries bigger than the size of the ring. This eventually will lead to the multiple enqueue of the same FD which will determine the same FD to end up on the Tx confirmation path and the same skb being freed twice. Just read the consumer index from the cache inhibited area so that we avoid this situation. Signed-off-by: Ioana Ciornei --- drivers/soc/fsl/dpio/qbman-portal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/soc/fsl/dpio/qbman-portal.c b/drivers/soc/fsl/dpio/qbman-portal.c index 058b78fac5e3..0a3fb6c115f4 100644 --- a/drivers/soc/fsl/dpio/qbman-portal.c +++ b/drivers/soc/fsl/dpio/qbman-portal.c @@ -743,8 +743,8 @@ int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s, full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; - p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; - s->eqcr.ci = *p & full_mask; + s->eqcr.ci = qbman_read_register(s, QBMAN_CINH_SWP_EQCR_CI); + s->eqcr.ci &= full_mask; s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, eqcr_ci, s->eqcr.ci); if (!s->eqcr.available) { @@ -887,8 +887,8 @@ int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s, full_mask = s->eqcr.pi_ci_mask; if (!s->eqcr.available) { eqcr_ci = s->eqcr.ci; - p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK; - s->eqcr.ci = *p & full_mask; + s->eqcr.ci = qbman_read_register(s, QBMAN_CINH_SWP_EQCR_CI); + s->eqcr.ci &= full_mask; s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size, eqcr_ci, s->eqcr.ci); if (!s->eqcr.available)