Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp751080ybl; Tue, 13 Aug 2019 01:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqw5ZVdw3kOTrGGmpZFe4ZnK/t14cemTt9/iznZjlF/G81qFnahOr9fJKmC6id/8Dkpjc9QV X-Received: by 2002:a63:e5a:: with SMTP id 26mr32357487pgo.3.1565686664373; Tue, 13 Aug 2019 01:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565686664; cv=none; d=google.com; s=arc-20160816; b=TAwdhBkc7HfJsUD59ITFGlbdcNjzvQ+EOsO5w9UHAzlIQ5p+FKgNQglPsIgFRLyK+K VlkpJ+kTnY6mFR4Ia++Eazx9KZ9UPQcJOdml77M2ilOxXr0Fmko6+t+NiPUO1E19pTf6 AtgEQRGfRyTK1xAmlfjK4ZYz6yWZEAaPya7k9vDicgXyytVDjXWrnGDjoP0refioiZrc HifOYyXv9Aye9L3GMHmd8j52lLxYig307H73bosK8RE9HnYwjdTcymyvl9aUOnE/dBeT HknFG/DuGrXe1dAvqLiLroiyi5H5hggGxTKCElcYLqb/SdH8vCoddNM663Ldab2uegIN TcjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=k8HYp0l0fPL4+pu3MZQLPdPbwLifWWUCY/QgHi6QvTE=; b=IUYKjh6G3nSq838opDpJ4tY2R137InaR3BPwaoHg1ukzf7J1ZGHyLWpokXEgcKr84/ HXF8dljFOZE6fi6R9PeL+ejL2sTIYOWWNggsDLCREMmrfAkL+uKAGnZcDoNjNWDssMES Js7X1RUJIm7Oq2+pQ0pfhEJP4sgFFr3MjmNQ78+EWEECyGmsaPVf5fliCrpUa+NGFuut 3e8OWrn0cMdFoYxHhmEWi4TtEFuAqn6+qHiKxlKkiwQw0Np5OoFnavvbo9FeFVaZaQdF ZRTZLuhcBRcMvcGjrncbH8a7YADl9KANUpDuPYVpUnWVDrF3e6umNWE4feZJXTnaPvOh y4oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cf17si2012681plb.48.2019.08.13.01.57.28; Tue, 13 Aug 2019 01:57:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728326AbfHMIy7 (ORCPT + 99 others); Tue, 13 Aug 2019 04:54:59 -0400 Received: from inva020.nxp.com ([92.121.34.13]:56152 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728303AbfHMIyz (ORCPT ); Tue, 13 Aug 2019 04:54:55 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 60FC41A0766; Tue, 13 Aug 2019 10:54:54 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 550041A075F; Tue, 13 Aug 2019 10:54:54 +0200 (CEST) Received: from fsr-ub1464-137.ea.freescale.net (fsr-ub1464-137.ea.freescale.net [10.171.82.114]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id F30792060E; Tue, 13 Aug 2019 10:54:53 +0200 (CEST) From: Ioana Ciornei To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org Cc: joe@perches.com, andrew@lunn.ch, ruxandra.radulescu@nxp.com, Ioana Ciornei Subject: [PATCH v2 10/10] staging: fsl-dpaa2/ethsw: do not force user to bring interface down Date: Tue, 13 Aug 2019 11:54:39 +0300 Message-Id: <1565686479-32577-11-git-send-email-ioana.ciornei@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1565686479-32577-1-git-send-email-ioana.ciornei@nxp.com> References: <1565686479-32577-1-git-send-email-ioana.ciornei@nxp.com> Reply-to: ioana.ciornei@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Link settings can be changed only when the interface is down. Disable and re-enable the interface, if necessary, behind the scenes so that we do not force users to an if down/up sequence. Reported-by: Andrew Lunn Signed-off-by: Ioana Ciornei --- Changes in v2: - added Reported-by tag drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c | 32 ++++++++++++++++++------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c index 0f9f8345e534..99d658fefa14 100644 --- a/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c +++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw-ethtool.c @@ -88,16 +88,21 @@ static void ethsw_get_drvinfo(struct net_device *netdev, const struct ethtool_link_ksettings *link_ksettings) { struct ethsw_port_priv *port_priv = netdev_priv(netdev); + struct ethsw_core *ethsw = port_priv->ethsw_data; struct dpsw_link_cfg cfg = {0}; - int err = 0; - - /* Due to a temporary MC limitation, the DPSW port must be down - * in order to be able to change link settings. Taking steps to let - * the user know that. - */ - if (netif_running(netdev)) { - netdev_info(netdev, "Sorry, interface must be brought down first.\n"); - return -EACCES; + bool if_running; + int err = 0, ret; + + /* Interface needs to be down to change link settings */ + if_running = netif_running(netdev); + if (if_running) { + err = dpsw_if_disable(ethsw->mc_io, 0, + ethsw->dpsw_handle, + port_priv->idx); + if (err) { + netdev_err(netdev, "dpsw_if_disable err %d\n", err); + return err; + } } cfg.rate = link_ksettings->base.speed; @@ -115,6 +120,15 @@ static void ethsw_get_drvinfo(struct net_device *netdev, port_priv->idx, &cfg); + if (if_running) { + ret = dpsw_if_enable(ethsw->mc_io, 0, + ethsw->dpsw_handle, + port_priv->idx); + if (ret) { + return ret; + netdev_err(netdev, "dpsw_if_enable err %d\n", ret); + } + } return err; } -- 1.9.1