From patchwork Thu Oct 5 18:06:34 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: 13410574 X-Patchwork-Delegate: kuba@kernel.org 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 1498C3D963 for ; Thu, 5 Oct 2023 18:07:39 +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="QCrYnS04" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2085.outbound.protection.outlook.com [40.107.21.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC92BCE; Thu, 5 Oct 2023 11:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QdqbJf6pHzJd1QXnjJd/dtmTfCuKXnWAMoIt6DJSMSlFiHP0ZDgCsKgxLuO6in5skzeES2E7Q/uMf/XxCqwGxHrLl6nfFJTJ04z0lTIfRVQpwXVHTAV+luW0aHrTaThrxLEFc99r1/Lqagen5k0J/8mahmHw0MV7pXJKvvwAxco9CDK3ajGhAzWcZHsfDMPJudvDMew36+uGnyyWzfott6p89lz1uIHTsU1rU0Bv/jwDAJIYhUaDngNEyb9cuasKhNgu7e23Vw8JUUajHa0CV5nk/tF5atZtlFbE4vIpUVj1ExTZOoumfFwUUVXcC72GGqXuhbOjoQO8mEKJj6DwXg== 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=Kj9o35ZKZhPAMSqqE+x2UeOe/m3DP19wAy6ruvbsgPU=; b=c4gtifYw776/MBY4x+JCxDDJ90jCd3iaKVFcakgzmJabnB4nxmSuPCNpCbWZOj6TsjI4eC1ubgG12UhwwBdK816inEmKPEV16eZdn9ctLjmWUP5/6wyt+ogDK0wclO+amkqIFuZCFxP7nb09VWXw8J+8FyDP/NzSQxDn4yqAChhT2PiiZdZGE9dlhz82EHDznCX3wlnd62AGOxeS0eALCD/DyJRA8qW6yk/lqX+EhggoZqHiuME0PqL233ut2SrbFRm6Hp0YWF23FWCee8BrSMO/MVcROcKBvddHCPnChgortq/WVC67VsO+hY146RTsoCDBPtL366w47zDkhqXxSQ== 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=Kj9o35ZKZhPAMSqqE+x2UeOe/m3DP19wAy6ruvbsgPU=; b=QCrYnS048LlUEokW+4sj4Ls5GS+rSo/THOyVsfzyTsk08kueiN3gEvbOFdF+mDCWZXaXXiNj5l3dRBEWOLIutfvAZcFhpAzfc3uts4uUTRvKAP9Zr4ROm1K0SvWft+ZfN2kBCXDxUt+ZJltIKflTK1cu6rFfKIyyeJyb6Q4untM= 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 AM8PR04MB7890.eurprd04.prod.outlook.com (2603:10a6:20b:24e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.23; Thu, 5 Oct 2023 18:07:34 +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.6838.033; Thu, 5 Oct 2023 18:07:34 +0000 From: "Radu Pirea (NXP OSS)" To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-rdma@vger.kernel.org Cc: sgoutham@marvell.com, gakula@marvell.com, sbhatta@marvell.com, hkelam@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, borisp@nvidia.com, saeedm@nvidia.com, leon@kernel.org, sd@queasysnail.net, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, richardcochran@gmail.com, sebastian.tobuschat@oss.nxp.com, phaddad@nvidia.com, ehakim@nvidia.com, raeds@nvidia.com, atenart@kernel.org, "Radu Pirea (NXP OSS)" Subject: [PATCH net v7 2/4] octeontx2-pf: mcs: update PN only when update_pn is true Date: Thu, 5 Oct 2023 21:06:34 +0300 Message-Id: <20231005180636.672791-3-radu-nicolae.pirea@oss.nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231005180636.672791-1-radu-nicolae.pirea@oss.nxp.com> References: <20231005180636.672791-1-radu-nicolae.pirea@oss.nxp.com> X-ClientProxiedBy: VI1P194CA0041.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::30) 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_|AM8PR04MB7890:EE_ X-MS-Office365-Filtering-Correlation-Id: c31e4110-02e9-4ee0-3ccd-08dbc5cdf347 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: UhLoi05Bp8HAlb+rLjbuNJAM9/0CODzC/w22OvJoVHjmrtszW5sRryOaUZ8+WFE3zfvc+jpNQkGkzujBl1r0JW98G4TC1jmiBHpC+NHpcexuDC/HI0F6jhDvsfyt/UjN1tpetBYrNISlIIlSGe6PdvhwQO6QOtqrxhx2ueSo/QtURsaDQYrn9slxnL3XeRw+M+UF/h1zfx9NVXXQiDTJbN29q5M7bLxvhDqHnuNxO0RX+9auTVHnCAAhW28C6kIgkXBYIFMNNycsHdD8S+/n5nwQh/K6QiuQw8+KLpS5cFLscuFuTM+JdKOjf68EuEcQw6VIb1V8MSCB2aRShNIzFT25Rzpc7tSh9Z4XHIXILH+DgM7131oK2qmujlfQRKZvgGuCTuLTyIho2WdJpjLt7O7BKutp0IU8k4HB8IH4RhVZCQfRvbISEhicZ48Ihp1zUinLCYOjiv+jVRXJhlkj+KoVjA3EURdBccrElWMhMsY8plEMLKe2DLfLuL39xu75N8kdcV3YLECWDG/6p1vb1jWQe4M9sBFMSPNMPSyhKZGhT2Gdq2yLyK9OPqcI9TocHCCAYtvd/ASiIGUAxcrr8rymson2X7uU/PqSOXSDF8mGlBvQU2mnkPd9yYW8xvMd 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)(396003)(39860400002)(346002)(366004)(376002)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(6512007)(52116002)(6506007)(478600001)(6486002)(83380400001)(26005)(1076003)(7416002)(2906002)(2616005)(15650500001)(316002)(66476007)(66556008)(66946007)(4326008)(41300700001)(8936002)(8676002)(5660300002)(38100700002)(38350700002)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-Chun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Ui1eJjBtkfzyqCUYp7L6O+DOQC1pKG7amUIx6DlHw0JCqy4+WBH9DG3u2rU5YzwztptpgRSnaL6VJLrUsn39QDhDWJSEwWh9Ia2YHuCknnQzSxHJb3jZuMnV6zwEJFmU4JcaUpGax8/OTKsGJ+SyRlwYSqiTvGqWaBasu3FC5Brv+bLG5BZ4whOO71VDYMeeZVE1p7K3cCsp27z0s6ZbdN+fXl2VSzS2T+KKtmJsw5vQmfFYnkWpeQpX1MnfoJR2rTURsI2d4ImuDzoybQFU+GeXwGP4sF5A8+D1qFvcUwM2AjFkTuBHNqmPsaNJaqhg10h9tFNlvSZzDDTrJcYgMMIdBNvfQeHU1DLtc25BB44ROlRCF9iFCLiYJyQMqqa/hy4t3P0FoflIXsYHaFhyfY7XJFJ5P0LohZdnuNiWG9PbT7VeMaFuBvJ+LesIFYQinLhtBuPhGFsw5choAMQdNgfRssDIEwyp2aeuKkExGvFOyHYVRnwLEiwS4vgc2wSIX8gLjIIj984QubjomDMJXpxTTq9QopxLp8G6dOmmqD9lqZqUSQ== X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c31e4110-02e9-4ee0-3ccd-08dbc5cdf347 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8954.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2023 18:07:34.4833 (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: 8J9eopdDUsPVYU+WwfAqFj/1AqEaYT90OuEirgwkbEBrLX9cfRwGWDdg+znp89iR46gzbhzAdWtgvQCxF2jZTbFQpaxzEqp81ClSq/XvV8g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7890 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org When updating SA, update the PN only when the update_pn flag is true. Otherwise, the PN will be reset to its previous value using the following command and this should not happen: $ ip macsec set macsec0 tx sa 0 on Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Radu Pirea (NXP OSS) --- Changes in v7: - fixed update_pn check in cn10k_mdo_upd_txsa Changes in v6: - patch added in v6 .../ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c index 59b138214af2..6cc7a78968fc 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c @@ -1357,10 +1357,12 @@ static int cn10k_mdo_upd_txsa(struct macsec_context *ctx) if (netif_running(secy->netdev)) { /* Keys cannot be changed after creation */ - err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num, - sw_tx_sa->next_pn); - if (err) - return err; + if (ctx->sa.update_pn) { + err = cn10k_write_tx_sa_pn(pfvf, txsc, sa_num, + sw_tx_sa->next_pn); + if (err) + return err; + } err = cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, sa_num, sw_tx_sa->active); @@ -1529,6 +1531,9 @@ static int cn10k_mdo_upd_rxsa(struct macsec_context *ctx) if (err) return err; + if (!ctx->sa.update_pn) + return 0; + err = cn10k_mcs_write_rx_sa_pn(pfvf, rxsc, sa_num, rx_sa->next_pn); if (err)