Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp341962rwr; Tue, 25 Apr 2023 23:29:10 -0700 (PDT) X-Google-Smtp-Source: AKy350YjgJVcGr/b9z6YOxTrNlbScE2JKlPkQP7fuMEo44V/gC77PSbm8pCdZYRDoWAV1i26NhRs X-Received: by 2002:a17:90a:f115:b0:23f:2661:f94c with SMTP id cc21-20020a17090af11500b0023f2661f94cmr19732485pjb.47.1682490550072; Tue, 25 Apr 2023 23:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682490550; cv=none; d=google.com; s=arc-20160816; b=O9lnfEdFiLnTTb7T8iP/ZG9sWOkgXVZHQbHJoLej8a6UfeVOimis5OVVEKPWB5rchT kodEiGB/GikKuFeFR+NWNyV9rqJopqAqaFKSw1RYp34rf5nF46/overQKpplCXFW8SMX 1m9nit0W71VukTmWEoO+x8ZwUhl6gUMwpgSMlUIz5NsQPKWaAbDpWFBlSLoi1sff92wN VkwX31tHP8H66+a19/B+j3uns24eabnCXoga8FyGhrfj66ETVzxqu4lgJVugSPH+cw1T 7DGfcNzc2QK0FdatrDVReqt9o7AHcD9EWcho2D9t488Vw45AOZFX9iADCLYvhdclcGsz o28w== 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=DqvQe2lSTO39WaAhIyycdfgVXKcqSizjD7cFiTIzcXQ=; b=lfVHIDiP5VrYcU9cUiEmhEPFL91sRzKtO/xrjb9Ze5v6Ma6qND1BVEAT6Ml4cJDfJA vfDclcrNRFwvSWc/R6KKL5pB6buCKSUWtUYt0cGZAE00WhHUHImH0o5qc+4C9UPnPKBE tUqtow0hu+/Vqermir5R9P1K4+P5SKdhCr2JCwQ+2SUP/V1y07wRXkuKQzayQqyNIKki WCyI2aSdvNtPCyvs/CYkW1TrzGOcPdCsbAhCEyXfwqsaOPeQCclnF/LrMwRAlHbC+jG2 Xs1gffyOWkB3cKu3kNDp+GA9UAzu43mr5Lq9jbFziSa9ZFaSWK9XMcXu/0mYowwJrc+8 PHwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=WDUSqucM; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a17090b018c00b002468b3ff982si15454077pjs.121.2023.04.25.23.28.48; Tue, 25 Apr 2023 23:29:10 -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=WDUSqucM; 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 S239584AbjDZG1N (ORCPT + 99 others); Wed, 26 Apr 2023 02:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239557AbjDZG1L (ORCPT ); Wed, 26 Apr 2023 02:27:11 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C73632D69; Tue, 25 Apr 2023 23:26:32 -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 33Q64AmT000573; Tue, 25 Apr 2023 23:26:04 -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=DqvQe2lSTO39WaAhIyycdfgVXKcqSizjD7cFiTIzcXQ=; b=WDUSqucMiVNeFuRknoITd/pSSwkOiV/kPgnuyR3cUjeRg4kKJ9DIpanC05l+tS4nNl8S eObiSRvfeHTMZyfWN1y5N6Rs01t5PPjhOp5E8e/QL+M+9Kw5MSyplPjP8qjGj7U1zv+c e/SiZAloDDVtpF/BO2uy45NbdTcQbIk+eqhmKoE2KP9OXmzkDa2i0D1W6+vi/7Xov4OK IZU0G2nKbvGCVe96wRXJdEDOui3JTKX5QZfMJQQSlrDwCcwt5h7+Umos7OLWHpBiM1OG vkq6/FGGLvw6XuE2fWUQhyJTFvm1xYq3iEUTH6lJ6ssfwJKiascO1qq4fi6qKm+PAfaa zw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdcx1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 25 Apr 2023 23:26:04 -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; Tue, 25 Apr 2023 23:26:02 -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; Tue, 25 Apr 2023 23:26:02 -0700 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id D74913F706D; Tue, 25 Apr 2023 23:25:58 -0700 (PDT) From: Geetha sowjanya To: , CC: , , , , , , , , Subject: [net PATCH v2 8/9] octeontx2-pf: mcs: Fix shared counters logic Date: Wed, 26 Apr 2023 11:55:27 +0530 Message-ID: <20230426062528.20575-9-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 Content-Type: text/plain X-Proofpoint-ORIG-GUID: 4S5kSwWKK7rUS6OVYB0oqns0l7cZS44l X-Proofpoint-GUID: 4S5kSwWKK7rUS6OVYB0oqns0l7cZS44l 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 From: Subbaraya Sundeep Macsec stats like InPktsLate and InPktsDelayed share same counter in hardware. If SecY replay_protect is true then counter represents InPktsLate otherwise InPktsDelayed. This mode change was tracked based on protect_frames instead of replay_protect mistakenly. Similarly InPktsUnchecked and InPktsOk share same counter and mode change was tracked based on validate_check instead of validate_disabled. This patch fixes those problems. 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 | 14 +++++++------- .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c index a108f986be50..0ef44faa1ee8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c @@ -1014,7 +1014,7 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy /* Check if sync is really needed */ if (secy->validate_frames == txsc->last_validate_frames && - secy->protect_frames == txsc->last_protect_frames) + secy->replay_protect == txsc->last_replay_protect) return; cn10k_mcs_secy_stats(pfvf, txsc->hw_secy_id_rx, &rx_rsp, MCS_RX, true); @@ -1036,19 +1036,19 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy rxsc->stats.InPktsInvalid += sc_rsp.pkt_invalid_cnt; rxsc->stats.InPktsNotValid += sc_rsp.pkt_notvalid_cnt; - if (txsc->last_protect_frames) + if (txsc->last_replay_protect) rxsc->stats.InPktsLate += sc_rsp.pkt_late_cnt; else rxsc->stats.InPktsDelayed += sc_rsp.pkt_late_cnt; - if (txsc->last_validate_frames == MACSEC_VALIDATE_CHECK) + if (txsc->last_validate_frames == MACSEC_VALIDATE_DISABLED) rxsc->stats.InPktsUnchecked += sc_rsp.pkt_unchecked_cnt; else rxsc->stats.InPktsOK += sc_rsp.pkt_unchecked_cnt; } txsc->last_validate_frames = secy->validate_frames; - txsc->last_protect_frames = secy->protect_frames; + txsc->last_replay_protect = secy->replay_protect; } static int cn10k_mdo_open(struct macsec_context *ctx) @@ -1120,7 +1120,7 @@ static int cn10k_mdo_add_secy(struct macsec_context *ctx) txsc->sw_secy = secy; txsc->encoding_sa = secy->tx_sc.encoding_sa; txsc->last_validate_frames = secy->validate_frames; - txsc->last_protect_frames = secy->protect_frames; + txsc->last_replay_protect = secy->replay_protect; list_add(&txsc->entry, &cfg->txsc_list); @@ -1544,12 +1544,12 @@ static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx) rxsc->stats.InPktsInvalid += rsp.pkt_invalid_cnt; rxsc->stats.InPktsNotValid += rsp.pkt_notvalid_cnt; - if (secy->protect_frames) + if (secy->replay_protect) rxsc->stats.InPktsLate += rsp.pkt_late_cnt; else rxsc->stats.InPktsDelayed += rsp.pkt_late_cnt; - if (secy->validate_frames == MACSEC_VALIDATE_CHECK) + if (secy->validate_frames == MACSEC_VALIDATE_DISABLED) rxsc->stats.InPktsUnchecked += rsp.pkt_unchecked_cnt; else rxsc->stats.InPktsOK += rsp.pkt_unchecked_cnt; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h index 3d22cc6a2804..f42b2b65bfd7 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h @@ -389,7 +389,7 @@ struct cn10k_mcs_txsc { struct cn10k_txsc_stats stats; struct list_head entry; enum macsec_validation_type last_validate_frames; - bool last_protect_frames; + bool last_replay_protect; u16 hw_secy_id_tx; u16 hw_secy_id_rx; u16 hw_flow_id; -- 2.25.1