From patchwork Mon Aug 17 15:12:23 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: 247794 Delivered-To: patch@linaro.org Received: by 2002:a54:3b12:0:0:0:0:0 with SMTP id j18csp2440122ect; Mon, 17 Aug 2020 08:28:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkr/gTLapAdLApCAGkbOYEnbuPe9bVgFOGjVzxQ/eI9Wq/v5bDEOkiDnmNxreQzKpeNNiG X-Received: by 2002:a17:906:a88b:: with SMTP id ha11mr15417073ejb.545.1597678126002; Mon, 17 Aug 2020 08:28:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597678125; cv=none; d=google.com; s=arc-20160816; b=OKe7P7/DNSLLmCSntmI7cDqjI/8EjRNXxHrzY64+kmUFm0Vx5YrMswSm+vxPFnBAmM /WepCejGQNKTxmBhF2UKu0Keg5zx0sMBYVj2mwB8m5as7eHSZaKyKWlxx5+r9ACEa7s8 zKJd06Li+A6vd/lxyJ9MZPdrAR5cqNphvfrz0R46ydsuN7hz8J9kKv5Emkzc0pbPI8f2 Ok62CE3I4VEexnz+FAsmqzkah9M7EH0xTdx0GlXS51bJNLQ8Aprz9W+pd9t/xe/RpAic 1USxaQc+btN2CvuH3dvO6D69Blc3XaMudvWsUkIze+odOj3xmr1NJtk8WBulC8CD4ySl v4ag== 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=sgowZPunqTH9A/uqKgFRncI2q2rxKl+IweNc9H1G7e0=; b=LLG4vtjT+9mQMaClnlgJWQsLjRtAL27d8c3YpFlsnO3PLy2gUe2B/EfQXrwlO3oqAA DgahdfnNBbIKh6gC4wPQto/Vgxn+qdlVHoJt0NuAVkwXrwtVWr8rGtWUVlS0YWpn9KmH 8xjjImkwcynI3phmTKVjoCGqNsKwlYipc+PsNqiRHntCU2/Zm1bpunB0Tka97JHFKTLR o3s4OThyYXbpWqxRlF2h1pAuWeolHpGe09Ttgy8Go7EFdDbUgRZbQK9MZ+vNDyApk8oe sBQtV+oaG7WmsxyU15Fm71ffOuFEvGS/MkeaWvXwBGqvG8bPptDsiJGcqEWOA1kDWtnc TNZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hMpqWL8F; 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 va2si11734350ejb.14.2020.08.17.08.28.45; Mon, 17 Aug 2020 08:28:45 -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=hMpqWL8F; 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 S1729731AbgHQP2l (ORCPT + 15 others); Mon, 17 Aug 2020 11:28:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:43124 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729666AbgHQP2c (ORCPT ); Mon, 17 Aug 2020 11:28: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 E425F23B40; Mon, 17 Aug 2020 15:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597678106; bh=Ayp/4nbw5HvV5c5EArbyB4xMrIEgilEBRcS1f8aK9F0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hMpqWL8F8r1jNfqu5d3AOF1UdbeBxLpZHRQOU5AySE2QP9AQpZKgAQQdlGCzyt23U uFfh2cYGhWMlaeFQg65xBYOpdR39iraqyapq+bzdL10bEhtn8X0AbD40K40lBRHo/U f7yMu1xttpovC7i+i7RjJJ1itDjK1FczHbqLaBy8= 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.8 190/464] net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up Date: Mon, 17 Aug 2020 17:12:23 +0200 Message-Id: <20200817143842.923412596@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@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 6d778bc3d012f..88832277edd5a 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);