From patchwork Sat Aug 3 01:53:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nevo Hed X-Patchwork-Id: 1141418 X-Patchwork-Delegate: joe.hershberger@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=starry.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=starry.com header.i=@starry.com header.b="BEu5oRRH"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 460nCS2lSxz9sMr for ; Sat, 3 Aug 2019 11:54:42 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 76C8AC21DD7; Sat, 3 Aug 2019 01:54:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 52A24C21C2C; Sat, 3 Aug 2019 01:54:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 20AFAC21C27; Sat, 3 Aug 2019 01:54:33 +0000 (UTC) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) by lists.denx.de (Postfix) with ESMTPS id 8AAD5C21BE5 for ; Sat, 3 Aug 2019 01:54:32 +0000 (UTC) Received: by mail-qt1-f194.google.com with SMTP id d17so75738277qtj.8 for ; Fri, 02 Aug 2019 18:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=starry.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f3DvFAhTmH6+ml7NlltqjIhIXNQl8+Js41S+rDu3yVg=; b=BEu5oRRHsaqxjUZq6Qo4bYX8rLu1btOgJE+e2NwPIP0fZCf5y772/Kfw+ET0PTjV82 hcTKAbtW5a21AI3nQHNM0q2d3AnC9Sh8GY6p+ZSV070GZp4wLWnSb4/00LsXktBvWz/0 Qah2uZ0X9iJqDinCOR0cwpYZRC96DYtKxi01w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f3DvFAhTmH6+ml7NlltqjIhIXNQl8+Js41S+rDu3yVg=; b=JPOkF1M0RzHrt8M50UtMRfnkxKoh451b7UULQogFib0Hk18utZZhSR7gGEOZAC2J30 YrxNjnPHkJ/FLl63lmw7Pd4Vy3pmViiEFuXD+x8T0pNdCl8liFmQI1kN+48GC+Q1UfLg DQibYAFxUfe5aMv+e7a0hskwx7yxs0dFfgoK+TC1tnnz0DXbdlHQwEhgy6Izj39/S3hm 716pHjvF+hlznoAXX969bAmPhYkc8odi2uEdnpV9BBfoOINMdL+V0HLuqdmYQ8ayobeJ +We7co3mmGRXGww913V7h3BxmKewUDCZZdntTjDXmc4cY+1nUeIy4+2bPXfUbckY1GPi JTaA== X-Gm-Message-State: APjAAAWlf+QDVuZN1/cMGOeAl7dkWx9t1hJI/OXUOUL6tSHDtOwHPXoM Np2AGWHQLu/8Ef+Zwy+RTn6stQ== X-Google-Smtp-Source: APXvYqzflJb6FJqtf9Z856nCK7ZvjnX73Z4ZKrI27iIOtkhcr1ajmVZhYxPSJpd+HBXC9U4grtRqSg== X-Received: by 2002:aed:2336:: with SMTP id h51mr95715347qtc.125.1564797271253; Fri, 02 Aug 2019 18:54:31 -0700 (PDT) Received: from nhed-lt1 (205-201-16-55.starry-inc.net. [205.201.16.55]) by smtp.gmail.com with ESMTPSA id r40sm45971237qtk.2.2019.08.02.18.54.29 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 02 Aug 2019 18:54:30 -0700 (PDT) From: nhed+uboot@starry.com To: u-boot@lists.denx.de Date: Fri, 2 Aug 2019 21:53:22 -0400 Message-Id: <20190803015327.9345-2-nhed+uboot@starry.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190803015327.9345-1-nhed+uboot@starry.com> References: <20190803015327.9345-1-nhed+uboot@starry.com> MIME-Version: 1.0 Cc: make@marvell.com Subject: [U-Boot] [PATCH v2 1/6] net: mvpp2x: fix traffic stuck after PHY start error X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Stefan Chulski Issue: - Network stuck if autonegotion fails Issue root cause: - During port open procedure if autonegotion fails, configuration of packet processor won't be finished and open procedure exits with error. - However this won't prevent u-boot network framework from calling send and receive procedures. - Using of transmit and receive function of not configured properly packet processor will cause traffic stuck. Fix: - Don't stop packet processor configuration if autonegotion failed. Only error message would be triggered. - Exit transmit and receive function if there are no PHY link indication. - U-boot network framework would call open procedure during next transmit initiation. Signed-off-by: Stefan Chulski Reviewed-on: http://vgitil04.il.marvell.com:8080/55398 Reviewed-by: Igal Liberman Tested-by: Igal Liberman --- 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()];