Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4206022ybb; Mon, 23 Mar 2020 15:56:01 -0700 (PDT) X-Google-Smtp-Source: ADFU+vumwNWmPquxWO9UMiGhvjCVXQzdGVWqhyvQ8FsCgUu6p2Q+kX6OPqezy4dcdQ+0aOgtL7yz X-Received: by 2002:a54:4388:: with SMTP id u8mr1294854oiv.67.1585004161676; Mon, 23 Mar 2020 15:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585004161; cv=none; d=google.com; s=arc-20160816; b=t2/NmAHRmA2VrN10cdBKeeucXHTdPFhRL60iPOEDOGzsjiVueY3Gm1La1PuZ3pwN7r 7buETUwQ/Jz9mclmeTgG5FoFwi2wcee3ammvKyAqEo3mxIIcxXmWEk/Ol4xeX71iZBwQ ziaRoZKV9xjrfsgmy5G/RrxZENapcSSVcDIi7nfp+PHJySQZaXSd55e70jPuZJKGU4jX 1AGynRiQh2x2BHgwWNn7syr1W4kQxG7jOnHFDFr04sdSll5ZM7KcW0egNkZlICNz5jR4 Hqe6REf37746HqYQTcfHRVENuRtF5eYEKOu2NZf8E+xDqZAurzjqOn1xuWjKymbFiBUM B2mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=k0vxdq9MCYQnNQ+mHGw+Dh0Z5Z5FQRbYbThLE0zRg9U=; b=kaGgFiPup1KVVfwRXHD0pnSSXCVvL5M0XQo9Nzbk6JiY+Enr4Vb8r37k8sNxM75zUg 9oNw80IrwctsxAsD6mgqVsP/rMkjfSLekxbV7w0THVqacNY8vNe8utB7x1zwz4Wnwxr9 Ot9elL4+IqvNZm3AR1TQ8N69SWqB6qSdMmGUeg+SxHGN9olTWIEvu1iPWN7ZOVrmCtDv GCPv+WLzbTZfCWLTRziomEHybetz8R9DdKBgODH8Hj/QrmSOdymBUJJ9huFp/efBxwQG 7smC0b9b/8WYu6hIWG1fYwJb5EKv8Q2Zolk6IMUDlMNoQYgafe1aTznLG9iVkh+dhs+g gxfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=B5AVCsyV; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e19si8648138otp.40.2020.03.23.15.55.48; Mon, 23 Mar 2020 15:56:01 -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=@ti.com header.s=ti-com-17Q1 header.b=B5AVCsyV; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727124AbgCWWxG (ORCPT + 99 others); Mon, 23 Mar 2020 18:53:06 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:57042 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727046AbgCWWxG (ORCPT ); Mon, 23 Mar 2020 18:53:06 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02NMr0Vx032066; Mon, 23 Mar 2020 17:53:00 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1585003980; bh=k0vxdq9MCYQnNQ+mHGw+Dh0Z5Z5FQRbYbThLE0zRg9U=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=B5AVCsyVfgpnmas9d2txViYHS7LLdzxZRjj3S6EhKJdx9D5+dnkflEyy6HtfPFg09 RQhTs4628r6csEoMv4FNfSsTBnpecFOX66F0/LJh3GNEWt1EzV1SszUngCcrK5UQZ0 FSsno0j4seeF7SNIDnT6k/pa1d9+4Y3y76dD6iZU= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02NMr0gI101564 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 23 Mar 2020 17:53:00 -0500 Received: from DLEE113.ent.ti.com (157.170.170.24) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Mon, 23 Mar 2020 17:52:59 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Mon, 23 Mar 2020 17:52:59 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 02NMqwRg125532; Mon, 23 Mar 2020 17:52:59 -0500 From: Grygorii Strashko To: Peter Ujfalusi , Rob Herring , Tero Kristo , "David S . Miller" , netdev , Roger Quadros , , Jakub Kicinski CC: Murali Karicheri , Sekhar Nori , Kishon Vijay Abraham I , , , Grygorii Strashko Subject: [PATCH net-next v6 02/11] net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled Date: Tue, 24 Mar 2020 00:52:45 +0200 Message-ID: <20200323225254.12759-3-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200323225254.12759-1-grygorii.strashko@ti.com> References: <20200323225254.12759-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On AM65xx MCU CPSW2G NUSS and 66AK2E/L NUSS the unregistered multicast packets are still can be received with promisc and allmulti disabled. This happens, because ALE VLAN entries on these SoCs do not contain port masks for reg/unreg mcast packets, but instead store indexes of ALE_VLAN_MASK_MUXx_REG registers which intended for store port masks for reg/unreg mcast packets. ALE VLAN entry:UNREG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXx ALE VLAN entry:REG_MCAST_FLOOD_INDEX -> ALE_VLAN_MASK_MUXy The commit b361da837392 ("net: netcp: ale: add proper ale entry mask bits for netcp switch ALE") update ALE code to support such ALE entries, it is always used ALE_VLAN_MASK_MUX0_REG index in ALE VLAN entry for unreg mcast packets mask configuration, which is read-only, at least for AM65xx MCU CPSW2G NUSS and 66AK2E/L NUSS. As result unreg mcast packets are allowed always. Hence, update ALE code to use ALE_VLAN_MASK_MUX1_REG index for ALE VLAN entries to configure unreg mcast port mask. Fixes: b361da837392 ("net: netcp: ale: add proper ale entry mask bits for netcp switch ALE") Signed-off-by: Grygorii Strashko Tested-by: Murali Karicheri Tested-by: Peter Ujfalusi --- drivers/net/ethernet/ti/cpsw_ale.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index ecdbde539eb7..5815225c000c 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -122,6 +122,8 @@ DEFINE_ALE_FIELD(mcast, 40, 1) DEFINE_ALE_FIELD(vlan_unreg_mcast_idx, 20, 3) DEFINE_ALE_FIELD(vlan_reg_mcast_idx, 44, 3) +#define NU_VLAN_UNREG_MCAST_IDX 1 + /* The MAC address field in the ALE entry cannot be macroized as above */ static inline void cpsw_ale_get_addr(u32 *ale_entry, u8 *addr) { @@ -455,6 +457,8 @@ int cpsw_ale_add_vlan(struct cpsw_ale *ale, u16 vid, int port_mask, int untag, cpsw_ale_set_vlan_unreg_mcast(ale_entry, unreg_mcast, ale->vlan_field_bits); } else { + cpsw_ale_set_vlan_unreg_mcast_idx(ale_entry, + NU_VLAN_UNREG_MCAST_IDX); cpsw_ale_set_vlan_mcast(ale, ale_entry, reg_mcast, unreg_mcast); } cpsw_ale_set_vlan_member_list(ale_entry, port_mask, -- 2.17.1