Netdev List
 help / color / mirror / Atom feed
From: Siddharth Vadapalli <s-vadapalli@ti.com>
To: "A. Sverdlin" <alexander.sverdlin@siemens.com>
Cc: <netdev@vger.kernel.org>, Roger Quadros <rogerq@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Karl Mehltretter <kmehltretter@gmail.com>,
	Kevin Hao <haokexin@gmail.com>,
	Guangshuo Li <lgs201920130244@gmail.com>,
	"Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
	Ilias Apalodimas <ilias.apalodimas@linaro.org>,
	Murali Karicheri <m-karicheri2@ti.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Mugunthan V N <mugunthanvnm@ti.com>, <linux-omap@vger.kernel.org>,
	Lukas Stockmann <lukas.stockmann@siemens.com>,
	<s-vadapalli@ti.com>
Subject: Re: [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode
Date: Thu, 3 Dec 2026 14:43:05 +0530	[thread overview]
Message-ID: <64474f41-6ac5-4286-91eb-9dd6557dd5e5@ti.com> (raw)
In-Reply-To: <20261203080514.577407-2-alexander.sverdlin@siemens.com>

On 12/3/26 1:35 PM, A. Sverdlin wrote:
> From: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> 
> In dual-MAC mode the ALE is VLAN-aware and the Unknown VLAN register is
> left at its reset value, so frames tagged with a VID the ALE doesn't know
> are dropped even if the interface is promiscuous. ALE_P0_UNI_FLOOD only
> helps with unknown unicast in known VLANs.

Would just the following diff also work? (given that the issue seems to be 
with dropping packets of unknown VLANs)

diff --git a/drivers/net/ethernet/ti/cpsw_new.c 
b/drivers/net/ethernet/ti/cpsw_new.c
index 9ea7b6ffc992..af38711770f7 100644
--- a/drivers/net/ethernet/ti/cpsw_new.c
+++ b/drivers/net/ethernet/ti/cpsw_new.c
@@ -79,6 +79,7 @@ static bool cpsw_is_switch_en(struct cpsw_common *cpsw)
  static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
  {
         struct cpsw_common *cpsw = ndev_to_cpsw(ndev);
+       struct cpsw_priv *priv = netdev_priv(ndev);
         bool enable_uni = false;
         int i;

@@ -100,12 +101,16 @@ static void cpsw_set_promiscious(struct net_device 
*ndev, bool enable)
         }

         if (enable) {
+               cpsw_ale_control_set(cpsw->ale, priv->emac_port,
+                                    ALE_PORT_DROP_UNKNOWN_VLAN, 0);
                 /* Enable unknown unicast, reg/unreg mcast */
                 cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
                                      ALE_P0_UNI_FLOOD, 1);

                 dev_dbg(cpsw->dev, "promiscuity enabled\n");
         } else {
+               cpsw_ale_control_set(cpsw->ale, priv->emac_port,
+                                    ALE_PORT_DROP_UNKNOWN_VLAN, 1);
                 /* Disable unknown unicast */
                 cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
                                      ALE_P0_UNI_FLOOD, 0);

Regards,
Siddharth.

> 
> This breaks DSA switches with VLAN-based tagging protocols, like LAN9303,
> which encodes the source port in the VID: DSA puts the conduit into
> promiscuous mode, but the ALE drops the frames coming from the switch.
> 
> Bypass the ALE in promiscuous mode, as the legacy cpsw driver does in
> dual_emac mode. In dual-MAC mode the ALE never forwards between external
> ports and bypass delivers all received frames to the host port only, so
> the port separation is preserved. When leaving promiscuous mode restore
> the bypass setting configured via devlink.
> 
> Switch mode changes reset ALE_BYPASS, re-apply the rx mode of the running
> ports afterwards so that the promiscuous state isn't lost.
> 
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Tested-by: Lukas Stockmann <lukas.stockmann@siemens.com>
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
> ---
>   drivers/net/ethernet/ti/cpsw_new.c | 18 ++++++++++++------
>   1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw_new.c b/drivers/net/ethernet/ti/cpsw_new.c
> index 9ea7b6ffc992b..5f0fe96814f0c 100644
> --- a/drivers/net/ethernet/ti/cpsw_new.c
> +++ b/drivers/net/ethernet/ti/cpsw_new.c
> @@ -100,15 +100,13 @@ static void cpsw_set_promiscious(struct net_device *ndev, bool enable)
>   	}
>   
>   	if (enable) {
> -		/* Enable unknown unicast, reg/unreg mcast */
> -		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
> -				     ALE_P0_UNI_FLOOD, 1);
> +		/* Bypass also delivers frames of VLANs unknown to the ALE */
> +		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_BYPASS, 1);
>   
>   		dev_dbg(cpsw->dev, "promiscuity enabled\n");
>   	} else {
> -		/* Disable unknown unicast */
> -		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM,
> -				     ALE_P0_UNI_FLOOD, 0);
> +		cpsw_ale_control_set(cpsw->ale, HOST_PORT_NUM, ALE_BYPASS,
> +				     cpsw->ale_bypass);
>   		dev_dbg(cpsw->dev, "promiscuity disabled\n");
>   	}
>   }
> @@ -1769,6 +1767,14 @@ static int cpsw_dl_switch_mode_set(struct devlink *dl, u32 id,
>   		cpsw_ale_control_set(cpsw->ale, 0, ALE_BYPASS, 0);
>   		cpsw->data.dual_emac = true;
>   	}
> +
> +	/* ALE_BYPASS has been reset above, re-apply promiscuity */
> +	for (i = 0; i < cpsw->data.slaves; i++) {
> +		struct net_device *sl_ndev = cpsw->slaves[i].ndev;
> +
> +		if (sl_ndev && netif_running(sl_ndev))
> +			cpsw_ndo_set_rx_mode(sl_ndev);
> +	}
>   exit:
>   	rtnl_unlock();
>   


  reply	other threads:[~2026-12-03  9:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  8:05 [PATCH net-next 0/3] net: ethernet: ti: cpsw: Support cascaded switches A. Sverdlin
2026-12-03  8:05 ` [PATCH net-next 1/3] net: ethernet: ti: cpsw_new: bypass ALE in promiscuous mode A. Sverdlin
2026-12-03  9:13   ` Siddharth Vadapalli [this message]
2026-12-03  8:05 ` [PATCH net-next 2/3] net: ethernet: ti: cpsw: forward unknown VLANs in promiscuous switch mode A. Sverdlin
2026-12-03  8:05 ` [PATCH net-next 3/3] net: ethernet: ti: cpsw: don't untag frames on DSA conduit A. Sverdlin

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=64474f41-6ac5-4286-91eb-9dd6557dd5e5@ti.com \
    --to=s-vadapalli@ti.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=alexander.sverdlin@siemens.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=haokexin@gmail.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=kmehltretter@gmail.com \
    --cc=kuba@kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=lukas.stockmann@siemens.com \
    --cc=m-karicheri2@ti.com \
    --cc=mugunthanvnm@ti.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rogerq@kernel.org \
    /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