Re: [PATCH net-next v3] net: ethernet: mtk_eth_soc: ppe: add support for multiple PPEs

Jakub Kicinski
2024-02-13T00:22:45Z

On Sat, 10 Feb 2024 15:56:07 +0200 Elad Yifee wrote:
> Add the missing pieces to allow multiple PPEs units, one for each GMAC.
> mtk_gdm_config has been modified to work on targted mac ID,
> the inner loop moved outside of the function to allow unrelated
> operations like setting the MAC's PPE index.

> diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index a6e91573f8da..5d5cf73a5d5a 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2010,6 +2010,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
> struct mtk_rx_dma_v2 *rxd, trxd;
> int done = 0, bytes = 0;
> dma_addr_t dma_addr = DMA_MAPPING_ERROR;
> + u8 ppe_index = 0;

Please don't use u8 for basic on-stack variables unless it matches some
HW field which is 8b.

> @@ -3358,6 +3350,8 @@ static int mtk_open(struct net_device *dev)
> struct mtk_mac *mac = netdev_priv(dev);
> struct mtk_eth *eth = mac->hw;
> int i, err;
> + struct mtk_mac *target_mac;
> + const u8 ppe_num = mtk_get_ppe_num(eth);

nit: Please order variable decl lines longest to shortest.
If the order breaks init, you should move the init to the body.

It's a bit unclear what the difference between ppe_num, num_ppe and
ppe_index, id and ppe_idx are. It'd be good to increase the naming
consistency.

> @@ -1311,6 +1313,7 @@ struct mtk_eth {
> struct mtk_mac {
> int id;
> phy_interface_t interface;
> + u8 ppe_idx;

this looks misaligned

> int speed;
> struct device_node *of_node;
> struct phylink *phylink;

When you repost please do not reply in the same thread.
Start a new one.

https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#resending-after-review

--
pw-bot: cr