Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp737505pxj; Fri, 11 Jun 2021 10:09:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwFoWR7fjexxWknVkgM4L+KZyVyx5riiNaJD1jAHV8metXdoYssdwc5d5Vf1TQvIsItlsG X-Received: by 2002:a17:906:27d3:: with SMTP id k19mr4417478ejc.368.1623431380908; Fri, 11 Jun 2021 10:09:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623431380; cv=none; d=google.com; s=arc-20160816; b=y9HgAUOSJS89ezFAPmgS9c1l7OLZ55KHmYJDt8KRpgl+khFF9hHpHZ7Qx2ZbSzIfRo RHA7U4kZLHRz3c9RaSFtaxAJjiqkvbLadr9yBva0Czfg2K/R6LRBeAuzZbnj7gLXAY07 m/EAMbYI/gjwbCSw+yLxejuGwV4R2pB4ekH0yGBnzZMzLTGFDzuI1jCbvfmuMAyMreev QFvDrIY6z2rVZiBCvt7KYJR2m2YSCogDbPZlH7mC/a7IGNd4wHe7geVjH5eGGsItZB+j SOTa1+BOB4kX+PzC++qr6rj3MIyopEuBs85bRjaosj/PClQEfMmgPUaroqzMsyfOKAqG Uxog== 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=6T7kZ03xwL1KC1iS1k0e4hpoEerlMg9oGroEXRU3uws=; b=V+U9+csMjTN70MGLqB2kdQ3dI50tLCmwCinQMPm1DDU9Ps54F4hrjN2QQT0wDyFbkL NMMTL7tLvpFxDMnFqa1iK+n9RIpNS9pP8WxqLyZ4WMEzfmyANWBLvZgYv1FMwEXiYFGd ULemv5C3SoVk8zx1Vu9fzCtw81drMcb+E+27rfqLjCfWnUZqJd5IAK3cgQC/XjRqhfmL hh4DeY85vhiW/yB0qSV4VDnG2a2yOUoANS91cVxfy8UWs5JO4d9WSZXJ0u54vGfVhbQ1 sR/t5TPq+PWiFhd6GCnzpAorsJCC/665HWYtafm18ht56nAb6zrGq22CJZhz7DKjZNsx lhBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=SBj2jLq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id yc7si1749534ejb.288.2021.06.11.10.09.11; Fri, 11 Jun 2021 10:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=SBj2jLq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231500AbhFKRKK (ORCPT + 99 others); Fri, 11 Jun 2021 13:10:10 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:59688 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229510AbhFKRKI (ORCPT ); Fri, 11 Jun 2021 13:10:08 -0400 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=6T7kZ03xwL1KC1iS1k0e4hpoEerlMg9oGroEXRU3uws=; b=SBj2jLq9tpzGW2hPfTQC71h8jE BOfHdzo63YZbgLOrNV1z5XGwNW8ENW+dNGbW2JS10MJx5VUH10VR2MGHRKXqAmOh3gYMQ0FbddMHv WzhvXt9WZy3eAjFtoi8MJSRtzJDXtEmyzWocp5lq5pMuFnObOJBvKJdZzHmG2slOGjYU=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1lrkdU-008t06-LY; Fri, 11 Jun 2021 19:08:00 +0200 Date: Fri, 11 Jun 2021 19:08:00 +0200 From: Andrew Lunn To: Oleksandr Mazur Cc: "jiri@nvidia.com" , "davem@davemloft.net" , "kuba@kernel.org" , Vadym Kochan , Taras Chornyi , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Taras Chornyi , Vadym Kochan , Serhiy Pshyk , Volodymyr Mytnyk Subject: Re: [PATCH net-next 10/11] net: marvell: prestera: add storm control (rate limiter) implementation Message-ID: References: <20210609151602.29004-1-oleksandr.mazur@plvision.eu> <20210609151602.29004-11-oleksandr.mazur@plvision.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 11, 2021 at 01:19:13PM +0000, Oleksandr Mazur wrote: > >> On Wed, Jun 09, 2021 at 06:16:00PM +0300, Oleksandr Mazur wrote: > > Storm control (BUM) provides a mechanism to limit rate of ingress > > > port traffic (matched by type). Devlink port parameter API is used: > > > driver registers a set of per-port parameters that can be accessed to both > > > get/set per-port per-type rate limit. > > > Add new FW command - RATE_LIMIT_MODE_SET. > > > Hi Oleksandr > > > Just expanding on the two comments you already received about this. > > > We often see people miss that switchdev is about. It is not about > > writing switch drivers. It is about writing network stack > > accelerators. You take a feature of the Linux network stack and you > > accelerate it by offloading it to the hardware. So look around the > > network stack and see how you configure it to perform rate limiting of > > broadcast traffic ingress. Once you have found a suitable mechanism, > > accelerate it via offloading. > > > If you find Linux has no way to perform a feature the hardware could > > accelerate, you first need to add a pure software version of that > > feature to the network stack, and then add acceleration support for > > it. > > > Hello Andrew, Ido, Nikolay, > I appreciate your time and comments provided over this patchset, though i have a few questions to ask, if you don't mind: > > 1. Does it mean that in order to support storm control in switchdev > driver i need to implement software storm control in bridge driver, > and then using the switchdev attributes (notifiers) mechanism > offload the configuration itself to the HW? Hi Oleksandr Not necessarily. Is storm control anything more than ingress packet matching and rate limiting? I'm not TC expert, but look for example at https://man7.org/linux/man-pages/man8/tc-police.8.html and the example: # tc qdisc add dev eth0 handle ffff: ingress # tc filter add dev eth0 parent ffff: u32 \ match u32 0 0 \ police rate 1mbit burst 100k Replace the "match u32 0 0" with something which matches on broadcast frames. Maybe "flower dst_mac ff:ff:ff:ff:ff:ff" So there is a software solution. Now accelerate it. > 2. Is there any chance of keeping devlink solution untill the > discussed (storm control implemented in the bridge driver) mechanism > will be ready/implemented? No. Please do it correctly from the beginning. No hacks. Andrew