Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp998607pxb; Wed, 3 Nov 2021 16:22:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJLcohhnVMOwO0W0h7l4+gt8emy2vHgEfFULRd8dMO73QGTcwso31a7M5qzgt+zNyMxRYp X-Received: by 2002:aa7:c952:: with SMTP id h18mr66033256edt.18.1635981730530; Wed, 03 Nov 2021 16:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635981730; cv=none; d=google.com; s=arc-20160816; b=SyMCOI1R2cZ/buR7iAEJcpGdUqmutPJhx51jZXYFUmbZgZcbi7eRI2Psz02s6x1kgg 6MsmGjuwsmjQXI7BERmm2/I5EzLUDT0pP3fMvN7LWtBi4IEsiVYq8x1KpN3nJ7coQb+Z DCI4LXjL6v7G7EfOPZMeSqicEE92eM/KS2P5umpk1TFsS20zQXJy/1AcM34DcKmgiWPN zu7uCy0qnkFF86ZXsw1iLZ9q671jtcPvqdCszIqlr8ZTKoyJEgG9etGQ/vDoPs+X5Y0L j1DhzZtU7o65mdxhfginru7yJdBXrF6Zt83MrFJt7n43SacjyxB0cWZhFbkWEdJ9uPQU KNEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=3NI8re5mbbuzi7E/gBD8Pd6lBaiNoGJv6ABjsmw/z9Q=; b=BLJx6m4cC0ILo85erDCbX75lTvJ7SnttdWE3teFcXhr+fJE8Q7ANpi5pz4U8YyAOAD 0bd81AlS++Bb+o/y7wG1FM0eurg99GfrTaZcSVVTNqbMUdjrTt9iqsHGcW7p7Smii10F M/LGIoHlxYx1BZu3q91JJmOuiyK7U0dNK9F7IeEQlBpjf9BYiB0mN9yuwHCfvEHli7yx t2G00FIz3LKAWLf1zpzP7Yt3Z3AoRvCC9kd8umoIr06PF4GDjmaAZq64hUsmQhmfE+dA ezzZKG9LO2n5mMH3h9kPY5ovRqizvn9+aH6u173qU+E0bOWxim6i/SvtRwAQsFoMCrPH pX1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=YdkPPvTv; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ji21si6421026ejc.604.2021.11.03.16.21.44; Wed, 03 Nov 2021 16:22:10 -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=@ti.com header.s=ti-com-17Q1 header.b=YdkPPvTv; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230343AbhKCXWa (ORCPT + 99 others); Wed, 3 Nov 2021 19:22:30 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:41984 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229964AbhKCXW2 (ORCPT ); Wed, 3 Nov 2021 19:22:28 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 1A3NJdUX033371; Wed, 3 Nov 2021 18:19:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1635981579; bh=3NI8re5mbbuzi7E/gBD8Pd6lBaiNoGJv6ABjsmw/z9Q=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=YdkPPvTvjoJCTTj9PxnRv6D6gzKKF2ee36r2BCCiScLwtm4Z5EtojjnMGh/t+Nsn9 SGBAlSPR1RRqzOee7SsfDfzObO+axPKNmnHUqqKJGWTYchAa8AzQPQV1ADvrpuPU5d TPElMrbMukanTJxKT4MWv/87gzyDIF+ugZzDcUvs= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 1A3NJdFs111402 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 3 Nov 2021 18:19:39 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 3 Nov 2021 18:19:39 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Wed, 3 Nov 2021 18:19:39 -0500 Received: from [10.250.100.73] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 1A3NJaCN119288; Wed, 3 Nov 2021 18:19:36 -0500 Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: am65-cpsw: enable bc/mc storm prevention support To: Jakub Kicinski CC: "David S. Miller" , , , Kishon Vijay Abraham I , Vignesh Raghavendra , , Tony Lindgren , Andrew Lunn , Vladimir Oltean 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> <20211103160742.51218d7d@kicinski-fedora-PC1C0HJN> From: Grygorii Strashko Message-ID: Date: Thu, 4 Nov 2021 01:19:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211103160742.51218d7d@kicinski-fedora-PC1C0HJN> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/11/2021 01:07, Jakub Kicinski wrote: > 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. Ah, got it. Thank you. > >> 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. -- Best regards, grygorii