From patchwork Sun Apr 23 09:54:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geetha sowjanya X-Patchwork-Id: 86686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2119707vqo; Sun, 23 Apr 2023 03:15:19 -0700 (PDT) X-Google-Smtp-Source: AKy350a0E9y63qqzD/9Vv5xrbcEhXf1gGxVcFCyoG8XGH2qG2kwKptIGer+FNVelw3YhVofRXz02 X-Received: by 2002:a17:902:c40f:b0:1a6:4e7b:7037 with SMTP id k15-20020a170902c40f00b001a64e7b7037mr14458009plk.69.1682244919426; Sun, 23 Apr 2023 03:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682244919; cv=none; d=google.com; s=arc-20160816; b=DHAJepzqoe3cQW70DiEEGWQnCEaqt6ZLzBJuB4T9qSHgrpjbnC6fFTLU+0PHlazDIb 2icS5EMsYAfx+Rq7k0pxb3Bs5rwQ7fzKvp5PeWnT5SHao8k0TmkeYPzoWZQRYUapN84p 50ZQE10zDE6/6qmVTXd2N6408FGOOVwD2mNfcqUGzWU4pZ4lcKrzF3uDkVbA2ObTuTMP 1NCf+sfmSP7ffOuhvhwfI1eKK56jmRbQZcqfjp5B7pzjnYDJ229SaY9YkfRRfefVuPi0 iysy5IqkaSue53t8mokA2fmK04F1F9K0FYqaYq9ReLdzBoPBzfSDGEIEqQUlnPHE2IC9 GjwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rWYnN6oOOSKQumjx6Xkd4ZNAgEqtsYFhL4sV/ZNKiwM=; b=wHxiF7YwbOdg/v7rUlu3H3Q1eKT+9d9dJBvcvS3aepmWbWfuq8gBnn44+/G9fPgth1 pP7/kJDnRkXmSgvQc4aWozcKvp1+enfX2oj/ho+ouifhQvzU76OkudBke49gOFCxEGi6 GbF+veuOHreA4EqQOkb5rXtC+DLNzcXfNOOTeFGgkJpVTVwxv/GHiAI5xFDlutaSopth mXQ8uqm7zFn2qr4Ks0nebBosezaGX5IKvMl5/WrBGiC0qnumXV0LSXlY5iCiOixGLGeV 2xI45Sjz2r7bVogCoBv+9aliQ5zr68pVk7B3iv+VQoBR+t4gFgDseBoUoR/UHe2VPtlb Ap+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Xl0MGaEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s4-20020a170902ea0400b001a647aadbeasi9773287plg.416.2023.04.23.03.15.05; Sun, 23 Apr 2023 03:15:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Xl0MGaEq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230301AbjDWJ4x (ORCPT + 99 others); Sun, 23 Apr 2023 05:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbjDWJ4Z (ORCPT ); Sun, 23 Apr 2023 05:56:25 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548BF273A; Sun, 23 Apr 2023 02:55:58 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33N4iPJW009043; Sun, 23 Apr 2023 02:55:36 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=rWYnN6oOOSKQumjx6Xkd4ZNAgEqtsYFhL4sV/ZNKiwM=; b=Xl0MGaEq0ToDfVhnDTg6OvBCL7Xy2qODJkKWC01gVo1hp2Q0nM+vzh+IAEim7uTkSmdX sfdqE4XKy47KaL8/ttU6uHxtde7VIixD13s4o85jpqpYSmlZmj49sfpbcU2/Eh8GaOKP Xd3FgKOdyW/5dFLr73ZPwwsEE7mwSQF1MtoghlXte6cvAsZLOLtnDLOhhcNoAtge1KJB drgFVIvKE8/JSjxSp5Dye68ADcFuNYY5HiLaYrmK7tQ5hwrw1qE5rY+O8fHw1dm42daB hfsIlBTv1qheIaPVXn3eX+9MWvetupxC17Ee9sTgZ8LrYB6i95L96EPQefA2ld8I+kkZ 5w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3p2pru-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 23 Apr 2023 02:55:36 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 23 Apr 2023 02:55:34 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Sun, 23 Apr 2023 02:55:34 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 85B1E3F706A; Sun, 23 Apr 2023 02:55:30 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , , Subject: [net PATCH 9/9] octeontx2-pf: mcs: Do not reset PN while updating secy Date: Sun, 23 Apr 2023 15:24:54 +0530 Message-ID: <20230423095454.21049-10-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230423095454.21049-1-gakula@marvell.com> References: <20230423095454.21049-1-gakula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4BHql2XAa2T1xiVf7I1SLr7PFsiTds_i X-Proofpoint-GUID: 4BHql2XAa2T1xiVf7I1SLr7PFsiTds_i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-23_06,2023-04-21_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763961648772221035?= X-GMAIL-MSGID: =?utf-8?q?1763961648772221035?= From: Subbaraya Sundeep After creating SecYs, SCs and SAs a SecY can be modified to change attributes like validation mode, protect frames mode etc. During this SecY update, packet number is reset to initial user given value by mistake. Hence do not reset PN when updating SecY parameters. Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Goutham Signed-off-by: Geetha sowjanya Reviewed-by: Leon Romanovsky --- .../ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c index 0ef44faa1ee8..9ef70980f786 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c @@ -1137,6 +1137,7 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx) struct macsec_secy *secy = ctx->secy; struct macsec_tx_sa *sw_tx_sa; struct cn10k_mcs_txsc *txsc; + bool active; u8 sa_num; int err; @@ -1144,15 +1145,19 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx) if (!txsc) return -ENOENT; - txsc->encoding_sa = secy->tx_sc.encoding_sa; - - sa_num = txsc->encoding_sa; - sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); + /* Encoding SA got changed */ + if (txsc->encoding_sa != secy->tx_sc.encoding_sa) { + txsc->encoding_sa = secy->tx_sc.encoding_sa; + sa_num = txsc->encoding_sa; + sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); + active = sw_tx_sa ? sw_tx_sa->active : false; + cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, sa_num, active); + } if (netif_running(secy->netdev)) { cn10k_mcs_sync_stats(pfvf, secy, txsc); - err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, sw_tx_sa, sa_num); + err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, NULL, 0); if (err) return err; }