Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Sergei Antonov <saproj@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: ftmac100: add multicast filtering possibility
Date: Tue, 8 Aug 2023 16:28:40 +0300	[thread overview]
Message-ID: <20230808132840.667cwgzippl63xe5@skbuf> (raw)
In-Reply-To: <20230808124307.2252938-1-saproj@gmail.com>

On Tue, Aug 08, 2023 at 03:43:07PM +0300, Sergei Antonov wrote:
> If netdev_mc_count() is not zero and not IFF_ALLMULTI, filter
> incoming multicast packets. The chip has a Multicast Address Hash Table
> for allowed multicast addresses, so we fill it.
> 
> Implement .ndo_set_rx_mode and recalculate multicast hash table. Also
> observe change of IFF_PROMISC and IFF_ALLMULTI netdev flags.
> 
> Signed-off-by: Sergei Antonov <saproj@gmail.com>
> ---
> v1 -> v2:
> * fix hashing algorithm (the old one was based on bad testing)
> * observe change of IFF_PROMISC, IFF_ALLMULTI in set_rx_mode
> * u64 and BIT_ULL code simplification suggested by Vladimir Oltean
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

> +static void ftmac100_set_rx_bits(struct ftmac100 *priv, unsigned int *maccr)
> +{
> +	struct net_device *netdev = priv->netdev;
> +
> +	/* Clear all */
> +	*maccr &= ~(FTMAC100_MACCR_RCV_ALL | FTMAC100_MACCR_RX_MULTIPKT |
> +		   FTMAC100_MACCR_HT_MULTI_EN);
> +
> +	/* Set the requested bits */
> +	if (netdev->flags & IFF_PROMISC)
> +		*maccr |= FTMAC100_MACCR_RCV_ALL;
> +	if (netdev->flags & IFF_ALLMULTI)
> +		*maccr |= FTMAC100_MACCR_RX_MULTIPKT;
> +	else if (netdev_mc_count(netdev)) {
> +		*maccr |= FTMAC100_MACCR_HT_MULTI_EN;
> +		ftmac100_setup_mc_ht(priv);
> +	}

Minor nitpick, you don't need to resend for this: generally the coding
style recommends to open braces for all "if/else" blocks if one of them
requires braces. But it doesn't look horrible here.

> +}

  reply	other threads:[~2023-08-08 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 12:43 [PATCH net-next v2] net: ftmac100: add multicast filtering possibility Sergei Antonov
2023-08-08 13:28 ` Vladimir Oltean [this message]
2023-08-11  6:00 ` patchwork-bot+netdevbpf

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=20230808132840.667cwgzippl63xe5@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=saproj@gmail.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