From: Clement Leger <clement.leger@linux.dev>
To: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
Simon Horman <horms@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Ralph Siemsen <ralph.siemsen@linaro.org>,
linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org,
Prabhakar <prabhakar.csengg+renesas@gmail.com>,
Biju Das <biju.das.jz@bp.renesas.com>,
Fabrizio Castro <fabrizio.castro.jz@renesas.com>,
Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: Re: [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size from OF data
Date: Fri, 20 Nov 2026 21:04:24 +0100 [thread overview]
Message-ID: <3b26635a-4ab4-450f-8626-e4737d16be12@linux.dev> (raw)
In-Reply-To: <CA+V-a8vikSkbxjoE+Wq+jZ1uQjtbu2VFttHEMGXHkWqqcqf6Lg@mail.gmail.com>
On 11/20/26 19:34, Lad, Prabhakar wrote:
> Hi Clement,
>
> Thank you for the review.
>
> On Fri, Nov 20, 2026 at 9:44 AM Clement Leger <clement.leger@linux.dev> wrote:
>>
>>
>>
>> On 11/20/26 01:25, Prabhakar wrote:
>>> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>>
>>> The RZ/N1 A5PSW has 8192 lookup table entries, whereas the RZ/T2H
>>> and RZ/N2H ETHSW have only 4096 entries.
>>>
>>> Add the lookup table size to struct a5psw_of_data, derive the address
>>> mask from it and use it in the FDB and ageing code.
>>>
>>> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>> ---
>>> v4->v5:
>>> - New patch
>>> ---
>>> drivers/net/dsa/rzn1_a5psw.c | 10 ++++++----
>>> drivers/net/dsa/rzn1_a5psw.h | 4 ++--
>>> 2 files changed, 8 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
>>> index 7e9bc252d92a..c0c1f45852da 100644
>>> --- a/drivers/net/dsa/rzn1_a5psw.c
>>> +++ b/drivers/net/dsa/rzn1_a5psw.c
>>> @@ -311,18 +311,19 @@ static void a5psw_phylink_mac_link_up(struct phylink_config *config,
>>> static int a5psw_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)
>>> {
>>> struct a5psw *a5psw = ds->priv;
>>> + unsigned int entries = a5psw->of_data->lk_table_entries;
>>> unsigned long rate;
>>> u64 max, tmp;
>>> u32 agetime;
>>>
>>> rate = clk_get_rate(a5psw->clk);
>>> - max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * A5PSW_TABLE_ENTRIES * 1024),
>>> + max = div64_ul(((u64)A5PSW_LK_AGETIME_MASK * entries * 1024),
>>> rate) * 1000;
>>> if (msecs > max)
>>> return -EINVAL;
>>>
>>> tmp = div_u64(rate, MSEC_PER_SEC);
>>> - agetime = div_u64(msecs * tmp, 1024 * A5PSW_TABLE_ENTRIES);
>>> + agetime = div_u64(msecs * tmp, 1024 * entries);
>>>
>>> a5psw_reg_writel(a5psw, A5PSW_LK_AGETIME, agetime);
>>>
>>> @@ -511,7 +512,7 @@ static int a5psw_lk_execute_lookup(struct a5psw *a5psw, union lk_data *lk_data,
>>> if (ret)
>>> return ret;
>>>
>>> - *entry = ctrl & A5PSW_LK_ADDR_CTRL_ADDRESS;
>>> + *entry = ctrl & (a5psw->of_data->lk_table_entries - 1);
>>>
>>> return 0;
>>> }
>>> @@ -638,7 +639,7 @@ static int a5psw_port_fdb_dump(struct dsa_switch *ds, int port,
>>>
>>> mutex_lock(&a5psw->lk_lock);
>>>
>>> - for (i = 0; i < A5PSW_TABLE_ENTRIES; i++) {
>>> + for (i = 0; i < a5psw->of_data->lk_table_entries; i++) {
>>> reg = A5PSW_LK_ADDR_CTRL_READ | A5PSW_LK_ADDR_CTRL_WAIT | i;
>>>
>>> ret = a5psw_lk_execute_ctrl(a5psw, ®);
>>> @@ -1357,6 +1358,7 @@ static const struct a5psw_of_data rzn1_of_data = {
>>> .pattern_ctrl_base = 0x3eb0,
>>> .vlan_res_vlanid = GENMASK(16, 5),
>>> .vlan_res_portmask = GENMASK(4, 0),
>>> + .lk_table_entries = 8192,
>>> };
>>>
>>> static const struct of_device_id a5psw_of_mtable[] = {
>>> diff --git a/drivers/net/dsa/rzn1_a5psw.h b/drivers/net/dsa/rzn1_a5psw.h
>>> index 29d205e2331d..fd523fe7bf47 100644
>>> --- a/drivers/net/dsa/rzn1_a5psw.h
>>> +++ b/drivers/net/dsa/rzn1_a5psw.h
>>> @@ -93,7 +93,6 @@
>>> #define A5PSW_LK_ADDR_CTRL_WAIT BIT(27)
>>> #define A5PSW_LK_ADDR_CTRL_READ BIT(26)
>>> #define A5PSW_LK_ADDR_CTRL_WRITE BIT(25)
>>> -#define A5PSW_LK_ADDR_CTRL_ADDRESS GENMASK(12, 0)
>>>
>>> #define A5PSW_LK_DATA_LO 0x40C
>>> #define A5PSW_LK_DATA_HI 0x410
>>> @@ -210,7 +209,6 @@
>>>
>>> #define A5PSW_LK_BUSY_USEC_POLL 10
>>> #define A5PSW_CTRL_TIMEOUT 1000
>>> -#define A5PSW_TABLE_ENTRIES 8192
>>>
>>> struct fdb_entry {
>>> u8 mac[ETH_ALEN];
>>> @@ -241,6 +239,7 @@ union lk_data {
>>> * @pattern_ctrl_base: Offset of the PATTERN_CTRL register of pattern 0
>>> * @vlan_res_vlanid: VLANID field mask of the VLAN_RES registers
>>> * @vlan_res_portmask: PORTMASK field mask of the VLAN_RES registers
>>> + * @lk_table_entries: Number of entries in the lookup table (power of 2)
>>> */
>>> struct a5psw_of_data {
>>> unsigned int nports;
>>> @@ -252,6 +251,7 @@ struct a5psw_of_data {
>>> u16 pattern_ctrl_base;
>>> u32 vlan_res_vlanid;
>>> u32 vlan_res_portmask;
>>> + unsigned int lk_table_entries;
>>> };
>>>
>>> /**
>>
>> Hi Prabhakar,
>>
>> It would probably be better to fold all these commits that adds data
>> into bits of data in oa5psw_of_data into two commits: a first one that
>> prepares support for RZ/N2 and then a second one that add RZ/N2 support
>> itself. I'm not the net maintainer but your series is already quite
>> large just for this change so folding the commits make sense rather than
>> commitmaxxing.
>>
> My intention here was to keep changes minimal so that it's easier to
> review. Since the fixes patches will go as a separate series, I would
> like to keep this as is. Hope thats OK.
Yes sure, I mean if it fits under the 15 patches limit, that is
certainly fine :)
Thanks,
Clément
>
> Cheers,
> Prabhakar
next prev parent reply other threads:[~2026-11-20 20:04 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 0:25 [PATCH net-next v5 00/24] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 01/24] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 02/24] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 03/24] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
2026-11-20 9:32 ` Clement Leger
2026-11-20 18:31 ` Lad, Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 04/24] net: pcs: rzn1-miic: Select ETHSW port speed through SWCTRL Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 05/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Reject the "ports" node Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 06/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Limit port reg values Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 07/24] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 08/24] net: dsa: rzn1-a5psw: Fix LK_LEARNCOUNT write mode encoding Prabhakar
2026-11-20 3:27 ` Andrew Lunn
2026-11-20 6:01 ` Clement Leger
2026-11-20 18:29 ` Lad, Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 09/24] net: dsa: rzn1-a5psw: Fix VLANTransmitted counter offset Prabhakar
2026-11-20 3:29 ` Andrew Lunn
2026-11-20 18:28 ` Lad, Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 10/24] net: dsa: rzn1-a5psw: Fix MDIO clock divider calculation Prabhakar
2026-11-20 6:51 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 11/24] net: dsa: rzn1-a5psw: Set driver data in probe Prabhakar
2026-11-20 6:53 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 12/24] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
2026-11-20 3:32 ` Andrew Lunn
2026-11-20 0:25 ` [PATCH net-next v5 13/24] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 14/24] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
2026-11-20 6:58 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 15/24] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
2026-11-20 7:02 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 16/24] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
2026-11-20 7:03 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 17/24] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 18/24] net: dsa: rzn1-a5psw: Get pattern matcher register offsets from OF data Prabhakar
2026-11-20 9:35 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 19/24] net: dsa: rzn1-a5psw: Get VLAN_RES field layout " Prabhakar
2026-11-20 9:37 ` Clement Leger
2026-11-20 0:25 ` [PATCH net-next v5 20/24] net: dsa: rzn1-a5psw: Get lookup table size " Prabhakar
2026-11-20 9:44 ` Clement Leger
2026-11-20 18:34 ` Lad, Prabhakar
2026-11-20 19:49 ` Andrew Lunn
2026-11-20 20:04 ` Clement Leger [this message]
2026-11-20 0:25 ` [PATCH net-next v5 21/24] net: dsa: rzn1-a5psw: Update CPU port comment for RZ/T2H Prabhakar
2026-11-20 9:45 ` Clement Leger
2026-11-20 18:35 ` Lad, Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 22/24] net: dsa: rzn1-a5psw: Keep MAC TX enabled on RZ/T2H Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 23/24] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-11-20 0:25 ` [PATCH net-next v5 24/24] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
2026-11-20 0:28 ` [PATCH net-next v5 00/24] Add ETHSW support for Renesas " netdev-bot+sinfo
2026-11-20 14:43 ` Lad, Prabhakar
2026-11-20 3:14 ` Jakub Kicinski
2026-11-20 14:44 ` Lad, Prabhakar
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=3b26635a-4ab4-450f-8626-e4737d16be12@linux.dev \
--to=clement.leger@linux.dev \
--cc=andrew@lunn.ch \
--cc=biju.das.jz@bp.renesas.com \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=fabrizio.castro.jz@renesas.com \
--cc=geert+renesas@glider.be \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=prabhakar.csengg+renesas@gmail.com \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=ralph.siemsen@linaro.org \
--cc=robh@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