From patchwork Wed Oct 24 22:10:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 149506 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp560922ljp; Wed, 24 Oct 2018 15:11:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5dUNrVQ0yfL8ImYdloUzyeE1hbYASvgyTTEnc9FccZAJcxsPCXArsy1JdYF6gDZfvTyMvNc X-Received: by 2002:a17:902:788b:: with SMTP id q11-v6mr4179033pll.54.1540419081181; Wed, 24 Oct 2018 15:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540419081; cv=none; d=google.com; s=arc-20160816; b=i4FI8l65ss/GRIRf/YrzhaH22H1wlZxnQwSWbxiP55NrOnsNnI/YZEfsyaxltu7aXa RvJ8IPj+nN7b9ilSEBxvpBpDVGsze2WS23Klp4Tayrku01NFHvkIKLlvHQ980B30IHm2 bTjI1fFFuKnGKIuRNO64QdNu2hj65LeYFVTg07lqiQ9XfQlNhFjuWEI5eJeRRDIREFt9 KTmQdjVE8Vz5Dr4OfApCpRGoV+nrZ/s8Zz8/2aInITu37K8a/ApJxd95SDsZgJWlLoTx if0qvhEjg9BtuzblF+Bb7fRVilD3kSAtGv/XXJhp5vLM5kCmvkM2k3bMp0HlvlCxnTjo fyNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=TR0EsogAgO34iqbw5VJcRTSY0YEnIrhIhjr9xb1cTvc=; b=H2+jwTeiSjbti7eqCzUfCAZRtPtLkvaW0BsL8MUMjlhFP5/636gRV2EeRoxyqPdfIe RUfeQbVJpbSHj6u3Kz8iRWljvxAeSeLe0XGU+sGa5Lwqnax+XVi2SZ0Ah3wE3wsPzx8h kUepi2zYMXyFWpMvI8taJ44G33TdOD1VbO50NcPmIB/5noaS7dtvSwbB3/HnhayRBx/g hfIAadJE0siFbRoNn0G77hbkqHeuKJxL9zCzE5/jmfu/DpPp7uocX1HjLtODSgGJ8tmW nFib4RwnAG2ba+8lt33tMkdP5tUskBonSUEBfaOIgq9k+YLNO/T/nZbl0rrg2Rcn0aCe SqvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QH4l17QX; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e32-v6si6012599plb.309.2018.10.24.15.11.20; Wed, 24 Oct 2018 15:11:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QH4l17QX; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727308AbeJYGlL (ORCPT + 10 others); Thu, 25 Oct 2018 02:41:11 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:38592 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbeJYGlK (ORCPT ); Thu, 25 Oct 2018 02:41:10 -0400 Received: by mail-lj1-f196.google.com with SMTP id k11-v6so6263349lja.5 for ; Wed, 24 Oct 2018 15:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TR0EsogAgO34iqbw5VJcRTSY0YEnIrhIhjr9xb1cTvc=; b=QH4l17QXxF0XBWk+z3/tnLL5j/cXJXpS/QtaI/1w62fb7r9KYN5Y65dC1lvQACWXHM ueVvCdK+DIwDu4w4OSSTQJd2uG8mHCeyihdzEZCFpc+ejNXzhsidz66vKNXDEmB166Ae VkGtsjN/WTeRBX7gLewyC6OEaA5jgepQ+gQhs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TR0EsogAgO34iqbw5VJcRTSY0YEnIrhIhjr9xb1cTvc=; b=Byj5FkFfy3tYZbzCJ0DJoTdtNw5Rs3Kqb2PsYsNov7xjZ87mglqwPQe86eOavcofPh 1QAGRIuSpkRGddGk970Hga0c1GR9QHaGeQEjL8JjAP7j1mTttxSQ8jCVUrSxJqyepHbj kQJw2EJ6MjPt/4h7fKLFVtW0//CZfxJRiyLE6NcLZZXCjYAH2hbJCM/XfIAaQ0YeIQGT SHavawfD9GxRwOQ16lbPulP1MuAqZ8hVlc5MirtomzOFB6mFg9Yn6LC6G3QNVoxqaP3h uKGHKCfUPzvPM0qcTqaDPoVItlo/Uc4giE5xZleoz60iKjF3S7Cqq/jLDCXnh90YvRSc co5w== X-Gm-Message-State: AGRZ1gK3dXbV5rydMcViZxg20bPUy/iYEO7sRNIaiY5+JTwXKBZAhRxa TjD/DSBYOxvGZLSr6I+qPqTJbw== X-Received: by 2002:a2e:1311:: with SMTP id 17-v6mr2885804ljt.70.1540419077508; Wed, 24 Oct 2018 15:11:17 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id f19-v6sm835350ljc.31.2018.10.24.15.11.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Oct 2018 15:11:16 -0700 (PDT) From: Ivan Khoronzhuk To: grygorii.strashko@ti.com, davem@davemloft.net Cc: linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, alexander.h.duyck@intel.com, bjorn@mork.no, Ivan Khoronzhuk Subject: [PATCH net-next 4/4] net: ethernet: ti: cpsw: fix vlan configuration while down/up Date: Thu, 25 Oct 2018 01:10:59 +0300 Message-Id: <20181024221059.21834-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181024221059.21834-1-ivan.khoronzhuk@linaro.org> References: <20181024221059.21834-1-ivan.khoronzhuk@linaro.org> 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 donw/up sequence (if dual-emac - both interfaces). Tested on am572x EVM. Steps to check: ~# ip link add link eth1 name eth1.100 type vlan id 100 ~# ifconfig eth0 down ~# ifconfig eth1 down Try to remove vid and observe warning: ~# ip link del eth1.100 [ 739.526757] net eth1: removing vlanid 100 from vlan filter [ 739.533322] failed to kill vid 0081/100 for device eth1 This patch fixes it, restoring only vlan ALE entries and all other unicast/multicast entries are restored by system calling rx_mode ndo. Reviewed-by: Grygorii Strashko Signed-off-by: Ivan Khoronzhuk --- drivers/net/ethernet/ti/cpsw.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 27e0a5d5ccf9..a061a12e3022 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c @@ -565,6 +565,9 @@ static const struct cpsw_stats cpsw_gstrings_ch_stats[] = { (func)(slave++, ##arg); \ } while (0) +static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, + __be16 proto, u16 vid); + static inline int cpsw_get_slave_port(u32 slave_num) { return slave_num + 1; @@ -1977,9 +1980,23 @@ static void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv) slave_write(slave, tx_prio_map, tx_prio_rg); } +static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg) +{ + struct cpsw_priv *priv = arg; + + if (!vdev) + return 0; + + cpsw_ndo_vlan_rx_add_vid(priv->ndev, 0, vid); + return 0; +} + /* restore resources after port reset */ static void cpsw_restore(struct cpsw_priv *priv) { + /* restore vlan configurations */ + vlan_for_each(priv->ndev, cpsw_restore_vlans, priv); + /* restore MQPRIO offload */ for_each_slave(priv, cpsw_mqprio_resume, priv);