[RFC net-next v3 3/3] net: ethernet: mtk_eth_soc: Add LRO support

Andrew Lunn andrew at lunn.ch
Sun Dec 14 08:49:43 PST 2025


>  static int mtk_hwlro_rx_init(struct mtk_eth *eth)
>  {
>  	const struct mtk_reg_map *reg_map = eth->soc->reg_map;
> -	int i;
> +	const struct mtk_soc_data *soc = eth->soc;
> +	int i, val;
>  	u32 ring_ctrl_dw1 = 0, ring_ctrl_dw2 = 0, ring_ctrl_dw3 = 0;
>  	u32 lro_ctrl_dw0 = 0, lro_ctrl_dw3 = 0;

Reverse Christmas tree. It looks like it was already broken, but you
should not make it worse, and i think you can even fix it here.

> +static int mtk_hwlro_add_ipaddr_idx(struct net_device *dev, u32 ip4dst)
> +{
> +	struct mtk_mac *mac = netdev_priv(dev);
> +	struct mtk_eth *eth = mac->hw;
> +	const struct mtk_reg_map *reg_map = eth->soc->reg_map;
> +	u32 reg_val;
> +	int i;

More Reverse Christmas tree probes. You will need to move the
assignment to reg_map into the body of the function.

> +#define MTK_PDMA_LRO_CTRL_DW0	(reg_map->pdma.lro_ctrl_dw0)
> +#define MTK_PDMA_LRO_CTRL_DW1	(reg_map->pdma.lro_ctrl_dw0 + 0x04)
> +#define MTK_PDMA_LRO_CTRL_DW2	(reg_map->pdma.lro_ctrl_dw0 + 0x08)
> +#define MTK_PDMA_LRO_CTRL_DW3	(reg_map->pdma.lro_ctrl_dw0 + 0x0c)

Same comment as the previous patch.

	Andrew



More information about the Linux-mediatek mailing list