From patchwork Sun Aug 8 14:35:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 493798 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, 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 4657FC4338F for ; Sun, 8 Aug 2021 14:35:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22A956044F for ; Sun, 8 Aug 2021 14:35:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231824AbhHHOgN (ORCPT ); Sun, 8 Aug 2021 10:36:13 -0400 Received: from mail-eopbgr70088.outbound.protection.outlook.com ([40.107.7.88]:17029 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229923AbhHHOgM (ORCPT ); Sun, 8 Aug 2021 10:36:12 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lV5HtFPY1IUGA4viviVwvhaNM9nQiEMyINe/74jO1tDwqBPvMyUpe2bWCU6z6Ix+8Du6Bob9Pcbzv7xfqZ/xkhxXkAEn8eMSonjrn/32qvks+VNTK16+JeQUFQAlbT1NXBWViy3LWflA+I48iQTq6PrJfsY6l6u9B+AKkZ2uNT+M7j0oMDNggiRTgeRLLVnyAZHs6gXrkrV8tr6JJRQ0e28EjNzUCrd475sI+dMSYupezjY1t14xF9NFPThTsgftGVgAggJIH/Bvm8SPv6/2cV0TBkUDFUcT+G8n16YXcPzzyfTijzwwGtAAtrZ4oDmEKO7aA7zvr/q7gkU6KwUwyA== 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=z1qdmwu4GjhU74QReJnB6ln+Ys7GkslluCZ3FTHTThc=; b=HnJhVOW5CH6Gl741AMOk/jr67cGesdQcnSGj5R79pTbS4ijs1qdxTs09Zy0T/+V7E5OTgNi5YvSIxraP2K/ZO2DCvQwcXUdhpHLmgh/y8vlfufM9myltyq2YCN0oWFu5RWH56KCoyegM9gDfGjZz8L2r/BZSGDFYl+Gk5aoZWPhhShv6LVDCL5d7t9xGZOWvlT+TmZkw6qW4qm3AqfPC2AatqSw84G7eIJwa+Ix53vdiou+LntWUqOdVHkh6E5/mr5hdZZgpSFFCm4XHH48kFGBcQmf++PFOihFBmHVWDhH/bzBQ7U//QqHHQXBIT/pgPfSi3AajWIqd+3W/LA8KUw== 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=z1qdmwu4GjhU74QReJnB6ln+Ys7GkslluCZ3FTHTThc=; b=O0jpJFd3dSNTBosWdzWdLGbe+evux/peHEVZ4hQxAQpA1v3Dy6ExyhNr1puiHEMQNnt6EVGNBqKrGI5CsCcREaI8TlKDFXFioB4TGJnS1WAn6hioH7CP18tAVlGRt+LntXP6C47Y8g8xE35MD8usHwLppEFSVPMKInmyngjj5wg= 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 VI1PR0401MB2301.eurprd04.prod.outlook.com (2603:10a6:800:2e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Sun, 8 Aug 2021 14:35:49 +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.4394.022; Sun, 8 Aug 2021 14:35:49 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next 2/5] net: dsa: don't fast age bridge ports with learning turned off Date: Sun, 8 Aug 2021 17:35:24 +0300 Message-Id: <20210808143527.4041242-3-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808143527.4041242-1-vladimir.oltean@nxp.com> References: <20210808143527.4041242-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0601CA0003.eurprd06.prod.outlook.com (2603:10a6:800:1e::13) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.144.60) by VI1PR0601CA0003.eurprd06.prod.outlook.com (2603:10a6:800:1e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16 via Frontend Transport; Sun, 8 Aug 2021 14:35:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7144838-e507-410e-f5aa-08d95a79d0e1 X-MS-TrafficTypeDiagnostic: VI1PR0401MB2301: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZcuyVhX3IvfsdrajfmYkG+o0dpMD9sSWjssrjg4101M/gqyX+ukAPy4kYNjeqEt2/v1+0F5OFsL5UMk4dmgWTQm4U/m25nfAPkgv2H/uCAnRouAJONXx2rhbdL5ZwgpzJPJKWfOtF2z6wq6CygVJtCIw2rn0rgtY5GH/kQI5VVxymWugSYaBzBDUBbp3B9zNZXGsCM2WIvhHTz7qv6CFYmlJVYMWTXugiCoswXBD/e9nFioL7G2yZ1lP1ER2CvWEJSe79owt+tPbpLF3YTB6UPNJ3dzuc4+SeKJmN912ya0bAuljc3mHh+3KVVGWB0G6vFL2JA8kgTSt1CsDud436TD3m+IGCg3jgG5i0CALDss0DfyzcI2II2kAYexTY8Idnp1KRi0ZlB6qOwO1FuQD9DDtUgLu/dTFMs+epbxf63N46dxAzB5/iHl5YSAdVHnudns0IlUBergCXPbk/61HcEZLiTlQUuZPJmXzY+G1TuJXDc5LMoI8zSCaFNTasBMaPfLnXjrpd1cf3bNsER8IFInPqIn3zSZH6POfG6QKOpAM70+0Iz9txlXZdVYOTBB/CxNsyECgblhyiKkQ7RzHKURzJgNJmXixOJQq18/jEik1ByaYUObDSgHnylZeC91VJ8RATw9YrJCDwbNFFReut+GRTgM4b0sWq0s09lBfyo52HkAM3fW3kdqoOoqFw0tSz7nq3+SiNqUdkcLS/6hJ9A== 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)(366004)(86362001)(36756003)(8676002)(6486002)(6512007)(956004)(2616005)(44832011)(4326008)(6506007)(186003)(2906002)(1076003)(38350700002)(38100700002)(26005)(52116002)(66556008)(66946007)(66476007)(8936002)(83380400001)(6666004)(110136005)(54906003)(5660300002)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: RGf6kv/++BGN0BAqyPqSxKBltK8+DjbdDRU/4fOZTYQPVnJqsUoBIEJukYGtH+w/K5s6jzr8QsdnBAuuhr9lRlOjgKHvppc2uOI0XQFzhtI+h99jI9CiHc7qQxWdSsf3j8SvYM4u8CEmbqwHq1ov5DxHcMuAtpjavXt2IhKyVP9+jdqw1r+w+rRFnFHHy/s9EkzSNd9aJE5FCmJgQ3RTGvKo7ZbA+BEn4+wYCA72LzHUAkUNknLcEhwaydxUYpTwv/a6TaBZHEEZj9vO2hU1YJxJIpEkggvt09sb9f+lg1tf70qsgkXstaEWfP92SbgpZda5xjrNnR58D4hmoZHEAeQOJR+1PQD1xDqYQ60+Xh0vtkFarKF5qqmJxBI/26SFDhvyj6bmRdON6hQl7GOCrQUcm8PlSylHMIuPgMX1cecR/6RYWsQiHQ5CrsbMOrp5EnHsPtV/rOBTadmB/i1TeOR/yBrxXTcyLJjzjoexRGz2pIbRmULtPpJNeoRttR7a2y48zUy+LLVad8ky4EQN+pKh2TfNAZfhTqywZabjmvrkrsngsZfGcjWNp6g2cxKRgdCWChkn2muK04Z4NJM4g2ph3eglC1CsxO4/xUeDKyeAg11bR+ip/zIyc0bXadQagwTMG5S1J9cGxNv3IEL3yaJvDNDk1aZlERMMN13CZE+Hpnt7Vo2ALF0CqRQ6gOyyaHXhX2wq7IxhmDVE07XYpitAUTRJNlu68ivLSILV9BgRlbsCvyyrAy88mb7hPbkPLFVvObjwqS4klHY2Zcu242mLcTu4I3xr65LaKstVX9ckihpVYTPrQu/0p4uq6QzvZXw69l6nwbZfr6FjG4woR66loW5o6sHD1DLhFlRTOrKSrLv4q3pxQW2bhuTFuPHieWTeJTRXGliVMkeioUB8p1dW7/BT5lVheYpgTOOY+BgbXX8RuRnDi23bwXyTGgVx3W9+0bUlsRQSOpnNXeoljiWVFX+KmkYpeBY0UphGCuftUZIxFLQeb/sVKz6Pp93jz/x0dsnG7/S48oRCkcEfbjyHW/tvRMgELw9LAAhXFnvzm9Ew9vVKu24regPXEABqTUJYMx7KvSND8hPpfOlENrnUbLyUgbGUOIb/z42eBXJJne0tfTdtBhG6BLhdFruZ+4/QkJllc6nnVFzoFRkNBcaopTeac/MRqlQwYXmjgxrnJ0MnTyvZNLX98O3gyqvh02XQX5xhamHjz4Z1vOmXGUCZx3qnqIEl12ITWeInZAlqJgW3K38Ovvnb1gggVp9V2QDbGSRc3pGsPRUxbbg7d3QSTRvdtwvOl9zIhyLvomXzRd6S/mfQsGNS5nsq/TO3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7144838-e507-410e-f5aa-08d95a79d0e1 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2021 14:35:49.2767 (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: C3/n6xdZlvwG5dG14rgDcuXmWIFXyAwu4cPmJRs9dH0jdV4QNZUOKCvU0hIVrIZxeVccIYhpCeLfSosTZu/IPA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2301 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On topology changes, stations that were dynamically learned on ports that are no longer part of the active topology must be flushed - this is described by clause "17.11 Updating learned station location information" of IEEE 802.1D-2004. However, when address learning on the bridge port is turned off in the first place, there is nothing to flush, so skip a potentially expensive operation. We can finally do this now since DSA is aware of the learning state of its bridged ports. Signed-off-by: Vladimir Oltean --- net/dsa/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dsa/port.c b/net/dsa/port.c index d6a35a03acd6..a4c8d19a76e2 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -50,7 +50,7 @@ int dsa_port_set_state(struct dsa_port *dp, u8 state, bool do_fast_age) ds->ops->port_stp_state_set(ds, port, state); - if (do_fast_age) { + if (do_fast_age && dp->learning) { /* Fast age FDB entries or flush appropriate forwarding database * for the given port, if we are moving it from Learning or * Forwarding state, to Disabled or Blocking or Listening state. From patchwork Sun Aug 8 14:35:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 493796 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, 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 7CA36C432BE for ; Sun, 8 Aug 2021 14:36:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6066F60E93 for ; Sun, 8 Aug 2021 14:36:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231685AbhHHOgW (ORCPT ); Sun, 8 Aug 2021 10:36:22 -0400 Received: from mail-db8eur05on2044.outbound.protection.outlook.com ([40.107.20.44]:24033 "EHLO EUR05-DB8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231841AbhHHOgQ (ORCPT ); Sun, 8 Aug 2021 10:36:16 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L6f1dI48O6bEP+zI8hzQ1wJ+oDYjfg/GCZltKOwErD71Hs9NXp/0R3T0Gk5GR5RRqZMRC7yM2HZmmlS5qEpYULhGsNgOs3kwgamsWqVsDI5AHX3lIDTC5Ivn7a02qmWzCZv4Tht2Me+L6kEEj/k09Ml8jQ91J3V23qMpZC7Nb4CYUsIPb4rZ8472ydnjSFyOArHfEsDsZbmsAi/we6pFSAoyStDdV2DxMbKZev9moNyaiewzdhXkz0t5rnIPmJUVyWLSu34qXbcM6Z1Pz4y7tkRugOLyAPFoS1PnxWBjSGM5NvvHxDbOo3cCVNHorSUYlC9wplWRF4nd++PWXdQuRg== 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=YnOF/uCCgriJR/rH1D4T/uFiEU5ijtyHies5RzDu9c8=; b=LAGsD4lUtQ71C2q8CCqkpvziiuhVxNsUYdLijEmk1WF9UGk8BW4tIa6HeTLH5OosrLo0JVpt2iYtBAUxSLk+DAqPczYmcd5RrCjYs1gXd62BDXRe3apnZleVZYgWmwtrVgdBnW8oUXrLun+rLnWYT0F+hujc9OaMrzcBA1D+gZAtDbCCSj10SXHl4ftCYgfvY5ZRB6SxT0PCFCGayaDkIlAFPw9DZNGnWEubW/RlEO544N+UsQXyTtlHmWRkRV5Pm2wFMhQcAHqYGubBLjc3s1uO6eWNPB6vLy7DM5IaueVeOp4rq087cOXX0PBtQf1jOV5E8akWQCHn1wUdD35a3w== 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=YnOF/uCCgriJR/rH1D4T/uFiEU5ijtyHies5RzDu9c8=; b=sqxCCZNpmtWHPmBE/NMoaMNERnXOE/BSh1rrqnPz9EiX+wKrjnq6h2YQW3CgXUHvBW+bht2LxAxmaQ2jGf69AwoGQ/0UskJLTgzuZn70RCouFDTfHQzd6WKtueXEOgh3sdrKdROUTv0H7ejCiSCOh7+8Zx7YXdG3Ql852/t4n2E= 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 VI1PR0401MB2301.eurprd04.prod.outlook.com (2603:10a6:800:2e::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.17; Sun, 8 Aug 2021 14:35:50 +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.4394.022; Sun, 8 Aug 2021 14:35:50 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, Jakub Kicinski , "David S. Miller" Cc: Andrew Lunn , Florian Fainelli , Vivien Didelot , Vladimir Oltean Subject: [PATCH net-next 4/5] net: dsa: sja1105: rely on DSA core tracking of port learning state Date: Sun, 8 Aug 2021 17:35:26 +0300 Message-Id: <20210808143527.4041242-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210808143527.4041242-1-vladimir.oltean@nxp.com> References: <20210808143527.4041242-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: VI1PR0601CA0003.eurprd06.prod.outlook.com (2603:10a6:800:1e::13) To VI1PR04MB5136.eurprd04.prod.outlook.com (2603:10a6:803:55::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (188.25.144.60) by VI1PR0601CA0003.eurprd06.prod.outlook.com (2603:10a6:800:1e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4394.16 via Frontend Transport; Sun, 8 Aug 2021 14:35:50 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 090849fe-701c-4329-847f-08d95a79d19f X-MS-TrafficTypeDiagnostic: VI1PR0401MB2301: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HBOveOH5knI39DIRPUhVgpIzWTml9IKkB4ssoBuO6Y38r5BL/eGCB/WrVgiaHTTrxd5SgNK4ItznUjT3DaOuKYyLby2JV9UUeM/j16Pl3tr3ZlMi/cNc2ROBsBUygbdS+gdA51PiIajpRXQUgc5B5lQ/G9Fd+dIr4NdkWLPbscYIIm2xNNIP+ZN/LqTxii0st1jgJS6LQoScYfDuHtG6UhHNElrYCcSevuWgNTgdevtSE/3b0OXbKFEsVrydfGXzSgCoop0Z/N4v80UGRJHeUsXxkaWlbnuEZAQzrOy+zcDvWNVo+DP23e+i1Ji1YcIgmQt4OASduuDMyu2iI+UpI6VuryppJKBk+haQPraFo41w+nW83e4/fGG7Gqp40pP/fzC7rG/3XUqP4doOgiF9vpH1hm4ARRWWgdpjP4iVqa6Or4HRWxUirVHtZHGd/RtJ6jXFiJZ+fwVIMeeBrp7zOpp8qcYQR0bmswQkqENLFRQ7Vlls1vOsSz0mhNkFOOzxmBRFQwvyUTLHcMsz1rUcjx0zkLsqji6qkj50JAFEDjOdEMV85SnL7hZjjAz5pNKQsI+aipWw60SOIWphQSD2+6M67u7ksauhnEI1EkyQAhgzflrQLdSnpzlL+j/7iZA9JVfTHWyZWYaFkQOT0sXuQVUjKyC0/a8Ka5pm6VM48uGQ41R/c5GV2G7Qnl/u/41m 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)(366004)(86362001)(36756003)(8676002)(6486002)(6512007)(956004)(2616005)(44832011)(4326008)(6506007)(186003)(2906002)(1076003)(38350700002)(38100700002)(26005)(52116002)(66556008)(66946007)(66476007)(8936002)(83380400001)(6666004)(110136005)(54906003)(5660300002)(508600001)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oQsb/J6antLSpiqTAkqIjO2J4LFrrudMaFHxpkQJ2ytrlihUQgfgfFvZUwDFJ9JwkXTuQTjxDgnVoD5R+OlFeZG7M79lPSNXdLshbq2nSE4wv/KKJl/+i4er9I9Qi65bStd2s0eL+TDOx1dkpHdNrBTNDs/8xDwELxzbSh7berhOlgbppF+vQxxQ+rG9udt9/uEWDnY8vsd7ug7fYNE8fUgn9kIWc+Vznu7D9q3fC69BDuchHLddLyeeO7kBYC5cXMV1h05VDY7eqImLk8k29i0vleLImzK9TgxoFfhgzr+lksgmgUnTEW1SD4hEBm6K58OcEqhoN4gPQk9FDMN29VVXZy1gh9RXnnmavVgeYVJVI3yj3iQ/ibElz09HEFvLVpTH9i+5lLe5UWSMGfI91eU70q5E/aS1AXOGCrQB6fKG20jNFRghlPWKw4GLoF7yGkxjeAZiuKsWOQJz3Bum8ry6dHLAa2gxYqR3hfmcZQtbz8V0KlLlVCiu74yWlUSR5ZBg0bUIkZWmWgDpXnBXcVfOqLvwZFG4E88Lt7N4gqsvIsnVWhREh9Aii8f0h0phUxiKCF743TgygKjSWvcHjaJZaylhoPzS5sQ2MV9/q/wGlktdxdffGNVHvfxlus0SxhizzhwRWTLjTd1ixcT9AG8QhNr4DhUlw1t0G7b/juNXzaCRbgK2zz4C1euJh+5qPNENWVD2Fh2xYtbPYY6b7hhUPestVsr49f29VmNK8hLTg/pIBNrvULdqMYz0ozyKO8wXtJHlkrs3M64z/IldAoZ/Kh2jmAUaUIbfGx22n6HFAgwMHHLMkWeMP5RA+GENlI77dKSGfXdXHns/OepiNeShiXnU/dBCKhyuqEeurb2mUUQjL4qkZ7/mb2p02w/tFLqq5V1vvR8CNe4FKVKU76FtI2EpD0JXZ/9zrMn1eXdG7y6Lfy+3ca1YcqR3Rlr/4n55tDSXUaYlGmaahQYIR3eowJ+5UNA4hhK3RlEdMgoOIPbhb+HAfO0IaVwIeKFAmpa2RFgHLVCfIjCTwRe4GeR3aBswcXG5nAhECl6aA1is6u0EZCr0FtpLAv8rTpbsGKmJre5HgHg/RV7L4K1L0T1gMHEBUMeSCps8Mt9C6Nb+mH0m0TRXmZxChnljRhnOETr8op7KWfbPSnoEUQ6rrgaWLhBYBTIygm2t3j5U2O35a26ESsASpfbMTcU3LnXenJMdoatjXHaKI5pbM84Y5UdCfTPGoK2ZsMoNCjTLNRKQKeIpVoSNgkdlhyN1vTJnKt1dQftD6S4AuYcCJen+Slg9jwQB8gtFCiYlzDNkbIcJb4xVwWxUbm3O3H6Se6fi X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 090849fe-701c-4329-847f-08d95a79d19f X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5136.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Aug 2021 14:35:50.5300 (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: qf89jLfj6wf+3MTeSwDd5DCoauuvf843cPDiqGGFqXOOs8KExRY0PXWkW1XPJxMFPAggPTGvCmme6H+HxBxwYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2301 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Now that DSA keeps track of the port learning state, it becomes superfluous to keep an additional variable with this information in the sja1105 driver. Remove it. The DSA core's learning state is present in struct dsa_port *dp. To avoid the antipattern where we iterate through a DSA switch's ports and then call dsa_to_port to obtain the "dp" reference (which is bad because dsa_to_port iterates through the DSA switch tree once again), just iterate through the dst->ports and operate on those directly. The sja1105 had an extra use of priv->learn_ena on non-user ports. DSA does not touch the learning state of those ports - drivers are free to do what they wish on them. Mark that information with a comment in struct dsa_port and let sja1105 set dp->learning for cascade ports. Signed-off-by: Vladimir Oltean --- drivers/net/dsa/sja1105/sja1105.h | 1 - drivers/net/dsa/sja1105/sja1105_main.c | 32 +++++++++++--------------- include/net/dsa.h | 1 + 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/net/dsa/sja1105/sja1105.h b/drivers/net/dsa/sja1105/sja1105.h index 9cd7dbdd7db9..2e899c9f036d 100644 --- a/drivers/net/dsa/sja1105/sja1105.h +++ b/drivers/net/dsa/sja1105/sja1105.h @@ -233,7 +233,6 @@ struct sja1105_private { phy_interface_t phy_mode[SJA1105_MAX_NUM_PORTS]; bool fixed_link[SJA1105_MAX_NUM_PORTS]; bool vlan_aware; - unsigned long learn_ena; unsigned long ucast_egress_floods; unsigned long bcast_egress_floods; const struct sja1105_info *info; diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c index 241fd25b0b86..87e279be89c9 100644 --- a/drivers/net/dsa/sja1105/sja1105_main.c +++ b/drivers/net/dsa/sja1105/sja1105_main.c @@ -176,7 +176,7 @@ static int sja1105_init_mac_settings(struct sja1105_private *priv) struct sja1105_mac_config_entry *mac; struct dsa_switch *ds = priv->ds; struct sja1105_table *table; - int i; + struct dsa_port *dp; table = &priv->static_config.tables[BLK_IDX_MAC_CONFIG]; @@ -195,8 +195,11 @@ static int sja1105_init_mac_settings(struct sja1105_private *priv) mac = table->entries; - for (i = 0; i < ds->num_ports; i++) { - mac[i] = default_mac; + list_for_each_entry(dp, &ds->dst->ports, list) { + if (dp->ds != ds) + continue; + + mac[dp->index] = default_mac; /* Let sja1105_bridge_stp_state_set() keep address learning * enabled for the DSA ports. CPU ports use software-assisted @@ -205,8 +208,8 @@ static int sja1105_init_mac_settings(struct sja1105_private *priv) * CPU ports in a cross-chip topology if multiple CPU ports * exist. */ - if (dsa_is_dsa_port(ds, i)) - priv->learn_ena |= BIT(i); + if (dsa_port_is_dsa(dp)) + dp->learning = true; } return 0; @@ -1899,6 +1902,7 @@ static int sja1105_bridge_member(struct dsa_switch *ds, int port, static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port, u8 state) { + struct dsa_port *dp = dsa_to_port(ds, port); struct sja1105_private *priv = ds->priv; struct sja1105_mac_config_entry *mac; @@ -1924,12 +1928,12 @@ static void sja1105_bridge_stp_state_set(struct dsa_switch *ds, int port, case BR_STATE_LEARNING: mac[port].ingress = true; mac[port].egress = false; - mac[port].dyn_learn = !!(priv->learn_ena & BIT(port)); + mac[port].dyn_learn = dp->learning; break; case BR_STATE_FORWARDING: mac[port].ingress = true; mac[port].egress = true; - mac[port].dyn_learn = !!(priv->learn_ena & BIT(port)); + mac[port].dyn_learn = dp->learning; break; default: dev_err(ds->dev, "invalid STP state: %d\n", state); @@ -2891,23 +2895,13 @@ static int sja1105_port_set_learning(struct sja1105_private *priv, int port, bool enabled) { struct sja1105_mac_config_entry *mac; - int rc; mac = priv->static_config.tables[BLK_IDX_MAC_CONFIG].entries; mac[port].dyn_learn = enabled; - rc = sja1105_dynamic_config_write(priv, BLK_IDX_MAC_CONFIG, port, - &mac[port], true); - if (rc) - return rc; - - if (enabled) - priv->learn_ena |= BIT(port); - else - priv->learn_ena &= ~BIT(port); - - return 0; + return sja1105_dynamic_config_write(priv, BLK_IDX_MAC_CONFIG, port, + &mac[port], true); } static int sja1105_port_ucast_bcast_flood(struct sja1105_private *priv, int to, diff --git a/include/net/dsa.h b/include/net/dsa.h index 995e9d3f9cfc..0c2cba45fa79 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -254,6 +254,7 @@ struct dsa_port { struct device_node *dn; unsigned int ageing_time; bool vlan_filtering; + /* Managed by DSA on user ports and by drivers on CPU and DSA ports */ bool learning; u8 stp_state; struct net_device *bridge_dev;