From patchwork Thu Oct 19 12:02:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Radu Pirea (NXP OSS)" X-Patchwork-Id: 13428728 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3F2A1DFE0 for ; Thu, 19 Oct 2023 12:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=NXP1.onmicrosoft.com header.i=@NXP1.onmicrosoft.com header.b="TQM2dRoy" Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on2070.outbound.protection.outlook.com [40.107.13.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A9C19A; Thu, 19 Oct 2023 05:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UAJCGfgTWUyyF7SzrVJSnujcS+paps8VNoKa9VBmOYNddqhkuxsbmfJyeocXbXWRkmDUb9PD2I9V3nKKQmqtzsL5uzHTzQWBr7uAQV0+hGoNrYNOb06/tjGO2rCscxhmiftxmz4T0fp5x/mz1vtYPp+4T5HG4fFk+aXrD+JZOCGF/5habShmGgOzkPygPK4ZX1jE7TsYJDAV1g77Y1/nSjHXmCSX6FdbvuQ7gMMPgg0D0TtcQKr+cUkggiJx7cRgWXK4zdJbIv+PXqXGcgJg8Y39vhqmlL8KOhQTEGvG3Y6V+3IM5kYd8fxA/59LFeKfFOPqb1Ln+lD2v31TDMKeVw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tJ6IWB1eO23xxxCaqkfHUdzdxtoCCVxgxW7CGg8ub4o=; b=HCH1reW/UuyAmIO3IWsAnK28um9by+lQeFlzyZqGYG7obojBvYlMkYid9y62SY1nrTHZwwZsLfD9wlJw4WXXQrnsD3JZtPcBxaE9VNmT1N/XK4xR2rQ2NHofPNtq+uNH3Vty5bJBGQyhHHuDSkfmc/1bv2iovFnpkkCWFwkVELoEHAoKq5x0gWLDoZA9RtmsqazzriVbPguaXsXqW3OzU4H/1p30u1uiy8t7NO+dBTukmJogOSdUkiDuxFehCyZVmetJmsUyr2LdXNOfBWOU/nBgkbhFmJHqXGhw3zhbYEzvs9t6Xe5n3Wh2f1sBfx99R0DgmsLNxHyIr1NOTjHNpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tJ6IWB1eO23xxxCaqkfHUdzdxtoCCVxgxW7CGg8ub4o=; b=TQM2dRoyPja4XbBpCzeacslMIBI66nalXNW5p8Yk/QvCHFqEgSYb1W4pJ3daXCHg7PTMOTThOaC91wbnZnXVsRNPS+JIS5rAx4NrVvgJqy8jYCL8vaS2dycyspZdbW75ixvdrp+c8Yq73Dbnx600TjM3IC6TIDbj7/tHTi8GbgU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) by DBBPR04MB7961.eurprd04.prod.outlook.com (2603:10a6:10:1ee::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.7; Thu, 19 Oct 2023 12:02:50 +0000 Received: from AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::e109:7026:7d76:5617]) by AM9PR04MB8954.eurprd04.prod.outlook.com ([fe80::e109:7026:7d76:5617%7]) with mapi id 15.20.6933.008; Thu, 19 Oct 2023 12:02:50 +0000 From: "Radu Pirea (NXP OSS)" To: sd@queasysnail.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, richardcochran@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, sebastian.tobuschat@oss.nxp.com, "Radu Pirea (NXP OSS)" Subject: [PATCH net-next v7 0/7] Add MACsec support for TJA11XX C45 PHYs Date: Thu, 19 Oct 2023 15:02:02 +0300 Message-Id: <20231019120209.290480-1-radu-nicolae.pirea@oss.nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: VI1PR08CA0236.eurprd08.prod.outlook.com (2603:10a6:802:15::45) To AM9PR04MB8954.eurprd04.prod.outlook.com (2603:10a6:20b:409::7) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR04MB8954:EE_|DBBPR04MB7961:EE_ X-MS-Office365-Filtering-Correlation-Id: ca1cec73-e0da-4642-92b8-08dbd09b505d X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9bf5XIhjFIZuDqJQRaWqTI65TS00jSiQF4rL684lwxorYOazs6TdZPy+Pq08+X6VRH8CiBtMFFDKyv2uZgaksvQr2QAVtrKEjs/v0CFG+RKIivPPUqH+dAySqklAl2E/gH6MBCqIxswcgNjPxZMsht5xRAFuQD+2uX63fKSLFOcQvHcgKeyi0C4fahZxnQD2TojsyiZ7/Mlbq36PQr2yzSHWHMOgqsItQwwGuyWJGgeI7PwmkSFq8PZVWfRTTGeAXMzl0khasrDLOHUUr0+Mkhuo+KWXMe3vAPWY6j+sg1c2PeF5BaZC2QE/UZxxWiufaSE/h88FdMTPYJdReG8fKHYGjyNviM7sCG9uMFZv7U5D9Czfu79IQmF5yPPGi69q+WN6SPl9rbgnbUS8EiPqiNoACscg5Vyn7GEzPCJrSiEkmJp2U60gO/HuGl/h/8rukuOVwYnc97/pBhLncmQRx8sgXeko+0IZyul168cHEC6zN23iCnDrsDrFehRUAeHUE89NbblSN6j3/WHqGo4zgKswvT7d06tZwVdjXpCBqYEwb24Sg/EI520DWlsOi3EMFBRXWv7qq4WPBD8AmnFelwtWvLJTHZRGWvFtCY1zxe3Bhv5x85NxKFAwEhtgSdr4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM9PR04MB8954.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(396003)(346002)(136003)(39860400002)(376002)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(38350700005)(41300700001)(6506007)(38100700002)(4326008)(8676002)(2906002)(7416002)(86362001)(83380400001)(1076003)(26005)(6512007)(2616005)(52116002)(5660300002)(6486002)(6666004)(478600001)(8936002)(316002)(66476007)(66556008)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: metzaYOjr+vGbllQd66niENEKQ1KQZV9eIV7hgYMspR9QKE9CtIc/4HOSlMxsc6Bxt+Y7KqHFbF4VdvFHSaZYoWwRFTFpsJW+CJpAh9P+4yf3gnbIMk42iiSEBT5yyuyetCv/Y/gLkZxI9UWooWUFZkB9ykv60kY0CzlJm3jfahHhl6FAbtDI998tRNAKRKQwbpJ2aGW5Rz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WqIWOx4uZRTXY3PG+C76r2ZH7C8g4NMUU51Ms7RAMy7CIAu3ELENa1qBY8+G2XwXQTfoJg9y77JP+Wg1HuPF2azudNykR0Y/SDjRLZ0cWYuoaTfL4qEgXW/7AEYo8vsvSzZ8cYQW/uVfxaqDn0QimItVA7I0bEhK8FpFQ5o/tZUH+Aq9iC7CimwvLGzCTjUHjNl6mypfTS+XgUB73RFoaX09XSwcYLeexOe90s404JM4fs8cFwOmxTBYxh6gYWuBeD88MfF29joouCV4zQZ24Od7p8Kc/qgBR06zpm+rglt4cLOTh1NNBSxj7TgSenn+TcW+2A6dpDgI114SnxESFWN9eeFGQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca1cec73-e0da-4642-92b8-08dbd09b505d X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8954.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2023 12:02:50.0511 (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: HOgZTuWkoFmG1BGHTsuIyj+g1MTTr13ramXJEjiI/iEYUce55RPbhHlNdJQ1QgmKC+ONBumRd5eMSpwsOTBB3so5/yMkdQ4n82I9R4nulik= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7961 X-Patchwork-Delegate: kuba@kernel.org This is the MACsec support for TJA11XX PHYs. The MACsec block encrypts the ethernet frames on the fly and has no buffering. This operation will grow the frames by 32 bytes. If the frames are sent back to back, the MACsec block will not have enough room to insert the SecTAG and the ICV and the frames will be dropped. To mitigate this, the PHY can parse a specific ethertype with some padding bytes and replace them with the SecTAG and ICV. These padding bytes might be dummy or might contain information about TX SC that must be used to encrypt the frame. Radu P. Radu Pirea (NXP OSS) (7): net: macsec: move sci_to_cpu to macsec header net: macsec: documentation for macsec_context and macsec_ops net: macsec: revert the MAC address if mdo_upd_secy fails net: macsec: introduce mdo_insert_tx_tag net: phy: nxp-c45-tja11xx: add MACsec support net: phy: nxp-c45-tja11xx: add MACsec statistics net: phy: nxp-c45-tja11xx: implement mdo_insert_tx_tag MAINTAINERS | 2 +- drivers/net/macsec.c | 144 +- drivers/net/netdevsim/macsec.c | 5 - drivers/net/phy/Kconfig | 2 +- drivers/net/phy/Makefile | 6 +- drivers/net/phy/nxp-c45-tja11xx-macsec.c | 1724 ++++++++++++++++++++++ drivers/net/phy/nxp-c45-tja11xx.c | 77 +- drivers/net/phy/nxp-c45-tja11xx.h | 62 + include/net/macsec.h | 54 + 9 files changed, 2028 insertions(+), 48 deletions(-) create mode 100644 drivers/net/phy/nxp-c45-tja11xx-macsec.c create mode 100644 drivers/net/phy/nxp-c45-tja11xx.h