public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Grygorii Strashko <grygorii.strashko@ti.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	<linux-omap@vger.kernel.org>, Tony Lindgren <tony@atomide.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <vladimir.oltean@nxp.com>
Subject: Re: [PATCH net-next v2 2/3] net: ethernet: ti: am65-cpsw: enable bc/mc storm prevention support
Date: Thu, 4 Nov 2021 01:19:24 +0200	[thread overview]
Message-ID: <de899dec-e9da-5fbc-77f5-672f0fed1222@ti.com> (raw)
In-Reply-To: <20211103160742.51218d7d@kicinski-fedora-PC1C0HJN>



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

  reply	other threads:[~2021-11-03 23:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 17:01 [PATCH net-next v2 0/3] net: ethernet: ti: cpsw: enable bc/mc storm prevention support Grygorii Strashko
2021-11-01 17:01 ` [PATCH net-next v2 1/3] drivers: net: cpsw: ale: add broadcast/multicast rate limit support Grygorii Strashko
2021-11-01 17:01 ` [PATCH net-next v2 2/3] net: ethernet: ti: am65-cpsw: enable bc/mc storm prevention support Grygorii Strashko
2021-11-03  0:38   ` Jakub Kicinski
2021-11-03 22:20     ` Grygorii Strashko
2021-11-03 23:07       ` Jakub Kicinski
2021-11-03 23:19         ` Grygorii Strashko [this message]
2021-11-01 17:01 ` [PATCH net-next v2 3/3] net: ethernet: ti: cpsw_new: " Grygorii Strashko
2021-11-01 23:53 ` [PATCH net-next v2 0/3] net: ethernet: ti: cpsw: " Vladimir Oltean
2021-11-02 12:36   ` Grygorii Strashko
2021-11-02 14:38     ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=de899dec-e9da-5fbc-77f5-672f0fed1222@ti.com \
    --to=grygorii.strashko@ti.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kishon@ti.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox