netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Arınç ÜNAL" <arinc.unal@arinc9.com>
Cc: Daniel Golle <daniel@makrotopia.org>,
	Landen Chao <Landen.Chao@mediatek.com>,
	DENG Qingfang <dqfext@gmail.com>,
	Sean Wang <sean.wang@mediatek.com>, Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Bartel Eerdekens <bartel.eerdekens@constell8.be>,
	mithat.guner@xeront.com, erkin.bozoglu@xeront.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH net] net: dsa: mt7530: fix handling of 802.1X PAE frames
Date: Mon, 14 Aug 2023 18:05:34 +0300	[thread overview]
Message-ID: <20230814150534.epuluw2gfldrtgnl@skbuf> (raw)
In-Reply-To: <20230813105917.32102-1-arinc.unal@arinc9.com> <20230813105917.32102-1-arinc.unal@arinc9.com>

On Sun, Aug 13, 2023 at 01:59:17PM +0300, Arınç ÜNAL wrote:
> 802.1X PAE frames are link-local frames, therefore they must be trapped to
> the CPU port. Currently, the MT753X switches treat 802.1X PAE frames as
> regular multicast frames, therefore flooding them to user ports. To fix
> this, set 802.1X PAE frames to be trapped to the CPU port(s).
> 
> Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
>  drivers/net/dsa/mt7530.c | 4 ++++
>  drivers/net/dsa/mt7530.h | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 38b3c6dda386..b8bb9f3b3609 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -1006,6 +1006,10 @@ mt753x_trap_frames(struct mt7530_priv *priv)
>  	mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK,
>  		   MT753X_BPDU_CPU_ONLY);
>  
> +	/* Trap 802.1X PAE frames to the CPU port(s) */
> +	mt7530_rmw(priv, MT753X_BPC, MT753X_PAE_PORT_FW_MASK,
> +		   MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY));
> +

In the interest of efficiency, this could have been merged with the
previous write to MT753X_BPC, which would save some MDIO transactions:

	mt7530_rmw(priv, MT753X_BPC,
		   MT753X_BPDU_PORT_FW_MASK | MT753X_PAE_PORT_FW_MASK,
		   MT753X_BPDU_CPU_ONLY |
		   MT753X_PAE_PORT_FW(MT753X_BPDU_CPU_ONLY));

In the interest of readability, this is probably fine too.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

>  	/* Trap LLDP frames with :0E MAC DA to the CPU port(s) */
>  	mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK,
>  		   MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY));
> diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
> index 08045b035e6a..17e42d30fff4 100644
> --- a/drivers/net/dsa/mt7530.h
> +++ b/drivers/net/dsa/mt7530.h
> @@ -66,6 +66,8 @@ enum mt753x_id {
>  /* Registers for BPDU and PAE frame control*/
>  #define MT753X_BPC			0x24
>  #define  MT753X_BPDU_PORT_FW_MASK	GENMASK(2, 0)
> +#define  MT753X_PAE_PORT_FW_MASK	GENMASK(18, 16)
> +#define  MT753X_PAE_PORT_FW(x)		FIELD_PREP(MT753X_PAE_PORT_FW_MASK, x)
>  
>  /* Register for :03 and :0E MAC DA frame control */
>  #define MT753X_RGAC2			0x2c
> -- 
> 2.39.2
> 


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-13 10:59 [PATCH net] net: dsa: mt7530: fix handling of 802.1X PAE frames Arınç ÜNAL
2023-08-14 15:05 ` Vladimir Oltean [this message]
2023-08-19 11:41 ` 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=20230814150534.epuluw2gfldrtgnl@skbuf \
    --to=olteanv@gmail.com \
    --cc=Landen.Chao@mediatek.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=arinc.unal@arinc9.com \
    --cc=bartel.eerdekens@constell8.be \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=dqfext@gmail.com \
    --cc=edumazet@google.com \
    --cc=erkin.bozoglu@xeront.com \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mithat.guner@xeront.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.wang@mediatek.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;
as well as URLs for NNTP newsgroup(s).