From patchwork Fri Nov 29 17:58:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 180491 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp1899185ile; Fri, 29 Nov 2019 09:58:23 -0800 (PST) X-Google-Smtp-Source: APXvYqxTQdMMYrhJ95FUQ/IhQyv1t/ca/H7bdYZ7Or5/YYnvqGvC8Fv+09PXzrz8AcWmPcUCR+oa X-Received: by 2002:a17:906:6006:: with SMTP id o6mr62239883ejj.51.1575050302981; Fri, 29 Nov 2019 09:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575050302; cv=none; d=google.com; s=arc-20160816; b=wLQc6hpU5qF9rtYozwJbnBU+GDzjXcAbDrw5IF+j1pmCEgnUlwd03Bo5PcvrFY4fjy 0vZzcuKgJXlrvcjFwjLwkJrXSsMZiokzlNEGgUhqHGY6J5zVqsi0NeyYgTv4DvMZk/lM cHbqNWbKKov6yjktF+zGkeiKhG9jRlGbMx7MMsu/xBtnENeDLwcWknxb7a5/cQGlTZqi QLp0pHFKcoZlaTfAV+azJt+jGMWMIuIxYxbcjeBMRM7EzrmDDZvLnmpuyqjFhN9gvulG SBxcb6uzTUR72Vw+yzUfhayFvYDFiahIE8n931yzU/rfick+7cyHFzv23Wz102s4I4+f e86g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=P1uSBoJmDQ8Q5hjwiJepbv6UkgzRKi6n7TO9FbhvtSs=; b=diIH6kX/i3QTi0HI8R5ZZkPRemrnFUx0K0HQ/HOuMMSLe/qn6XrhEMjFVq5Mst99uu inKtPFtU/erCFPtXvIOkapWLjejKGRrS39Iyo4USC5hZcsV+dPYzXhtBrbaFYf7P2M7m qmG8YN/gtunHw5tepL1ttLLNDlt01G7O11aWPkckAJj+GFUFazPKJUQQ8IRPvdSu02BP Jx8ixS6pEIKiakH3/bt+jX4ibiV6H3vqzLy7JgRAVpIkKyyeA3RK69EFzvYzEq90+XQs PTQqeYumPUbHdzmfAPO3YNlFWMfN7kCjR9Z3wtgpSgxpfhj91CSyrTCSBg83CxmsVwh+ V0SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zC2MmyuI; 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 y23si14827521edt.366.2019.11.29.09.58.22; Fri, 29 Nov 2019 09:58:22 -0800 (PST) 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=zC2MmyuI; 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 S1727209AbfK2R6U (ORCPT + 27 others); Fri, 29 Nov 2019 12:58:20 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:58620 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfK2R6U (ORCPT ); Fri, 29 Nov 2019 12:58:20 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id xATHwDjG058044; Fri, 29 Nov 2019 11:58:13 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1575050293; bh=P1uSBoJmDQ8Q5hjwiJepbv6UkgzRKi6n7TO9FbhvtSs=; h=From:To:CC:Subject:Date; b=zC2MmyuIkoRw3U2qRpJjMXjPe6NJEWZ985i7CfqBhv6IRXMIKjwZr72sU9naqOL9e XFB0d2SV79b8BpNXutvRnMncDCvAKmJMx2me8HFwjJIR4LfA5+hBr58E2nUWiyHcwb KxMtCK1Wva0CCwOQa7uat3MmPbukrv5MeLrmgxQ8= Received: from DFLE110.ent.ti.com (dfle110.ent.ti.com [10.64.6.31]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xATHwDmg059290 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 Nov 2019 11:58:13 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 29 Nov 2019 11:58:13 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) 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; Fri, 29 Nov 2019 11:58:13 -0600 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 xATHwCfi110240; Fri, 29 Nov 2019 11:58:12 -0600 From: Grygorii Strashko To: , "David S . Miller" CC: Ilias Apalodimas , Andrew Lunn , Sekhar Nori , Ivan Khoronzhuk , , , Grygorii Strashko Subject: [PATCH v2] net: ethernet: ti: ale: ensure vlan/mdb deleted when no members Date: Fri, 29 Nov 2019 19:58:09 +0200 Message-ID: <20191129175809.815-1-grygorii.strashko@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 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 The recently updated ALE APIs cpsw_ale_del_mcast() and cpsw_ale_del_vlan_modify() have an issue and will not delete ALE entry even if VLAN/mcast group has no more members. Hence fix it here and delete ALE entry if !port_mask. The issue affected only new cpsw switchdev driver. Fixes: e85c14370783 ("net: ethernet: ti: ale: modify vlan/mdb api for switchdev") Signed-off-by: Grygorii Strashko --- drivers/net/ethernet/ti/cpsw_ale.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 929f3d3354e3..ecdbde539eb7 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -384,7 +384,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, int flags, u16 vid) { u32 ale_entry[ALE_ENTRY_WORDS] = {0, 0, 0}; - int mcast_members; + int mcast_members = 0; int idx; idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); @@ -397,11 +397,13 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, const u8 *addr, int port_mask, mcast_members = cpsw_ale_get_port_mask(ale_entry, ale->port_mask_bits); mcast_members &= ~port_mask; + } + + if (mcast_members) cpsw_ale_set_port_mask(ale_entry, mcast_members, ale->port_mask_bits); - } else { + else cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); - } cpsw_ale_write(ale, idx, ale_entry); return 0; @@ -478,6 +480,10 @@ static void cpsw_ale_del_vlan_modify(struct cpsw_ale *ale, u32 *ale_entry, members = cpsw_ale_get_vlan_member_list(ale_entry, ale->vlan_field_bits); members &= ~port_mask; + if (!members) { + cpsw_ale_set_entry_type(ale_entry, ALE_TYPE_FREE); + return; + } untag = cpsw_ale_get_vlan_untag_force(ale_entry, ale->vlan_field_bits);