From patchwork Fri Jul 30 17:18:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 489697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D343C4338F for ; Fri, 30 Jul 2021 17:18:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2EB7C60F4B for ; Fri, 30 Jul 2021 17:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbhG3RSw (ORCPT ); Fri, 30 Jul 2021 13:18:52 -0400 Received: from mail-eopbgr130043.outbound.protection.outlook.com ([40.107.13.43]:45569 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229953AbhG3RSu (ORCPT ); Fri, 30 Jul 2021 13:18:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aP22nUjuUvDJzgCjGdW3IkBiwGJfaqAalymZ5NY6jFsu7uFkOdb6UvbBNtvBE3Dkcm7f/q+i/uM4ks8RGKs9VUjHPXh3Z7yUGGR4E3bziHUf3RLZF/FNVbJ7qj3mNAgALLi01x43CsCft5w39VwZdYiNzjN8sKb4eNQZ4GfKR7MRHzRpIz7ohw4s6yCOl3bj/mZWqHUj1TrvSfu6sL63CLkmInC3OS07d6M7qq8ktx87/zX94B6hLt6VGRJ16PSLgSXLRyyAC/AeL7Enf1bOuijL0GcuxM/M/wHtel4G2/HoZmbWLNVaE577MQ+LkCz9IhMP+rgOLovzDdWqtTzY5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=thfhnqk1nzamhsLZzBgflLeZb8oStp2ZYMO7t5Mw87I=; b=TNa0FHDO7YQckFk6BKKDj7YRFt0y/sSZ53kz3c91aWoleIc1rXe7LERzNCVOahVf7/c0gV4Twj9WT7d8NQMQRJEjt9dtB9Q2hthYeXEt8JiQ58Z3ZYNqDAsLr80Qc1jQd+nJ+rUpsybiZMBX/C5c+sZ7+3dIz/MMu2lBaUiffXS/n25wQuCQvCu/85WisFqY2eUHPuazUT7cEs8jMp+ymZq10Cr37mDiCrUM17VXfipD944qQVyn39Bdowa9b3yBQjfAQle8eRYQAAQlasjNUjLVuKxYqtjzgc8kk82jnIgIT9Yl5BuXb7dTxnJL2cbIvzCNIVZv7V5fMPc2Bm590A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=thfhnqk1nzamhsLZzBgflLeZb8oStp2ZYMO7t5Mw87I=; b=HbivenGhr10LDMB1fN65vo3fFrL0uX1Gizgp7aTn/2fmWUmaT4dP7JJahohYK4/l31ZAZx67AOFaVMgBfCwfReKFx0G+noKq4R1vo5KnsObhCh0MzkZhMCJSz0eUAhUvdgYKCkTIUu5Db2xIbFM+oBaz0PTbqKV9LIwZqD9x8rk= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB3967.eurprd04.prod.outlook.com (2603:10a6:803:4c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Fri, 30 Jul 2021 17:18:42 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4373.025; Fri, 30 Jul 2021 17:18:42 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Vivien Didelot Subject: [PATCH net 2/6] net: dsa: sja1105: overwrite dynamic FDB entries with static ones in .port_fdb_add Date: Fri, 30 Jul 2021 20:18:11 +0300 Message-Id: <20210730171815.1773287-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210730171815.1773287-1-vladimir.oltean@nxp.com> References: <20210730171815.1773287-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.76.66.29) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17 via Frontend Transport; Fri, 30 Jul 2021 17:18:41 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa8e0e0f-2805-49b4-657a-08d9537e142a X-MS-TrafficTypeDiagnostic: VI1PR04MB3967: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7EDmc+cx/9TWtb/PCarnjauoGDP0yYory/nO4VId6AOfq+pu4W0YwmcKbozAsG4SM7UwGMZ4/WkgiGTsV60CrRj7HOrYg8Ndn9zgD1VSBfGrZflFrve8H6w5UMJ3slTM3jSawdmj7B7HBczrWRMiBd1QAbAz4y0AmjKt90X6cE+h2YDiTghwk5pLrcr6u0Zs8ljxm5KEkgaVEnnykpqLotpofTTg6YD/rGusdUwans8hG9Y31JiLoIT29G7vhOjr+38l/cmDUQ33oPfHLGBHxJoxuUDaygBbqLEHOFOwpgQ6LPCylxq/IAmGdQ6oY5ZlaJjclf+yuc+8cq7OQhRgSHYEOGoaskyUCmCkhCOGbH7fvViWlbLq8OlutYgexxmAHTGmzFKSecENYMho50QMUEPKZ+nGQfatT0PIrPUatBN8Oa5Xz1qOSIU00lYqN1kpR0wKxt6pVHuq0Q74lC0hBH6IewdI1dIpBVKO76jHO7IpLOR9xDCQKJPP7s+/hb8CdtIHAGAy7yq3XonWCM0/RBTRkeM5dh1GxG3tX4wsIFE862f4KmtiJYFLRmbm9RAyhLMk4d0Hvphxfa2zzD1YkCUVzlDGgsxt3eQo0Y/gNn3SfbTs3Y18R9OmgHr3J++5/ehlIncyJPeYwO/uGBS0nN3noT4007Ek3iL1AfDRIp6gzBRiI09H/A/tQ3mQzR6SI7+634hS4QIZV4nVLJVkHH5O+RBanY+563W7CbTWAxI= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(376002)(39850400004)(366004)(2906002)(86362001)(6512007)(6506007)(478600001)(956004)(83380400001)(2616005)(316002)(38100700002)(36756003)(6666004)(38350700002)(6486002)(44832011)(52116002)(186003)(4326008)(26005)(66476007)(8936002)(66556008)(5660300002)(110136005)(1076003)(8676002)(54906003)(66946007)(142923001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J0M8fxbXkm1R1lYaXCFhh0f4UEk9ONyRnns/0VWQsBDV5JdPUp6KP6byNkWTp2DF5TG8ntYJs3dKZwU4s2RkT/QMuaB+hursT5KEkdBneFbGdq61w6K6//UYRJ/dUSYFsKphXjsOpgSHem0ROwG2oJ9tJhEo3aYSHaeSfjOsWV1d/yCWNiRLS2WKc+iQBmSzCNAmMyuk3oH5SiPuDwJpE2Pk84bSYpuvzQbv3OgjfvSPIMM58suB4hEpFL8BH7VXHUa/mKA9DkDRFXrm+oe+ljjWKvS7g/VvM91q/oDv2mP4jQb7VOpaENFToMsH1VOwBZh4Cb4mXUiGh26ca/QiX+5LMydroqBgx+tEVVIZw5JzCvmECG3AeKMoSMXUBlXwKbxcEl5VBAuTEKl28lWCa6jmUDwu8MIv1+G4CgRmGXUk/k57vnZuITdHtrHRusd9CuWFC/dTFvQoqbWIMJlgdVwqHsnlyDi1NHHEGM9MbFdSS6YVutTWZzKxYjgq4F66qFdDb721NbMSnoCmNI/v5NA8N5sYD6Cf1/mG2imrsJCcIfgQUWP2PoN+D9GTMo7q53+KmYObpYUlvh/LZCbyLVq14E5cow1qD7HMuyDoidNzyKwzPxUtdErsP8sze9MZAMZuUwQyVzAHjXLHDEXzUjNkOzDsr6bGKvyct0lAtfoLyv5GV2bovx2sV0wfvZGuzi7wCJHmldJ0cqkl4+/MIKiFz+bJYY/HEF3SLk60HmMdmVCeYhhUbS/Tx3HMsWLNuSHjWsZF6SR05WIFMqVz9718gjMFfmj8e7QOF/5j0f94gdS3iKnvs5zGNuxVzZle7MaphR5VY1L8+FMjSlgVbq3HPUKwdclug3jKQWMPJ14UsCFz1VfCmMUx0a605gWRKIGXKrhCeE9wxCfVHT0e1mDboEdZhT8eom1cRkIW0oUsaK3/yRoBQX1omTTLKytKzrLFfjcPa4Od3DOAUYvskT68XQB515XexDpFytEqvOpKPh37T+ky11b6Sy/9L95xOeYyl5YegvpWM+ezQh9JAGyP8vJfB7OXZ5kzuLpoTh2mDnR6U1g2xRND4h52Av7neM3WUnZIVGngu7ecy/+8LcUb8C+i/kUmxpRsUs920CTyybPToLe0cElHxTgeQUyM8Tet7KW66KwgQBDCcv9el6SN1Zb7j0k40zx0EDPNs8hpNEDOux8S8KB5vwg51PIRscxPPGDEYkwQeTbNSOmowb3ZEVrKazBJxy8SNjMs4EgYFkgPWYRXppMUXp9E7P6PZoPSS0SWMql7J/S81UNE/DiwsjOX8INrtCw1pnNAotWT0JcQhTTG+56XtXYVGnkU X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa8e0e0f-2805-49b4-657a-08d9537e142a X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2021 17:18:42.1421 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mVRqeHg7ixnpHrLBBOHtKQAD3hcAYPCkAXLrL5jBoAxlFqvmlHWoh2ROAwOW5YykcKxhPkTuGA8TrIZKtZZ6gw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3967 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The SJA1105 switch family leaves it up to software to decide where within the FDB to install a static entry, and to concatenate destination ports for already existing entries (the FDB is also used for multicast entries), it is not as simple as just saying "please add this entry". This means we first need to search for an existing FDB entry before adding a new one. The driver currently manages to fool itself into thinking that if an FDB entry already exists, there is nothing to be done. But that FDB entry might be dynamically learned, case in which it should be replaced with a static entry, but instead it is left alone. This patch checks the LOCKEDS ("locked/static") bit from found FDB entries, and lets the code "goto skip_finding_an_index;" if the FDB entry was not static. So we also need to move the place where we set LOCKEDS = true, to cover the new case where a dynamic FDB entry existed but was dynamic. Fixes: 291d1e72b756 ("net: dsa: sja1105: Add support for FDB and MDB management") Fixes: 1da73821343c ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index e2dc997580a8..cc4a22ee1474 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1333,7 +1333,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, * mask? If yes, we need to do nothing. If not, we need * to rewrite the entry by adding this port to it. */ - if (l2_lookup.destports & BIT(port)) + if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) return 0; l2_lookup.destports |= BIT(port); } else { @@ -1364,6 +1364,7 @@ int sja1105et_fdb_add(struct dsa_switch *ds, int port, index, NULL, false); } } + l2_lookup.lockeds = true; l2_lookup.index = sja1105et_fdb_index(bin, way); rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, @@ -1434,10 +1435,10 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, SJA1105_SEARCH, &l2_lookup); if (rc == 0) { - /* Found and this port is already in the entry's + /* Found a static entry and this port is already in the entry's * port mask => job done */ - if (l2_lookup.destports & BIT(port)) + if ((l2_lookup.destports & BIT(port)) && l2_lookup.lockeds) return 0; /* l2_lookup.index is populated by the switch in case it * found something. @@ -1460,10 +1461,11 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, dev_err(ds->dev, "FDB is full, cannot add entry.\n"); return -EINVAL; } - l2_lookup.lockeds = true; l2_lookup.index = i; skip_finding_an_index: + l2_lookup.lockeds = true; + rc = sja1105_dynamic_config_write(priv, BLK_IDX_L2_LOOKUP, l2_lookup.index, &l2_lookup, true); From patchwork Fri Jul 30 17:18:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 489696 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD62CC4320A for ; Fri, 30 Jul 2021 17:19:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B3BE360F94 for ; Fri, 30 Jul 2021 17:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230405AbhG3RTO (ORCPT ); Fri, 30 Jul 2021 13:19:14 -0400 Received: from mail-eopbgr130043.outbound.protection.outlook.com ([40.107.13.43]:45569 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230251AbhG3RSy (ORCPT ); Fri, 30 Jul 2021 13:18:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HU2IOZCMEKyFsdkGuyBWSHhX4pbRwIO39/XbUqQ3xXMCfaq5JJdUsfSYCuGqhJlheTexWk/hKEwwn1EnGh8K+RQq0iqqpHN2ySkz79xozIT/LhLOrGUId4t9uP7/PxqEz+7SosrHfT0dfTJEuqWL9vtG06VjofRsDZBXSp8UHfTGhKPnyCzwuAGMrrBcV+X8E/w3bX4bGUA2/FK+MIB55AyD+msalIP8IavxjKNMhJY/PToPcu652ZxvbXdrN8JFCWCDzQbMcH6b+UPbESpENRf6mLYNDEHXQI8C4GSHLkPZL7CwSBLAHEJ1tbt8ddVcJ+1l1TUQDAm0QiLcir1LtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6isRyCG/7HzIzO6bIZio6G8gyoGZBNzk6xDybmiCWaI=; b=cuox+Af0itaZai8Zvgo4whExmJeUbcthjoWq+lYJ9xzci8y+9cyZ80iXlJoT2ZcYxFPLD49pRm8oHyTk6hs63sw37XDj6ACwsSR2DVxuBW3biRFlLpg9GnUWnSw/kxkqJZYpNNvDJwSMdGUUKZIwqsd32Ybf56Y6rcKANBcAQowYcQrOtkvCE+uIKoHu9slBGFVJWQbfca66dfyMLHoJBiJnmLgVxGUIpTK1SxpZQBNT9+nC5r3fRnpCOdwWwB/CcsnB/IJGi1w9txLIjZlSJEByNQi64G0V7BIe26qwtBU09zfAve1GnNqSTS44OwvKPTt8DEoncEz/ex4p3+pDvw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6isRyCG/7HzIzO6bIZio6G8gyoGZBNzk6xDybmiCWaI=; b=PHMa/OsgMzEgzhXSVXpgstzSaM8DmawfXuFhsGybnQ9zAK8Tx5ydrUL2SgqjHghJtCOcIY3pU/oHHk1mp7RZ8qTFQFSd/JDlyvLVKKwv5yimVbL2jURu8V0f5nTwwJgNkFyTe/GLK2Wa9j5UHCCUnCC0PIlbPLmyRT9vIM/vTZ4= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB3967.eurprd04.prod.outlook.com (2603:10a6:803:4c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Fri, 30 Jul 2021 17:18:45 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4373.025; Fri, 30 Jul 2021 17:18:45 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Vivien Didelot Subject: [PATCH net 5/6] net: dsa: sja1105: be stateless with FDB entries on SJA1105P/Q/R/S/SJA1110 too Date: Fri, 30 Jul 2021 20:18:14 +0300 Message-Id: <20210730171815.1773287-6-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210730171815.1773287-1-vladimir.oltean@nxp.com> References: <20210730171815.1773287-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.76.66.29) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17 via Frontend Transport; Fri, 30 Jul 2021 17:18:44 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ff5ba6a-4d14-4fb2-608b-08d9537e15e0 X-MS-TrafficTypeDiagnostic: VI1PR04MB3967: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3826; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PdA//IMv8xwpWoeWkzCo7m8yi+HiFeHY91X4HUjitCzi95yFD4L9PU4s0cvCDyN5cUUswuPshqNl+WdGIMiUSIaYaBEVJGchKf9uDcj/LsA/Gq1pTdehzn3/lFULkCcRk+UYSmf4GvtuARQuY/4+eVaWedFUYW+6DfE3c59R2XIxWEqXX2Ab+JKjqmej1govLEFZkxegBn0jAubYDgQkq1WAXFie6oFqbWTdS0PZla0nTi6GxXRzcu7q4eHTf7jRkI7kuckBLrg6LKQOuAnd5anGFtgr2Sw3UIUVkafclLelkXM/hZ8X7+j3sdWm8agj6thditZBddxR6ZH1vGVdbJUHKYaIp02Gd9LJ5n6mjuQbZKTX+KsToLNZ7IyQ+9BvYdP4HcFVOvYBxJNCGckaXNNHTKek6rWz6WTOcme94W03AShiLLKMCoW3qfkolGXhOKoMgeEbi17y9tYa83e7e3nW18+C1xzfFhFwALNmrKUEaZAqO4mlzL6lFTOvUGMb8vAhLkoc9UJRK+BQbKv1ja/maT54LfXiGh1AFU8H2KIBxtbQZGqUbbxLZZvWWEe3XAUUNzjIZXL472xcevhUQVVzfF0D2XNdKboTfOrnn44BdrPdxycS6TpUQgKXXVMRrhha8tChw0NWPEHOk/M8AoAhRhb9HRYUueGZfvphd8aL3YpU3ZPWnElByES52GpJdRhLDx+igKGemXGUGAhN+w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(376002)(39850400004)(366004)(2906002)(86362001)(6512007)(6506007)(478600001)(956004)(83380400001)(2616005)(316002)(38100700002)(36756003)(6666004)(38350700002)(6486002)(44832011)(52116002)(186003)(4326008)(26005)(66476007)(8936002)(66556008)(5660300002)(110136005)(1076003)(8676002)(54906003)(66946007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6/8ljFP5leP/kl2Pzmm7ICye23PdRWzx/dm5fxtYgdQGPeIwY4L3oOAGfWgIV9o5TgXs5aOIWlZkPVj6IaM9sEao2ctr9bz6627A/+rtk3raH76oBQdqV9rpEqQp1H/OJlwX1rU7icGdJsul3DbEVhhxVyAuLHz0Zd2s3YwXKgQhPTLxg7fA4F7JEmvzE8m80skeccNCpt7SWhILrTZOzoldD7UI4HBJ0Xevqk8VR8fpYgwbkPGgEbBq/HqhPdfNy+ZWVGcc91kie+GxwHBqU9apxXaZ+YRk07oJsh8hTuro7B4egVutMWrezOelxn0Hl/jVakZHDjiMJwMAljWuFzv84X5J/t+GglXiWErZdypLJKag7vQiLtq2vObtUTwlZK/AE3Mo7bugv1GeE+IvZ876eBkAYVS5oj7JQ53CznYn6ggTh+Tpq7Ke80KNe1QQAUZwQ9zf7DB4rf5AIK8HNaYlgJw16Pi1CfMa+6QeI9knFNi9hsw1BGzOreq9BbFsAtWgqP1MeMfFnhLSlcEFvld/bG7jnHN6qxvj/yuxHc8EP0mX+ADI0Q+sbWpcrSucU6isnmqfo/vX+SeoKkpQ77mHKhm+ny9ghnoWHGhXn8KggdlABa3jzMzuvCmJOaD/OhGgzAWg/KGi2otMvLQHmkALecQMwyE4pBHoEsOjPNcF6oMPYRwRHxve/8HLcJLo+P+h+M0lWGo3aJs2cqZa1Z6TBNZlDykZXnTrLMZMVL1V79DKG09rHCLYUMolUoOr/Xfgav7v/KytxtheESaTgoe9bDNzuxDmq5sObBDg5mUPYhzyt+8ADowcfdDhOouilaInEuZnzZJro4qqOqxfELDIrGdaC2Zdkt1o+nGIFwgRKIflyTPDKwUD3m+8I5hCspTshCYJ5dbSbLS8LX0rFJNSUCOAoGJTARXjRVh5HJhhOSnLQjuOJDcHQYNA4F5sVg+ecdbw1NW621ZNUUSJ6256qOxZnsryHKfd2bnLzTSekL70OTee/KaymdNv8YQIQW+n3O62zgWHQwoUHYSEIrTqKbvadw/JmSu64s14pqGF7iYcrruagcJqeWxihX7XzjeaAQVrKu/QwqezdRBxVTdm7zQAv5MrQkkiUCl4SvS1IIp/eLNhsd7j3ysqfPvAFrCW7OGJovz4C5daqMUrr5lOKgjoNz44j3S4AGs9Vup+gtVyLDL2P7zzlCBMkVxquMLu4pxOyts/c7Rpuz0xy0vf+Trx3r2QH21xWpRn7d2G0VR2AOt5J4TjRQH97vsz1JTCF2Ec6V2CrS3PHu96QqOLiBWjEhSGsjfEBFRuNf0/2xKORhI62/pngQ/VrQ2G X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ff5ba6a-4d14-4fb2-608b-08d9537e15e0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2021 17:18:44.9175 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GUwej1ZIxsO7dGKCH/ulGrpfvIVD5MFsU88rL0otukFjkKmu/1bw684o6jWBYKwpjTFGwc7MWfWhpjfYyom9tQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3967 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Similar but not quite the same with what was done in commit b11f0a4c0c81 ("net: dsa: sja1105: be stateless when installing FDB entries") for SJA1105E/T, it is desirable to drop the priv->vlan_aware check and simply go ahead and install FDB entries in the VLAN that was given by the bridge. As opposed to SJA1105E/T, in SJA1105P/Q/R/S and SJA1110, the FDB is a maskable TCAM, and we are installing VLAN-unaware FDB entries with the VLAN ID masked off. However, such FDB entries might completely obscure VLAN-aware entries where the VLAN ID is included in the search mask, because the switch looks up the FDB from left to right and picks the first entry which results in a masked match. So it depends on whether the bridge installs first the VLAN-unaware or the VLAN-aware FDB entries. Anyway, if we had a VLAN-unaware FDB entry towards one set of DESTPORTS and a VLAN-aware one towards other set of DESTPORTS, the result is that the packets in VLAN-aware mode will be forwarded towards the DESTPORTS specified by the VLAN-unaware entry. To solve this, simply do not use the masked matching ability of the FDB for VLAN ID, and always match precisely on it. In VLAN-unaware mode, we configure the switch for shared VLAN learning, so the VLAN ID will be ignored anyway during lookup, so it is redundant to mask it off in the TCAM. This patch conflicts with net-next commit 0fac6aa098ed ("net: dsa: sja1105: delete the best_effort_vlan_filtering mode") which changed this line: if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { into: if (priv->vlan_aware) { When merging with net-next, the lines added by this patch should take precedence in the conflict resolution (i.e. the "if" condition should be deleted in both cases). Fixes: 1da73821343c ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 5d8739b30d8c..335b608bad11 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1447,13 +1447,8 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, l2_lookup.vlanid = vid; l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); - if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { - l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); - } else { - l2_lookup.mask_vlanid = 0; - l2_lookup.mask_iotag = 0; - } + l2_lookup.mask_vlanid = VLAN_VID_MASK; + l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); tmp = l2_lookup; @@ -1545,13 +1540,8 @@ int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port, l2_lookup.vlanid = vid; l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); - if (priv->vlan_state != SJA1105_VLAN_UNAWARE) { - l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); - } else { - l2_lookup.mask_vlanid = 0; - l2_lookup.mask_iotag = 0; - } + l2_lookup.mask_vlanid = VLAN_VID_MASK; + l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP, From patchwork Fri Jul 30 17:18:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 489695 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8210DC4338F for ; Fri, 30 Jul 2021 17:19:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6718860F4A for ; Fri, 30 Jul 2021 17:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbhG3RTS (ORCPT ); Fri, 30 Jul 2021 13:19:18 -0400 Received: from mail-eopbgr130043.outbound.protection.outlook.com ([40.107.13.43]:45569 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230327AbhG3RS5 (ORCPT ); Fri, 30 Jul 2021 13:18:57 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UFyGc/BgG3/4TI53xClcCMZy6qI+Slnz74YFAA8PGSf54SwTP3peY6fw3BMe/Z4SD0/OkMF0TqzwPwJ/jujeCrOjgRJ2Pjo6s8x9UW6HoxxuGpZHyOzsqjep2YWGiF8+3zQR63oPIe2xZTlZxaBXjyD9yYvGnqpcgX62Df8UarbQUJbxFGZMsnrf03fUGWHPuYFwCCTJNWUhbvqsRhDNUYyLRK70S3glwzw78yfy1Zx6QTWhM8wozkaNIVvcFvF44zdtmL6TMDSIZ+DwUJTJ7zICpGUhFMho8fHL3pIVWQ+1Ckx2zZbjmC7HmSHznr/TmDeFfxDCOL2XSQNE5gyu0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZkvshXB0uErqhw46mqeZ8k2TSBDdDqNiEqlT68BQcZ4=; b=eRE3zDi2Azbdf8tpXNfgveGqGkazRUIfrL5dsVX5e1lrxqfGLT/NuT0QbwO/XFLxYoMlz/l/auGALVpLo9uF3zUj8DziaxH/ZwdDwR8n62f3AaX5QNYG0TtsnF3EKsZoxw2vgiLszejgQRwZpi/tqFCgwohj65KZL/YUad2rxI1rB6R+NG/rMReoWlzOxQ3CpeQx7mUKiNCa+vL6HUJdQG/O76IOVuyPYR26pguu5Z6kGWV5jwGAnTax9o0AtwkrT2R3nb3CPCOfKXOV8BvBULjlBJyoaWAqVpLIFDeDGON49428QVrBy5ucN1JfEZk8sMQJVdlchHKqziQDjCqCXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZkvshXB0uErqhw46mqeZ8k2TSBDdDqNiEqlT68BQcZ4=; b=n3bIQiPyxIeezzcXyUE1QTH/gZUng4S0VOqMOIM3sskQ6zY64W9YMNONOONOWfBjLpZVY1pamPtHkWKkp5zR2Zz9VwyLy2oT/ylVI/d/sqj4C4S1PJQZfAmF92oydoEhcq4brfORpSK6rrU7JF++ouWPWcyC0H1vvBWgA4GK0Ak= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) by VI1PR04MB3967.eurprd04.prod.outlook.com (2603:10a6:803:4c::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.25; Fri, 30 Jul 2021 17:18:45 +0000 Received: from VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0]) by VI1PR04MB5136.eurprd04.prod.outlook.com ([fe80::109:1995:3e6b:5bd0%2]) with mapi id 15.20.4373.025; Fri, 30 Jul 2021 17:18:45 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Vivien Didelot Subject: [PATCH net 6/6] net: dsa: sja1105: match FDB entries regardless of inner/outer VLAN tag Date: Fri, 30 Jul 2021 20:18:15 +0300 Message-Id: <20210730171815.1773287-7-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210730171815.1773287-1-vladimir.oltean@nxp.com> References: <20210730171815.1773287-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (82.76.66.29) by AM4PR0202CA0008.eurprd02.prod.outlook.com (2603:10a6:200:89::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4373.17 via Frontend Transport; Fri, 30 Jul 2021 17:18:45 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48ee15f7-d1a0-4230-8f57-08d9537e1668 X-MS-TrafficTypeDiagnostic: VI1PR04MB3967: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EcAjqkJSzJKALGeT1o5UPEBKliqPE0Y+oTuc0/GSV0ItejA5loaZzqc/l27QQXY+BtJOp9iab3AeuC3HS2Pn0i/sv2dscU4QJsF7SmB4gp433D9g1YR9eyjZ3opOCLso0NKhwTEAmNpW7p3Fc6GREAU01BeEVsEtEHiV/rcZeAnIcDy7ydeYxH+H7Qffm2vzAxB53Ezql2ihNjra+LBMwtLTud0kVpO+v4b4wlIMUH+c3vq04uSIN2aG2x0ug9lzUIUoxl3af//cRwbfpEh17HADfBZxLMBckh2UQgyX3xK8O0eYqv7JqyMum6l0251VXwvqHgt6MsDG+7CQmkQKUw8MhJ1I2XbLd1VhvFZANbPc2n5zv1mTrrwshM75KzYa2fLmzlXXVBYE3B7URPrrjnG/jYpQTKWtDx8uo7iaMiedt48XvOUI61QVbWy7l+Ku94IsFYTEeFEinavDvFuUvo+4kBVbbB21oPh6X0VHRGo7swLolC08xJutH3jidsGR6mMWDp9jyjerYb1Lgkh31YZS6BGcGW/YGN4LtUTosLugoFTXodkBJS8wS4RPrCoeSUbGsF33/Vd638rbm6k+gZuWr4WRQyd4LCfRowKHT8i2lr9iLW+1o8ujnGJN/LrxXCSCuhZtTMxJQgHweiSFglNATMYZS9Zx/vnw9nkaekAgBu9mwxHZivh6Izzv+I86MznCtIFF3w6b/KgvqCe+VF5hG7yieNS7RkPQAjoY2Mw= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR04MB5136.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(346002)(136003)(396003)(376002)(39850400004)(366004)(2906002)(86362001)(6512007)(6506007)(478600001)(956004)(83380400001)(2616005)(316002)(38100700002)(36756003)(6666004)(38350700002)(6486002)(44832011)(52116002)(186003)(4326008)(26005)(66476007)(8936002)(66556008)(5660300002)(110136005)(1076003)(8676002)(54906003)(66946007)(26953001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ELrMHv0P74dX4ZRoHCRMKf9xoJY0qvMsNMvDiClj4xsxSjxRgoqQOJh5R+70yRYkKezKSW8F2ZbVQrundnCTOWoATtDhwxnpg1R+I7SroYpQAtxZzmBu1nXNiPqNwX5CIVAntvoF4+J/9QxZa3boO8QUV1Bnh34nWiNlRMlL2FT3y0DjXbvoNGK4IuqL/roiGjP5qYT7RGtTDfHusysdcTWFSRVDiV/auKD+Q82eYfTiY8Ur7eUy6R+2oockaxubyDywL2bgX55VCAhbaHGx6P23UR07/t5nEeVdh/KHpMwzE9Y/0FmaNWEsHv9uplXRAX7tkkUCd5sCUsWO61Bg9zQrLE73T0Dgdeuph5sXA9sETffAV26vH2C4k4114FxshD3I4AYluBwWJRyt1Wnv3i3fX3O5dQJOLCEsNhWU0dFZdVonmLNpEGYXexUiDH52q1q/aCOXCfZ0K1L5ex9vatrmvpm+XqwCjLV4yOAx43F5tBKqN9sM7yJdHz3xD6/0t2jNDTzel1tdQVm+ONYzzS6YRLwP0DBGMYqUwAFBVjyBPvMQEZE/PUotBR/eCxJHDdrRF6JEvYJG/rXkgAwfGvXNpC2U8BfBo2wqQZGg2nVuFmloVFCfyCY57Jhn7G8xicM8Zp7HEBkdpLC6qMVa1OI1Q1lhNbEMpIGVn3yrh2KDWHzajx8z/pPBjwCS37JFEO7jB8DFx1d6RsiRfU9M0BVCwnYAeH8PKEY6dOW+89Eo/SqC2O45EFlTCvybdzfOaYUJdqP/NNKK+3sRMDDSJwwGXLwrzfDry9MItesKhTKGEs1fEhBtSDGtvDQ+eoffEh4n+C1bm+nh4XM2kv/6IMVjg2itsq0PdwLRf0kGiyawdEE55gkW5B5Ff2Ph6bA6vjKkq571kK2mx2N9iRZZr0oX1IWAel43D3gvAp566KX0Uom+1MpeKiP/CTokmE5dq+5DGOxvBxF1kbIO1AOebXNXplNEWHUn1CUTMe7eg+C7Klkch10rTZolM0tVMeCKg/WzK2/USP/1mm3GbZfKOq514F4zTYbqutlB7nyCOKMFCq5O07iOkvk1CtlbRI8lPZwPiCtFL+TMyetgU5Es6/Mc6t8J9Cb2xe4ku5mfkSbEaQHa2D066yCh0mfd4vB8e4dx/PiZIG9q0zb2G+CmxZjbVfQBX9op1gWVnIXQop6GG6EcbMm2Vhho7gzhpSLdO75v0i8oLhF6+vwRgmnXw8bAKBl146ZbFaTHQr5YyiskVq7iWniRjpjtzj6gBxZF92dqTHtxa37yFe5R9ytIeNP4lUO+puZwQKg3+xagX/SXfPPAtNcFqq2W4uTmssiM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48ee15f7-d1a0-4230-8f57-08d9537e1668 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2021 17:18:45.7890 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /gMGo4enh2P0a8gAC/YJTIFb+X4v9r6VHDVWe0qbkeNzAiH8Nh57NIb4dnYflE26L2nK2FVva/T8bYPFIYuDmQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB3967 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On SJA1105P/Q/R/S and SJA1110, the L2 Lookup Table entries contain a maskable "inner/outer tag" bit which means: - when set to 1: match single-outer and double tagged frames - when set to 0: match untagged and single-inner tagged frames - when masked off: match all frames regardless of the type of tag This driver does not make any meaningful distinction between inner tags (matches on TPID) and outer tags (matches on TPID2). In fact, all VLAN table entries are installed as SJA1110_VLAN_D_TAG, which means that they match on both inner and outer tags. So it does not make sense that we install FDB entries with the IOTAG bit set to 1. In VLAN-unaware mode, we set both TPID and TPID2 to 0xdadb, so the switch will see frames as outer-tagged or double-tagged (never inner). So the FDB entries will match if IOTAG is set to 1. In VLAN-aware mode, we set TPID to 0x8100 and TPID2 to 0x88a8. So the switch will see untagged and 802.1Q-tagged packets as inner-tagged, and 802.1ad-tagged packets as outer-tagged. So untagged and 802.1Q-tagged packets will not match FDB entries if IOTAG is set to 1, but 802.1ad tagged packets will. Strange. To fix this, simply mask off the IOTAG bit from FDB entries, and make them match regardless of whether the VLAN tag is inner or outer. Fixes: 1da73821343c ("net: dsa: sja1105: Add FDB operations for P/Q/R/S series") Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 335b608bad11..8667c9754330 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -1445,10 +1445,8 @@ int sja1105pqrs_fdb_add(struct dsa_switch *ds, int port, /* Search for an existing entry in the FDB table */ l2_lookup.macaddr = ether_addr_to_u64(addr); l2_lookup.vlanid = vid; - l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); tmp = l2_lookup; @@ -1538,10 +1536,8 @@ int sja1105pqrs_fdb_del(struct dsa_switch *ds, int port, l2_lookup.macaddr = ether_addr_to_u64(addr); l2_lookup.vlanid = vid; - l2_lookup.iotag = SJA1105_S_TAG; l2_lookup.mask_macaddr = GENMASK_ULL(ETH_ALEN * 8 - 1, 0); l2_lookup.mask_vlanid = VLAN_VID_MASK; - l2_lookup.mask_iotag = BIT(0); l2_lookup.destports = BIT(port); rc = sja1105_dynamic_config_read(priv, BLK_IDX_L2_LOOKUP,