From patchwork Mon Aug 17 15:13:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 247857 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp2883905ilo; Mon, 17 Aug 2020 11:59:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzipU2FIWke+1n+ydwKW1qTY4Khhd860mG3c2z8qUwNLPEQyIWxf6g00mY/kTijBHkYJqFT X-Received: by 2002:aa7:c6c2:: with SMTP id b2mr16922654eds.173.1597690769101; Mon, 17 Aug 2020 11:59:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597690769; cv=none; d=google.com; s=arc-20160816; b=YXF4fLhlHmTkyQAC3MhoyJ4HBXgHmGf/YVYngNXoXufPWtXbqH3yCitQT69Y8Yf34s IWF2iX3Mdm+epcPfTgEU0SZ5mHtPHjnpSx0rdBUEpBLysf9phR5G+zIA8xzLA1y0sPC4 7VKi++p8cTVDrra6cUHhUPgD05bMURjHfROOof5rlXlKgqRellUGgMrT0GJAp4ywQAFq 9uQ1uKJTSMqpblrIOFEBHtPgb3vrsX6gaYLepqp1WyjARxyoJT/NrsT8TF7vq9J8v7MI 3PFDFjz3wk8WJ12Z/yFH8FhWd+Ld2ZMe1fd9P5r+Sk2ufr+gAulDSXjaQ+zCSIon0dB3 xg0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=THM+CqD9pIA48Rl8rGuYBTgDDBCyathDNaceauB07SY=; b=u1Lsnt6iNICketPadul893zm1/c2hvnKpSa3mDfHs5zR87TYbUh0y4i1RuMEA4XKOE fzr9Rz8E4qk5GyAhcl4Ezs5rPi4U25iCihsAb8MvsesbMf6mYI4vXL4LQQzdbOYaFKG3 9Pomrxyi/msJ0eiktU4G3PH+RerJH6QnxZFTlH/zGw7eTsvrtBf7RrNkQkwUJcxduuD0 7uALWDd3GIcH1J2JlewSxv9M8r5UaSsZ21OVSVRribgmtGLnsyWJ2kuqmwO+4/4b22kf iWqoS1FpAztbXCGH3yY4BvaaDg0NEHQtwGEssytfqh5gXfMQecCqBjlW8jSi5rxD5sAm r+Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CqhDwspY; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si11644238ejd.623.2020.08.17.11.59.28; Mon, 17 Aug 2020 11:59:29 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@kernel.org header.s=default header.b=CqhDwspY; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388755AbgHQS72 (ORCPT + 15 others); Mon, 17 Aug 2020 14:59:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:59920 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730855AbgHQPsc (ORCPT ); Mon, 17 Aug 2020 11:48:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 55CA62067C; Mon, 17 Aug 2020 15:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679310; bh=SOZN3vB8b/e9xXVr3NCnRkVcHjwE78Nhys0Nf+rGu6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CqhDwspYfQ+NgN7RlEBUlc56Np/+rsiVmWSyn6mJGVdTP4anChlndV4gSIiGk7zXF Jrm1LtLMS+rbJwL6/DqTDelsQN2iwwwTXbfKdL1Gg7OJUNSvepkiMNSHaO/QGht3lz N2AOih6PP0nmUNVQ1P8BeIUagE5WGFpp6FQFJbB0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grygorii Strashko , "David S. Miller" , Sasha Levin Subject: [PATCH 5.7 168/393] net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up Date: Mon, 17 Aug 2020 17:13:38 +0200 Message-Id: <20200817143827.769585713@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Grygorii Strashko [ Upstream commit 7bcffde02152dd3cb180f6f3aef27e8586b2a905 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.25.1 diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index 3e4388e6b5fa1..61b59a3b277ec 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -217,6 +217,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); @@ -240,6 +243,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); @@ -565,6 +571,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); @@ -638,6 +654,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);