From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0685F42CA8; Tue, 13 Jun 2023 11:47:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9A23240A8A; Tue, 13 Jun 2023 11:47:02 +0200 (CEST) Received: from mail-vk1-f181.google.com (mail-vk1-f181.google.com [209.85.221.181]) by mails.dpdk.org (Postfix) with ESMTP id 941AE40698 for ; Tue, 13 Jun 2023 11:47:01 +0200 (CEST) Received: by mail-vk1-f181.google.com with SMTP id 71dfb90a1353d-46e71b39143so50832e0c.3 for ; Tue, 13 Jun 2023 02:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686649621; x=1689241621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Vo1gvysZ3jXIcGstz19GJdKSDVYlGGIq31qC3hjPuZ8=; b=lRCzuWMjCjkPaVLseE5ZE08ILBb9DlrCCDH72F+25VXwnZYN/JW8ZgS0DJ8U4RyfSf mwjibp9+1oFrV/gIvDTqYGSIgqAkmpmyRnM7CI6UIbZUl3mcC1+Puqz3Qew6W7bQDQWe hVB++lO+ePgKjZHjVIG/SUAg5TbLwkMGMhJK50od0O8RDDqtqx8v6Chl3o4r4mqIDQIw 01P4/U30ZJ0GVVBP1Sgd7AKQbrvXC05w8eU8MC9l7o8oftGpSoab9Rq46Z+5+/l9SsJX 3fmtbbLpFLGeb6g0Zo9cDGm1hkJlAvWFET9lJwlTdkMRyyFORJ8Lmg/5zsiceTvMkGBV 3J2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686649621; x=1689241621; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Vo1gvysZ3jXIcGstz19GJdKSDVYlGGIq31qC3hjPuZ8=; b=STr5wyLb7rrzlU+M74ocOOmv6o2xpHZHnEkR0CqFzjMDXFAYxIm2/61pbiqCol9Pq5 thop3/w0cONAQdZ1TQlYdCcPQHBs4zcuz3innQ9o+7XSMP58m79WXmHgKTRAqz1cqWtH BAsZ3xoBIlSi1J0nJwIZJeIABc9ceo3kDzZlaR0eRNaXk9AantXoOExKweby9Eb00a2Y k17Ho1/pGpyYzidNcVUolWDTbWJ+mQ7imgeY6nwsS7zWUoookxUpfDav/P5gVM7GvO8D PBhn/lNBuFCCAFThSeB2GI2pKFZ+zgac4q8j+M2l2XHkWdfNRKIDl4F2tTwxMvkGPmj2 kFrw== X-Gm-Message-State: AC+VfDxOytHLifPjcQA72MZPwdjqtiVoUTl4tkEeqfJNdle1wwSKhyxw ijLRBq1+4A7dQ8QZ/SGeF11mbLrGm66Llflmifc= X-Google-Smtp-Source: ACHHUZ4PqSFe0YRWKKhMhTJCxJrw2JwX5srmR7mmyo46xYStiu1orGhrUT1Uy19fQuSxJN5D/LCW4Z7mh1Eat75aIP8= X-Received: by 2002:a1f:3dc3:0:b0:46e:6eaf:9071 with SMTP id k186-20020a1f3dc3000000b0046e6eaf9071mr301777vka.12.1686649620912; Tue, 13 Jun 2023 02:47:00 -0700 (PDT) MIME-Version: 1.0 References: <20220928124516.93050-1-gakhil@marvell.com> <20230523200401.1945974-1-gakhil@marvell.com> <20230523200401.1945974-16-gakhil@marvell.com> In-Reply-To: <20230523200401.1945974-16-gakhil@marvell.com> From: Jerin Jacob Date: Tue, 13 Jun 2023 15:16:34 +0530 Message-ID: Subject: Re: [PATCH 15/15] net/cnxk: add MACsec stats To: Akhil Goyal Cc: dev@dpdk.org, thomas@monjalon.net, olivier.matz@6wind.com, orika@nvidia.com, david.marchand@redhat.com, vattunuru@marvell.com, ferruh.yigit@amd.com, jerinj@marvell.com, adwivedi@marvell.com, ndabilpuram@marvell.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, May 24, 2023 at 1:35=E2=80=AFAM Akhil Goyal wr= ote: > > Added support for MACsec SC/flow/session stats. > > Signed-off-by: Akhil Goyal # Please fix the the build issue http://mails.dpdk.org/archives/test-report/2023-June/410104.html # Please rebase to dpdk-next-mrvl as doc is updated in https://patches.dpdk.org/project/dpdk/patch/20230613045652.228319-1-psathee= sh@marvell.com/ > --- > drivers/net/cnxk/cn10k_ethdev_sec.c | 11 +++-- > drivers/net/cnxk/cnxk_ethdev_mcs.c | 64 +++++++++++++++++++++++++++++ > drivers/net/cnxk/cnxk_ethdev_mcs.h | 9 ++++ > 3 files changed, 81 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/cnxk/cn10k_ethdev_sec.c b/drivers/net/cnxk/cn10k= _ethdev_sec.c > index 0a8e7ae6fd..cd0fd1744f 100644 > --- a/drivers/net/cnxk/cn10k_ethdev_sec.c > +++ b/drivers/net/cnxk/cn10k_ethdev_sec.c > @@ -1027,12 +1027,17 @@ cn10k_eth_sec_session_stats_get(void *device, str= uct rte_security_session *sess, > { > struct rte_eth_dev *eth_dev =3D (struct rte_eth_dev *)device; > struct cnxk_eth_dev *dev =3D cnxk_eth_pmd_priv(eth_dev); > + struct cnxk_macsec_sess *macsec_sess; > struct cnxk_eth_sec_sess *eth_sec; > int rc; > > eth_sec =3D cnxk_eth_sec_sess_get_by_sess(dev, sess); > - if (eth_sec =3D=3D NULL) > + if (eth_sec =3D=3D NULL) { > + macsec_sess =3D cnxk_eth_macsec_sess_get_by_sess(dev, ses= s); > + if (macsec_sess) > + return cnxk_eth_macsec_session_stats_get(dev, mac= sec_sess, stats); > return -EINVAL; > + } > > rc =3D roc_nix_inl_sa_sync(&dev->nix, eth_sec->sa, eth_sec->inb, > ROC_NIX_INL_SA_OP_FLUSH); > @@ -1076,6 +1081,6 @@ cn10k_eth_sec_ops_override(void) > cnxk_eth_sec_ops.capabilities_get =3D cn10k_eth_sec_capabilities_= get; > cnxk_eth_sec_ops.session_update =3D cn10k_eth_sec_session_update; > cnxk_eth_sec_ops.session_stats_get =3D cn10k_eth_sec_session_stat= s_get; > - cnxk_eth_sec_ops.macsec_sc_stats_get =3D NULL; > - cnxk_eth_sec_ops.macsec_sa_stats_get =3D NULL; > + cnxk_eth_sec_ops.macsec_sc_stats_get =3D cnxk_eth_macsec_sc_stats= _get; > + cnxk_eth_sec_ops.macsec_sa_stats_get =3D cnxk_eth_macsec_sa_stats= _get; > } > diff --git a/drivers/net/cnxk/cnxk_ethdev_mcs.c b/drivers/net/cnxk/cnxk_e= thdev_mcs.c > index c5ac5bafbb..e79b8279a7 100644 > --- a/drivers/net/cnxk/cnxk_ethdev_mcs.c > +++ b/drivers/net/cnxk/cnxk_ethdev_mcs.c > @@ -517,6 +517,70 @@ cnxk_mcs_flow_destroy(struct cnxk_eth_dev *dev, void= *flow) > return (ret =3D=3D 0) ? 1 : ret; > } > > +int > +cnxk_eth_macsec_sa_stats_get(void *device, uint16_t sa_id, enum rte_secu= rity_macsec_direction dir, > + struct rte_security_macsec_sa_stats *stats) > +{ > + RTE_SET_USED(device); > + RTE_SET_USED(sa_id); > + RTE_SET_USED(dir); > + RTE_SET_USED(stats); > + > + return 0; > +} > + > +int > +cnxk_eth_macsec_sc_stats_get(void *device, uint16_t sc_id, enum rte_secu= rity_macsec_direction dir, > + struct rte_security_macsec_sc_stats *stats) > +{ > + struct rte_eth_dev *eth_dev =3D (struct rte_eth_dev *)device; > + struct cnxk_eth_dev *dev =3D cnxk_eth_pmd_priv(eth_dev); > + struct cnxk_mcs_dev *mcs_dev =3D dev->mcs_dev; > + struct roc_mcs_stats_req req =3D {0}; > + > + if (!roc_feature_nix_has_macsec()) > + return -ENOTSUP; > + > + req.id =3D sc_id; > + req.dir =3D (dir =3D=3D RTE_SECURITY_MACSEC_DIR_RX) ? MCS_RX : MC= S_TX; > + > + return roc_mcs_sc_stats_get(mcs_dev->mdev, &req, (struct roc_mcs_= sc_stats *)stats); > +} > + > +int > +cnxk_eth_macsec_session_stats_get(struct cnxk_eth_dev *dev, struct cnxk_= macsec_sess *sess, > + struct rte_security_stats *stats) > +{ > + struct cnxk_mcs_dev *mcs_dev =3D dev->mcs_dev; > + struct roc_mcs_flowid_stats flow_stats =3D {0}; > + struct roc_mcs_port_stats port_stats =3D {0}; > + struct roc_mcs_stats_req req =3D {0}; > + > + if (!roc_feature_nix_has_macsec()) > + return -ENOTSUP; > + > + req.id =3D sess->flow_id; > + req.dir =3D sess->dir; > + roc_mcs_flowid_stats_get(mcs_dev->mdev, &req, &flow_stats); > + plt_nix_dbg("\n******* FLOW_ID IDX[%u] STATS dir: %u********\n", = sess->flow_id, sess->dir); > + plt_nix_dbg("TX: tcam_hit_cnt: 0x%lx\n", flow_stats.tcam_hit_cnt)= ; > + > + req.id =3D mcs_dev->port_id; > + req.dir =3D sess->dir; > + roc_mcs_port_stats_get(mcs_dev->mdev, &req, &port_stats); > + plt_nix_dbg("\n********** PORT[0] STATS ****************\n"); > + plt_nix_dbg("RX tcam_miss_cnt: 0x%lx\n", port_stats.tcam_miss_cnt= ); > + plt_nix_dbg("RX parser_err_cnt: 0x%lx\n", port_stats.parser_err_c= nt); > + plt_nix_dbg("RX preempt_err_cnt: 0x%lx\n", port_stats.preempt_err= _cnt); > + plt_nix_dbg("RX sectag_insert_err_cnt: 0x%lx\n", port_stats.secta= g_insert_err_cnt); > + > + req.id =3D sess->secy_id; > + req.dir =3D sess->dir; > + > + return roc_mcs_secy_stats_get(mcs_dev->mdev, &req, > + (struct roc_mcs_secy_stats *)(&stat= s->macsec)); > +} > + > static int > cnxk_mcs_event_cb(void *userdata, struct roc_mcs_event_desc *desc, void = *cb_arg) > { > diff --git a/drivers/net/cnxk/cnxk_ethdev_mcs.h b/drivers/net/cnxk/cnxk_e= thdev_mcs.h > index 2b1a6f2c90..4a59dd3df9 100644 > --- a/drivers/net/cnxk/cnxk_ethdev_mcs.h > +++ b/drivers/net/cnxk/cnxk_ethdev_mcs.h > @@ -97,6 +97,15 @@ int cnxk_eth_macsec_sa_destroy(void *device, uint16_t = sa_id, > int cnxk_eth_macsec_sc_destroy(void *device, uint16_t sc_id, > enum rte_security_macsec_direction dir); > > +int cnxk_eth_macsec_sa_stats_get(void *device, uint16_t sa_id, > + enum rte_security_macsec_direction dir, > + struct rte_security_macsec_sa_stats *sta= ts); > +int cnxk_eth_macsec_sc_stats_get(void *device, uint16_t sa_id, > + enum rte_security_macsec_direction dir, > + struct rte_security_macsec_sc_stats *sta= ts); > +int cnxk_eth_macsec_session_stats_get(struct cnxk_eth_dev *dev, struct c= nxk_macsec_sess *sess, > + struct rte_security_stats *stats); > + > int cnxk_eth_macsec_session_create(struct cnxk_eth_dev *dev, struct rte_= security_session_conf *conf, > struct rte_security_session *sess); > int cnxk_eth_macsec_session_destroy(struct cnxk_eth_dev *dev, struct rte= _security_session *sess); > -- > 2.25.1 >