Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp820393rwb; Fri, 18 Nov 2022 08:39:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sh3Glxmx1Eu4nieOskpPLu6+0GqV1DiFFkchUrp2UlxPesoYaniHSzrY1mc792ZBKdDt1 X-Received: by 2002:a17:906:19d5:b0:780:93d2:8510 with SMTP id h21-20020a17090619d500b0078093d28510mr6629518ejd.457.1668789542812; Fri, 18 Nov 2022 08:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668789542; cv=none; d=google.com; s=arc-20160816; b=aC4rwjU7iUJQR1gLSdHLdc5ETPR1UXKpkbWdgMg3TswXA3xlgsNF9ytUQ72OIlqbu/ LgJlem1aYIdvNS0VX0qEvPufQ7/K4CvDmz53tnJ5gdk17FDx/h2OzJb0zXKKvP38JRgp sFxcWfLBMTd0xKp4I68TeV98LfHLKOp2OLxOJ908w3NVLRh7IZs0+vbH3t/DjVcE5ECZ hf//qh7py26iaby0PzCAOtNXRXF1JYekBJFoSt22s/DExQsK3MY9VIEgicgSljjfQt7T 5dtlqYf3tZgB4N1o5mYImRy2ZFwWXHtgTHAtTYByRPd5YTqVUkHYXjjxWrSZKD0mJqZt Yshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=PYQLBryNBg2V98bbiL4e5M8gxG2GeWbeLo/CFoncenc=; b=tK9XfmqqaJhi/OjlByJqtbMvetiN5m6/R0zSt+P9b1wxuXbkxbcMojswMw65+9jFp1 36Zt/QrJwkjDIOtN93ZlQsUrInK/ogKVXybguA3JfaXh1DuX4QRiSuoV9TGyi+Uc8u6U fT6G8pbv0PGNONAVwtNNCRY8FUsNwQ8lmenZFfFazPDxeIDGbeYLk8k5mjgomFMv/d+4 Ti/l95P8gefKBLCh+7ckwAARI886CTO+bBY6B1yRke6Z5BCBdtHXUIkDEhYhMhTqLhS5 lFugG5q5ZncXld37AE7F5eOXPdXIMNctaIXANDwPpJW+0E2OB4GORSKgOSc4a1H4zq/9 R8OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@fe80.eu header.s=20190804 header.b=Uvm3QR9u; 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=fe80.eu Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a508702000000b004691125c420si1590437edb.264.2022.11.18.08.38.40; Fri, 18 Nov 2022 08:39:02 -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=@fe80.eu header.s=20190804 header.b=Uvm3QR9u; 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=fe80.eu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235357AbiKRQaH (ORCPT + 91 others); Fri, 18 Nov 2022 11:30:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235270AbiKRQaF (ORCPT ); Fri, 18 Nov 2022 11:30:05 -0500 X-Greylist: delayed 1797 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 18 Nov 2022 08:30:04 PST Received: from mail.base45.de (mail.base45.de [IPv6:2001:67c:2050:320::77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADCA3109A for ; Fri, 18 Nov 2022 08:30:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=fe80.eu; s=20190804; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date: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=PYQLBryNBg2V98bbiL4e5M8gxG2GeWbeLo/CFoncenc=; b=Uvm3QR9uY6MNvHIwv4bkERMGk7 Z/DfjHBIRgLeuVa7KXDB1VwttGKa9DT8JDsvWd0lbqMEPlz7C1cgYHvKTBthnFenPvJVunBKHBB5a 0BZ6dGOtT9mg9k6LTNK7DrLVuD2Mb+C6/MFISaouSrhB2++qfXu9QmpvRV+a8zBUT62K/DBq852YK +/C266DYZT+gIW45CsnB5b0oknfj2LxYc0PtMlfbwf9byFSZrespOc1aBLjnuWKiocfBlZ33Wjz5p Xt0hxBH2BanVBi+qYak7zzj7N7QgFJ6cb6LuDMDO2V9GsBfMiDiRHEhGgqOZ7BaOoNcTzbL8aAsVp 0UVHdKMg==; Received: from [145.224.93.132] (helo=javelin) by mail.base45.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ow33k-001vrc-1i; Fri, 18 Nov 2022 15:13:40 +0000 Date: Fri, 18 Nov 2022 15:13:31 +0000 From: Alexander 'lynxis' Couzens To: Felix Fietkau 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 Subject: Re: [PATCH net-next 4/6] net: ethernet: mtk_eth_soc: implement multi-queue support for per-port queues Message-ID: <20221118151331.4694574f@javelin> In-Reply-To: <20221116080734.44013-5-nbd@nbd.name> References: <20221116080734.44013-1-nbd@nbd.name> <20221116080734.44013-5-nbd@nbd.name> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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_PASS, UPPERCASE_50_75 autolearn=no 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 Hi Felix, On Wed, 16 Nov 2022 09:07:32 +0100 Felix Fietkau wrote: > @@ -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)); > } > > +static void mtk_set_queue_speed(struct mtk_eth *eth, unsigned int idx, > + int speed) > +{ > + const struct mtk_soc_data *soc = eth->soc; > + u32 ofs, val; > + > + if (!MTK_HAS_CAPS(soc->caps, MTK_QDMA)) > + return; > + > + val = 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 |= MTK_QTX_SCH_LEAKY_BUCKET_EN; > + > + if (IS_ENABLED(CONFIG_SOC_MT7621)) { > + switch (speed) { > + case SPEED_10: > + val |= 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 |= 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 |= 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 |= 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 |= 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 |= 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 = 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 *config, What's happening to 2.5Gbit ports (e.g. on mt7622)? Should be SPEED_2500 also 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.