[U-Boot] [PATCH 04/10] net: mvpp2x: fix BM configuration overrun issue

Joe Hershberger joe.hershberger at ni.com
Tue Aug 8 16:05:21 UTC 2017


On Wed, Jun 21, 2017 at 3:31 AM,  <stefanc at malvell.com> wrote:
> From: Stefan Chulski <stefanc at marvell.com>
>
> Issue:
> BM counters were overran by probe that called per Network interface and

overran -> overrun

> caused release of wrong number of buffers during remove procedure.
>
> Fix:
> Add CP level flags to call init and remove procedure once per CP.

CP?

>
> Change-Id: I7fa24704e1feadb079d7dc3a19a0b92b3b69b238
> Signed-off-by: Stefan Chulski <stefanc at marvell.com>
> Reviewed-on: http://vgitil04.il.marvell.com:8080/39400
> Tested-by: iSoC Platform CI <ykjenk at marvell.com>
> Reviewed-by: Igal Liberman <igall at marvell.com>
> ---
>  drivers/net/mvpp2.c | 27 ++++++++++++++++++++++-----
>  1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
> index 3083111..af3c3ef 100644
> --- a/drivers/net/mvpp2.c
> +++ b/drivers/net/mvpp2.c
> @@ -67,6 +67,12 @@ do {                                                                 \
>
>  #define NET_SKB_PAD    max(32, MVPP2_CPU_D_CACHE_LINE_SIZE)
>
> +#define MV_EMAC_F_REMOVE_BIT   0
> +#define MVPP2_F_PROBE_BIT      1

Drop the "BIT" definitions - they are never used except immediately below.

> +
> +#define MVPP2_F_PROBE          BIT(MV_EMAC_F_REMOVE_BIT)

PROBE -> PROBED

> +#define MVPP2_F_REMOVE         BIT(MVPP2_F_PROBE_BIT)

REMOVE -> REMOVED

> +
>  #define CONFIG_NR_CPUS         1
>  #define ETH_HLEN               ETHER_HDR_SIZE  /* Total octets in header */
>
> @@ -942,6 +948,9 @@ struct mvpp2 {
>         struct mii_dev *bus;
>
>         int probe_done;
> +
> +       /* Flags */
> +       u64 flags;
>  };
>
>  struct mvpp2_pcpu_stats {
> @@ -5553,11 +5562,14 @@ static int mvpp2_probe(struct udevice *dev)
>                 gop_port_init(port);
>         }
>
> -       /* Initialize network controller */
> -       err = mvpp2_init(dev, priv);
> -       if (err < 0) {
> -               dev_err(&pdev->dev, "failed to initialize controller\n");
> -               return err;
> +       if (!(priv->flags & MVPP2_F_PROBE)) {
> +               /* Initialize network controller */
> +               err = mvpp2_init(dev, priv);
> +               if (err < 0) {
> +                       dev_err(&pdev->dev, "failed to initialize controller\n");
> +                       return err;
> +               }
> +               priv->flags |= MVPP2_F_PROBE;
>         }
>
>         err = mvpp2_port_probe(dev, port, dev_of_offset(dev), priv);
> @@ -5585,9 +5597,14 @@ static int mvpp2_remove(struct udevice *dev)
>         struct mvpp2 *priv = port->priv;
>         int i;
>
> +       if (priv->flags & MVPP2_F_REMOVE)
> +               return 0;

This seems wrong. Wouldn't you want to remove on the last instance,
not the first?

> +
>         for (i = 0; i < MVPP2_BM_POOLS_NUM; i++)
>                 mvpp2_bm_pool_destroy(dev, priv, &priv->bm_pools[i]);
>
> +       priv->flags |= MVPP2_F_REMOVE;
> +
>         return 0;
>  }
>
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list