Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8824C6FD1E for ; Wed, 8 Mar 2023 07:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229610AbjCHHRF (ORCPT ); Wed, 8 Mar 2023 02:17:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjCHHRA (ORCPT ); Wed, 8 Mar 2023 02:17:00 -0500 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B9EEA8817 for ; Tue, 7 Mar 2023 23:16:59 -0800 (PST) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZo2d-0005BM-Pk; Wed, 08 Mar 2023 08:16:51 +0100 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1pZo2b-0004gI-Ne; Wed, 08 Mar 2023 08:16:49 +0100 Date: Wed, 8 Mar 2023 08:16:49 +0100 From: Oleksij Rempel To: "David S. Miller" , Andrew Lunn , Eric Dumazet , Florian Fainelli , Jakub Kicinski , Paolo Abeni , Vladimir Oltean , Woojung Huh Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next v1 2/2] net: dsa: microchip: add ETS Qdisc support for KSZ9477 series Message-ID: <20230308071649.GD1692@pengutronix.de> References: <20230306124940.865233-1-o.rempel@pengutronix.de> <20230306124940.865233-2-o.rempel@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230306124940.865233-2-o.rempel@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 06, 2023 at 01:49:40PM +0100, Oleksij Rempel wrote: > +static int ksz_queue_set_strict(struct ksz_device *dev, int port, int queue) > +{ > + int ret; > + > + /* In order to ensure proper prioritization, it is necessary to set the > + * rate limit for the related queue to zero. Otherwise strict priority > + * mode will not work. > + */ > + ret = ksz_pwrite8(dev, port, KSZ9477_REG_PORT_OUT_RATE_0 + queue, > + KSZ9477_OUT_RATE_NO_LIMIT); Uff, this part works by accident. KSZ9477_REG_PORT_OUT_RATE_0 registers should be written in a direct order. According to the documentation "update will not take effect until the Port Queue 3 Egress Limit Control Register is written.". But we are writing in a reverse order - queue 3 is written first. > + if (ret) > + return ret; > + > + ret = ksz_pwrite32(dev, port, REG_PORT_MTI_QUEUE_INDEX__4, queue); > + if (ret) > + return ret; > + > + return ksz_setup_tc_mode(dev, port, MTI_SCHEDULE_STRICT_PRIO, > + MTI_SHAPING_OFF); > +} > + > +static int ksz_queue_set_wrr(struct ksz_device *dev, int port, int queue, > + int weight) > +{ > + int ret; > + > + /* In order to ensure proper prioritization, it is necessary to set the > + * rate limit for the related queue to zero. Otherwise weighted round > + * robin mode will not work. > + */ > + ret = ksz_pwrite8(dev, port, KSZ9477_REG_PORT_OUT_RATE_0 + queue, > + KSZ9477_OUT_RATE_NO_LIMIT); same here. -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |