All of lore.kernel.org
 help / color / mirror / Atom feed
From: nhed+uboot at starry.com <nhed+uboot@starry.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/7] net: mvpp2x: fix traffic stuck after PHY start error
Date: Tue,  6 Aug 2019 11:51:38 -0400	[thread overview]
Message-ID: <20190806155144.19301-2-nhed+uboot@starry.com> (raw)
In-Reply-To: <20190806155144.19301-1-nhed+uboot@starry.com>

From: Stefan Chulski <stefanc@marvell.com>

Issue:
- Network stuck if autonegotion fails.

Issue root cause:

- When autonegotiation fails during port open procedure, the packet
  processor configuration does not finish and open procedure exits
  with error.
- However, this doesn't prevent u-boot network framework from
  calling send and receive procedures.
- Using transmit and receive functions of misconfigured packet
  processor will cause traffic to get stuck.

Fix:

- Continue packet processor configuration even if autonegotiation
  fails.  Only error message is triggered in this case.
- Exit transmit and receive functions if there is no PHY link
  indication.
- U-boot network framework now calls open procedure again during next
  transmit initiation.

Signed-off-by: Stefan Chulski <stefanc@marvell.com>
Reviewed-by: Igal Liberman <igall@marvell.com>
Tested-by: Igal Liberman <igall@marvell.com>
---
 drivers/net/mvpp2.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index bd89725e77..f36c8236b1 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -4494,7 +4494,7 @@ static void mvpp2_stop_dev(struct mvpp2_port *port)
 		gop_port_enable(port, 0);
 }
 
-static int mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
+static void mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
 {
 	struct phy_device *phy_dev;
 
@@ -4504,7 +4504,7 @@ static int mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
 		port->phy_dev = phy_dev;
 		if (!phy_dev) {
 			netdev_err(port->dev, "cannot connect to phy\n");
-			return -ENODEV;
+			return;
 		}
 		phy_dev->supported &= PHY_GBIT_FEATURES;
 		phy_dev->advertising = phy_dev->supported;
@@ -4516,18 +4516,14 @@ static int mvpp2_phy_connect(struct udevice *dev, struct mvpp2_port *port)
 
 		phy_config(phy_dev);
 		phy_startup(phy_dev);
-		if (!phy_dev->link) {
+		if (!phy_dev->link)
 			printf("%s: No link\n", phy_dev->dev->name);
-			return -1;
-		}
-
-		port->init = 1;
+		else
+			port->init = 1;
 	} else {
 		mvpp2_egress_enable(port);
 		mvpp2_ingress_enable(port);
 	}
-
-	return 0;
 }
 
 static int mvpp2_open(struct udevice *dev, struct mvpp2_port *port)
@@ -4567,10 +4563,7 @@ static int mvpp2_open(struct udevice *dev, struct mvpp2_port *port)
 	}
 
 	if (port->phy_node) {
-		err = mvpp2_phy_connect(dev, port);
-		if (err < 0)
-			return err;
-
+		mvpp2_phy_connect(dev, port);
 		mvpp2_link_event(port);
 	} else {
 		mvpp2_egress_enable(port);
@@ -5175,6 +5168,10 @@ static int mvpp2_recv(struct udevice *dev, int flags, uchar **packetp)
 	struct mvpp2_rx_queue *rxq;
 	u8 *data;
 
+	if (port->phy_node)
+		if (!port->phy_dev->link)
+			return 0;
+
 	/* Process RX packets */
 	rxq = port->rxqs[0];
 
@@ -5240,6 +5237,10 @@ static int mvpp2_send(struct udevice *dev, void *packet, int length)
 	int tx_done;
 	int timeout;
 
+	if (port->phy_node)
+		if (!port->phy_dev->link)
+			return 0;
+
 	txq = port->txqs[0];
 	aggr_txq = &port->priv->aggr_txqs[smp_processor_id()];
 
-- 
2.21.0

  reply	other threads:[~2019-08-06 15:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 15:51 [U-Boot] [PATCH v3 0/7] Switch MVPP2 to use new MVMDIO nhed+uboot at starry.com
2019-08-06 15:51 ` nhed+uboot at starry.com [this message]
2019-08-07 17:50   ` [U-Boot] [PATCH v3 1/7] net: mvpp2x: fix traffic stuck after PHY start error Ramon Fried
2019-08-14 15:59   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 2/7] net: mvpp2: Replace SMI implementation with marvell MDIO API nhed+uboot at starry.com
2019-08-07 17:52   ` Ramon Fried
2019-08-06 15:51 ` [U-Boot] [PATCH v3 3/7] net: mvpp2: mark phy as invalid in case of missing appropriate driver nhed+uboot at starry.com
2019-08-07 17:52   ` Ramon Fried
2019-08-06 15:51 ` [U-Boot] [PATCH v3 4/7] net: mvpp2: no deref null nhed+uboot at starry.com
2019-08-07 14:57   ` Ramon Fried
2019-08-06 15:51 ` [U-Boot] [PATCH v3 5/7] arm: dts: armada-cp110-*dtsi: add xmdio nodes nhed+uboot at starry.com
2019-08-07 17:54   ` Ramon Fried
2019-08-14 15:55   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 6/7] net: mvpp2: use new MVMDIO driver nhed+uboot at starry.com
2019-08-14 15:59   ` Joe Hershberger
2019-08-06 15:51 ` [U-Boot] [PATCH v3 7/7] net: mvpp2: MVPP2 now needs MVMDIO nhed+uboot at starry.com
2019-08-07 14:56   ` Ramon Fried
2019-08-14 15:49   ` Joe Hershberger

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=20190806155144.19301-2-nhed+uboot@starry.com \
    --to=nhed+uboot@starry.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.