Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1135897ima; Wed, 24 Oct 2018 15:13:46 -0700 (PDT) X-Google-Smtp-Source: AJdET5cKvwX8Judw7APAfbaFMu4rDsVouoIdRMSfW/KjCrK1maSXiphtygRVi1/Y5lp8iuSYrekI X-Received: by 2002:a17:902:64c1:: with SMTP id y1-v6mr4115172pli.210.1540419226874; Wed, 24 Oct 2018 15:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540419226; cv=none; d=google.com; s=arc-20160816; b=e5+FwwE072odxFr3n0xQOIGnH3PiNYe1XEc4E2NH2HTALrGD6/DokfC2qT2rOGnz5e 3U9AJkoIBm8uWD+HIfHSrVDAwx3vu+QdD4n0cPu39Ym6w3m793awsKldLpuWcRrXN454 rB+Xe8m/BNgSEb7p0p1Np1769r6lS0/XmER9XqWR6zjOqP6AQJVC5YPpVl5VGDWqpWIa zfcUOzpqTeieh8mGLRxL4eooZbxQfurVYl4NcM8gx+je4viY44pJNE1ClhAiw5gGE7KI vgwyPWX9ArPKva5Sj+X9h4s6nVqU/MPxsx2fxrSWuwy5u0RwvDtQA+ErEUGFiG7RUXvq ZjFg== 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=STUHM9u3q/nHEfoRPk5bZVyyJZ0gR/uERBd/fPVYoY9i1lppCI5VgVtbup8Gxux/Ts Aqm8DtNJauBiSqq39GHDCFeEQUY0NnRGBYC3OAc84tOiwhtPVmzMhQr/0lDwbQljGT/E RqDk2EgP320PltN1MjGjbCOFD7Asj+M2zWA0gAg32AC+tkH2cB0WtrGaM8iE01ls4y2M B89ALT3exBij2c2rKRNKLq54aqwdfKj1iQwyV2Wbqc+YFzbDVt0LezcWsRS8daCCl15y BQOBn7OWM4FNo8Qf9ThV9R/wV9v4565yi6+wsaZxXR/uyz7U4LMwwMafFtLBC968c8or qK3A== 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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 bj8-v6si5600338plb.67.2018.10.24.15.13.28; Wed, 24 Oct 2018 15:13:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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 linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727385AbeJYGlV (ORCPT + 99 others); Thu, 25 Oct 2018 02:41:21 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:34574 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727225AbeJYGlK (ORCPT ); Thu, 25 Oct 2018 02:41:10 -0400 Received: by mail-lj1-f195.google.com with SMTP id c21-v6so387174ljj.1 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=BmgSn8sX/sr35p0hZe2jMRk0OVu42VobEB/QBx3/8sJjlX9NxbpcJXbtquW7ttJiN3 1w5WN8Qbsps6Pqe83vcXLiN8ddDLjMIl3VDpXg+NGZ+14aq15JIjhCUSHcqzqVSZ6Fj3 g4U4ZYPWJ2gxKGBO0GgFLRabsgWUxck6sfIdtQWgjFNpsPzEoy1FUfAQDk0eByhwsjGj Zaw+3UESlr0rZj7sISNQndjb78dtiCHmZ/kPkp5S8WfKiCWN5olenfgpSkdKmEsl4cnA OsDGovKWWLcryUxUDP54fQ/lDsCz+2Pgaa5dct4TykJC0vkBpGwAF0c/+7+WUIg/gPOr kFnw== X-Gm-Message-State: AGRZ1gJn8+oG9z8C6vfc6pvhTrQMKUJJWNXSbJxt3/c+PuJb/Sg4UG0l qAMJm60/3ittD9s5huCFqtFbUA== 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(+) 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); -- 2.17.1