Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3050601ybh; Mon, 5 Aug 2019 11:06:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxStF5iE7X4qGSmoXv4JD+0P1thgtIN8tAps4zBtI+ZfG5EzJV5PIwkoaAVGTd4bTvTcT8/ X-Received: by 2002:a63:3148:: with SMTP id x69mr49034871pgx.300.1565028367404; Mon, 05 Aug 2019 11:06:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565028367; cv=none; d=google.com; s=arc-20160816; b=n+Z5n5g4BXlof5FTwQ0/y4TGBoaylQwkOK+czRELhn26fSq1ZrO/7H6gUYxmtCCzqZ P0CcyDvTyScsNayRgdfXc33bRyeqVsITPqXlVmn1vgC64c+9IuW39+c7Uw5VRrccoMUH +vUl7qaCS6KVDjS6uXl2alynQF20H3eMJVizAaDmjFLhM3zbnzqFdAMt1nMwQZReAy7Q rBS/2dLuZKp+lTf19QYIuDmTxymj93tJBpAnrPVHWg5FFypGY/SLTOzGv8Md+dzk7N2K 93Ud3CHIA2OXGeFH9yesOIkLvZR4x3ExmtwCz9ePSMU6E9jF262pPMo7SahPYO7AmAtw wbTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=Sgzszp7iyCwDlBbd+y1btECwxDp6ROAuDipYnAdE7PU=; b=Z2NaeZcr1Q/4g8AUzXJXtaSROMxD01csravy04tVvAgxsz9OC3Dk/al0nH2V8vsQSr JNoWjI60MzX+/EVmgGQxkx94WAuxMEo7QZ+iaMiiE3ZaK+JJoDmvVo46M/8PsJokqSBn xkQ44g7pUFxY79/sSKJM9vfS8/b/3rxeYYew16QHiNL8UMtJ5TbIz/AP0hj89AQamhLV OGGK/GOHNYxaG3CuE5ftzzPfv/BHL8GhFiqqm/3kArYgcmz+yzMHqjbTPRidD1L5GbdQ YTdg4eNRCcxh43ewhJwmeJupp6FZfROuL6FVm4pHac+ExddgPcK4hk8lwsK3B3IuCMAo 7ZMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Hy+1gQdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si39504748plo.406.2019.08.05.11.05.51; Mon, 05 Aug 2019 11:06:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=Hy+1gQdw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730512AbfHESCY (ORCPT + 99 others); Mon, 5 Aug 2019 14:02:24 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.61.142]:56220 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728867AbfHESBf (ORCPT ); Mon, 5 Aug 2019 14:01:35 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id DEDE5C0A69; Mon, 5 Aug 2019 18:01:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1565028094; bh=0tXrBzavpJ30SObdk4JISSwIOZOnt+7gyCH6maN+jEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=Hy+1gQdwRmP7AR2ROWw0ejrFMfuJcyoPf4BM04d5yXH6Nk0knMnSBXT8VZLv7nWyh BidllMaJRqbAZl2VUg0/gCgOxqbXM+nN7GTkisGDDKzO1u1/kVmyejHDYA8tnSNJ7Q FeNkoanAupcAYvjkKqZ79f6LRr7w94kFGhdXEljwUdU6uIGNS5rnZliViW+LVWQKlb bjFx9kXCMjFiD+R+ZirhZzkKkzxh3PESa9/PA3BOt0iyKvhBGaMQ4M2LIpzU/YeY9r KkKptMbvT8Q4zZ/g6p0P8wp2qumSGPQbdUyS7Hvcfn3mmMghn/+wHQbyXs81JUIFRK 8NjXnv/hSSSZg== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id 971A5A0067; Mon, 5 Aug 2019 18:01:32 +0000 (UTC) From: Jose Abreu To: netdev@vger.kernel.org Cc: Joao Pinto , Jose Abreu , Giuseppe Cavallaro , Alexandre Torgue , "David S. Miller" , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 03/10] net: stmmac: Fix issues when number of Queues >= 4 Date: Mon, 5 Aug 2019 20:01:16 +0200 Message-Id: <5e95bb1761f9438361f198d744640685a34790ea.1565027782.git.joabreu@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When queues >= 4 we use different registers but we were not subtracting the offset of 4. Fix this. Found out by Coverity. Signed-off-by: Jose Abreu --- Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Cc: "David S. Miller" Cc: Maxime Coquelin Cc: netdev@vger.kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 4 ++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index 01c2e2d83e76..fc9954e4a772 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -85,6 +85,8 @@ static void dwmac4_rx_queue_priority(struct mac_device_info *hw, u32 value; base_register = (queue < 4) ? GMAC_RXQ_CTRL2 : GMAC_RXQ_CTRL3; + if (queue >= 4) + queue -= 4; value = readl(ioaddr + base_register); @@ -102,6 +104,8 @@ static void dwmac4_tx_queue_priority(struct mac_device_info *hw, u32 value; base_register = (queue < 4) ? GMAC_TXQ_PRTY_MAP0 : GMAC_TXQ_PRTY_MAP1; + if (queue >= 4) + queue -= 4; value = readl(ioaddr + base_register); diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index 03a6a59650ca..85c68b7ee8c6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -108,6 +108,8 @@ static void dwxgmac2_rx_queue_prio(struct mac_device_info *hw, u32 prio, u32 value, reg; reg = (queue < 4) ? XGMAC_RXQ_CTRL2 : XGMAC_RXQ_CTRL3; + if (queue >= 4) + queue -= 4; value = readl(ioaddr + reg); value &= ~XGMAC_PSRQ(queue); @@ -171,6 +173,8 @@ static void dwxgmac2_map_mtl_to_dma(struct mac_device_info *hw, u32 queue, u32 value, reg; reg = (queue < 4) ? XGMAC_MTL_RXQ_DMA_MAP0 : XGMAC_MTL_RXQ_DMA_MAP1; + if (queue >= 4) + queue -= 4; value = readl(ioaddr + reg); value &= ~XGMAC_QxMDMACH(queue); -- 2.7.4