Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3049840ybh; Mon, 5 Aug 2019 11:05:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDBf1/dZl04TkSqCU8EL86FIJYVqaIM1n2Ta4OYix/KbYknRQRPbb5NW3KzTunYpc/DQHw X-Received: by 2002:a62:1c93:: with SMTP id c141mr76599543pfc.9.1565028321354; Mon, 05 Aug 2019 11:05:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565028321; cv=none; d=google.com; s=arc-20160816; b=QXgYC+bNBNPb0+qpHRw0A0NjQXpTO9CCMELGwbwKACoX9N/8mxjOWEeeTK5vfkFW8x p9+u7kZfUPTEwPqm2JAQOr3x7JB0aSMIBXNuEVcwLtjvAR7Sh8Z9Jw9cP4df/koiSd4P lKeFkDX6P01++X5ud3lPbgdBrtdL2/VSecfyUt8TQozhRHAwbkUls7VB98G8uigJCTwI 1VUDeeX+h2UL44cnDX0BofcDoUhznALGTkUQV3vegOqq9TDJg4wrg7YwODq8x1xGhC1X qA4oADt1JcLjbb35ireLiMylQo0S3hfVILjpX7WHB/8KYI8kq5T8wzLpgPowCI2LSgmN WPUQ== 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=hZawmwmmUEIzruP/hFrrJxUlpSTGnI98sx+YZ6JITf4=; b=T1FoxM9eiGIN6IP0LK6SCHhhHBNCwsFeThDHkO+JMCXT+LYubvRLKxOiSWvO87SwcM QqF93BakdtHpgfFFbd9xs4Qek2vI998g4T+a2B+t/cc4HyE/UVn8rDsZASC6vTAV1Eyu kkWjtcafbWx0PXp+UQwjRqnXdH7Ff3WZDGWadihVrRAyNjd7SnGPFeJvs2K/+JGTMzeE p7PSv6YFM2L/LRsdCyJyRSnLIHZVHU3djj4pXtt+nayqsnMjIswHY0pkayD139FYBp/I fHRe7nVkn92JWFdN+GLcFJRMHDsgydQtmZ1T8S/d+/+rxOkcSZjlrH8MZUl3urewvpaG oCZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=iBQSd25U; 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 l102si12774558pje.78.2019.08.05.11.05.05; Mon, 05 Aug 2019 11:05:21 -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=iBQSd25U; 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 S1730097AbfHESBf (ORCPT + 99 others); Mon, 5 Aug 2019 14:01:35 -0400 Received: from smtprelay-out1.synopsys.com ([198.182.61.142]:56142 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfHESBe (ORCPT ); Mon, 5 Aug 2019 14:01:34 -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 EA45CC0A6B; 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=fbtQFB9LCewR+4CQnQA+pjZHqX6A89CQKWKrIGkEz44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:In-Reply-To: References:From; b=iBQSd25UVNyYm+S3WEREWlo5+RMVjc0mJLyVaG/CVEZ5tjsJG5sl0i+e3wVdqwZ3b /0DVI1zdLe/qult05m1Y08LJKBa6hPPdktAKwx+z7HoIOZTSL7cpSISwdJa+RQejUE BN4ezMcDdyZ901z+YEZ4esZbL2Py38V1/rq2iSG2xgOrZu0Xm1pirY9aEdQH9ELhkn 1vLW8szIAAby5ukWY307jm5ZG/SC6Zd76qWEteYGXiAnCGsmnh2Agyyq6zpGtEAzbc Ahd952CpZ6QJ+EcW0/rPwUvYwvklpsX2EKBGO0Z+VfDYSB1rSQF6pykvKBmbCDSqNo hDr+R2Gah35mQ== Received: from de02dwia024.internal.synopsys.com (de02dwia024.internal.synopsys.com [10.225.19.81]) by mailhost.synopsys.com (Postfix) with ESMTP id A5BE3A0057; 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 05/10] net: stmmac: xgmac: Implement tx_queue_prio() Date: Mon, 5 Aug 2019 20:01:18 +0200 Message-Id: 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 Implement the TX Queue Priority callback in XGMAC core. 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/dwxgmac2.h | 4 ++++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 86a42bc39d21..b77091161765 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -127,6 +127,10 @@ #define XGMAC_MTL_RXQ_DMA_MAP1 0x00001034 #define XGMAC_QxMDMACH(x) GENMASK((x) * 8 + 3, (x) * 8) #define XGMAC_QxMDMACH_SHIFT(x) ((x) * 8) +#define XGMAC_TC_PRTY_MAP0 0x00001040 +#define XGMAC_TC_PRTY_MAP1 0x00001044 +#define XGMAC_PSTC(x) GENMASK((x) * 8 + 7, (x) * 8) +#define XGMAC_PSTC_SHIFT(x) ((x) * 8) #define XGMAC_MTL_TXQ_OPMODE(x) (0x00001100 + (0x80 * (x))) #define XGMAC_TQS GENMASK(25, 16) #define XGMAC_TQS_SHIFT 16 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index ce6503dfc86d..bfbd5ae11540 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -118,6 +118,23 @@ static void dwxgmac2_rx_queue_prio(struct mac_device_info *hw, u32 prio, writel(value, ioaddr + reg); } +static void dwxgmac2_tx_queue_prio(struct mac_device_info *hw, u32 prio, + u32 queue) +{ + void __iomem *ioaddr = hw->pcsr; + u32 value, reg; + + reg = (queue < 4) ? XGMAC_TC_PRTY_MAP0 : XGMAC_TC_PRTY_MAP1; + if (queue >= 4) + queue -= 4; + + value = readl(ioaddr + reg); + value &= ~XGMAC_PSTC(queue); + value |= (prio << XGMAC_PSTC_SHIFT(queue)) & XGMAC_PSTC(queue); + + writel(value, ioaddr + reg); +} + static void dwxgmac2_prog_mtl_rx_algorithms(struct mac_device_info *hw, u32 rx_alg) { @@ -428,7 +445,7 @@ const struct stmmac_ops dwxgmac210_ops = { .rx_ipc = dwxgmac2_rx_ipc, .rx_queue_enable = dwxgmac2_rx_queue_enable, .rx_queue_prio = dwxgmac2_rx_queue_prio, - .tx_queue_prio = NULL, + .tx_queue_prio = dwxgmac2_tx_queue_prio, .rx_queue_routing = NULL, .prog_mtl_rx_algorithms = dwxgmac2_prog_mtl_rx_algorithms, .prog_mtl_tx_algorithms = dwxgmac2_prog_mtl_tx_algorithms, -- 2.7.4