{"id":2230780,"url":"http://patchwork.ozlabs.org/api/patches/2230780/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260430024945.3413973-13-wei.fang@nxp.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20260430024945.3413973-13-wei.fang@nxp.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20260430024945.3413973-13-wei.fang@nxp.com/","date":"2026-04-30T02:49:42","name":"[v5,net-next,12/15] net: dsa: netc: add FDB, STP, MTU, port setup and host flooding support","commit_ref":null,"pull_url":null,"state":"handled-elsewhere","archived":false,"hash":"9993509d3f7a319f23a83cd6b52b05c367fb62bd","submitter":{"id":84380,"url":"http://patchwork.ozlabs.org/api/people/84380/?format=json","name":"Wei Fang","email":"wei.fang@nxp.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20260430024945.3413973-13-wei.fang@nxp.com/mbox/","series":[{"id":502180,"url":"http://patchwork.ozlabs.org/api/series/502180/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=502180","date":"2026-04-30T02:49:30","name":"Add preliminary NETC switch support for i.MX94","version":5,"mbox":"http://patchwork.ozlabs.org/series/502180/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230780/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230780/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linuxppc-dev+bounces-20315-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256\n header.s=selector1 header.b=booOGDsa;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20315-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=pass smtp.remote-ip=\"2a01:111:f403:c201::6\" arc.chain=microsoft.com","lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=nxp.com","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256\n header.s=selector1 header.b=booOGDsa;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=permerror (SPF Permanent Error: Void lookup limit of 2 exceeded)\n smtp.mailfrom=nxp.com (client-ip=2a01:111:f403:c201::6;\n helo=am0pr02cu008.outbound.protection.outlook.com;\n envelope-from=wei.fang@nxp.com; receiver=lists.ozlabs.org)","dkim=none (message not signed)\n header.d=none;dmarc=none action=none header.from=nxp.com;"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5dt60XFvz1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 12:49:18 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4g5dsk4g1zz2ynT;\n\tThu, 30 Apr 2026 12:48:58 +1000 (AEST)","from AM0PR02CU008.outbound.protection.outlook.com\n (mail-westeuropeazlp170130006.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c201::6])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange secp256r1 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4g5dsj1fw9z2xtC\n\tfor <linuxppc-dev@lists.ozlabs.org>; Thu, 30 Apr 2026 12:48:57 +1000 (AEST)","from DBBPR04MB7500.eurprd04.prod.outlook.com (2603:10a6:10:1f4::16)\n by PAXPR04MB8608.eurprd04.prod.outlook.com (2603:10a6:102:21b::17) with\n Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9870.18; Thu, 30 Apr\n 2026 02:48:54 +0000","from DBBPR04MB7500.eurprd04.prod.outlook.com\n ([fe80::c291:543b:4bde:cee7]) by DBBPR04MB7500.eurprd04.prod.outlook.com\n ([fe80::c291:543b:4bde:cee7%6]) with mapi id 15.20.9870.020; Thu, 30 Apr 2026\n 02:48:53 +0000"],"ARC-Seal":["i=2; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1777517338;\n\tcv=pass;\n b=oVf76W9vOC6JbuU+ByGbuc/rnDSGPCx3X8VrNqV9zbXivrh/cRutDQb+Fg5xvpVBPko8W6W6H4Zt1qYJnSqy+Qp4hE+lMPQ3bZlkIOSAncoQpYoalPxd0eq9xankFCCKXGUl7D7Es4/7UyGNP3gE9omnyp6Mg/EwmZdnwUa46vpJixEvUHMt3atJ+y1lQFXsnEmiTu7WYfvgeVIAW+aZLG19DNEzppZzr9jv85u78VqyXDBRsl4LY3wdq/EosDknDh4+UQjMT93RqBqWotZ/xSA0QW8az3oOwq47QT2VarqNIT9FqOc9hQbSi0z03DErOWsP5353egPnHvc8TseRTA==","i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=wPphvdBFkAjTIx0DR5wW2foXz7ZxtvtZVFyBCNoHatf4TgVJSunbOYehFiRzJGuGrrh5A9TKTlbHW7Mo9wGnqAveLItI3n3hGcSUoC+vAoDiqrUJHZpgLwCP/7ckog058c7m5JcgRJotBWHK8h1LNGjnntddJFNNLghqMkKMy4bJt6TBEomk286VVhPKaAeTEghQ6+7F3/H98Fc36ocwK/B8B+1NWMwCWlNrOHZGObbWI4IHz18s6aQnJ0dJNgle1Ltja0ZUscMenktQCay7lhAnbXbpS+FeViS76PyLbeVqQSbC6cLaJZVK8uwQikAOGoLxwLEl775M1RQ5qHQ+GQ=="],"ARC-Message-Signature":["i=2; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1777517338; c=relaxed/relaxed;\n\tbh=FYZvlqohtm1cNvxbiISAo6twb4bmcR00GXL7nA+pDB0=;\n\th=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:\n\t Content-Type:MIME-Version;\n b=WBjcXD9grjsue46+jBhbiIYsUYMRncSNVyhODDG1Q5PNF8wL0+RgR1awzPDdHAcItod+ul0ZGClZIjB4FJiW0lo3SfMP6q2sFsRbUq/YnEANN8wyECE4UtpedZPWVa67wpm+arUS6KaDzLvvi6qfnDhV/xig9NWTylT9iu+jktloqqzrrQXcdHFchHca50LYollxNyjWy2Lc74LoFdmOW+aQEwoKVR1WxTJT5jHoJYeu1wckj1DvXN8PWixCEGS+Xqqmuy9B6HXDGERO5VAYLyysT7Oiszx9JHO2mF7jdIRsxg1rLHodyZ/jFHLvsMZVikVTefTpznqLH7CE3vuSng==","i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=FYZvlqohtm1cNvxbiISAo6twb4bmcR00GXL7nA+pDB0=;\n b=hYg3blkDJFhexgdhe6qjVdnL1ieIZfcx5FaU+HlZHGRBqHGFhAdMZE6iOSfBLvCON0kAbb7CYiqjLKO/9fSfG3v4B4JiHxSpZp++810mzyICCrna9e8EDwIdtsCOdVz4/zq9YGYsrj0LPTrOIb+wZ01ElNoq/HVxFHOHBp/RqwhnLkJeSthTJD9kUAIaaUd+sUgHC2g/kS7nxlO0WkDVZD67TM5ehVOcegaQXHPVcIt3PrE17Pdx62AWDZhLhw+GrRaDUxmfgHIhvu4sisOTMCKn6+D9PugayXe4waZaIGyaLHK+omU/SMQQOfokfJ8/epppkd2zQvau8MkhXx4+Pw=="],"ARC-Authentication-Results":["i=2; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=nxp.com; dkim=pass (2048-bit key;\n unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256\n header.s=selector1 header.b=booOGDsa; dkim-atps=neutral;\n spf=permerror (client-ip=2a01:111:f403:c201::6;\n helo=am0pr02cu008.outbound.protection.outlook.com;\n envelope-from=wei.fang@nxp.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=nxp.com","i=1; mx.microsoft.com 1; spf=pass\n smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass\n header.d=nxp.com; arc=none"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=FYZvlqohtm1cNvxbiISAo6twb4bmcR00GXL7nA+pDB0=;\n b=booOGDsaia4CCGdWjefWFuDY2Q17zzGhJE+YMdY8ErbBdAfY7AQ1eZkRAD012vAxUtcPmanmy327GcT0whCNtRqA+Xl1V1stRWZa1z8gcfvT6En8OjzrHYHKgWEmTEDF2kOqT+99Z2lYV5xChLdnZeC/bb8knherg35yrC4bnOQ0b0AYQKb69XGKsYt56GGJtrfkte+It9t+NJX3TWChvQxMm+5pjbCWegec361kWFQZfM6aSfV1XkxhCL216OM47jwGT/WDea6mfj+kvG2ZHPBS0pq306HYtgch6x1a61hj/KlJGwH1pKtH6PdWLfyZEJ7icWCCBtin9B1IV1vtnQ==","From":"Wei Fang <wei.fang@nxp.com>","To":"claudiu.manoil@nxp.com,\n\tvladimir.oltean@nxp.com,\n\txiaoning.wang@nxp.com,\n\tandrew+netdev@lunn.ch,\n\tdavem@davemloft.net,\n\tedumazet@google.com,\n\tkuba@kernel.org,\n\tpabeni@redhat.com,\n\trobh@kernel.org,\n\tkrzk+dt@kernel.org,\n\tconor+dt@kernel.org,\n\tf.fainelli@gmail.com,\n\tfrank.li@nxp.com,\n\tchleroy@kernel.org,\n\thorms@kernel.org,\n\tlinux@armlinux.org.uk","Cc":"netdev@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tdevicetree@vger.kernel.org,\n\tlinuxppc-dev@lists.ozlabs.org,\n\tlinux-arm-kernel@lists.infradead.org,\n\timx@lists.linux.dev","Subject":"[PATCH v5 net-next 12/15] net: dsa: netc: add FDB, STP, MTU,\n port setup and host flooding support","Date":"Thu, 30 Apr 2026 10:49:42 +0800","Message-Id":"<20260430024945.3413973-13-wei.fang@nxp.com>","X-Mailer":"git-send-email 2.34.1","In-Reply-To":"<20260430024945.3413973-1-wei.fang@nxp.com>","References":"<20260430024945.3413973-1-wei.fang@nxp.com>","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-ClientProxiedBy":"SG2PR01CA0133.apcprd01.prod.exchangelabs.com\n (2603:1096:4:8f::13) To DBBPR04MB7500.eurprd04.prod.outlook.com\n (2603:10a6:10:1f4::16)","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"DBBPR04MB7500:EE_|PAXPR04MB8608:EE_","X-MS-Office365-Filtering-Correlation-Id":"19f1c2c5-f57c-42bf-be78-08dea6630435","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"\n\tBCL:0;ARA:13230040|1800799024|366016|19092799006|7416014|52116014|376014|38350700014|921020|56012099003|22082099003|18002099003;","X-Microsoft-Antispam-Message-Info":"\n\tpwbQ+5jA2DmfSvaDRw9j3kApSxgdJHvyS3u8/0UtSo6GvrZyKL0tMxQKBa4MPy7In6QE7H0yC1TFF8PK8PYZWVTLPfH0cVct4SqWqvq2cuSiZ3H+72A5JiKFWxFpu/hxRDEobuKIzeemBGp/j4CUfKfyrqyZpNTBRnr6JaulKkV/nZz1cptJTSr92wb2oObDmo7pwf3faoLFmcIm6SumvT0nvTMRTp+ky3L4onc/EpqdFpRzVDUz1fe6PY8T4afo/LS3G5rUgagwWEsd5Mh5/KInv4FYohKK6StlbeXXHVxpmn/9LIw900vE+buzjauFgkd3ORQSl34JeesyjG3hFNUZjzRA8ypU2t6xQMO/j43Hsb1cji1g6p+XvaxkFeaQksz0bR1qIVsUSRQ7ZLu2uhS7vvCuhrOVNZg26N6Qp6jlTbC+xlNNheOLpfC055rTMVdVDlr4ysS9461qruwZJDrIkrW4p05cHVU4N8cGtzhmaclSVUluX80FEXuZpPtWv1e3r9Y0VDghbSpng1bV7kNIsFki3Lb3sXhwoDrt0b1wd57l8pVi+RVtmZwrJwFIXEFt1N7BepVuNo2C2stOIKmGcyg2th7n3/En8T2EeVe8Y9vjjM05fYb55mrTcCpgXVDcGwU832Ka7gtJg+VnVJnTBp6i7UFeBj97A9XCAQPNyqEocxqapItcKMCq2/Vu7xx/t5W0CWLzqfebAcL1w2dF3xV4sP54yoemZUBQgV9U0HKf1ELv9mkGWS6hgleRiCrUoob5eW2LIYV+yEttudMrIHrFTZx8XIFeJk5neh1AqWiRVCs1Po1O5kZ8JOYg","X-Forefront-Antispam-Report":"\n\tCIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DBBPR04MB7500.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(19092799006)(7416014)(52116014)(376014)(38350700014)(921020)(56012099003)(22082099003)(18002099003);DIR:OUT;SFP:1101;","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"\n XtisJxxdSnvahijQEaXtPxxguJfgwwWNfE+Kn+yU03hbu60ZZy3JJtVva9yE3fURQIIGUTtBRhq03+tk7wWVwHr0JBqC67+Ss+G51AH2c3adv7VkceSKeFIW/Uar0hoZMjVQR+S2tuy1x715jZ2NmOeXzYA/m5e5GMP3sAloQuDE10pAaPYgI87UNl0sFpXnchKazL7NPl+Bt0MRJN4UfzwUQmRft7pZvxkjZ/fVRBXxvCM1cge91hL0TQ7UPcNPWSwIFcdfeu6xJukLWjvx552hdtXRVqBWkY71o45vrfJzY4eZnZfIRAWHATPGXEV2z+Vif2qoaplho9CUsWxjZr8wli8NlI8uLyHHFuQLIqOFC7LGsuknlpvviwuKLyQt8gP4c1pJvxOm+F/B25LTybfXfC1HsHEla81GlQGkHonMyEUjwPtkVEOU//ghPDv7/VgfgxYK7qwrp/8UDK/yBfocF+gao0Wz28tenoMd233mJtcJblwv3Klb9qD2LNKzDt0kfCDIsfqc6oF9j2/ExN6ZzSO/mykHOCKMu677zHCm55DtvZB56hEwqZtY7O+rh4/jmBZSGE60B5ZSlR3008rpfzmL36HGwCzdgrRO4QHVnUzBHXMZSUzt3dNXN1EXQAAPNM9/0PwFXL8B7MFUA1AFiMNe6fs87GMDoGjc29UN3qpmN2RQnx+HDJWvfHStEIli8aen8HnBbtyUzSLt5xsBQ8XuENTVGhSp9rAY3iFsDC5vwnGoShpYadZsppXhudqcAWacac0FkORKaVhE2nQsWKn9dchV0uvsHdRwvKTfsxC918UTIdPYU2RlYYDIgMG++8LZ/IpA+ii+aUZMSyVrB8cjKBoP0ktbYx6zLTr85skthNSezvRZxEPFthfeOXGWvI+mRikO1BmURdl4BLvoVqTN3v2yyWeBTWFUaezpYhmnRxqSNw8xghQ57CJ5S4OvlsZNcyGVYGTwsKQGhg91BS2szHP4btNXGLqOazskvBn2z+rEV0Vi8m4YP6rOSZufVqJOsTtFKuJPiQZf9sOSPqjqB1TA/NQqW6soFVOQcCyihxDLO3Kyd79O37IKqLAlplXlE4Byx1sUAIkAme+IwEA39LgtVRppFgMltNOK5njCWO3iLmMz42LcKhdnIvCOQHLqXaS72UIbMopgBJmruP/6h3in6xVma1l0+4+lMBroqFNU95d7uSzGcKnvMKbZH3DFMajZSsjwBIwRCkzYnMqIx9bCknaK1ocz6nFOq/drg/3/NkmwUHKHuleP3aQ003WzNM06H3BrHdargkzrmhCpT5u2IdKd1i+SJFtyTN1fTFXUA6E6OEbdbko0EI3UNUCSE0ELDu82RXa9KWyBf4tirUAVLDUHGdQJgBYbui1JZ1fJTe2cONZMvPrAneszNs14ym5+n6inisjarO99uFItLvZj9lTcez2VfYcCXr73+xWOPi3rwYtzuGehWb+uzNkIyrFUFB9w36V2wQDd7H3sve7ozypSjLkD78igOhqIrzUFL+Z28GguMW6G7NQJOV6tvXmG9r03uSV4YRcmWraL2gVvfA//z8M2R+spuWeHB3ShRll2uSVvQ6/UpiaXyXr+A2LgJD8Jf57j2GAPprAo243jqOUJzUuahR7oLxcncdxcIn/hv9XKJXzZo5WlJDVoQpPgGIbc2elw+RxDArkOa84w5S8TIZObGiM3u9g2pwN/7er/4nYVPylb","X-OriginatorOrg":"nxp.com","X-MS-Exchange-CrossTenant-Network-Message-Id":"\n 19f1c2c5-f57c-42bf-be78-08dea6630435","X-MS-Exchange-CrossTenant-AuthSource":"DBBPR04MB7500.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Internal","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"30 Apr 2026 02:48:53.9007\n (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":"\n XJyktw98t+Ut89Jl3rH4HgtUnYVkGs+zqPVKfwVvQ9nGyk46a0kfICfAPhOHia+lEewsXTFGqcoQ03omPkmI0Q==","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"PAXPR04MB8608","X-Spam-Status":"No, score=0.8 required=3.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,\n\tSPF_HELO_PASS,T_SPF_PERMERROR autolearn=disabled version=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"Expand the NETC switch driver with several foundational features:\n- FDB and MDB management\n- STP state handling\n- MTU configuration\n- Port setup/teardown\n- Host flooding support\n\nAt this stage, the driver operates only in standalone port mode. Each\nport uses VLAN 0 as its PVID, meaning ingress frames are internally\nassigned VID 0 regardless of whether they arrive tagged or untagged.\nNote that this does not inject a VLAN 0 header into the frame, the VID\nis used purely for subsequent VLAN processing within the switch.\n\nSigned-off-by: Wei Fang <wei.fang@nxp.com>\n---\n drivers/net/dsa/netc/netc_main.c      | 573 ++++++++++++++++++++++++++\n drivers/net/dsa/netc/netc_switch.h    |  36 ++\n drivers/net/dsa/netc/netc_switch_hw.h |  14 +\n 3 files changed, 623 insertions(+)","diff":"diff --git a/drivers/net/dsa/netc/netc_main.c b/drivers/net/dsa/netc/netc_main.c\nindex edf50cb32cb6..7f1ab1fbb6fb 100644\n--- a/drivers/net/dsa/netc/netc_main.c\n+++ b/drivers/net/dsa/netc/netc_main.c\n@@ -7,11 +7,36 @@\n #include <linux/clk.h>\n #include <linux/etherdevice.h>\n #include <linux/fsl/enetc_mdio.h>\n+#include <linux/if_bridge.h>\n #include <linux/if_vlan.h>\n #include <linux/of_mdio.h>\n \n #include \"netc_switch.h\"\n \n+static struct netc_fdb_entry *\n+netc_lookup_fdb_entry(struct netc_switch *priv,\n+\t\t      const unsigned char *addr,\n+\t\t      u16 vid)\n+{\n+\tstruct netc_fdb_entry *entry;\n+\n+\thlist_for_each_entry(entry, &priv->fdb_list, node)\n+\t\tif (ether_addr_equal(entry->keye.mac_addr, addr) &&\n+\t\t    le16_to_cpu(entry->keye.fid) == vid)\n+\t\t\treturn entry;\n+\n+\treturn NULL;\n+}\n+\n+static void netc_destroy_fdb_list(struct netc_switch *priv)\n+{\n+\tstruct netc_fdb_entry *entry;\n+\tstruct hlist_node *tmp;\n+\n+\thlist_for_each_entry_safe(entry, tmp, &priv->fdb_list, node)\n+\t\tnetc_del_fdb_entry(entry);\n+}\n+\n static enum dsa_tag_protocol\n netc_get_tag_protocol(struct dsa_switch *ds, int port,\n \t\t      enum dsa_tag_protocol mprot)\n@@ -176,6 +201,15 @@ static int netc_init_switch_id(struct netc_switch *priv)\n \treturn 0;\n }\n \n+static void netc_get_switch_capabilities(struct netc_switch *priv)\n+{\n+\tstruct netc_switch_regs *regs = &priv->regs;\n+\tu32 val;\n+\n+\tval = netc_base_rd(regs, NETC_FDBHTCAPR);\n+\tpriv->num_fdb_gmac = FIELD_GET(FDBHTCAPR_NUM_GMAC, val);\n+}\n+\n static int netc_init_all_ports(struct netc_switch *priv)\n {\n \tstruct device *dev = priv->dev;\n@@ -383,6 +417,206 @@ static void netc_port_default_config(struct netc_port *np)\n \tnetc_port_set_all_tc_msdu(np);\n }\n \n+static u32 netc_available_port_bitmap(struct netc_switch *priv)\n+{\n+\tstruct dsa_port *dp;\n+\tu32 bitmap = 0;\n+\n+\tdsa_switch_for_each_available_port(dp, priv->ds)\n+\t\tbitmap |= BIT(dp->index);\n+\n+\treturn bitmap;\n+}\n+\n+static int netc_add_standalone_vlan_entry(struct netc_switch *priv)\n+{\n+\tu32 bitmap_stg = VFT_STG_ID(0) | netc_available_port_bitmap(priv);\n+\tstruct vft_cfge_data *cfge;\n+\tu16 cfg;\n+\tint err;\n+\n+\tcfge = kzalloc_obj(*cfge);\n+\tif (!cfge)\n+\t\treturn -ENOMEM;\n+\n+\tcfge->bitmap_stg = cpu_to_le32(bitmap_stg);\n+\tcfge->et_eid = cpu_to_le32(NTMP_NULL_ENTRY_ID);\n+\tcfge->fid = cpu_to_le16(NETC_STANDALONE_PVID);\n+\n+\t/* For standalone ports, MAC learning needs to be disabled, so frames\n+\t * from other user ports will not be forwarded to the standalone ports,\n+\t * because there are no FDB entries on the standalone ports. Also, the\n+\t * frames received by the standalone ports cannot be flooded to other\n+\t * ports, so MAC forwarding option needs to be set to\n+\t * MFO_NO_MATCH_DISCARD, so the frames will discarded rather than\n+\t * flooding to other ports.\n+\t */\n+\tcfg = FIELD_PREP(VFT_MLO, MLO_DISABLE) |\n+\t      FIELD_PREP(VFT_MFO, MFO_NO_MATCH_DISCARD);\n+\tcfge->cfg = cpu_to_le16(cfg);\n+\n+\terr = ntmp_vft_add_entry(&priv->ntmp, NETC_STANDALONE_PVID, cfge);\n+\tif (err)\n+\t\tdev_err(priv->dev,\n+\t\t\t\"Failed to add standalone VLAN entry\\n\");\n+\n+\tkfree(cfge);\n+\n+\treturn err;\n+}\n+\n+static int netc_port_add_fdb_entry(struct netc_port *np,\n+\t\t\t\t   const unsigned char *addr, u16 vid)\n+{\n+\tstruct netc_switch *priv = np->switch_priv;\n+\tstruct netc_fdb_entry *entry;\n+\tstruct fdbt_keye_data *keye;\n+\tstruct fdbt_cfge_data *cfge;\n+\tint port = np->dp->index;\n+\tu32 cfg = 0;\n+\tint err;\n+\n+\tentry = kzalloc_obj(*entry);\n+\tif (!entry)\n+\t\treturn -ENOMEM;\n+\n+\tkeye = &entry->keye;\n+\tcfge = &entry->cfge;\n+\tether_addr_copy(keye->mac_addr, addr);\n+\tkeye->fid = cpu_to_le16(vid);\n+\n+\tcfge->port_bitmap = cpu_to_le32(BIT(port));\n+\tcfge->cfg = cpu_to_le32(cfg);\n+\tcfge->et_eid = cpu_to_le32(NTMP_NULL_ENTRY_ID);\n+\n+\terr = ntmp_fdbt_add_entry(&priv->ntmp, &entry->entry_id, keye, cfge);\n+\tif (err) {\n+\t\tkfree(entry);\n+\n+\t\treturn err;\n+\t}\n+\n+\tnetc_add_fdb_entry(priv, entry);\n+\n+\treturn 0;\n+}\n+\n+static int netc_port_set_fdb_entry(struct netc_port *np,\n+\t\t\t\t   const unsigned char *addr, u16 vid)\n+{\n+\tstruct netc_switch *priv = np->switch_priv;\n+\tstruct netc_fdb_entry *entry;\n+\tstruct fdbt_cfge_data *cfge;\n+\tint port = np->dp->index;\n+\tint err = 0;\n+\n+\tmutex_lock(&priv->fdbt_lock);\n+\n+\tentry = netc_lookup_fdb_entry(priv, addr, vid);\n+\tif (!entry) {\n+\t\terr = netc_port_add_fdb_entry(np, addr, vid);\n+\t\tif (err)\n+\t\t\tdev_err(priv->dev,\n+\t\t\t\t\"Failed to add FDB entry on port %d\\n\",\n+\t\t\t\tport);\n+\n+\t\tgoto unlock_fdbt;\n+\t}\n+\n+\tcfge = &entry->cfge;\n+\t/* If the entry already exists on the port, return 0 directly */\n+\tif (unlikely(cfge->port_bitmap & cpu_to_le32(BIT(port))))\n+\t\tgoto unlock_fdbt;\n+\n+\t/* If the entry already exists, but not on this port, we need to\n+\t * update the port bitmap. In general, it should only be valid\n+\t * for multicast or broadcast address.\n+\t */\n+\tcfge->port_bitmap |= cpu_to_le32(BIT(port));\n+\terr = ntmp_fdbt_update_entry(&priv->ntmp, entry->entry_id, cfge);\n+\tif (err) {\n+\t\tcfge->port_bitmap &= cpu_to_le32(~BIT(port));\n+\t\tdev_err(priv->dev, \"Failed to set FDB entry on port %d\\n\",\n+\t\t\tport);\n+\t}\n+\n+unlock_fdbt:\n+\tmutex_unlock(&priv->fdbt_lock);\n+\n+\treturn err;\n+}\n+\n+static int netc_port_del_fdb_entry(struct netc_port *np,\n+\t\t\t\t   const unsigned char *addr, u16 vid)\n+{\n+\tstruct netc_switch *priv = np->switch_priv;\n+\tstruct ntmp_user *ntmp = &priv->ntmp;\n+\tstruct netc_fdb_entry *entry;\n+\tstruct fdbt_cfge_data *cfge;\n+\tint port = np->dp->index;\n+\tint err = 0;\n+\n+\tmutex_lock(&priv->fdbt_lock);\n+\n+\tentry = netc_lookup_fdb_entry(priv, addr, vid);\n+\tif (unlikely(!entry))\n+\t\tgoto unlock_fdbt;\n+\n+\tcfge = &entry->cfge;\n+\tif (unlikely(!(cfge->port_bitmap & cpu_to_le32(BIT(port)))))\n+\t\tgoto unlock_fdbt;\n+\n+\tif (cfge->port_bitmap != cpu_to_le32(BIT(port))) {\n+\t\t/* If the entry also exists on other ports, we need to\n+\t\t * update the entry in the FDB table.\n+\t\t */\n+\t\tcfge->port_bitmap &= cpu_to_le32(~BIT(port));\n+\t\terr = ntmp_fdbt_update_entry(ntmp, entry->entry_id, cfge);\n+\t\tif (err) {\n+\t\t\tcfge->port_bitmap |= cpu_to_le32(BIT(port));\n+\t\t\tgoto unlock_fdbt;\n+\t\t}\n+\t} else {\n+\t\t/* If the entry only exists on this port, just delete\n+\t\t * it from the FDB table.\n+\t\t */\n+\t\terr = ntmp_fdbt_delete_entry(ntmp, entry->entry_id);\n+\t\tif (err)\n+\t\t\tgoto unlock_fdbt;\n+\n+\t\tnetc_del_fdb_entry(entry);\n+\t}\n+\n+unlock_fdbt:\n+\tmutex_unlock(&priv->fdbt_lock);\n+\n+\treturn err;\n+}\n+\n+static int netc_add_standalone_fdb_bcast_entry(struct netc_switch *priv)\n+{\n+\tconst u8 bcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};\n+\tstruct dsa_port *dp, *cpu_dp = NULL;\n+\n+\tdsa_switch_for_each_cpu_port(dp, priv->ds) {\n+\t\tcpu_dp = dp;\n+\t\tbreak;\n+\t}\n+\n+\tif (!cpu_dp)\n+\t\treturn -ENODEV;\n+\n+\t/* If the user port acts as a standalone port, then its PVID is 0,\n+\t * MLO is set to \"disable MAC learning\" and MFO is set to \"discard\n+\t * frames if no matching entry found in FDB table\". Therefore, we\n+\t * need to add a broadcast FDB entry on the CPU port so that the\n+\t * broadcast frames received on the user port can be forwarded to\n+\t * the CPU port.\n+\t */\n+\treturn netc_port_set_fdb_entry(NETC_PORT(priv->ds, cpu_dp->index),\n+\t\t\t\t       bcast, NETC_STANDALONE_PVID);\n+}\n+\n static int netc_setup(struct dsa_switch *ds)\n {\n \tstruct netc_switch *priv = ds->priv;\n@@ -393,6 +627,8 @@ static int netc_setup(struct dsa_switch *ds)\n \tif (err)\n \t\treturn err;\n \n+\tnetc_get_switch_capabilities(priv);\n+\n \terr = netc_init_all_ports(priv);\n \tif (err)\n \t\treturn err;\n@@ -401,19 +637,61 @@ static int netc_setup(struct dsa_switch *ds)\n \tif (err)\n \t\treturn err;\n \n+\tINIT_HLIST_HEAD(&priv->fdb_list);\n+\tmutex_init(&priv->fdbt_lock);\n+\n \tnetc_switch_fixed_config(priv);\n \n \t/* default setting for ports */\n \tdsa_switch_for_each_available_port(dp, ds)\n \t\tnetc_port_default_config(priv->ports[dp->index]);\n \n+\terr = netc_add_standalone_vlan_entry(priv);\n+\tif (err)\n+\t\tgoto free_lock_and_ntmp_user;\n+\n+\terr = netc_add_standalone_fdb_bcast_entry(priv);\n+\tif (err)\n+\t\tgoto free_lock_and_ntmp_user;\n+\n \treturn 0;\n+\n+free_lock_and_ntmp_user:\n+\tmutex_destroy(&priv->fdbt_lock);\n+\tnetc_free_ntmp_user(priv);\n+\n+\treturn err;\n+}\n+\n+static void netc_destroy_all_lists(struct netc_switch *priv)\n+{\n+\tnetc_destroy_fdb_list(priv);\n+\tmutex_destroy(&priv->fdbt_lock);\n+}\n+\n+static void netc_free_host_flood_rules(struct netc_switch *priv)\n+{\n+\tstruct dsa_port *dp;\n+\n+\tdsa_switch_for_each_user_port(dp, priv->ds) {\n+\t\tstruct netc_port *np = priv->ports[dp->index];\n+\n+\t\t/* No need to clear the hardware IPFT entry. Because PCIe\n+\t\t * FLR will be performed when the switch is re-registered,\n+\t\t * it will reset hardware state. So only need to free the\n+\t\t * memory to avoid memory leak.\n+\t\t */\n+\t\tkfree(np->host_flood);\n+\t\tnp->host_flood = NULL;\n+\t}\n }\n \n static void netc_teardown(struct dsa_switch *ds)\n {\n \tstruct netc_switch *priv = ds->priv;\n \n+\tnetc_destroy_all_lists(priv);\n+\tnetc_free_host_flood_rules(priv);\n \tnetc_free_ntmp_user(priv);\n }\n \n@@ -542,6 +820,289 @@ static void netc_switch_get_ip_revision(struct netc_switch *priv)\n \tpriv->revision = FIELD_GET(IPBRR0_IP_REV, val);\n }\n \n+static int netc_port_enable(struct dsa_switch *ds, int port,\n+\t\t\t    struct phy_device *phy)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\tint err;\n+\n+\tif (np->enable)\n+\t\treturn 0;\n+\n+\terr = clk_prepare_enable(np->ref_clk);\n+\tif (err) {\n+\t\tdev_err(ds->dev,\n+\t\t\t\"Failed to enable enet_ref_clk of port %d\\n\", port);\n+\t\treturn err;\n+\t}\n+\n+\tnp->enable = true;\n+\n+\treturn 0;\n+}\n+\n+static void netc_port_disable(struct dsa_switch *ds, int port)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\n+\t/* When .port_disable() is called, .port_enable() may not have been\n+\t * called. In this case, both the prepare_count and enable_count of\n+\t * clock are 0. Calling clk_disable_unprepare() at this time will\n+\t * cause warnings.\n+\t */\n+\tif (!np->enable)\n+\t\treturn;\n+\n+\tclk_disable_unprepare(np->ref_clk);\n+\tnp->enable = false;\n+}\n+\n+static void netc_port_stp_state_set(struct dsa_switch *ds,\n+\t\t\t\t    int port, u8 state)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\tu32 val;\n+\n+\tswitch (state) {\n+\tcase BR_STATE_DISABLED:\n+\tcase BR_STATE_LISTENING:\n+\tcase BR_STATE_BLOCKING:\n+\t\tval = NETC_STG_STATE_DISABLED;\n+\t\tbreak;\n+\tcase BR_STATE_LEARNING:\n+\t\tval = NETC_STG_STATE_LEARNING;\n+\t\tbreak;\n+\tcase BR_STATE_FORWARDING:\n+\t\tval = NETC_STG_STATE_FORWARDING;\n+\t\tbreak;\n+\tdefault:\n+\t\treturn;\n+\t}\n+\n+\tnetc_port_wr(np, NETC_BPSTGSR, val);\n+}\n+\n+static int netc_port_change_mtu(struct dsa_switch *ds,\n+\t\t\t\tint port, int mtu)\n+{\n+\tu32 max_frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\n+\t/* dsa_user_change_mtu() does not add the switch tag overhead\n+\t * for the CPU port, so we need to add this overhead for the\n+\t * CPU port here.\n+\t */\n+\tif (dsa_is_cpu_port(ds, port)) {\n+\t\tmax_frame_size += NETC_TAG_MAX_LEN;\n+\t\tif (max_frame_size > NETC_MAX_FRAME_LEN)\n+\t\t\tmax_frame_size = NETC_MAX_FRAME_LEN;\n+\t}\n+\n+\tnetc_port_set_max_frame_size(np, max_frame_size);\n+\n+\treturn 0;\n+}\n+\n+static int netc_port_max_mtu(struct dsa_switch *ds, int port)\n+{\n+\treturn NETC_MAX_FRAME_LEN - VLAN_ETH_HLEN - ETH_FCS_LEN;\n+}\n+\n+static int netc_port_fdb_add(struct dsa_switch *ds, int port,\n+\t\t\t     const unsigned char *addr, u16 vid,\n+\t\t\t     struct dsa_db db)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\n+\t/* Currently, only support standalone port mode, so only\n+\t * NETC_STANDALONE_PVID (= 0) is supported here.\n+\t */\n+\tif (vid != NETC_STANDALONE_PVID)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn netc_port_set_fdb_entry(np, addr, vid);\n+}\n+\n+static int netc_port_fdb_del(struct dsa_switch *ds, int port,\n+\t\t\t     const unsigned char *addr, u16 vid,\n+\t\t\t     struct dsa_db db)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\n+\tif (vid != NETC_STANDALONE_PVID)\n+\t\treturn -EOPNOTSUPP;\n+\n+\treturn netc_port_del_fdb_entry(np, addr, vid);\n+}\n+\n+static int netc_port_fdb_dump(struct dsa_switch *ds, int port,\n+\t\t\t      dsa_fdb_dump_cb_t *cb, void *data)\n+{\n+\tstruct netc_switch *priv = ds->priv;\n+\tu32 resume_eid = NTMP_NULL_ENTRY_ID;\n+\tstruct fdbt_entry_data *entry;\n+\tstruct fdbt_keye_data *keye;\n+\tstruct fdbt_cfge_data *cfge;\n+\tu32 cfg, cnt = 0;\n+\tbool is_static;\n+\tint err;\n+\tu16 vid;\n+\n+\tentry = kmalloc_obj(*entry);\n+\tif (!entry)\n+\t\treturn -ENOMEM;\n+\n+\tkeye = &entry->keye;\n+\tcfge = &entry->cfge;\n+\tmutex_lock(&priv->fdbt_lock);\n+\n+\tdo {\n+\t\tmemset(entry, 0, sizeof(*entry));\n+\t\terr = ntmp_fdbt_search_port_entry(&priv->ntmp, port,\n+\t\t\t\t\t\t  &resume_eid, entry);\n+\t\tif (err || entry->entry_id == NTMP_NULL_ENTRY_ID)\n+\t\t\tbreak;\n+\n+\t\tcfg = le32_to_cpu(cfge->cfg);\n+\t\tis_static = (cfg & FDBT_DYNAMIC) ? false : true;\n+\t\tvid = le16_to_cpu(keye->fid);\n+\n+\t\terr = cb(keye->mac_addr, vid, is_static, data);\n+\t\tif (err)\n+\t\t\tbreak;\n+\n+\t\t/* To prevent hardware malfunctions from causing an\n+\t\t * infinite loop.\n+\t\t */\n+\t\tif (++cnt >= priv->num_fdb_gmac)\n+\t\t\tbreak;\n+\t} while (resume_eid != NTMP_NULL_ENTRY_ID);\n+\n+\tmutex_unlock(&priv->fdbt_lock);\n+\tkfree(entry);\n+\n+\treturn err;\n+}\n+\n+static int netc_port_mdb_add(struct dsa_switch *ds, int port,\n+\t\t\t     const struct switchdev_obj_port_mdb *mdb,\n+\t\t\t     struct dsa_db db)\n+{\n+\treturn netc_port_fdb_add(ds, port, mdb->addr, mdb->vid, db);\n+}\n+\n+static int netc_port_mdb_del(struct dsa_switch *ds, int port,\n+\t\t\t     const struct switchdev_obj_port_mdb *mdb,\n+\t\t\t     struct dsa_db db)\n+{\n+\treturn netc_port_fdb_del(ds, port, mdb->addr, mdb->vid, db);\n+}\n+\n+static int netc_port_add_host_flood_rule(struct netc_port *np,\n+\t\t\t\t\t bool uc, bool mc)\n+{\n+\tconst u8 dmac_mask[ETH_ALEN] = {0x1, 0, 0, 0, 0, 0};\n+\tstruct netc_switch *priv = np->switch_priv;\n+\tstruct ipft_entry_data *host_flood;\n+\tstruct ipft_keye_data *keye;\n+\tstruct ipft_cfge_data *cfge;\n+\tu16 src_port;\n+\tu32 cfg;\n+\tint err;\n+\n+\tif (!uc && !mc) {\n+\t\t/* Disable ingress port filter table lookup */\n+\t\tnetc_port_wr(np, NETC_PIPFCR, 0);\n+\t\tnp->uc = false;\n+\t\tnp->mc = false;\n+\n+\t\treturn 0;\n+\t}\n+\n+\thost_flood = kzalloc_obj(*host_flood);\n+\tif (!host_flood)\n+\t\treturn -ENOMEM;\n+\n+\tkeye = &host_flood->keye;\n+\tcfge = &host_flood->cfge;\n+\n+\tsrc_port = FIELD_PREP(IPFT_SRC_PORT, np->dp->index);\n+\tsrc_port |= IPFT_SRC_PORT_MASK;\n+\tkeye->src_port = cpu_to_le16(src_port);\n+\n+\t/* If either only unicast or only multicast need to be flooded\n+\t * to the host, we always set the mask that tests the first MAC\n+\t * DA octet. The value should be 0 for the first bit (if unicast\n+\t * has to be flooded) or 1 (if multicast). If both unicast and\n+\t * multicast have to be flooded, we leave the key mask empty, so\n+\t * it matches everything.\n+\t */\n+\tif (uc && !mc)\n+\t\tether_addr_copy(keye->dmac_mask, dmac_mask);\n+\n+\tif (!uc && mc) {\n+\t\tether_addr_copy(keye->dmac, dmac_mask);\n+\t\tether_addr_copy(keye->dmac_mask, dmac_mask);\n+\t}\n+\n+\tcfg = FIELD_PREP(IPFT_FLTFA, IPFT_FLTFA_REDIRECT);\n+\tcfg |= FIELD_PREP(IPFT_HR, NETC_HR_HOST_FLOOD);\n+\tcfge->cfg = cpu_to_le32(cfg);\n+\n+\terr = ntmp_ipft_add_entry(&priv->ntmp, host_flood);\n+\tif (err) {\n+\t\tkfree(host_flood);\n+\t\treturn err;\n+\t}\n+\n+\tnp->uc = uc;\n+\tnp->mc = mc;\n+\tnp->host_flood = host_flood;\n+\t/* Enable ingress port filter table lookup */\n+\tnetc_port_wr(np, NETC_PIPFCR, PIPFCR_EN);\n+\n+\treturn 0;\n+}\n+\n+static void netc_port_remove_host_flood(struct netc_port *np,\n+\t\t\t\t\tstruct ipft_entry_data *host_flood)\n+{\n+\tstruct netc_switch *priv = np->switch_priv;\n+\n+\tif (!host_flood)\n+\t\treturn;\n+\n+\tntmp_ipft_delete_entry(&priv->ntmp, host_flood->entry_id);\n+\tkfree(host_flood);\n+}\n+\n+static void netc_port_set_host_flood(struct dsa_switch *ds, int port,\n+\t\t\t\t     bool uc, bool mc)\n+{\n+\tstruct netc_port *np = NETC_PORT(ds, port);\n+\tstruct ipft_entry_data *old_host_flood;\n+\n+\tif (np->uc == uc && np->mc == mc)\n+\t\treturn;\n+\n+\t/* IPFT does not support in-place updates to the KEYE element,\n+\t * we need to add a new entry and then delete the old one. So\n+\t * save the old entry first.\n+\t */\n+\told_host_flood = np->host_flood;\n+\tnp->host_flood = NULL;\n+\n+\tif (netc_port_add_host_flood_rule(np, uc, mc)) {\n+\t\tnp->host_flood = old_host_flood;\n+\t\tdev_err(ds->dev, \"Failed to add host flood rule on port %d\\n\",\n+\t\t\tport);\n+\t\treturn;\n+\t}\n+\n+\t/* Remove the old host flood entry */\n+\tnetc_port_remove_host_flood(np, old_host_flood);\n+}\n+\n static void netc_phylink_get_caps(struct dsa_switch *ds, int port,\n \t\t\t\t  struct phylink_config *config)\n {\n@@ -768,6 +1329,17 @@ static const struct dsa_switch_ops netc_switch_ops = {\n \t.setup\t\t\t\t= netc_setup,\n \t.teardown\t\t\t= netc_teardown,\n \t.phylink_get_caps\t\t= netc_phylink_get_caps,\n+\t.port_enable\t\t\t= netc_port_enable,\n+\t.port_disable\t\t\t= netc_port_disable,\n+\t.port_stp_state_set\t\t= netc_port_stp_state_set,\n+\t.port_change_mtu\t\t= netc_port_change_mtu,\n+\t.port_max_mtu\t\t\t= netc_port_max_mtu,\n+\t.port_fdb_add\t\t\t= netc_port_fdb_add,\n+\t.port_fdb_del\t\t\t= netc_port_fdb_del,\n+\t.port_fdb_dump\t\t\t= netc_port_fdb_dump,\n+\t.port_mdb_add\t\t\t= netc_port_mdb_add,\n+\t.port_mdb_del\t\t\t= netc_port_mdb_del,\n+\t.port_set_host_flood\t\t= netc_port_set_host_flood,\n };\n \n static int netc_switch_probe(struct pci_dev *pdev,\n@@ -807,6 +1379,7 @@ static int netc_switch_probe(struct pci_dev *pdev,\n \tds->num_tx_queues = NETC_TC_NUM;\n \tds->ops = &netc_switch_ops;\n \tds->phylink_mac_ops = &netc_phylink_mac_ops;\n+\tds->fdb_isolation = true;\n \tds->priv = priv;\n \tpriv->ds = ds;\n \ndiff --git a/drivers/net/dsa/netc/netc_switch.h b/drivers/net/dsa/netc/netc_switch.h\nindex eb65c36ecead..3efe37fca390 100644\n--- a/drivers/net/dsa/netc/netc_switch.h\n+++ b/drivers/net/dsa/netc/netc_switch.h\n@@ -30,6 +30,8 @@\n \n #define NETC_MAX_FRAME_LEN\t\t9600\n \n+#define NETC_STANDALONE_PVID\t\t0\n+\n struct netc_switch;\n \n struct netc_switch_info {\n@@ -43,6 +45,11 @@ struct netc_port_caps {\n \tu32 pseudo_link:1;\n };\n \n+enum netc_host_reason {\n+\t/* Software defined host reasons */\n+\tNETC_HR_HOST_FLOOD = 8,\n+};\n+\n struct netc_port {\n \tvoid __iomem *iobase;\n \tstruct netc_switch *switch_priv;\n@@ -50,6 +57,11 @@ struct netc_port {\n \tstruct dsa_port *dp;\n \tstruct clk *ref_clk; /* RGMII/RMII reference clock */\n \tstruct mii_bus *emdio;\n+\n+\tu16 enable:1;\n+\tu16 uc:1;\n+\tu16 mc:1;\n+\tstruct ipft_entry_data *host_flood;\n };\n \n struct netc_switch_regs {\n@@ -58,6 +70,13 @@ struct netc_switch_regs {\n \tvoid __iomem *global;\n };\n \n+struct netc_fdb_entry {\n+\tu32 entry_id;\n+\tstruct fdbt_cfge_data cfge;\n+\tstruct fdbt_keye_data keye;\n+\tstruct hlist_node node;\n+};\n+\n struct netc_switch {\n \tstruct pci_dev *pdev;\n \tstruct device *dev;\n@@ -69,6 +88,11 @@ struct netc_switch {\n \tstruct netc_port **ports;\n \n \tstruct ntmp_user ntmp;\n+\tstruct hlist_head fdb_list;\n+\tstruct mutex fdbt_lock; /* FDB table lock */\n+\n+\t/* Switch hardware capabilities */\n+\tu32 num_fdb_gmac;\n };\n \n #define NETC_PRIV(ds)\t\t\t((struct netc_switch *)((ds)->priv))\n@@ -91,6 +115,18 @@ static inline bool is_netc_pseudo_port(struct netc_port *np)\n \treturn np->caps.pseudo_link;\n }\n \n+static inline void netc_add_fdb_entry(struct netc_switch *priv,\n+\t\t\t\t      struct netc_fdb_entry *entry)\n+{\n+\thlist_add_head(&entry->node, &priv->fdb_list);\n+}\n+\n+static inline void netc_del_fdb_entry(struct netc_fdb_entry *entry)\n+{\n+\thlist_del(&entry->node);\n+\tkfree(entry);\n+}\n+\n int netc_switch_platform_probe(struct netc_switch *priv);\n \n #endif\ndiff --git a/drivers/net/dsa/netc/netc_switch_hw.h b/drivers/net/dsa/netc/netc_switch_hw.h\nindex 7d9afb493053..b04e9866d72a 100644\n--- a/drivers/net/dsa/netc/netc_switch_hw.h\n+++ b/drivers/net/dsa/netc/netc_switch_hw.h\n@@ -36,6 +36,9 @@\n #define  VFHTDECR2_MLO\t\t\tGENMASK(26, 24)\n #define  VFHTDECR2_MFO\t\t\tGENMASK(28, 27)\n \n+#define NETC_FDBHTCAPR\t\t\t0x2020\n+#define  FDBHTCAPR_NUM_GMAC\t\tGENMASK(8, 0)\n+\n /* Definition of Switch port registers */\n #define NETC_PCAPR\t\t\t0x0000\n #define  PCAPR_LINK_TYPE\t\tBIT(4)\n@@ -67,6 +70,9 @@\n #define  PQOSMR_VQMP\t\t\tGENMASK(19, 16)\n #define  PQOSMR_QVMP\t\t\tGENMASK(23, 20)\n \n+#define NETC_PIPFCR\t\t\t0x0084\n+#define  PIPFCR_EN\t\t\tBIT(0)\n+\n #define NETC_POR\t\t\t0x100\n #define  POR_TXDIS\t\t\tBIT(0)\n #define  POR_RXDIS\t\t\tBIT(1)\n@@ -122,6 +128,14 @@ enum netc_mfo {\n #define  BPDVR_RXVAM\t\t\tBIT(24)\n #define  BPDVR_TXTAGA\t\t\tGENMASK(26, 25)\n \n+#define NETC_BPSTGSR\t\t\t0x520\n+\n+enum netc_stg_stage {\n+\tNETC_STG_STATE_DISABLED = 0,\n+\tNETC_STG_STATE_LEARNING,\n+\tNETC_STG_STATE_FORWARDING,\n+};\n+\n /* Definition of Switch ethernet MAC port registers */\n #define NETC_PMAC_OFFSET\t\t0x400\n #define NETC_PM_CMD_CFG(a)\t\t(0x1008 + (a) * 0x400)\n","prefixes":["v5","net-next","12/15"]}