From patchwork Tue Oct 16 18:20:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 148981 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5435131lji; Tue, 16 Oct 2018 11:20:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV61txXDjLlF0CzZA3qhCMgyGS3FaG2lL3KLlyU/K2rnh/GALAympoKOitHL3Bfvh2eMEovVR X-Received: by 2002:a62:8145:: with SMTP id t66-v6mr22533889pfd.192.1539714048495; Tue, 16 Oct 2018 11:20:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539714048; cv=none; d=google.com; s=arc-20160816; b=DerUvWUFanBtenWkrjHAzN0Fs+yMWUzFUBGbGkqepf9W8RaFbAcjSHlgBALvJWc4vG PbH7B0uB+EW/we2pTFNPLFDfgudbjoNRoWzuET0WqugKIvXQAhQZQWTV7J7ph+rGbR70 t8IOkt8HKvpYcWfYTENDL/LbuZXxLVU4kf/i7e547AxqjDBISV9vv75VLfVuD9XpwFY7 n7LVvCU3EMI647IamQhno8wbw6qWqBcCDtqt4SQUSrcBqfu6+3lswH6HcZpTwfqo4CKY +CE67AfMz8C9oZ/95f5n66TNYxPLO0ZLUYXe+CYhh9t52h+lAUAU7ERSFYS8QbnyawcE erBQ== 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=ssuygcYMLn1Q3WIghGGutlJDCYEv/K27yRAinbSWkn0=; b=zvZj5lklJmr+EGtSUvwqfFmeIR+tK30KiZ/kZtubfGGCcZqX1JaLYRqmvKgW0ebgaC ZIOpbfdbjdumzACxI44rP80zitaTM8VCP05Jsnj+ncb2wh4holGUnghrG16B4oITsWY1 acHx9eFfNIE8oImZ9jCTS9rBPBDivV+Z5z9OMHIlp8DsbaFG6xPOoVpG0GpFeGk2wPM6 VlpGJAFyBECMqEAiO/7+ltIDHu5NMGy2sJ9brCXIBXo0dpPZwFaU5NWwaRK61AdV5Xik 9tpvWMMQhMuCOdPmEfvi1KyMqWMc9CHyV3qMoSzXjSPW11QsQcNmOj4ZnsH5EESCKZI+ NGiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SVgLBgPN; 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 202-v6si13653070pgb.63.2018.10.16.11.20.48; Tue, 16 Oct 2018 11:20:48 -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=SVgLBgPN; 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 S1727615AbeJQCM1 (ORCPT + 10 others); Tue, 16 Oct 2018 22:12:27 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:39284 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727160AbeJQCM1 (ORCPT ); Tue, 16 Oct 2018 22:12:27 -0400 Received: by mail-lf1-f66.google.com with SMTP id n14-v6so5884542lfe.6 for ; Tue, 16 Oct 2018 11:20:44 -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=ssuygcYMLn1Q3WIghGGutlJDCYEv/K27yRAinbSWkn0=; b=SVgLBgPNL/Sitz1phBzvx86rsDjysgDcl4zkZoW8vR7l04xha37TWN57++dA+Z7tbG 8a62jDyS2L1Cmn1YBDyC8OBpIl6Sy83zj1YANM8LCJN9L7KJE56gjxwSuXKVXYISoQq7 HoWglV34ppwNd8C53EhQe0LRiHB1zASMCaoqc= 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=ssuygcYMLn1Q3WIghGGutlJDCYEv/K27yRAinbSWkn0=; b=ru0dzNk1cXrB8sg6omnzf7VjkjyhmWysgMM/aT7vo2qewIVnFxfrJJ7pXfz3VgbSra ZQMVYCNsZ+HarBAT9NiOIrIwZ99+yxoj/U/8LAlJ3y1i8yl/UZtgwVGVTGfjx2jfhonI KBx7q0fmClDN3b2+BMLhBR71VhLYdDSo8AGAdVvwmTqa9SnMzZpkjibftmSZct6C4mKv wJNwv1tKY5/fkYrMGXp0Nq9OLKp+EXNFrr3dV6ZVV6/gMfQMlGq6asoz+N2a7NvjA+E9 8T47ofCQHltoUuwLd51a2B+nbS7buD9OcqixXU73/K6L8SRR3QB7BL7XSNy9TqTmaHsp pOwg== X-Gm-Message-State: ABuFfojZWf1aoumAx6R8WYlbQa7f2UecVeRptinsFl7Bu8zjcsTsIRBU +j3mxxtECDYua+BJUTl5DQ7/dA== X-Received: by 2002:a19:d3c4:: with SMTP id k187-v6mr13953987lfg.101.1539714044045; Tue, 16 Oct 2018 11:20:44 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id i27-v6sm3207844lfc.22.2018.10.16.11.20.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Oct 2018 11:20:43 -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, Ivan Khoronzhuk Subject: [RFC PATCH net-next 4/4] net: ethernet: ti: cpsw: fix vlan configuration while down/up Date: Tue, 16 Oct 2018 21:20:35 +0300 Message-Id: <20181016182035.18234-5-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181016182035.18234-1-ivan.khoronzhuk@linaro.org> References: <20181016182035.18234-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 This is TI sdk tool, dumping all ALE entries, see they are present ~# switch-config -d ~# ifconfig eth1 up See entry for vid 100 is absent ~# switch-config -d 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. 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 5967484619d4..0b28a90b62bb 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; @@ -1955,9 +1958,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);