From mboxrd@z Thu Jan 1 00:00:00 1970 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 4625EC433EF for ; Wed, 13 Jul 2022 17:53:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229772AbiGMRw7 (ORCPT ); Wed, 13 Jul 2022 13:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbiGMRw6 (ORCPT ); Wed, 13 Jul 2022 13:52:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5E8C2D1CB for ; Wed, 13 Jul 2022 10:52:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7968061CCA for ; Wed, 13 Jul 2022 17:52:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 831E7C34114; Wed, 13 Jul 2022 17:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657734776; bh=PVBRoJ5r3h8Fbmul370PfTVFgn4YG3r7pBZA372P04k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uJktk5rcEsz8J+NLk3AEHAFciLAuqvseBX5t0TksuVD44zj//1pnSlk3oHCwJ72ha d8RajPAHgFOwUndefYB9udPOLOmAmIh6VklGnZq1gTPsKQKVrPkno/aBwypX+eKj19 Lc4rOL8LoK3fOES3HTddYeBv7YKhmPHG8m7QghEBvYpHIcEyhl78MtsOg+0F2Ae0xn RMiPcL3n1L0MqYoFIkWM/TCiggTe7mEdzOzKADq/woBj3rtpRGdRq9jhZ1kKWJUG4S fM9lP1UDbeD/HeOsCx4F2gR/Z1joBGuqgJl2CZAQXr1JT/WtBNRqzyLCe6gQSYObCJ hUHPyVaLM04QA== Date: Wed, 13 Jul 2022 10:52:55 -0700 From: Jakub Kicinski To: Jiri Pirko Cc: Jiri Pirko , Dima Chumak , "David S. Miller" , Eric Dumazet , Paolo Abeni , netdev@vger.kernel.org, Simon Horman , Michal Wilczynski Subject: Re: [PATCH net-next 0/5] devlink rate police limiter Message-ID: <20220713105255.4654c4ad@kernel.org> In-Reply-To: References: <228ce203-b777-f21e-1f88-74447f2093ca@nvidia.com> <20220630111327.3a951e3b@kernel.org> <20220707131649.7302a997@kernel.org> <20220708110535.63a2b8e9@kernel.org> <20220711102957.0b278c12@kernel.org> <20220712171341.29e2e91c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 13 Jul 2022 07:04:04 +0200 Jiri Pirko wrote: > Wed, Jul 13, 2022 at 02:13:41AM CEST, kuba@kernel.org wrote: > >> I don't think this has anything to do with netdev model. > >> It is actually out of the scope of it, therefore there cannot be any mudding of it. > > > >You should have decided that rate limiting was out of scope for netdev > >before we added tc qdisc and tc police support. Now those offloads are > >there, used by people and it's too late. > > > >If you want to create a common way to rate limit functions you must > >provide plumbing for the existing methods (at least tc police, > >preferably legacy NDO as well) to automatically populate the new API. > > Even if there is no netdevice to hook it to, because it does not exist? > I have to be missing something, sorry :/ What I'm saying is that we can treat the devlink rate API as a "lower layer interface". A layer under the netdevs. That seems sensible and removes the API duplication which otherwise annoys me. We want drivers to only have to implement one API. So when user calls the legacy NDO API it should check if the device has devlink rate support, first, and try to translate the legacy request into devlink rate. Same for TC police as installed by the OvS offload feature that Simon knows far more about than I do. IIRC we use a combination of matchall and police to do shaping. That way drivers don't have to implement all three APIs, only devlink rate (four APIs if we count TC qdisc but I think only NFP uses that one and it has RED etc so that's too much). Does this help or am I still not making sense?