From patchwork Fri Jun 26 18:17:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 191888 Delivered-To: patch@linaro.org Received: by 2002:a54:3249:0:0:0:0:0 with SMTP id g9csp647044ecs; Fri, 26 Jun 2020 11:17:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdSo7eYTn+DiIMRdSZxaKd/k1Qvm8lCuHF8Dbd30JVU0A4k7BboHQLy71NsSd59xdkmsQa X-Received: by 2002:a05:6402:1d86:: with SMTP id dk6mr4780889edb.108.1593195479053; Fri, 26 Jun 2020 11:17:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593195479; cv=none; d=google.com; s=arc-20160816; b=lep/FlAncG4cWFbGWUfdWD3YcIHiMyI08hQqbIgNVRmnqHeo99/UTnyof991WcsdvU JOsDQiOffw0kSF/IfO9SmD/Ml0G6texPi+nh781Br/io/+z4YAGXel21AzK98aQvgDg8 7mDAQYQEafkGyJ4usao45+1A93PLgEFwxWNx+A2QY+99z2g3VdRAswEfpOHCaryC4vFD KhVUOsmoMgt+CGufkfar9PmUDPSeLbqT923Es4oha4FGYSZpPhREBNclLl4LKG1RC1rG m9ZSDXXKw+u3lH6iIDwdQysSE8ze2NxxUbYd83eNJeHbq2TzstlyCAtjeoXFniFQak1w pCEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=X1AdtspTztF0AsbIA9EqIyCbI1qi1qSf0aeaX1Wq600=; b=oHDwB9U3fHsLdzmeVfs3xB2TAqXJVxOR2BLqC54aWVfmx3pHmAWs35+v85i/tg5nbt uDuwnBcX7hruoYwcCtkJMkwl/PWHvOkCEBXygQUiG2FICSEEK26iDBjDEif+Q7H70DAA 0cLmaguyw1EiBBbZvHvAGLLRuNewN4OqpXg4SXjE88TfqmrC86wubWZtD7Z0o8zewg5o UEdtEYMZWJUfTvaoqKc8EKdv2YfAapY4+JAs8zTAfjBI+KpT95qpNfIrEZwM2g5sgF41 ByxVIKd3wUV1PCAr5eTZQLoNDqcFSAocviB0azb3aqFHqP5v5uExL0Xlb+Wq+aDLhWH8 /CAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pS7nzfvF; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v7si13555565edd.252.2020.06.26.11.17.58; Fri, 26 Jun 2020 11:17:59 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pS7nzfvF; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbgFZSRz (ORCPT + 9 others); Fri, 26 Jun 2020 14:17:55 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:59804 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726404AbgFZSRc (ORCPT ); Fri, 26 Jun 2020 14:17:32 -0400 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05QIHKUt115360; Fri, 26 Jun 2020 13:17:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1593195440; bh=X1AdtspTztF0AsbIA9EqIyCbI1qi1qSf0aeaX1Wq600=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pS7nzfvFqyrvwmju07m7Oyd6+zceLwR27lZTCbufbUafLxM0dL4B2Jcnb8dNP9wWG n/sWEragj6VJKengnFOMcmB+jPIYsGPJyJ/wyLvQx4Z3gnz4G+XAXwWfpcVM8PpNVD f+a5Og74LwjBQ5c+BYbfe/2fQH95ZzXzEt+AyBsY= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05QIHJba008680 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Jun 2020 13:17:20 -0500 Received: from DLEE111.ent.ti.com (157.170.170.22) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 26 Jun 2020 13:17:19 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Fri, 26 Jun 2020 13:17:19 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05QIHIXH122959; Fri, 26 Jun 2020 13:17:19 -0500 From: Grygorii Strashko To: "David S. Miller" , , Jakub Kicinski CC: Sekhar Nori , , , Murali Karicheri , Vignesh Raghavendra , Jan Kiszka , Grygorii Strashko Subject: [PATCH net-next 5/6] net: ethernet: ti: am65-cpsw-ethtool: configured critical setting only when no running netdevs Date: Fri, 26 Jun 2020 21:17:08 +0300 Message-ID: <20200626181709.22635-6-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200626181709.22635-1-grygorii.strashko@ti.com> References: <20200626181709.22635-1-grygorii.strashko@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Ensure that critical setting can only be configured when there are no running netdevs - all ports are down. Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/am65-cpsw-ethtool.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c index f7b33875a385..496dafb25128 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-ethtool.c +++ b/drivers/net/ethernet/ti/am65-cpsw-ethtool.c @@ -445,7 +445,7 @@ static int am65_cpsw_set_channels(struct net_device *ndev, /* Check if interface is up. Can change the num queues when * the interface is down. */ - if (netif_running(ndev)) + if (common->usage_count) return -EBUSY; am65_cpsw_nuss_remove_tx_chns(common); @@ -734,6 +734,9 @@ static int am65_cpsw_set_ethtool_priv_flags(struct net_device *ndev, u32 flags) rrobin = !!(flags & AM65_CPSW_PRIV_P0_RX_PTYPE_RROBIN); + if (common->usage_count) + return -EBUSY; + if (common->est_enabled && rrobin) { netdev_err(ndev, "p0-rx-ptype-rrobin flag conflicts with QOS\n");