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: 10655039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 00A4317F3 for ; Wed, 24 Oct 2018 22:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E72E22B42E for ; Wed, 24 Oct 2018 22:11:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E59FD2B451; Wed, 24 Oct 2018 22:11:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 863D72B430 for ; Wed, 24 Oct 2018 22:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727228AbeJYGlK (ORCPT ); Thu, 25 Oct 2018 02:41:10 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:41800 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725829AbeJYGlK (ORCPT ); Thu, 25 Oct 2018 02:41:10 -0400 Received: by mail-lj1-f194.google.com with SMTP id u21-v6so6260526lja.8 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=uKeGfO5cuyF4ZHxjqK10yQN8yk5rYxTsS74DNb8vu47UzeBfq+7neqz5spWb8eCMXA vCjQrs7xrMYQHQdkaGfFS0Buu14cCUxguyj00lb31W7rQ3jUkv81+/SoojWujLynyreG wYLjyN7QL+58Oww+WG9yZlWlunUfIkdUICpU9uk/IGBEYh3jboSJHpIgkYkSwfGzJ3f+ HBQjPvI81LAThB0ST+CkbVlrMVCDl/x6ZN3o9i8EISYNNwE1Z/xEPfYqIK76zqKdwK9U iIYILvFxZ12MWQ9huz8QKFiuQ6OYIUddWYCF0BcYk9KS59SVsWOGztlZqOzHHvWRUkGe d1Zw== X-Gm-Message-State: AGRZ1gL27P/cxTLJ/Xug4ykLIEI5xPmhJ+UaoYG6X/T4OTOguN+1MojB gqcafOFBFNUPxNOuyHe+LsOTqtPxLOQ= X-Google-Smtp-Source: AJdET5fzsjx9iC+dbzwJM7VcnPoh5bc5w9V1Txr9UORGlY/GVkTTHqWFQKHmYtAxHIDws5ipPDejkA== 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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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);