Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp862832rwb; Fri, 18 Nov 2022 09:12:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf5A+dDarumulpiL30h3KyG0pjWA2xX1lTxL5aWYVDil6xLUlvs4IhZS01tV56E1Ff9ydHz/ X-Received: by 2002:a17:906:7fd6:b0:78d:b5be:e5f with SMTP id r22-20020a1709067fd600b0078db5be0e5fmr6698275ejs.601.1668791547705; Fri, 18 Nov 2022 09:12:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668791547; cv=none; d=google.com; s=arc-20160816; b=D/ilJHXMJrkn2rLlGcZKXfdtpZT/HDjkz/1NTD/w3/zs3GG3nkX/IiOViC56oNb4pC HLa+JaR4VJTUb38LFCFMfmQLJ37iK1bTx1u4LXbsYLsvqkmFktmOFcVx0hFm6DYNc/lC Tj+JfPdCobqFe3Qt0pJQcyCj2n//sMZcTyJf2RrDVtHFS51ZHeY2bTCjNF/j0fPFwexd uegcaItWWtWQaQonkI0G3jV47Pp8cufKBYEOhzwyaKFu8eRbwnb/OaT/jmfImIR7JP4/ K5JveLz22X6aLiDsnJj5zfrZn/thEpAHN4YgdZ2omQK6aLGG70H9QCHe/taiDRRxZI8x oUFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=hv3wattWbtjbSTdeYjK2ZDT7gtCeh5K4SfrhrDsjmCA=; b=mONhcAXUznTyL0O/C23tXiYmlhgh+ImF7I8ZKuQ7MHhw4PrFT9BQUHLkWVeNf4W1Vg /aHRgi/XrfyMeDYNOr5FS8XpaMNbNVh7Zj3yFb5tsHxEq7gIeu+411WFFzJznBoNdIP5 NNx78lfC0AUOPHnYhZUPoOeLLeWrM+lvUugZRN4bBoDcyrIjkuIp3sOTAS2X/C5aIn5H NXbZc8G9GmDHKvW2bW5qq9aSrxcbmAdDE1ZI8ZT9ySj+300Dxt0pmXY0SBUkNRZzY7id lRfjOB8suMHT9EATt44UjLzirGmw+qAp6kfhRySjLjKsadq4+Qb+2nSc9qDfWb2oias6 fS8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=Vw52Gubc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h11-20020aa7c60b000000b0045cea9cf231si3284667edq.566.2022.11.18.09.12.04; Fri, 18 Nov 2022 09:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b=Vw52Gubc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nbd.name Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241341AbiKRQb3 (ORCPT + 91 others); Fri, 18 Nov 2022 11:31:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbiKRQb2 (ORCPT ); Fri, 18 Nov 2022 11:31:28 -0500 Received: from nbd.name (nbd.name [46.4.11.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FB98EB4; Fri, 18 Nov 2022 08:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=To:In-Reply-To:Cc:References:Message-Id:Date:Subject: Mime-Version:From:Content-Transfer-Encoding:Content-Type:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hv3wattWbtjbSTdeYjK2ZDT7gtCeh5K4SfrhrDsjmCA=; b=Vw52GubctujRSSahq1c7EVle+S dmmzjJubKd0E5hkAWgBNj0UX5Zo2BSGlCJ+0ysPloa8J0W12twiXJ2M54qkOA4/u4VZspHLsd48nB o6rYFcmAf3trVw3Pagq238S/DfxNL8ehh8iaGbL6t6n7PpEpgBFuUG9uUFe6qaJxq3kk=; Received: from [2a01:598:b1b7:5a55:79cf:cd83:9b5c:5b05] (helo=smtpclient.apple) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ow4GX-0032wy-4s; Fri, 18 Nov 2022 17:30:57 +0100 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Felix Fietkau Mime-Version: 1.0 (1.0) Subject: Re: [PATCH net-next 4/6] net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues Date: Fri, 18 Nov 2022 17:30:46 +0100 Message-Id: <8EC28201-A848-4078-812A-AFE08ED12F7B@nbd.name> References: <20221118151331.4694574f@javelin> Cc: netdev@vger.kernel.org, John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , Russell King , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org In-Reply-To: <20221118151331.4694574f@javelin> To: Alexander 'lynxis' Couzens X-Mailer: iPhone Mail (20B101) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On 18. Nov 2022, at 16:13, Alexander 'lynxis' Couzens wro= te: >=20 > =EF=BB=BFHi Felix, >=20 >> On Wed, 16 Nov 2022 09:07:32 +0100 >> Felix Fietkau wrote: >>=20 >> @@ -614,6 +618,75 @@ static void mtk_mac_link_down(struct phylink_config *= config, unsigned int mode, >> mtk_w32(mac->hw, mcr, MTK_MAC_MCR(mac->id)); >> } >>=20 >> +static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, >> + int speed) >> +{ >> + const struct mtk_soc_data *soc =3D eth->soc; >> + u32 ofs, val; >> + >> + if (!MTK_HAS_CAPS(soc->caps, MTK_QDMA)) >> + return; >> + >> + val =3D MTK_QTX_SCH_MIN_RATE_EN | >> + /* minimum: 10 Mbps */ >> + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_MAN, 1) | >> + FIELD_PREP(MTK_QTX_SCH_MIN_RATE_EXP, 4) | >> + MTK_QTX_SCH_LEAKY_BUCKET_SIZE; >> + if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) >> + val |=3D MTK_QTX_SCH_LEAKY_BUCKET_EN; >> + >> + if (IS_ENABLED(CONFIG_SOC_MT7621)) { >> + switch (speed) { >> + case SPEED_10: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 103) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 2) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); >> + break; >> + case SPEED_100: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 103) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 3); >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); >> + break; >> + case SPEED_1000: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 105) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 4) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 10); >> + break; >> + default: >> + break; >> + } >> + } else { >> + switch (speed) { >> + case SPEED_10: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 1) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 4) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); >> + break; >> + case SPEED_100: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 1) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 5); >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 1); >> + break; >> + case SPEED_1000: >> + val |=3D MTK_QTX_SCH_MAX_RATE_EN | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_MAN, 10) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_EXP, 5) | >> + FIELD_PREP(MTK_QTX_SCH_MAX_RATE_WEIGHT, 10); >> + break; >> + default: >> + break; >> + } >> + } >> + >> + ofs =3D MTK_QTX_OFFSET * idx; >> + mtk_w32(eth, val, soc->reg_map->qdma.qtx_sch + ofs); >> +} >> + >> static void mtk_mac_link_up(struct phylink_config *config, >> struct phy_device *phy, >> unsigned int mode, phy_interface_t interface, >> @@ -639,6 +712,8 @@ static void mtk_mac_link_up(struct phylink_config *co= nfig, >=20 >=20 > What's happening to 2.5Gbit ports (e.g. on mt7622)? Should be SPEED_2500 a= lso in the switch/case? > E.g. a direct connected 2.5Gbit phy to GMAC0. > Or a mt7622 GMAC0 to mt7531 port 6 and a 2.5Gbit phy to port 5. On 2.5 Gbit/s, the code disables rate limiting, since it=E2=80=99s not neede= d. That=E2=80=99s why it=E2=80=99s not handled here - Felix=