Netdev List
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v7 07/10] net: airoha: Support multiple net_devices for a single FE GDM port
Date: Mon, 18 May 2026 23:28:34 +0200	[thread overview]
Message-ID: <aguEgmX1FDblt0g5@lore-desk> (raw)
In-Reply-To: <20260517055813.7DF3AC2BCF5@smtp.kernel.org>

[-- Attachment #1: Type: text/plain, Size: 3109 bytes --]

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Hardware state corruption for shared GDM ports
> --
> 
> commit 68e8fa8fe02248409d0048f81217cd5cf7eda775
> Author: Lorenzo Bianconi <lorenzo@kernel.org>
> 
> net: airoha: Support multiple net_devices for a single FE GDM port
> 
> This commit introduces support for multiple net_devices connected to the same
> Frame Engine GDM port via an external hardware arbiter. Note that issues with
> shared hardware state introduced here appear to be addressed in later commits
> such as 28e02ac461157 ("net: airoha: Do not stop GDM port if it is shared")
> and 01081daf7ce24 ("net: airoha: Introduce WAN device flag"), which add port
> user reference counting, aggregate the maximum MTU, and restrict WAN loopback
> configuration.
> 
> > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> > --- a/drivers/net/ethernet/airoha/airoha_eth.c
> > +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> > @@ -3035,11 +3043,25 @@ static int airoha_alloc_gdm_device(struct airoha_eth *eth,
> >  			 netdev->dev_addr);
> >  	}
> >  
> > +	/* Allowed nbq for EN7581 on GDM3 port are 4 and 5 for PCIE0
> > +	 * and PCIE1 respectively.
> > +	 */
> > +	index = nbq;
> > +	if (index && airoha_is_7581(eth) && port->id == AIROHA_GDM3_IDX)
> > +		index -= 4;
> > +
> > +	if (index >= ARRAY_SIZE(port->devs) || port->devs[index]) {
> > +		dev_err(eth->dev, "invalid nbq id: %d\n", nbq);
> > +		return -EINVAL;
> > +	}
> > +
> > +	netdev->dev.of_node = of_node_get(np);
> >  	dev = netdev_priv(netdev);
> >  	dev->dev = netdev;
> >  	dev->port = port;
> > -	port->dev = dev;
> >  	dev->eth = eth;
> > +	dev->nbq = nbq;
> > +	port->devs[index] = dev;
> 
> With multiple net_devices now sharing a single GDM port, could this cause
> hardware state corruption when configuring shared hardware registers?
> 
> For example, in airoha_dev_init(), airoha_set_gdm2_loopback() overwrites
> the global REG_FE_WAN_PORT register entirely, which might wipe out the
> configuration of previously initialized devices on the same port:
> 
> 	airoha_fe_rmw(eth, REG_FE_WAN_PORT,
> 		      WAN1_EN_MASK | WAN1_MASK | WAN0_MASK,
> 		      FIELD_PREP(WAN0_MASK, src_port));

A subsequent patch enforces this constraints, we can have at most one port
configured as WAN.

> 
> Additionally, in airoha_dev_stop(), unconditionally writing FE_PSE_PORT_DROP
> to REG_GDM_FWD_CFG(port->id) appears to drop all traffic for the entire
> GDM port, breaking other active devices sharing it.

This is fixed by a subsequent patch.

> 
> Similarly, in airoha_dev_change_mtu(), overwriting REG_GDM_LEN_CFG(port->id)
> with a lower MTU could restrict the hardware limit for the entire port, causing
> packet drops for other devices that require a higher MTU.

This is fixed by a subsequent patch.

Regards,
Lorenzo

> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260516-airoha-eth-multi-serdes-v7-0-99e0093303e2@kernel.org?part=7

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2026-05-18 21:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-16  5:57 [PATCH net-next v7 00/10] net: airoha: Support multiple net_devices connected to the same GDM port Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 01/10] dt-bindings: net: airoha: Add EN7581 ethernet-ports properties Lorenzo Bianconi
     [not found]   ` <20260517055811.EFECEC2BCB3@smtp.kernel.org>
2026-05-18 20:39     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 02/10] net: airoha: Introduce airoha_gdm_dev struct Lorenzo Bianconi
     [not found]   ` <20260517055812.CEC33C2BCB0@smtp.kernel.org>
2026-05-18 20:59     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 03/10] net: airoha: Move airoha_qdma pointer in " Lorenzo Bianconi
     [not found]   ` <20260517055811.39179C2BCB0@smtp.kernel.org>
2026-05-19  8:21     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 04/10] net: airoha: Rely on airoha_gdm_dev pointer in airoha_is_lan_gdm_port() Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 05/10] net: airoha: Move qos_sq_bmap in airoha_gdm_dev struct Lorenzo Bianconi
     [not found]   ` <20260517055814.3D107C2BCB0@smtp.kernel.org>
2026-05-19  8:23     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 06/10] net: airoha: Move {cpu,fwd}_tx_packets " Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 07/10] net: airoha: Support multiple net_devices for a single FE GDM port Lorenzo Bianconi
     [not found]   ` <20260517055813.7DF3AC2BCF5@smtp.kernel.org>
2026-05-18 21:28     ` Lorenzo Bianconi [this message]
2026-05-16  5:57 ` [PATCH net-next v7 08/10] net: airoha: Do not stop GDM port if it is shared Lorenzo Bianconi
     [not found]   ` <20260517055814.DB1F8C2BCB0@smtp.kernel.org>
2026-05-18 22:12     ` Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 09/10] net: airoha: Introduce WAN device flag Lorenzo Bianconi
2026-05-16  5:57 ` [PATCH net-next v7 10/10] net: airoha: Support multiple LAN/WAN interfaces for hw MAC address configuration Lorenzo Bianconi
     [not found]   ` <20260517055815.89B7CC2BCB0@smtp.kernel.org>
2026-05-19  8:37     ` Lorenzo Bianconi

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=aguEgmX1FDblt0g5@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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