Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3474419ybh; Tue, 17 Mar 2020 00:28:56 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvm1VFj9yBmVycmxzH3IIhrHPQw4pJObBtuJEhLguiS43jW6Sh4JvP3j8OA0vh/xwnfYV/E X-Received: by 2002:a05:6830:10c7:: with SMTP id z7mr2407916oto.235.1584430136217; Tue, 17 Mar 2020 00:28:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584430136; cv=none; d=google.com; s=arc-20160816; b=iFShqbkAoZCyw3dAMye8ra0uh6HzZDktZ55GjPpE4YWid+hQ5PzPiXRjy5yHZM/Ox1 CPeHfq57QI7LIWsiKTq0/zyXqtdo2n7lTV14xrlPe+Sad5Yq9rW4IBkbBrUO2UQuVJWl JjVFUpPZUqI2t2fiCqoFWf74ylTAE6ZZmYJrFlxT/YyWrYUtZ0QEk1lSyfxJB/w4Szn/ w1IOLnQVfBMLmGgxhmhARgHn9Per5X/zzLcYI6jG0rL0bYhmhMEwW9HFlR01+QfuqIod 8qsmuywA+jBgaEOKwgJhv+bvFXHIhrX2/BfSzmTj44+wL4PRc5IOzA47UBhmOcC0XdAp es0g== 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=GkIWSmqvUvL2zn1Fz+5BNI1CldpfxGZjKHp5TqDc4bY=; b=UnjOUeyR0ZMGmZsSjJlHrScUYNUmU0QOTPXW+W9Tn93gW+fEuHDat4nih7m/S/itdY CAMmPLZEOxbnUiUVXJUoKAH3JAJ4qk6nfasa6gSnMf9qqih1+BFEFlQxbKV3mDaIcsAP jVT4zDyFqDDeaVMULqSlAjHCXKEYL33BUxWq3dO4lVr2RHAeeFMx9gVl3P+R5wNdHr0Z dYVQAMfG9344cUnEX6322FCaWN37WxrB6wJeWTAiSuk5X5818RY9sdMtxUc/+hB024xe I82z01H5xjshr/MJXyoPzAWSQBYMaiBjWlHWs6cWgRGo0iWCPBo1PbQmoAFnLRS/CTyK yTVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="g/vgMYhq"; 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 l16si1280407oti.106.2020.03.17.00.28.43; Tue, 17 Mar 2020 00:28:56 -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="g/vgMYhq"; 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 S1726444AbgCQH2K (ORCPT + 99 others); Tue, 17 Mar 2020 03:28:10 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44658 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbgCQH2J (ORCPT ); Tue, 17 Mar 2020 03:28:09 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 02H7S3Vx062377; Tue, 17 Mar 2020 02:28:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1584430083; bh=GkIWSmqvUvL2zn1Fz+5BNI1CldpfxGZjKHp5TqDc4bY=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=g/vgMYhq3cJXgrTPYzpCByxDT1iz7zT2T4U4+7ZUuzJRqf5StDS2xaIJBY0TkJHgk dhxDV4yNZ9U+Q03qitJnB0Gyt4XjDtkNMRGVW5Au2qaeiBra5Mj/BSrL7AWPDruuuo Rs9+dnX9hNA16T+hR0XvnfAQuahEaKbF/IxuY6iM= Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 02H7S2Ln056091 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 17 Mar 2020 02:28:03 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Tue, 17 Mar 2020 02:28:02 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE103.ent.ti.com (157.170.170.33) 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; Tue, 17 Mar 2020 02:28:02 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 02H7S0wt123456; Tue, 17 Mar 2020 02:28:01 -0500 From: Grygorii Strashko To: Rob Herring , Kishon Vijay Abraham I , Tero Kristo , "David S . Miller" , netdev , Roger Quadros , , Jakub Kicinski CC: Murali Karicheri , Sekhar Nori , Peter Ujfalusi , , , Grygorii Strashko Subject: [PATCH net-next v4 02/11] net: ethernet: ti: ale: fix seeing unreg mcast packets with promisc and allmulti disabled Date: Tue, 17 Mar 2020 09:27:30 +0200 Message-ID: <20200317072739.23950-3-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200317072739.23950-1-grygorii.strashko@ti.com> References: <20200317072739.23950-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 --- 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