From patchwork Wed Apr 26 06:25:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geetha sowjanya X-Patchwork-Id: 87635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp42648vqo; Tue, 25 Apr 2023 23:38:29 -0700 (PDT) X-Google-Smtp-Source: AKy350aW4h1TVorMdm7V88hZ3+vNCwBM5v9icKAgpLpMA5Lly/iOmgT0lgfGkx0GZm+KQtQb5pZd X-Received: by 2002:a17:902:d54c:b0:1a5:19d1:f904 with SMTP id z12-20020a170902d54c00b001a519d1f904mr22282131plf.43.1682491108799; Tue, 25 Apr 2023 23:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682491108; cv=none; d=google.com; s=arc-20160816; b=jBjNpvzjGoWWn5wzeJTCvM7mvz/l+DvIQWdF3vifBTNtm/sQ3jg3zXzUrWdzhdF342 W00iBEf9HGJ2TKnB+77UOW2kaJj2tj2Xn56T+izYV42eqlB6L4O0jzQx9IIO6i+ToX7w bcm8uIllKLkaarjWA4gBwm9IUQlSbKHiEeTiGK/lBR17aHpKMb1h8+SyOH7dS1kXoPh3 t4HZaebJWvilIHKTt3G+ns/hueMKGFCgKSC/CdsHeS78YSbkC5s6fL8GssKYOv7c25v7 /QcNWFaVH1wNLNPjRUuSN5BzrgauBZPlldg/RUCJrHMNk6JI82mofq9S4RZ6Dbaz6t8X fldw== 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=4oeHPgFKJVUxQHp3g5Tc+JBCQQRS4AIR1GkiaUzw9x8=; b=IXOjodTI3LWjKMHS8h/fuyqQnedV5Ue1aYZ02CsJnfqgSJchPpwKVZi7vnO/22i3Xx 7TVnERZcXQrEUUcdPouIk+FVj1St8YzOj6NHtVTKdwxMg7CLxLu7ThHrzG3gm9/KXlq8 ia8lcZ0zXa26Yr5Yx2GXs60XzfdI+rYxPjmKMLuhphS+/2+lPyxhA27huXCE15yCBO84 TNH4tExMMnrmDNkmS3K6KuQwiCNSj4gOO6xqnLQ7A/rtijVjF1uYtH92HxM1dP3+/9+4 aeg9Fymy/z7ON5UvFcvO0aqVnjSx9QG/eg39q7c8YOoF5qp/tG8X0TlE38pRlMEDiaCa HwuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=To2ttArs; 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 k8-20020a170902c40800b001a04ed06ea0si17523945plk.419.2023.04.25.23.38.13; Tue, 25 Apr 2023 23:38:28 -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=To2ttArs; 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 S239578AbjDZG1Y (ORCPT + 99 others); Wed, 26 Apr 2023 02:27:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239597AbjDZG1R (ORCPT ); Wed, 26 Apr 2023 02:27:17 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA373AAB; Tue, 25 Apr 2023 23:26:39 -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 33Q64EO5000793; Tue, 25 Apr 2023 23:26:08 -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=4oeHPgFKJVUxQHp3g5Tc+JBCQQRS4AIR1GkiaUzw9x8=; b=To2ttArs4iw531JsHpPZFbAhy4ZTJQ3gm+XvZisHMqjETgD9dkVe9BRMkPRBOT5ggQHC vKNQy+aRstWqo6Gacll1qDVb1yBsk2pEBuwN72gY1ja/ozdzpKveTUvNQtI1o0JeW0/g wz5MANK0z34r3v/KLu/dDmnI6ZqvECGJ4SGEDoI8pS1SscTRZzzkSrZQzGSLHTdlHSD7 Dzv8WCAlPYFUS/ozXsHEdrj/do5bQjc2B59HK1hUo6fN/w/7HnHmA9zINm5LcDHl1FBr +f3Gyc46hNcTEfsd+FisWV18j7BarIkIr/wXS6s1MoAtqHBn7xJzVl5q7XOYZqU54Y19 Zg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdcx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 25 Apr 2023 23:26:07 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 25 Apr 2023 23:26:05 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 25 Apr 2023 23:26:05 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 880933F707F; Tue, 25 Apr 2023 23:26:02 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , , Subject: [net PATCH v2 9/9] octeontx2-pf: mcs: Do not reset PN while updating secy Date: Wed, 26 Apr 2023 11:55:28 +0530 Message-ID: <20230426062528.20575-10-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230426062528.20575-1-gakula@marvell.com> References: <20230426062528.20575-1-gakula@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: V2qwY2fhzsJ4KV9_ZRd6W_-TOIdKD2M1 X-Proofpoint-GUID: V2qwY2fhzsJ4KV9_ZRd6W_-TOIdKD2M1 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-26_02,2023-04-25_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,URIBL_BLOCKED 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?1764219796664498281?= X-GMAIL-MSGID: =?utf-8?q?1764219796664498281?= 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; }