Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp988616pxb; Wed, 3 Nov 2021 16:10:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPz1+Q78XONONb1TKqs9mqQ1Xb+ROcmwcj8CQwOxPuB1s/hRetGDwSrajYsMbEAnBJVLTS X-Received: by 2002:a17:906:e0d5:: with SMTP id gl21mr11117944ejb.421.1635981000243; Wed, 03 Nov 2021 16:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635981000; cv=none; d=google.com; s=arc-20160816; b=KjoYh9F9+YFdGnw6RYAmjL0q/8KEBYvLKlUuhkIHDEjweXlgWjkuyO6UzVAigBRuOF s+/6yrR20EOfPIJkoD+SS+7z/Gad9sBWWPmcvGi8L1jOMwHCQK6vIV/7RCRh8hh1puPi rxWpXOutLStmJY/BTuObVl6FLttdfM/JNI4B5OSvOZxUffCKa8w+4z1W+lE5fR5+LoBe H1CMnCpYFneaqET/uZaGUljh9LTYVuTys9YHs3U3FTgmSADpwLo800Hv9/4k6PIGNCT0 vxjyEerj+U4ZfUJPqdfNK56+9/Y2h6KiRxQN9v9gTHdClhBluddv/6CMEoOE4NxPtpbu vUFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=bDivLfyAaq9MdTbImupggeYiK+VnbwFixgM2PHLGsD8=; b=YnVPwxKOhKL5E3Rsk6eZY2uZ8L2tyeXlytF0ZgkH2BL1dylgHsCdaAdbU/eCcuWHvD bdiEThFCHMuAn13JK4o6dnIrWL4VWP3Zvtubr17uxWnYwWmnUbQt594zOUtL1Qi/VfHv h8tE3SLVvorwRYG7FAjqPCfDbRuWauqVDGijyzKSCEqeOiSfyWbPOVOPwRSDzlj9Nb4V Z/jpkth0PE3UY6Ale1X0Dzm8L7qgIVqilOt0i+G8Ihu9HG7IcmIydAVfA1EZmEVkRgmw QUtYypLj7gbeMOpJCxV13qroYAfDZR+TjFFcqHatHnR1qOhJqol1pLJpQpL/a863oV9I PBtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=qNrfBTlR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si7178131edk.367.2021.11.03.16.09.24; Wed, 03 Nov 2021 16:10:00 -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=@kernel.org header.s=k20201202 header.b=qNrfBTlR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229792AbhKCXKW (ORCPT + 99 others); Wed, 3 Nov 2021 19:10:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:56544 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbhKCXKV (ORCPT ); Wed, 3 Nov 2021 19:10:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E35B061108; Wed, 3 Nov 2021 23:07:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635980864; bh=ksVBAHxaotyoaSheG1DS+q0WjnPxmPNhpLsMd9Xw3qs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=qNrfBTlRKmry4asedm/zMIlYDQiQskAQyiV34Ja1UQx4nSB2Yy+QcZdVATpIyLRJT 2rEOQ5gt61mYnTQBSfoP/3cQfIMK+yGNxMb6qIZw5dd3uDU/lpxPLOVUrHDQyZ9K46 DnULkVvvJs7U400vTRASjU9Y+RIQUk1TONsdKd0JO1UrvHPlWyW/yj2I7baflBKmXv WHWt7Wl3cmTK/Uci2Jvlrz3NZU0HLDLao5oha1ELkqIZ8dhz4RZg7SlnJkuGKD8bBk 5Z2OD4WEFLmybOhfzEhIUWVfZ3GGvMBxrZqJKZyyE+/MrEcXBQ6f/QQ4djS5IQqhi6 mThMIppguLRbw== Date: Wed, 3 Nov 2021 16:07:42 -0700 From: Jakub Kicinski To: Grygorii Strashko Cc: "David S. Miller" , , , Kishon Vijay Abraham I , Vignesh Raghavendra , , Tony Lindgren , Andrew Lunn , Vladimir Oltean Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: am65-cpsw: enable bc/mc storm prevention support Message-ID: <20211103160742.51218d7d@kicinski-fedora-PC1C0HJN> In-Reply-To: <81a427a1-b969-4039-0c3f-567b3073abc1@ti.com> References: <20211101170122.19160-1-grygorii.strashko@ti.com> <20211101170122.19160-3-grygorii.strashko@ti.com> <20211102173840.01f464ec@kicinski-fedora-PC1C0HJN> <81a427a1-b969-4039-0c3f-567b3073abc1@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Nov 2021 00:20:30 +0200 Grygorii Strashko wrote: > On 03/11/2021 02:38, Jakub Kicinski wrote: > > On Mon, 1 Nov 2021 19:01:21 +0200 Grygorii Strashko wrote: > >> - 01:00:00:00:00:00 fixed value has to be used for MC packets rate > >> limiting (exact match) > > > > This looks like a stretch, why not use a mask? You can require users to > > always install both BC and MC rules if you want to make sure the masked > > rule does not match BC. > > > > Those matching rules are hard coded in HW for packet rate limiting and SW only > enables them and sets requested pps limit. > - 1:BC: HW does exact match on BC MAC address > - 2:MC: HW does match on MC bit (the least-significant bit of the first octet) > > Therefore the exact match done in this patch for above dst_mac's with > is_broadcast_ether_addr() and ether_addr_equal(). Right but flower supports masked matches for dest address, as far as I can tell. So you should check the mask is what you expect as well, not just look at the key. Mask should be equal to key in your case IIUC, so: if (is_broadcast_ether_addr(match.key->dst) && is_broadcast_ether_addr(match.mask->dst)) and if (!memcmp(match.key->dst, mc_mac, ETH_ALEN) && !memcmp(match.mask->dst, mc_mac, ETH_ALEN)) I think you should also test that the mask, not the key of source addr is zero. Note that ether_addr_equal() assumes the mac address is alinged to 2, which I'm not sure is the case here. Also you can make mc_mac a static const. > The K3 cpsw also supports number configurable policiers (bit rate limit) in > ALE for which supports is to be added, and for them MC mask (sort of, it uses > number of ignored bits, like FF-FF-FF-00-00-00) can be used.