All of lore.kernel.org
 help / color / mirror / Atom feed
From: stefanc at malvell.com <stefanc@malvell.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 04/10] net: mvpp2x: fix BM configuration overrun issue
Date: Wed, 21 Jun 2017 11:31:32 +0300	[thread overview]
Message-ID: <1498033898-15650-5-git-send-email-stefanc@malvell.com> (raw)
In-Reply-To: <1498033898-15650-1-git-send-email-stefanc@malvell.com>

From: Stefan Chulski <stefanc@marvell.com>

Issue:
BM counters were overran by probe that called per Network interface and
caused release of wrong number of buffers during remove procedure.

Fix:
Add CP level flags to call init and remove procedure once per CP.

Change-Id: I7fa24704e1feadb079d7dc3a19a0b92b3b69b238
Signed-off-by: Stefan Chulski <stefanc@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/39400
Tested-by: iSoC Platform CI <ykjenk@marvell.com>
Reviewed-by: Igal Liberman <igall@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
+
+#define MVPP2_F_PROBE		BIT(MV_EMAC_F_REMOVE_BIT)
+#define MVPP2_F_REMOVE		BIT(MVPP2_F_PROBE_BIT)
+
 #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;
+
 	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

  parent reply	other threads:[~2017-06-21  8:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-21  8:31 [U-Boot] [PATCH 00/10] This patch set represent Marvell mvpp2 driver fixes stefanc at malvell.com
2017-06-21  8:31 ` [U-Boot] [PATCH 01/10] net: mvpp2x: Add GPIO configuration support stefanc at malvell.com
2017-08-08 15:46   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 02/10] net: mvpp2x: fix phy connected to wrong mdio issue stefanc at malvell.com
2017-08-08 15:52   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 03/10] net: mvpp2x: Enable GoP packet padding in TX stefanc at malvell.com
2017-08-08 16:00   ` Joe Hershberger
2017-06-21  8:31 ` stefanc at malvell.com [this message]
2017-08-08 16:05   ` [U-Boot] [PATCH 04/10] net: mvpp2x: fix BM configuration overrun issue Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 05/10] net: mvpp2x: decrease size of AGGR_TXQ and CPU_DESC_CHUNK stefanc at malvell.com
2017-08-08 16:07   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 06/10] net: mvpp2x: remove MBUS configurations from MvPP22 driver stefanc at malvell.com
2017-08-08 16:08   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 07/10] net: mvpp2x: Remove IRQ configuration from u-boot stefanc at malvell.com
2017-08-08 16:12   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 08/10] net: mvpp2x: Set BM pool high address stefanc at malvell.com
2017-08-08 16:13   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 09/10] net: mvpp2x: remove TX drain from transmit routine stefanc at malvell.com
2017-08-08 16:15   ` Joe Hershberger
2017-06-21  8:31 ` [U-Boot] [PATCH 10/10] net: mvpp2x: Set BM poll size once during priv probe stefanc at malvell.com
2017-08-08 16:16   ` Joe Hershberger
2017-07-11  8:04 ` [U-Boot] [PATCH 00/10] This patch set represent Marvell mvpp2 driver fixes Stefan Roese
2017-08-08 12:05   ` Stefan Roese
2017-08-08 15:57     ` Joe Hershberger
2017-08-09  5:56       ` Stefan Roese
2017-08-09 15:24         ` Joe Hershberger
2017-08-10  7:47           ` Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498033898-15650-5-git-send-email-stefanc@malvell.com \
    --to=stefanc@malvell.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.