From patchwork Tue Oct 23 11:24:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 149438 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp568331ljp; Tue, 23 Oct 2018 04:26:25 -0700 (PDT) X-Google-Smtp-Source: ACcGV61VZGNHQjJca047oWDcEeMJliXhi3g+pYsDy6dGbCgWTSh8lfxeZNQfur49rwZcsf6Apvr+ X-Received: by 2002:a62:2fc1:: with SMTP id v184-v6mr49414829pfv.115.1540293984885; Tue, 23 Oct 2018 04:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540293984; cv=none; d=google.com; s=arc-20160816; b=SjiedkXUvfR998UaOB2jG6zzzuwOvUAxpwFmEPSN4R1TWdjspbat5f7KgWO4plGoqK zvyVAcZsiUelSnLIbi0DHj57nt05lmcRUArLklYUBtasXN21gXoZpw28gfnCUkY8rmpP WvEljgaojYlA6pU/E26jME3SVkANZ9QIlIHqtUJLNHZCDgudcfHn/8Tj9LXXJiR0oWSY fGYkPSOf8T1JvWj1UHqtGdYIOJ7VZuHDzOVQRaHepjV5kV4avx/FAjt3Nj+zAijeW9ur 4jHhtUZ8UexvXcUFB8FbWgB0CEt8l2wgcaxFrIe0zypEgFtynn7hPknYzTLtsD/KztmS SpcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=VTrcox16L0L1sYuYwrRItVZKI8otDkkL7OPztax/Ops=; b=HJgLtgW+0Qtk9WxWygUqRcN80GpSb+PRkEDw8o2O/VKAeOgMWnmv/tf0KhEWvIo/mm x5lUV8l0bGLXrmBblKp6HfLfsNNFN3DQbFN4+y3kvG138XxpwAZfMSkxjnKt7TIurYBt eyTMkHYZtqhWILAINkpoSoYqtYlhslEwLPFf6MTotPmkgPAT8dw9eifDimWvr6xDCVZO SQcxmAC2xJG7dZ+FvkAm2nLrtos4HeWUlGfq+U5h14BV9e0gRIEPv6AmGeh17A4MsXxo s++IK2VmtD14LFyZdjpQMa6vdaYErOSwov+FHUVcNzVQCG/fLbgBrxouZsdr1beTFzHP ILhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXKXuoUD; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si1056098pgl.279.2018.10.23.04.26.24; Tue, 23 Oct 2018 04:26:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WXKXuoUD; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728077AbeJWTt0 (ORCPT + 10 others); Tue, 23 Oct 2018 15:49:26 -0400 Received: from mail-yw1-f68.google.com ([209.85.161.68]:34230 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbeJWTt0 (ORCPT ); Tue, 23 Oct 2018 15:49:26 -0400 Received: by mail-yw1-f68.google.com with SMTP id v199-v6so379954ywg.1 for ; Tue, 23 Oct 2018 04:26:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VTrcox16L0L1sYuYwrRItVZKI8otDkkL7OPztax/Ops=; b=WXKXuoUDARaWg254hZi4AQR6NP0eKUZe0A2+gAboo6P5NIU/C6YH8oY3doQ64JZmNY 7D9KsSUAaJEKwq3Y9yUNhWzrAxl0arjtNaXQjYST5fL1gsKmd6sPLP13cOGqHvgWPhsv S8pUg1HZeZvcNQbPMuyIo89athATpEyz6wzf4= 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; bh=VTrcox16L0L1sYuYwrRItVZKI8otDkkL7OPztax/Ops=; b=G7kfT7RMHIkmKx0DYJqS7/DOLijqBlxjYTm7QRRYaWWe0VCaUvitQoVLFQCkPlxbse 1JaMYC8teQqEwgEHBJ7+RlW/oY3AUG2D09VHdywbH9YZZMFzibv53ryBfkIiW3293YFR r4Wo3b/BT6Yfcd60yXUXi2tfhWucq1XdMYUIEPKdIAd4UISagmNRNGqv62xCvi2IcQJy wd17k6711JtNavtCugXEeqib906l9u7ilBvDClkw+zmm7eMqUhMoJrKoK5dEYzTDlJcJ +K3S+Bc+SnJ76ipEqp1ipOQphFZel47wqbDoGZhypBn/zhRgVwo/A2Wu3jN40666Jt0G ezXA== X-Gm-Message-State: ABuFfohS7lxaFkpJO+AY07SGXQZfK4UzIriJq10FMPF+eEY7xerAAZ+n w6+KcOdDz86NiDrWZ5Ul9LSqffLwT7k= X-Received: by 2002:a81:5989:: with SMTP id n131-v6mr10396311ywb.54.1540293982192; Tue, 23 Oct 2018 04:26:22 -0700 (PDT) Received: from localhost ([121.95.100.191]) by smtp.gmail.com with ESMTPSA id j76-v6sm294066ywj.5.2018.10.23.04.26.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 04:26:21 -0700 (PDT) From: masahisa.kojima@linaro.org To: netdev@vger.kernel.org Cc: ilias.apalodimas@linaro.org, jaswinder.singh@linaro.org, ard.biesheuvel@linaro.org, osaki.yoshitoyo@socionext.com, Masahisa Kojima Subject: [PATCH net v2 1/3] net: socionext: Stop PHY before resetting netsec Date: Tue, 23 Oct 2018 20:24:26 +0900 Message-Id: <20181023112428.6785-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20181023112428.6785-1-masahisa.kojima@linaro.org> References: <20181023112428.6785-1-masahisa.kojima@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Masahisa Kojima In ndo_stop, driver resets the netsec ethernet controller IP. When the netsec IP is reset, HW running mode turns to NRM mode and driver has to wait until this mode transition completes. But mode transition to NRM will not complete if the PHY is in normal operation state. Netsec IP requires PHY is in power down state when it is reset. This modification stops the PHY before resetting netsec. Together with this modification, phy_addr is stored in netsec_priv structure because ndev->phydev is not yet ready in ndo_init. Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver") Signed-off-by: Masahisa Kojima Signed-off-by: Yoshitoyo Osaki --- changes in v2: - change the place to perform the PHY power down - use the MACROs defiend in include/uapi/linux/mii.h drivers/net/ethernet/socionext/netsec.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.14.2 diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 7aa5ebb6766c..829ed2718b22 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -274,6 +274,7 @@ struct netsec_priv { struct clk *clk; u32 msg_enable; u32 freq; + u32 phy_addr; bool rx_cksum_offload_flag; }; @@ -1340,11 +1341,11 @@ static int netsec_netdev_stop(struct net_device *ndev) netsec_uninit_pkt_dring(priv, NETSEC_RING_TX); netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); - ret = netsec_reset_hardware(priv, false); - phy_stop(ndev->phydev); phy_disconnect(ndev->phydev); + ret = netsec_reset_hardware(priv, false); + pm_runtime_put_sync(priv->dev); return ret; @@ -1354,6 +1355,7 @@ static int netsec_netdev_init(struct net_device *ndev) { struct netsec_priv *priv = netdev_priv(ndev); int ret; + u16 data; ret = netsec_alloc_dring(priv, NETSEC_RING_TX); if (ret) @@ -1363,6 +1365,11 @@ static int netsec_netdev_init(struct net_device *ndev) if (ret) goto err1; + /* set phy power down */ + data = netsec_phy_read(priv->mii_bus, priv->phy_addr, MII_BMCR) | + BMCR_PDOWN; + netsec_phy_write(priv->mii_bus, priv->phy_addr, MII_BMCR, data); + ret = netsec_reset_hardware(priv, true); if (ret) goto err2; @@ -1412,7 +1419,7 @@ static const struct net_device_ops netsec_netdev_ops = { }; static int netsec_of_probe(struct platform_device *pdev, - struct netsec_priv *priv) + struct netsec_priv *priv, u32 *phy_addr) { priv->phy_np = of_parse_phandle(pdev->dev.of_node, "phy-handle", 0); if (!priv->phy_np) { @@ -1420,6 +1427,8 @@ static int netsec_of_probe(struct platform_device *pdev, return -EINVAL; } + *phy_addr = of_mdio_parse_addr(&pdev->dev, priv->phy_np); + priv->clk = devm_clk_get(&pdev->dev, NULL); /* get by 'phy_ref_clk' */ if (IS_ERR(priv->clk)) { dev_err(&pdev->dev, "phy_ref_clk not found\n"); @@ -1620,12 +1629,14 @@ static int netsec_probe(struct platform_device *pdev) } if (dev_of_node(&pdev->dev)) - ret = netsec_of_probe(pdev, priv); + ret = netsec_of_probe(pdev, priv, &phy_addr); else ret = netsec_acpi_probe(pdev, priv, &phy_addr); if (ret) goto free_ndev; + priv->phy_addr = phy_addr; + if (!priv->freq) { dev_err(&pdev->dev, "missing PHY reference clock frequency\n"); ret = -ENODEV; From patchwork Tue Oct 23 11:24:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 149439 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp568468ljp; Tue, 23 Oct 2018 04:26:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62JQZHPFzbSvTIAHIArqnrH62AqktoWbWqs0AYXw2vM/SM5/r1GGrRHyiB5OWRH7IRpxkdb X-Received: by 2002:a17:902:5602:: with SMTP id h2-v6mr47612160pli.220.1540293994370; Tue, 23 Oct 2018 04:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540293994; cv=none; d=google.com; s=arc-20160816; b=vhwVVPc5QlinNMtiNFc+tIcQSS1qsvRm//6Q3hzacHhinR9fHEOUXHP3F1TyZq4s4/ hvMWVonUocUedR0gJV21D/KgRHKKmi6+t6TFjDPd6SLzKDAVElIoeBUYRds1v7TFa3nK ulJPELPgvdI6a7Pu/mrGnUnv9CK2Ft0ypbA4EOYVfeO5LWRXCNcIR2DVNwzyjafYq2Ux nas/6tHvts28IBLzh9s9Md76OcQDpV11sEg4IZVr7KSljEKpwTVMp4v4kpiQL9S1iVsh St8maYFv1hwYwq4cWLzOdKuARNBLd9JeQ8jR1RvBFxla16yvn7w+o0Fp+yurgQ5Jke1o JlsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=TUOW2QcqudOMU4++YbfL/YAuhSN/xUw3L01BavBZE5E=; b=Gg6lcrknChzHVnt6aHMDjMl7cOl/OK7dxjLSC9Ju5f1UZnWUxw5eyTPuu0LCDskXCj ezXSg99WSsCl5Zj8tjcaxF3VQf3PErQnu2o6u751jqt4ZBJEGDVod7rHv+mlcMJmUECq LibAHVL5gWBQJ4JPGAOr7CQZg3kdO2f3cuu+8RKWzzOa5f96bdre11y7346cPWlll5K6 /B2gYdTIfGlAahaOEhhf4pz8PDVA4r9ZScag17+2OW2HWqx7P5I25JLvrMt9I+nh6jbt 6KoNDii37JWaKDbPJ8L61KKppoU+Sf/JnRmhCfnH1J8Onq2kRfeFKzsmyMxpjUnhGe/U //tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FztF2Bti; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si1056098pgl.279.2018.10.23.04.26.34; Tue, 23 Oct 2018 04:26:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FztF2Bti; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728186AbeJWTtf (ORCPT + 10 others); Tue, 23 Oct 2018 15:49:35 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:35499 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbeJWTtf (ORCPT ); Tue, 23 Oct 2018 15:49:35 -0400 Received: by mail-yw1-f67.google.com with SMTP id y76-v6so379551ywd.2 for ; Tue, 23 Oct 2018 04:26:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TUOW2QcqudOMU4++YbfL/YAuhSN/xUw3L01BavBZE5E=; b=FztF2BtiAnBbqmOffMBJShpr+rJb/PpbZiBMXN9NConSEeV1v+GnVj1fkPMdSgwOs5 2z1V99c2cGSTDpy5bR/rDw7pQTsbHjcWD8UpZLMrQrPCV1cv3e64xU4uVfpPbhImQzFm BH2hwbwdzLbqJttSazglUNSSOAvW/KWhkmt78= 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; bh=TUOW2QcqudOMU4++YbfL/YAuhSN/xUw3L01BavBZE5E=; b=VFRI8zyhGcRyAaMylU0ZOtUgWajAmRmLc3Sbe4OCNQDeTyE2DDPU4aljoakS+RG9zO hgYFt4I7okfiBpw1I5Qo6IJvpbicyxe/Hap5S5R+u62Jrg6UGMKblC4kSqTvqwrrr1rz K2x8E0wXZL5Fddeo6Dw8HIL4ibsfZMtEr2qq5MfLCjpjTHtldBXp4lTXuHzPs5oM6eUH GJKmRCxT7S5LyVJmwKpZknUHdeRUWH3cact3CunqKVnOfSYa9BZnuYzUyaWebKPK1LHr JVUuupEWXDBSQCcb+pJQXFVMtO9W4ZlvojGOYhPE4F5e6XMVjeBD0YIV6qSfZwffNv9a 6JgQ== X-Gm-Message-State: ABuFfojqos9vTi4Xpb9K+/lYcmDnm2I/Z5ecc9VUtWwadPnPlotAVuvE dw6BwqmCHOcn9P+z5jpzli+v0fnzMN8= X-Received: by 2002:a81:3217:: with SMTP id y23-v6mr13898713ywy.509.1540293991750; Tue, 23 Oct 2018 04:26:31 -0700 (PDT) Received: from localhost ([121.95.100.191]) by smtp.gmail.com with ESMTPSA id e128-v6sm213262ywd.77.2018.10.23.04.26.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 04:26:31 -0700 (PDT) From: masahisa.kojima@linaro.org To: netdev@vger.kernel.org Cc: ilias.apalodimas@linaro.org, jaswinder.singh@linaro.org, ard.biesheuvel@linaro.org, osaki.yoshitoyo@socionext.com, Masahisa Kojima Subject: [PATCH net v2 2/3] net: socionext: Add dummy PHY register read in phy_write() Date: Tue, 23 Oct 2018 20:24:27 +0900 Message-Id: <20181023112428.6785-3-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20181023112428.6785-1-masahisa.kojima@linaro.org> References: <20181023112428.6785-1-masahisa.kojima@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Masahisa Kojima There is a compatibility issue between RTL8211E implemented in Developerbox and netsec ethernet controller IP. Our MDIO controller stops MDC clock right after the write access, but RTL8211E expects MDC clock must be kept toggling for several clock cycle with MDIO high before entering the IDLE state. Without keeping clock after write access, write access is not correctly handled and register is not updated. To meet this requirement, netsec driver needs to issue dummy read(e.g. read PHYID1(offset 0x2) register) right after write access, to keep MDC clock. We think this compatibility issue is a problem specific to our MDIO controller and RTL8211E. Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver") Signed-off-by: Masahisa Kojima Signed-off-by: Yoshitoyo Osaki --- changes in v2: - use the MACROs defiend in include/uapi/linux/mii.h drivers/net/ethernet/socionext/netsec.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) -- 2.14.2 diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 829ed2718b22..5c295cc0b8f8 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -432,9 +432,12 @@ static int netsec_mac_update_to_phy_state(struct netsec_priv *priv) return 0; } +static int netsec_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr); + static int netsec_phy_write(struct mii_bus *bus, int phy_addr, int reg, u16 val) { + int status; struct netsec_priv *priv = bus->priv; if (netsec_mac_write(priv, GMAC_REG_GDR, val)) @@ -447,8 +450,19 @@ static int netsec_phy_write(struct mii_bus *bus, GMAC_REG_SHIFT_CR_GAR))) return -ETIMEDOUT; - return netsec_mac_wait_while_busy(priv, GMAC_REG_GAR, - NETSEC_GMAC_GAR_REG_GB); + status = netsec_mac_wait_while_busy(priv, GMAC_REG_GAR, + NETSEC_GMAC_GAR_REG_GB); + + /* Developerbox implements RTL8211E PHY and there is + * a compatibility problem with F_GMAC4. + * RTL8211E expects MDC clock must be kept toggling for several + * clock cycle with MDIO high before entering the IDLE state. + * To meet this requirement, netsec driver needs to issue dummy + * read(e.g. read PHYID1(offset 0x2) register) right after write. + */ + netsec_phy_read(bus, phy_addr, MII_PHYSID1); + + return status; } static int netsec_phy_read(struct mii_bus *bus, int phy_addr, int reg_addr) From patchwork Tue Oct 23 11:24:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 149440 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp568571ljp; Tue, 23 Oct 2018 04:26:41 -0700 (PDT) X-Google-Smtp-Source: ACcGV61cFDte9/cHFXwVnPiQLLJIYAF81nUJVxVxb4LIgKjO4a1OedfK1XzgPwtQmqq8FC8cTCa5 X-Received: by 2002:a65:580d:: with SMTP id g13-v6mr43663594pgr.370.1540294001769; Tue, 23 Oct 2018 04:26:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540294001; cv=none; d=google.com; s=arc-20160816; b=XHcVaVBIWfOYelWmxSLVfzfrpoqjE+oLOgFUHUxs93p79OIgiks2ZjlUPuW6H5DMX4 Ow77IOPR0kzksDAD7pTf0QfjE62L+Br3VUbHMRbgSCcS6xbE8hyKMNgf9AdB2s74KRm/ ALUgKPRsrZ0RtS2fJV1zA1etZtvmGgKrhcy5ZQEHtdYQjUwwZzYwV2Sk48dpsJ+7UWzW Adh+qRwiKEyJoofjadeZB/9gxw+ecaQXJtYFOSqDULty67j42OhEu0pCtzJI5JOJ2H9Z AB2NYU7wrwwnBt7kmbqwu76I20JgI8T9SElCeAiquusXTIpWVmpCazEWbEtkkSxJqKw2 lZlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FAJ3+oju1lruSTwugc0cfuJ4vFog1NvT8AXzemkt1N8=; b=02rULib8Bt7+1ONJSLJdZXzWKZVDvZjGEItuRISPGxvfhlb0ng6nvp68o9E8nlBtC1 PjeI3/S0HQ4eTHwE74EnHkEtQ0ViA4l7c3OONULUqTonTYCjN2NEyMQdfxQnWYMBX17L b3Ye4XgbcSiiFgjong0NtSh9F9x6zGoq+cJ9HbANgr0DWsVCQYULh/zaAW+IRjUwnqC1 w7x9VaoOeAt5Zu+swx/aZ9E+UVG6LdVvqbGlPQ7QUmHZXpE3CxCqE2M5nM1Q4Bz1UAZS +SnHelCkqWNhA2FGmy6BXQp5Ee160N7LeLeafD9tLdgJQ5oX4Q4v1DpFUQil34CYycbc IdQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoTYwS3Y; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20-v6si1056098pgl.279.2018.10.23.04.26.41; Tue, 23 Oct 2018 04:26:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CoTYwS3Y; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728216AbeJWTtn (ORCPT + 10 others); Tue, 23 Oct 2018 15:49:43 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:40502 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727873AbeJWTtn (ORCPT ); Tue, 23 Oct 2018 15:49:43 -0400 Received: by mail-yw1-f65.google.com with SMTP id l79-v6so371790ywc.7 for ; Tue, 23 Oct 2018 04:26:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FAJ3+oju1lruSTwugc0cfuJ4vFog1NvT8AXzemkt1N8=; b=CoTYwS3YJGlHtLi3+XDSGbka8GGHJrsm19d0Q5IvQmamxrsO4Fa6z0T9/wlIIl4mCU qRzCWLdcynInyEfba6d/cGNm7J7m6ZtPyrgNy87pcddBI8QCPmT3UtExGe3LwSqAB5uC XuWVSIgSnQbnxxTjMUqv+3dAlaVcv2Yz45MF0= 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; bh=FAJ3+oju1lruSTwugc0cfuJ4vFog1NvT8AXzemkt1N8=; b=jPVKCsMgv45JfTCMneu6n84nHdNUIhbH+KQN32pensAWEaBSsSyPeRDt8Hw0NauB0Y 8EDZ9+2/Ov/HfylpfUvqo2WHsuRw/hk9PRHU3fOiQuzpv2IG55obnxk9e3wfQnpQvg/I 0Wwg1SPT/htcwjY9d6nfB555PcHLhawYva1090p+4UV1WrEIR+3yzEGKEFqdGyeGQYeI ghocv49jmitDO+jwuRsRIrBD4TY1h8zr6HiKUFhzs/VUpsOfznHYAYz7urSpApVI/Csl +kK9F/5UTkVSdRsZf3VyAV/RTYXZ5uuMjuAndo2TkY1K9f7X1If5mT88BAh7FZ/fsch6 88qg== X-Gm-Message-State: ABuFfoh+nDj1AOh8BVAao5K6Pj9sffI/jrEKlcWoPZIV6TFMa74nENA/ CEyJRFxG5LTBOqvsflLeUXwKXbLR4WA= X-Received: by 2002:a0d:d606:: with SMTP id y6-v6mr4860619ywd.358.1540293999429; Tue, 23 Oct 2018 04:26:39 -0700 (PDT) Received: from localhost ([121.95.100.191]) by smtp.gmail.com with ESMTPSA id b70-v6sm223031ywe.85.2018.10.23.04.26.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 23 Oct 2018 04:26:39 -0700 (PDT) From: masahisa.kojima@linaro.org To: netdev@vger.kernel.org Cc: ilias.apalodimas@linaro.org, jaswinder.singh@linaro.org, ard.biesheuvel@linaro.org, osaki.yoshitoyo@socionext.com, Masahisa Kojima Subject: [PATCH net v2 3/3] net: socionext: Reset tx queue in ndo_stop Date: Tue, 23 Oct 2018 20:24:28 +0900 Message-Id: <20181023112428.6785-4-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20181023112428.6785-1-masahisa.kojima@linaro.org> References: <20181023112428.6785-1-masahisa.kojima@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Masahisa Kojima We observed that packets and bytes count are not reset when user performs interface down. Eventually, tx queue is exhausted and packets will not be sent out. To avoid this problem, resets tx queue in ndo_stop. Fixes: 533dd11a12f6 ("net: socionext: Add Synquacer NetSec driver") Signed-off-by: Masahisa Kojima Signed-off-by: Yoshitoyo Osaki --- changes in v2: - update commit comment drivers/net/ethernet/socionext/netsec.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.14.2 diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c index 5c295cc0b8f8..d4da7e017207 100644 --- a/drivers/net/ethernet/socionext/netsec.c +++ b/drivers/net/ethernet/socionext/netsec.c @@ -952,6 +952,9 @@ static void netsec_uninit_pkt_dring(struct netsec_priv *priv, int id) dring->head = 0; dring->tail = 0; dring->pkt_cnt = 0; + + if (id == NETSEC_RING_TX) + netdev_reset_queue(priv->ndev); } static void netsec_free_dring(struct netsec_priv *priv, int id)