From: Michael Dege <michael.dege@renesas.com>
To: Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-renesas-soc@vger.kernel.org"
<linux-renesas-soc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH net] net: renesas: rswitch: fix forwarding offload statemachine
Date: Thu, 5 Feb 2026 12:49:07 +0000 [thread overview]
Message-ID: <TY4PR01MB142829D9748A483ECAF19FD3D8299A@TY4PR01MB14282.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <d6a9356d-6fd4-459b-9c5a-2f3e20368bbd@cogentembedded.com>
Hello Nikita,
Thank you once more for your comments.
> -----Original Message-----
> From: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
> Sent: Thursday, February 5, 2026 8:59 AM
> To: Michael Dege <michael.dege@renesas.com>; Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>;
> Andrew Lunn <andrew+netdev@lunn.ch>; David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@google.com>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Cc: netdev@vger.kernel.org; linux-renesas-soc@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH net] net: renesas: rswitch: fix forwarding offload statemachine
>
>
>
> WBR,
> Nikita Yushchenko,
> System Software Engineer @ Cogent Embedded
>
> 05.02.2026 08:47, Nikita Yushchenko wrote:
> > Hello Michael
> >
> >> - } else if (rdev->forwarding_offloaded) {
> >> + } else if (rdev->forwarding_offloaded &&
> >> + !rdev->forwarding_requested) {
> >> rswitch_change_l2_hw_offloading(rdev, false, false);
> >> }
> >
> > Although indeed the condition in the current code is not correct, I'm not sure comfortable with this
> fix.
> >
> > Full condition for a port to be a valid candidate for hardware
> > forwarding is
> >
> > rdev_for_l2_offload() && rdev->forwarding_requested
> >
> > It is not obvious if at this point rdev_for_l2_offload() could get
> > changed from the last call to rswitch_change_l2_hw_offloading(), so
> > using only the partial condition at this point does not look good for me.
> >
> > I'd suggest to either change to something like
> >
> > if (rdev_for_l2_offload() && rdev->forwarding_requested &&
> > !rdev->forwarding_offloaded)
> > rswitch_change_l2_hw_offloading(rdev, true, false); if
> > (!(rdev_for_l2_offload() && rdev->forwarding_requested) &&
> > rdev->forwarding_offloaded)
> > rswitch_change_l2_hw_offloading(rdev, false, false);
This works as expected.
> >
> > Or maybe just
> >
> > if (rdev_for_l2_offload() && rdev->forwarding_requested)
> > rswitch_change_l2_hw_offloading(rdev, true, false); else
> > rswitch_change_l2_hw_offloading(rdev, false, false);
> >
> > since rswitch_change_l2_hw_offloading() has internal check for the
> > current state and returns early if the requested change is already applied.
Unfortunately, this has a side effect, e.g., if you pull the cable on tsn0 and the link
goes down, you will see that the offloading is disabled on all ports connected to the
bridge and not just on tsn0.
>
> May be even better to add
>
> bool new_forwarding_offloaded = rdev_for_l2_offload(rdev) && rdev->forwarding_requested;
>
> at the beginning of the loop body, and use this flag over the loop - it will make the code shorter and
> cleaner.
Yes, this does make the code cleaner.
I will send around the updated patch shortly.
Best regards,
Michael
next prev parent reply other threads:[~2026-02-05 12:49 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 7:14 Michael Dege
2026-02-05 7:47 ` Nikita Yushchenko
2026-02-05 7:48 ` Nikita Yushchenko
2026-02-05 7:51 ` Michael Dege
2026-02-05 7:58 ` Nikita Yushchenko
2026-02-05 12:49 ` Michael Dege [this message]
2026-02-05 13:38 ` Nikita Yushchenko
2026-02-05 13:46 ` Michael Dege
2026-02-05 13:57 ` Nikita Yushchenko
2026-02-05 14:35 ` Michael Dege
2026-02-05 14:41 ` Nikita Yushchenko
2026-02-05 14:44 ` Nikita Yushchenko
2026-02-06 5:41 ` Michael Dege
2026-02-06 10:31 ` Nikita Yushchenko
2026-02-06 10:34 ` Nikita Yushchenko
2026-02-06 13:21 ` Michael Dege
2026-02-06 15:55 ` Andrew Lunn
2026-02-06 16:10 ` Nikita Yushchenko
2026-02-06 17:17 ` Andrew Lunn
2026-02-05 15:03 ` Nikita Yushchenko
2026-02-06 5:54 ` 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=TY4PR01MB142829D9748A483ECAF19FD3D8299A@TY4PR01MB14282.jpnprd01.prod.outlook.com \
--to=michael.dege@renesas.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nikita.yoush@cogentembedded.com \
--cc=pabeni@redhat.com \
--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
all inboxes | Powered by JetHome®