Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1863016pxj; Sun, 13 Jun 2021 00:42:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynnyASP0RcsZF8e7XUZIp31YCx4kNmH6WhNI1zSJMDD7DioTh+0ggo4cRAlH2MmCxoz4hU X-Received: by 2002:a17:906:240b:: with SMTP id z11mr10432438eja.545.1623570154034; Sun, 13 Jun 2021 00:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623570154; cv=none; d=google.com; s=arc-20160816; b=p7+9gAU5fujMQtiAiTjQ0l5qEuwESYcVG1hePMcKOWoHGayt2hY0BCZx5dCuImpfEC W9cOBsyeKCM98/Eq69rsU14auXk0WocEa599mFsGEiR92UddnIOKQ90eCyt/Ey92M+RK jgPGfFP5kKWv1Ug1nMyWzQIRH83U4NlbX2hcVqIrC4CW8Lf3BWehaWBsryucmop50jD2 LagmkL9NY8OS90dVfsUx34WOs02GCxvDxo3VKcXTrN+wsfOm6emY2dTQZR3yeUYuDrsu XIk/IshwxMIRs1xosvvRj15z4GSmgX36+F9+Z668+cA1U6+szDBqQZVTnzOI7Q7P2YPr L3MA== 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=7vEofMAqg+f6wYxXxRpaft9RyBo6WXP9j/L+Lqm8oNE=; b=I7wka1jdBiRPf0ebBRhPYOEaauu3snUsg7k4kBUHI9qnZ0U4R+RtxjwGeOMA6q1H2N upcXq492x/3nd4gNh4gnrZtyGT/g/AlatXBgDJTSMdQmpooeXh2az7v+1wvnTHYNxwJ/ vhb+VU45uDGFAILkUflUuAXwgQsngKufwnm4bH5Og3Hm2Lez3GlTwW4WWfsqhGJq9TEa HaG7a1opwq57I7Gn+BvHtMS8RnAuoHCV5yTBYiSBHZ+W9ahRF7F5Dnm+wOld9OnPmO05 322XjdD74v4ZaMDfY5cLLPVZ3Ez08xtsuTAsJOfKG4KfMiNYdpNvzAAXZrB4IftyHq8d 698Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=ErznCTvC; 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 f3si1097604ejl.241.2021.06.13.00.41.48; Sun, 13 Jun 2021 00:42:34 -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=@messagingengine.com header.s=fm3 header.b=ErznCTvC; 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 S230201AbhFMHgY (ORCPT + 99 others); Sun, 13 Jun 2021 03:36:24 -0400 Received: from new2-smtp.messagingengine.com ([66.111.4.224]:60121 "EHLO new2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbhFMHgX (ORCPT ); Sun, 13 Jun 2021 03:36:23 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 6746B5809B2; Sun, 13 Jun 2021 03:34:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 13 Jun 2021 03:34:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=7vEofM Aqg+f6wYxXxRpaft9RyBo6WXP9j/L+Lqm8oNE=; b=ErznCTvCm07KfuGG0pAzTr 3PMMfqK2nzr9kgdlzirnP4WhrG/ZHL4qiCxe8j4PjzFI3j6e9NU019cZ+kAGUnQG 5Sdd+V/J0uwDYl5Nor/ITTxU0r2IgZV2E2HU2CNtJMbzjHLR7lwlZO4P02dUKNoe XWbrYjJcouyM+HVAC7hdvOSzYLey9bMmR74o1LY3nsqnTgry9Tq5iuJCYhNOcsrH Dqt8pROxGjeFOryGmnQxPiN3NzNZ03tBuJy9KSx2Umy8ZPWfm7/UfPIZMaqswEsI jOMbVjxzeImsUCXw6urSQkhBdGP42xVAIz4Viy0xpbEInJWDNV1WuVLB12KpY/CQ == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfedvvddgvddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpefkughoucfu tghhihhmmhgvlhcuoehiughoshgthhesihguohhstghhrdhorhhgqeenucggtffrrghtth gvrhhnpeethfeijeefudehtddvheekteejheetvdekleffveekfeetiedtgeettdfhledv ueenucffohhmrghinhepmhgrnhejrdhorhhgnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 13 Jun 2021 03:34:20 -0400 (EDT) Date: Sun, 13 Jun 2021 10:34:18 +0300 From: Ido Schimmel To: Andrew Lunn Cc: Oleksandr Mazur , "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 07:08:00PM +0200, Andrew Lunn wrote: > 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. Storm control also needs the ability to limit other types of flooded traffic such unknown unicast and unregistered multicast packets. The entity which classifies packets as such is the bridge, which happens after the ingress hook. I see two options to support storm control in Linux: 1. By adding support in the bridge itself as a new bridge slave option. Something like: # ip link set dev swp1 type bridge_slave \ storm_control type { uuc | umc | bc} rate RATE mode { packet | byte } I suspect this similar to more traditional implementations that users might be used to and also maps nicely to hardware implementations 2. Teaching tc to call into the bridge to classify a packet. Not sure a whole new classifier is needed for this. Maybe just extend flower with a new key: dst_mac_type { uuc | umc }. I personally find this a bit weird, but it is more flexible and allows to reuse existing actions > > > 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. +1