Re: [PATCH v13 net-next 07/15] net: mvpp2: add FCA periodic timer configurations

From: Russell King - ARM Linux admin
Date: Thu Feb 11 2021 - 08:09:50 EST


On Thu, Feb 11, 2021 at 12:48:54PM +0200, stefanc@xxxxxxxxxxx wrote:
> @@ -751,6 +760,10 @@
> #define MVPP2_TX_FIFO_THRESHOLD(kb) \
> ((kb) * 1024 - MVPP2_TX_FIFO_THRESHOLD_MIN)
>
> +/* MSS Flow control */
> +#define FC_QUANTA 0xFFFF
> +#define FC_CLK_DIVIDER 100

You later change the number of tabs for these definitions in a later
patch. Would it be better to start having the correct number of tabs?

> +
> /* RX buffer constants */
> #define MVPP2_SKB_SHINFO_SIZE \
> SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
> diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> index 5730900..761f745 100644
> --- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> +++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
> @@ -1280,6 +1280,49 @@ static void mvpp22_gop_init_10gkr(struct mvpp2_port *port)
> writel(val, mpcs + MVPP22_MPCS_CLK_RESET);
> }
>
> +static void mvpp22_gop_fca_enable_periodic(struct mvpp2_port *port, bool en)
> +{
> + struct mvpp2 *priv = port->priv;
> + void __iomem *fca = priv->iface_base + MVPP22_FCA_BASE(port->gop_id);
> + u32 val;

net likes to have reverse christmas tree variables. I think you should
clean this up. However...

> +
> + val = readl(fca + MVPP22_FCA_CONTROL_REG);
> + val &= ~MVPP22_FCA_ENABLE_PERIODIC;
> + if (en)
> + val |= MVPP22_FCA_ENABLE_PERIODIC;
> + writel(val, fca + MVPP22_FCA_CONTROL_REG);

if (en)
val = MVPP22_FCA_ENABLE_PERIODIC;
else
val = 0;

mvpp2_modify(priv->iface_base + MVPP22_FCA_BASE(port->gop_id) +
MVPP22_FCA_CONTROL_REG, MVPP22_FCA_ENABLE_PERIODIC, val);

avoids the need for "fca".

> +}
> +
> +static void mvpp22_gop_fca_set_timer(struct mvpp2_port *port, u32 timer)
> +{
> + struct mvpp2 *priv = port->priv;
> + void __iomem *fca = priv->iface_base + MVPP22_FCA_BASE(port->gop_id);
> + u32 lsb, msb;

Same reverse christmas tree issue here.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!