From patchwork Fri Jun 26 18:17:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 191882 Delivered-To: patch@linaro.org Received: by 2002:a54:3249:0:0:0:0:0 with SMTP id g9csp646700ecs; Fri, 26 Jun 2020 11:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2dIq2o2x7NYvmmoV3jO1EETbGbDblA0yrKW67dLPOse5/x/7c/HyXI/9dzQ1NtaN6dvqo X-Received: by 2002:a50:8fa1:: with SMTP id y30mr4480157edy.86.1593195447362; Fri, 26 Jun 2020 11:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593195447; cv=none; d=google.com; s=arc-20160816; b=o7MgRdNtnu1Eg7jKZDLzqKrFnK3KXR4BYtdGR3Wr38Gsz1qYatMR6xIunSv857jeBA CHYi7i15D9KEQ99y9vUNWrEpxWAR25ZE2GEcENWWSrmI4AW02W1FghftqgiH6ygaiNF8 I1tpm8/0BsjQy3BsFJGPiG9f6F9JfMrhWrgjQU08VYhHDPD2pFKnNS8FTM9qrb9Zd2wY tFAIOF65GJCqQhipIR3vfuuQFa7P+la5zKXjnZDCiOivHgOfUBybhM1TPWCZT7g53uzY VJ9DKiDIZwpgsgyn/6ciY+DAYcwBZyWbuSVNfxw0HOsN8dmpfizIUpe3WjEcLzlX3C2z mVJQ== 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=ObJy3OzFPVwRVlL2NFhYDlEcbRHlojhYSa7S3qkOSMA=; b=sjow5/w5JCpNMxqgLPXhGMGbYfWs6z40Ez6UKOMsPvcQMtrXCQY73VcIPXKo9NC0LQ THC9E55NNP9H4b31Fqi9fft95pJ1QOXuudJpp4yjen8ca4JvSOOTD7+sG/M9JDsKu+lP rWuiLgGjezT16H7bCZjzO6OgC2Nsc7HgcPtHGZZlI68wM1EUjEi3DNlvF4t90BAbTkr9 8gCyrt8YIx1F5HpcpiUeJBLIt1j7u8tWs5CYZozeEDIfcSee5Hzf9m8vNOzbK23T4gN0 CXL/KRqoIsjtOFN10EnI4fUD+s3VU8FHiW8ULZaxq+u9ecD5IyNyu2yoZBD8XgAiIfGk 5M5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="j8TuFR/J"; 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 b15si17784448edz.588.2020.06.26.11.17.27; Fri, 26 Jun 2020 11:17:27 -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="j8TuFR/J"; 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 S1726344AbgFZSR0 (ORCPT + 9 others); Fri, 26 Jun 2020 14:17:26 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:48542 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726013AbgFZSRZ (ORCPT ); Fri, 26 Jun 2020 14:17:25 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 05QIHD2b002410; Fri, 26 Jun 2020 13:17:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1593195433; bh=ObJy3OzFPVwRVlL2NFhYDlEcbRHlojhYSa7S3qkOSMA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=j8TuFR/J7tzCEu0fsyPp2wq/HN0wHLQnNXXmVz4Z4rzEmd8FmPpH09snDjiWzdMmB 2VrqdaM3xLl22uds7bq9W0vdW8mRc5JVEN0k4/UT0aMhjNybpty7fBvJpdcYzlyjRO 567AcqvOyKb1pg1z33X7iWeFrVr03rEHDE+ynf+c= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 05QIHDL0058613 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Jun 2020 13:17:13 -0500 Received: from DLEE105.ent.ti.com (157.170.170.35) 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:12 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE105.ent.ti.com (157.170.170.35) 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:12 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 05QIHBAA081457; Fri, 26 Jun 2020 13:17:12 -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 1/6] net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up Date: Fri, 26 Jun 2020 21:17:04 +0300 Message-ID: <20200626181709.22635-2-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 The vlan configuration is not restored after interface down/up sequence. Steps to check: # ip link add link eth0 name eth0.100 type vlan id 100 # ifconfig eth0 down # ifconfig eth0 up This patch fixes it, restoring vlan ALE entries on .ndo_open(). Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 1492648247d9..82d3b1f20890 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -223,6 +223,9 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev, u32 port_mask, unreg_mcast = 0; int ret; + if (!netif_running(ndev) || !vid) + return 0; + ret = pm_runtime_get_sync(common->dev); if (ret < 0) { pm_runtime_put_noidle(common->dev); @@ -246,6 +249,9 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev, struct am65_cpsw_common *common = am65_ndev_to_common(ndev); int ret; + if (!netif_running(ndev) || !vid) + return 0; + ret = pm_runtime_get_sync(common->dev); if (ret < 0) { pm_runtime_put_noidle(common->dev); @@ -571,6 +577,16 @@ static int am65_cpsw_nuss_ndo_slave_stop(struct net_device *ndev) return 0; } +static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg) +{ + struct am65_cpsw_port *port = arg; + + if (!vdev) + return 0; + + return am65_cpsw_nuss_ndo_slave_add_vid(port->ndev, 0, vid); +} + static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) { struct am65_cpsw_common *common = am65_ndev_to_common(ndev); @@ -644,6 +660,9 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev) } } + /* restore vlan configurations */ + vlan_for_each(ndev, cpsw_restore_vlans, port); + phy_attached_info(port->slave.phy); phy_start(port->slave.phy);