[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ccfm3zhrhr767qjfaw4c7mvqw7bjbb4k4lgmvcogicak5sabsq@q547dfajx5au>
Date: Wed, 29 May 2024 01:42:21 +0100
From: Daniel Golle <daniel@...rotopia.org>
To: Elad Yifee <eladwf@...il.com>
Cc: Felix Fietkau <nbd@....name>, Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>, Lorenzo Bianconi <lorenzo@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH net-next v4] net: ethernet: mtk_eth_soc: ppe: add support
for multiple PPEs
Hi Elad,
now that net-next is opened again I finally also had some time to take
a deeper look at your patch ;)
On Sat, May 11, 2024 at 03:26:53PM GMT, Elad Yifee wrote:
> Add the missing pieces to allow multiple PPEs units, one for each GMAC.
> [...]
> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 179c0230655a..67e19bd25f7a 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> [...]
> @@ -1311,6 +1311,7 @@ struct mtk_eth {
> struct mtk_mac {
> int id;
> phy_interface_t interface;
> + u8 ppe_idx;
I think it would be smarter to just use
ifindex % mtk_get_ppe_num(eth)
Reasons:
- no need for an additional field in mtk_mac
- works for all net_device, not just mtk_eth type
> int speed;
> struct device_node *of_node;
> struct phylink *phylink;
> @@ -1421,6 +1422,14 @@ static inline u32 mtk_get_ib2_multicast_mask(struct mtk_eth *eth)
> return MTK_FOE_IB2_MULTICAST;
> }
>
> +static inline u8 mtk_get_ppe_num(struct mtk_eth *eth)
> +{
> + if (!eth->soc->offload_version)
> + return 0;
> +
> + return eth->soc->version;
Overloading the coincidentally identical hw version and number of PPEs
doesn't feel quite right. Better extend struct mtk_reg_map and turn the
gdma_to_ppe field into an array. Then the number of PPEs for a specific
SoC is the size of that array.
Reasons:
- we already got that mtk_reg_map structure for hw abstraction, no
need to introduce more SoC-specific macros like MTK_GDMA_TO_PPEx.
- no need for mtk_get_ppe_num inline function, or at least no
overloading of offload_version meaning.
Cheers
Daniel
Powered by blists - more mailing lists