Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2210601rwd; Fri, 9 Jun 2023 08:06:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/TjuoiIE8N1qsUJ3ItvsnPWO/YqcJjaJAGOYAFWn3Emdg16WDWadpD3s/l4ZtFG/szFLh X-Received: by 2002:a05:6a20:7485:b0:10c:1b38:c8a4 with SMTP id p5-20020a056a20748500b0010c1b38c8a4mr1270874pzd.31.1686323207328; Fri, 09 Jun 2023 08:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686323207; cv=none; d=google.com; s=arc-20160816; b=dYwCMUeQb9iSu3YnnojULJrAHIPcS4L9BIqVsl6IxKEURUm6MkbtvMiSzP4VGKD1pV FzA3HEOHj7ZcVurVRfoAbifQfAg1pJtDDMH9QQYsx7VP+CdoVgBALumLVXrmJgVOQDpB qoanc3OT+MyoflIQVIH5FpHQkFdBvMz8V72oq4M5twNZvYSHMDAsASFKQY9fLDwBNaDd YaspXCEOdlcBsrW5fLxVwf9tBnK/12vPvV4o6l3SNwowqn0RpsIwuJWUzBQILBPxfkHJ FwnEJYJ9WaCIRUyjlJRTlcqI+VANTfGlVucVopP3I+DCXxB020QuQSt5LHGtw7HElXJi svuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VoWyh3blPPiSMX+LkkceKIME1iOgbcnQP9AkgDOvlUs=; b=hiSphBB/fnq4A8ypBut1fB/vWOrIgNAPhg9kB/P2Hvhc/Cvnvp7fq7Y3Cf3Z3IUZSX H60Fv01ts2dGEUZp/U9bRcDgEekhTJDxN8qYeBc8XF2p5KMPmkWKHkZ6vClWsAgFflge wyyo30mNm9dGwVh75PKXaJCc4YEPrRNavovFIgIK9WfOAP31MZps3rq3jD7jZOgjg8ux WSsNNssMzG0I+SE3hVIj1kS4eFfdzidBuOAa13QO4HpggMgEEkgEQdxMQ9yVBhsGy2dO ts7eB+vPqLM5g2pVnwUyZWS6QOJ0t/z84HaDQTT4rcOJrmmpdySdKCFOklJDTkjpiu1r 2F7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="DVSgC/Ln"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k189-20020a6384c6000000b0053ef158b0c2si2798463pgd.185.2023.06.09.08.06.35; Fri, 09 Jun 2023 08:06:47 -0700 (PDT) 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=pass header.i=@lunn.ch header.s=20171124 header.b="DVSgC/Ln"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241598AbjFIOx4 (ORCPT + 99 others); Fri, 9 Jun 2023 10:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231841AbjFIOxy (ORCPT ); Fri, 9 Jun 2023 10:53:54 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20B582D48; Fri, 9 Jun 2023 07:53:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=VoWyh3blPPiSMX+LkkceKIME1iOgbcnQP9AkgDOvlUs=; b=DVSgC/LnAiRmpRoF+PC2QSQawU 6Mi8BAptpJH/Zzb5Nr584bueKOTp4DJ7j2IjBx3WbCFm+Fs+otVsfPLs0e252zJ+9V9pwA2FiZqvj JnIXAxsmWb9nVhVsB7y544VrU6pAYqLCH/EBwPUqoPnT2T9gm47mDvtcfozCsmH/38TY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1q7dUj-00FM88-Oq; Fri, 09 Jun 2023 16:53:41 +0200 Date: Fri, 9 Jun 2023 16:53:41 +0200 From: Andrew Lunn To: alexis.lothore@bootlin.com Cc: Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Thomas Petazzoni , paul.arola@telus.com, scott.roberts@telus.com Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: implement egress tbf qdisc for 6393x family Message-ID: References: <20230609141812.297521-1-alexis.lothore@bootlin.com> <20230609141812.297521-3-alexis.lothore@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230609141812.297521-3-alexis.lothore@bootlin.com> 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_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 > +int mv88e6393x_tbf_add(struct mv88e6xxx_chip *chip, int port, > + struct tc_tbf_qopt_offload_replace_params *replace_params) > +{ > + int rate_kbps = DIV_ROUND_UP(replace_params->rate.rate_bytes_ps * 8, 1000); > + int overhead = DIV_ROUND_UP(replace_params->rate.overhead, 4); > + int rate_step, decrement_rate, err; > + u16 val; > + > + if (rate_kbps < MV88E6393X_PORT_EGRESS_RATE_MIN_KBPS || > + rate_kbps >= MV88E6393X_PORT_EGRESS_RATE_MAX_KBPS) > + return -EOPNOTSUPP; > + > + if (replace_params->rate.overhead > MV88E6393X_PORT_EGRESS_MAX_OVERHEAD) > + return -EOPNOTSUPP; > + > + /* Switch supports only max rate configuration. There is no > + * configurable burst/max size nor latency. Can you return -EOPNOTSUPP if these values are not 0? That should make it clear to the user they are not supported. > /* Offset 0x09: Egress Rate Control */ > -#define MV88E6XXX_PORT_EGRESS_RATE_CTL1 0x09 > +#define MV88E6XXX_PORT_EGRESS_RATE_CTL1 0x09 > +#define MV88E6XXX_PORT_EGRESS_RATE_CTL1_STEP_64_KBPS 0x1E84 > +#define MV88E6XXX_PORT_EGRESS_RATE_CTL1_STEP_1_MBPS 0x01F4 > +#define MV88E6XXX_PORT_EGRESS_RATE_CTL1_STEP_10_MBPS 0x0032 > +#define MV88E6XXX_PORT_EGRESS_RATE_CTL1_STEP_100_MBPS 0x0005 > +#define MV88E6XXXw_PORT_EGRESS_RATE_CTL1_FRAME_OVERHEAD_SHIFT 8 Are they above values specific to the 6393? Or will they also work for other families? You use the MV88E6XXX prefix which means they should be generic across all devices. Andrew