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 CB90AA00C2; Thu, 10 Feb 2022 07:54:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C07AF4115D; Thu, 10 Feb 2022 07:54:29 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id A6AEB40041 for ; Thu, 10 Feb 2022 07:54:27 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 21A2i4PL014406 for ; Wed, 9 Feb 2022 22:54:27 -0800 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-transfer-encoding : content-type; s=pfpt0220; bh=lzP/HiXJqDinXqvfxByxwsBN6foqBEF+z81PZHhXzNc=; b=f0FBJF/xs9k+DwKI4FwcmCyLf7qgFgMpyVO6VHXW08Jf/mji4La2+oFGQa/+wIn8f4Cw iD5zl0p83Jp2kPMFrrYosTDyCEPyISbb9/eShsmomyR/dJ8gwSk9v2bdkVvJviGHcvM6 66ytraZwRPYe9rSBPK+CuPg1DfvLXMbqgBEE9klgHVkGYZMKewqVlA7gcH1jls1nP7pD KRTcYUOoNdlSqdsYW0JL22ouuKh402Foc6T7GqGva79yWPAX3C2H4D7aaUT/NE5NAWYU heaDP3Po+7aqanb1AyMbS7dUVa4nr+8IgG6GyG/ncB7FDx3A5iBv5KQXAgSUM+gJlCNP eg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3e4am951ve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Wed, 09 Feb 2022 22:54:26 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Wed, 9 Feb 2022 22:54:24 -0800 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.18 via Frontend Transport; Wed, 9 Feb 2022 22:54:24 -0800 Received: from hyd1349.t110.caveonetworks.com.com (unknown [10.29.45.13]) by maili.marvell.com (Postfix) with ESMTP id 4AA493F7053; Wed, 9 Feb 2022 22:54:21 -0800 (PST) From: Ankur Dwivedi To: CC: , , , , , , , Ankur Dwivedi Subject: [PATCH 2/2] net/cnxk: add telemetry for inline IPsec for cn10k Date: Thu, 10 Feb 2022 12:23:34 +0530 Message-ID: <20220210065334.19942-3-adwivedi@marvell.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20220210065334.19942-1-adwivedi@marvell.com> References: <20220210065334.19942-1-adwivedi@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: OA5PS43-RqTVIHSdes_Q6KvEHsR8URU0 X-Proofpoint-ORIG-GUID: OA5PS43-RqTVIHSdes_Q6KvEHsR8URU0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-10_02,2022-02-09_01,2021-12-02_01 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 Adds telemetry function to get information about inline outbound and inline inbound sa's. The function takes port id as input. Some fields in the structures roc_ot_ipsec_outb_sa and roc_ot_ipsec_inb_sa are returned as output. Signed-off-by: Ankur Dwivedi Reviewed-by: Jerin Jacob Kollanukkaran --- drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 156 ++++++++++++++++++- 1 file changed, 154 insertions(+), 2 deletions(-) diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c index 83015e11e2..dfad5af8fe 100644 --- a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c @@ -71,6 +71,152 @@ copy_inb_sa_9k(struct rte_tel_data *d, uint32_t i, void *sa) return 0; } +static int +copy_outb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa) +{ + struct roc_ot_ipsec_outb_sa *out_sa; + struct rte_tel_data *outer_hdr; + char str[STR_MAXLEN]; + char s64[W0_MAXLEN]; + uint32_t j; + + out_sa = (struct roc_ot_ipsec_outb_sa *)sa; + + snprintf(str, sizeof(str), "outsa_w0_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->w0.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_w1_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->w1.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_w2_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->w2.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_w10_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->w10.u64); + rte_tel_data_add_dict_string(d, str, s64); + + outer_hdr = rte_tel_data_alloc(); + if (!outer_hdr) { + plt_err("Could not allocate space for outer header"); + return -ENOMEM; + } + + rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL); + + for (j = 0; j < RTE_DIM(out_sa->outer_hdr.ipv6.src_addr); j++) + rte_tel_data_add_array_u64(outer_hdr, + out_sa->outer_hdr.ipv6.src_addr[j]); + + for (j = 0; j < RTE_DIM(out_sa->outer_hdr.ipv6.dst_addr); j++) + rte_tel_data_add_array_u64(outer_hdr, + out_sa->outer_hdr.ipv6.dst_addr[j]); + + snprintf(str, sizeof(str), "outsa_outer_hdr_%u", i); + rte_tel_data_add_dict_container(d, str, outer_hdr, 0); + + snprintf(str, sizeof(str), "outsa_errctl_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.err_ctl.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_esnval_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.esn_val); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_hl_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.hard_life); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_sl_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.soft_life); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_octs_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.mib_octs); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "outsa_pkts_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, out_sa->ctx.mib_pkts); + rte_tel_data_add_dict_string(d, str, s64); + + return 0; +} + +static int +copy_inb_sa_10k(struct rte_tel_data *d, uint32_t i, void *sa) +{ + struct roc_ot_ipsec_inb_sa *in_sa; + struct rte_tel_data *outer_hdr; + char str[STR_MAXLEN]; + char s64[W0_MAXLEN]; + uint32_t j; + + in_sa = (struct roc_ot_ipsec_inb_sa *)sa; + + snprintf(str, sizeof(str), "insa_w0_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->w0.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_w1_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->w1.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_w2_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->w2.u64); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_w10_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->w10.u64); + rte_tel_data_add_dict_string(d, str, s64); + + outer_hdr = rte_tel_data_alloc(); + if (!outer_hdr) { + plt_err("Could not allocate space for outer header"); + return -ENOMEM; + } + + rte_tel_data_start_array(outer_hdr, RTE_TEL_U64_VAL); + + for (j = 0; j < RTE_DIM(in_sa->outer_hdr.ipv6.src_addr); j++) + rte_tel_data_add_array_u64(outer_hdr, + in_sa->outer_hdr.ipv6.src_addr[j]); + + for (j = 0; j < RTE_DIM(in_sa->outer_hdr.ipv6.dst_addr); j++) + rte_tel_data_add_array_u64(outer_hdr, + in_sa->outer_hdr.ipv6.dst_addr[j]); + + snprintf(str, sizeof(str), "insa_outer_hdr_%u", i); + rte_tel_data_add_dict_container(d, str, outer_hdr, 0); + + snprintf(str, sizeof(str), "insa_arbase_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.ar_base); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_ar_validm_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.ar_valid_mask); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_hl_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.hard_life); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_sl_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.soft_life); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_octs_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.mib_octs); + rte_tel_data_add_dict_string(d, str, s64); + + snprintf(str, sizeof(str), "insa_pkts_%u", i); + snprintf(s64, sizeof(s64), "%" PRIu64, in_sa->ctx.mib_pkts); + rte_tel_data_add_dict_string(d, str, s64); + + return 0; +} + static int ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params, struct rte_tel_data *d) @@ -111,7 +257,10 @@ ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params, if (dev->tx_offloads & RTE_ETH_TX_OFFLOAD_SECURITY) { tvar = NULL; RTE_TAILQ_FOREACH_SAFE(eth_sec, &dev->outb.list, entry, tvar) { - ret = copy_outb_sa_9k(d, i++, eth_sec->sa); + if (roc_model_is_cn10k()) + ret = copy_outb_sa_10k(d, i++, eth_sec->sa); + else + ret = copy_outb_sa_9k(d, i++, eth_sec->sa); if (ret < 0) return ret; } @@ -123,7 +272,10 @@ ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params, if (dev->rx_offloads & RTE_ETH_RX_OFFLOAD_SECURITY) { tvar = NULL; RTE_TAILQ_FOREACH_SAFE(eth_sec, &dev->inb.list, entry, tvar) { - ret = copy_inb_sa_9k(d, i++, eth_sec->sa); + if (roc_model_is_cn10k()) + ret = copy_inb_sa_10k(d, i++, eth_sec->sa); + else + ret = copy_inb_sa_9k(d, i++, eth_sec->sa); if (ret < 0) return ret; } -- 2.28.0