From patchwork Sun Jan 12 18:32:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 13936507 X-Patchwork-Delegate: kuba@kernel.org 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 E5D1122083 for ; Sun, 12 Jan 2025 18:33:27 +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=1736706809; cv=none; b=iDpALUHH+A9imEuvik4dXLo07dwQWBS+WtpCaQow7kAzzMKbQFjhqYi/hOl6W6GnQT27buvGhHd0z1djsdLO6+KqH7cfoSiWAWi/twaP53Hw3Sw46g4vfR5XdF5xGGaEWWa4pIvtDhB63TPGMOHGrcFYbFrCQy5BCNmgNmHzIOU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736706809; c=relaxed/simple; bh=4WQQaCak4TJuaVWaDAMb3yACSDF7AlTUwq82HMM4tQo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=uiEEl4vvTjvKIW5rE12M97qWM2RhJ6bl0+PhkkClGyPMbAhZJzqUFQLFGwpWq0DeBMSiRcraChDVrd81rPHyT8/gahuclbFUmSjAEgV/CRbHPo5RSTSN0Xwo1Cbf9fLUlxaYWvBg3R/mU5vKw/FVAdYxCOSOCevn3U28ivxV4Ms= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vDAXRM3U; 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="vDAXRM3U" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEA33C4CEDF; Sun, 12 Jan 2025 18:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1736706807; bh=4WQQaCak4TJuaVWaDAMb3yACSDF7AlTUwq82HMM4tQo=; h=From:Date:Subject:To:Cc:From; b=vDAXRM3US9kpZLqIDfuJztnFopiRf/XL2Z4SjUeicqPbmPgFeZXBiEFWAmR+1dqgz ol7fQN0lR0fA1RIByTY04bp+PH1doZpW/Sh5xeURJco7kvHWizz7dmdkbDMiKEFcqG pwuDNoLMFMTbGJDNThywbLMPW3NLy0Fy0emoLF5LQZv5YeiLBejN4YSRuLBxoy0EbN UeEgJkebg1bWdFTc+pkLhoe489MFibL2m7f3g4g8rfQ0bgcoP92X9C4idZIGI8l0wk T5PxrL3TGDn8YFwUOjf7vAHro5PaKb/eaN9K4tY+qnHyL8zxfGHg5O4bWQY9FuyB3n DBCngiY45Iv3A== From: Lorenzo Bianconi Date: Sun, 12 Jan 2025 19:32:45 +0100 Subject: [PATCH net-next] net: airoha: Enforce ETS Qdisc priomap Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250112-airoha_ets_priomap-v1-1-fb616de159ba@kernel.org> X-B4-Tracking: v=1; b=H4sIAMwKhGcC/x3MMQqAMAxA0atIZgs2WBGvIiJBU82gLamIULy7x fEN/2dIrMIJhiqD8i1Jwllg6wqWnc6NjazFgA26xlo0JBp2mvlKc1QJB0WDzmHXUtuT91DCqOz l+afj9L4fh7NURWQAAAA= X-Change-ID: 20250112-airoha_ets_priomap-255264a48aff To: Felix Fietkau , Sean Wang , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Davide Caratti , Lorenzo Bianconi X-Mailer: b4 0.14.2 X-Patchwork-Delegate: kuba@kernel.org EN7581 SoC supports fixed QoS band priority where WRR queues have lowest priorities with respect to SP ones. E.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn Enforce ETS Qdisc priomap according to the hw capabilities. Suggested-by: Davide Caratti Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/mediatek/airoha_eth.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) --- base-commit: 7d0da8f862340c5f42f0062b8560b8d0971a6ac4 change-id: 20250112-airoha_ets_priomap-255264a48aff Best regards, diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c index a30c417d66f2f9b0958fe1dd3829fb9ac530a34c..415d784de741c991fa521243783860dee1ed0bfa 100644 --- a/drivers/net/ethernet/mediatek/airoha_eth.c +++ b/drivers/net/ethernet/mediatek/airoha_eth.c @@ -2793,7 +2793,7 @@ static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, struct tc_ets_qopt_offload_replace_params *p = &opt->replace_params; enum tx_sched_mode mode = TC_SCH_SP; u16 w[AIROHA_NUM_QOS_QUEUES] = {}; - int i, nstrict = 0; + int i, nstrict = 0, nwrr, qidx; if (p->bands > AIROHA_NUM_QOS_QUEUES) return -EINVAL; @@ -2807,7 +2807,20 @@ static int airoha_qdma_set_tx_ets_sched(struct airoha_gdm_port *port, if (nstrict == AIROHA_NUM_QOS_QUEUES - 1) return -EINVAL; - for (i = 0; i < p->bands - nstrict; i++) + /* EN7581 SoC supports fixed QoS band priority where WRR queues have + * lowest priorities with respect to SP ones. + * e.g: WRR0, WRR1, .., WRRm, SP0, SP1, .., SPn + */ + nwrr = p->bands - nstrict; + qidx = nstrict && nwrr ? nstrict : 0; + for (i = 1; i <= p->bands; i++) { + if (p->priomap[i % AIROHA_NUM_QOS_QUEUES] != qidx) + return -EINVAL; + + qidx = i == nwrr ? 0 : qidx + 1; + } + + for (i = 0; i < nwrr; i++) w[i] = p->weights[nstrict + i]; if (!nstrict)