Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: michael.dege@renesas.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	yoshihiro.shimoda.uh@renesas.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	niklas.soderlund@ragnatech.se, paul@pbarker.dev,
	netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 07/13] net: renesas: rswitch: make helper functions available to whole driver
Date: Tue, 12 May 2026 18:35:53 -0700	[thread overview]
Message-ID: <20260513013553.1408408-1-kuba@kernel.org> (raw)
In-Reply-To: <20260511-rswitch_add_vlans-v4-7-a5a225f8faae@renesas.com>

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: renesas: rswitch: make helper functions available to whole driver

This commit removes the static declaration from several helper functions and
adds their prototypes to rswitch.h. This makes the functions available for
upcoming L2 and VLAN handling features.

> diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
> --- a/drivers/net/ethernet/renesas/rswitch_main.c
> +++ b/drivers/net/ethernet/renesas/rswitch_main.c
[ ... ]
>  /* Gateway CPU agent block (GWCA) */
> -static int rswitch_gwca_change_mode(struct rswitch_private *priv,
> -				    enum rswitch_gwca_mode mode)
> +int rswitch_gwca_change_mode(struct rswitch_private *priv,
> +			     enum rswitch_gwca_mode mode)
>  {
>  	int ret;
[ ... ]
>  /* Ethernet TSN Agent block (ETHA) and Ethernet MAC IP block (RMAC) */
> -static int rswitch_etha_change_mode(struct rswitch_etha *etha,
> -				    enum rswitch_etha_mode mode)
> +int rswitch_etha_change_mode(struct rswitch_etha *etha,
> +			     enum rswitch_etha_mode mode)
>  {
>  	int ret;

Does exporting these functions expose unprotected read-modify-write
operations on shared hardware clock registers to concurrent execution?

These functions modify the shared RCEC and RCDC clock registers via
rswitch_agent_clock_ctrl(). Since all switch ports (ETHAs) and the GWCA
share the exact same coma_addr space, could concurrent invocations for
different ports cause a race condition?

For example, if multiple ports are configured concurrently via netlink,
or if parallel PHY adjust_link worker threads call these functions:

Thread 1 (Port A)
rswitch_etha_change_mode()
    rswitch_agent_clock_ctrl() reads RCEC

Thread 2 (Port B)
rswitch_etha_change_mode()
    rswitch_agent_clock_ctrl() reads RCEC
    rswitch_agent_clock_ctrl() writes RCEC

Thread 1 (Port A)
    rswitch_agent_clock_ctrl() writes stale RCEC

If RCEC and RCDC are Set/Clear command registers, reading the current state
and writing it back with a new bit could accidentally re-apply stale state,
reverting concurrent clock disable commands on other ports.

If they are standard configuration registers, could this result in classic
lost updates?

Can this lead to unpredictable port lockups or MAC failures by corrupting
hardware clocks for unrelated ports?

  reply	other threads:[~2026-05-13  1:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  8:52 [net-next PATCH v4 00/13] net: renesas: rswitch: R-Car S4 add VLAN aware switching Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 01/13] net: renesas: rswitch: improve port change mode functions Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 02/13] net: renesas: rswitch: use device instead of net_device Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 03/13] net: renesas: rswitch: fix FWPC2 register access macros Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 04/13] net: renesas: rswitch: add register definitions for vlan support Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 05/13] net: renesas: rswitch: add exception path for packets with unknown dst MAC Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-13  1:37   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 06/13] net: renesas: rswitch: add forwarding rules for gwca Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 07/13] net: renesas: rswitch: make helper functions available to whole driver Michael Dege
2026-05-13  1:35   ` Jakub Kicinski [this message]
2026-05-11  8:52 ` [PATCH net-next v4 08/13] net: renesas: rswitch: add basic vlan init to rswitch_fwd_init Michael Dege
2026-05-11  8:52 ` [PATCH net-next v4 09/13] net: renesas: rswitch: update port HW init Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 10/13] net: renesas: rswitch: clean up is_rdev rswitch_device checking Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 11/13] net: renesas: rswitch: add passing of rswitch_private into notifiers Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 12/13] net: renesas: rswitch: add handler for FDB notification Michael Dege
2026-05-13  1:35   ` Jakub Kicinski
2026-05-11  8:52 ` [PATCH net-next v4 13/13] net: renesas: rswitch: add vlan aware switching Michael Dege

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=20260513013553.1408408-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=michael.dege@renesas.com \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=pabeni@redhat.com \
    --cc=paul@pbarker.dev \
    --cc=yoshihiro.shimoda.uh@renesas.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