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 32806A0032; Thu, 17 Feb 2022 18:51:53 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB7F540150; Thu, 17 Feb 2022 18:51:52 +0100 (CET) Received: from mail-il1-f171.google.com (mail-il1-f171.google.com [209.85.166.171]) by mails.dpdk.org (Postfix) with ESMTP id B169140042 for ; Thu, 17 Feb 2022 18:51:51 +0100 (CET) Received: by mail-il1-f171.google.com with SMTP id h11so2828914ilq.9 for ; Thu, 17 Feb 2022 09:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8fhusFiwxL9QtFOo9a+GxA8xHybUmGY2F5dOGH1ACYY=; b=VRstHzGCbnygxz2UAaAJFUIfj9mRrTcLaIix4ZWUY8lqz8qjaU3vfpG4hrch29hxXg I+1AKpe36+dLWZVYCxFqxqYFB2XSNknJgAx0rXgw8K4AQt9pvdEDwcpiFOxhaBkj3B4/ nYP3mBRZXbwTOD8/urA5MUnuoW10XC5PHBiSjq8p52C/YXfQM3ojm9QahhPvjHV7CsMy UUtjcwum1jyC6DKXJGGrl3Ek3ZPAP8HQb58mKoGSKJjJtUZR8ylufyNtMvRF+M/SvzMm 2NZEENXH5/wrEwPp7atM7KZE48cc4+Snz8GtpBamIGHdBMjOEu30rrN0j+iiMZrSkwLm Xthg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8fhusFiwxL9QtFOo9a+GxA8xHybUmGY2F5dOGH1ACYY=; b=PMrE2obbF6msseLAKUe5RIb/5puvNzxgQMHClCH9nkbTvyBb08qluI1k0nnQRs8sly aOtSrCjsBI8PDMKHjmSzSxoZ3vBo2rIG+ykecX4l99YwUxx4B15UvqSpmYaAqzBo77jj AebB9TClWpceBvR32nVFQz9++FIk9FZdcCRmElYasCoTQLn9KyY3KfZcjhX+hOwpOSa0 U/6opziNbhqi7BlVwXfIpyYK2hVRnO8BDLmmjP0/rhC0cf+R4b836ZkIcwNqi3IJfsRJ x+hrVQRTPwVHf3M8MqTBo7ZSkKSbFL3FRR5gbAgOvOV0NBLE7urb5HUUAa/s1d7sy8Tz dI0A== X-Gm-Message-State: AOAM531DzPTHnKXM/qiCQv8Cy8hpQ/iiMZPcflB5Jg/ScopyPuc4WSfs QRMyOUQPoeq7r3pkN3Y2atLE3lud5FocXkLiUtU= X-Google-Smtp-Source: ABdhPJyJEU5Ca7qs19tYsazhXw1/8t564JynbEGsFoGLTHSAITuiJVfQG46ONE4x12epQM5PEcj85R1KSVu5mgp5hqI= X-Received: by 2002:a05:6e02:1846:b0:2bf:d363:ff3c with SMTP id b6-20020a056e02184600b002bfd363ff3cmr2756775ilv.318.1645120310974; Thu, 17 Feb 2022 09:51:50 -0800 (PST) MIME-Version: 1.0 References: <20220210065334.19942-1-adwivedi@marvell.com> <20220210065334.19942-2-adwivedi@marvell.com> In-Reply-To: <20220210065334.19942-2-adwivedi@marvell.com> From: Jerin Jacob Date: Thu, 17 Feb 2022 23:21:24 +0530 Message-ID: Subject: Re: [PATCH 1/2] net/cnxk: add telemetry for inline IPsec for cn9k To: Ankur Dwivedi , Ferruh Yigit Cc: dpdk-dev , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Koteswara Rao Kottidi , Jerin Jacob , Anoob Joseph , Tejasree Kondoj Content-Type: text/plain; charset="UTF-8" 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 Thu, Feb 10, 2022 at 12:24 PM Ankur Dwivedi wrote: > > 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_onf_ipsec_outb_sa > and roc_onf_ipsec_inb_sa are returned as output. Acked-by: Jerin Jacob Applied to dpdk-next-net-mrvl/for-next-net. Thanks > > Signed-off-by: Ankur Dwivedi > Reviewed-by: Jerin Jacob Kollanukkaran > --- > drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 140 +++++++++++++++++++ > drivers/net/cnxk/meson.build | 1 + > 2 files changed, 141 insertions(+) > create mode 100644 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c > > diff --git a/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c > new file mode 100644 > index 0000000000..83015e11e2 > --- /dev/null > +++ b/drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c > @@ -0,0 +1,140 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2022 Marvell. > + */ > + > +#include > + > +#include > + > +#include "cnxk_ethdev.h" > + > +#define STR_MAXLEN 20 > +#define W0_MAXLEN 21 > + > +static int > +copy_outb_sa_9k(struct rte_tel_data *d, uint32_t i, void *sa) > +{ > + struct roc_onf_ipsec_outb_sa *out_sa; > + union { > + struct roc_ie_onf_sa_ctl ctl; > + uint64_t u64; > + } w0; > + char strw0[W0_MAXLEN]; > + char str[STR_MAXLEN]; > + > + out_sa = (struct roc_onf_ipsec_outb_sa *)sa; > + w0.ctl = out_sa->ctl; > + > + snprintf(str, sizeof(str), "outsa_w0_%u", i); > + snprintf(strw0, sizeof(strw0), "%" PRIu64, w0.u64); > + rte_tel_data_add_dict_string(d, str, strw0); > + > + snprintf(str, sizeof(str), "outsa_src_%u", i); > + rte_tel_data_add_dict_u64(d, str, out_sa->udp_src); > + > + snprintf(str, sizeof(str), "outsa_dst_%u", i); > + rte_tel_data_add_dict_u64(d, str, out_sa->udp_dst); > + > + snprintf(str, sizeof(str), "outsa_isrc_%u", i); > + rte_tel_data_add_dict_u64(d, str, out_sa->ip_src); > + > + snprintf(str, sizeof(str), "outsa_idst_%u", i); > + rte_tel_data_add_dict_u64(d, str, out_sa->ip_dst); > + > + return 0; > +} > + > +static int > +copy_inb_sa_9k(struct rte_tel_data *d, uint32_t i, void *sa) > +{ > + struct roc_onf_ipsec_inb_sa *in_sa; > + union { > + struct roc_ie_onf_sa_ctl ctl; > + uint64_t u64; > + } w0; > + char strw0[W0_MAXLEN]; > + char str[STR_MAXLEN]; > + > + in_sa = (struct roc_onf_ipsec_inb_sa *)sa; > + w0.ctl = in_sa->ctl; > + > + snprintf(str, sizeof(str), "insa_w0_%u", i); > + snprintf(strw0, sizeof(strw0), "%" PRIu64, w0.u64); > + rte_tel_data_add_dict_string(d, str, strw0); > + > + snprintf(str, sizeof(str), "insa_esnh_%u", i); > + rte_tel_data_add_dict_u64(d, str, in_sa->esn_hi); > + > + snprintf(str, sizeof(str), "insa_esnl_%u", i); > + rte_tel_data_add_dict_u64(d, str, in_sa->esn_low); > + > + return 0; > +} > + > +static int > +ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params, > + struct rte_tel_data *d) > +{ > + struct cnxk_eth_sec_sess *eth_sec, *tvar; > + struct rte_eth_dev *eth_dev; > + struct cnxk_eth_dev *dev; > + uint16_t port_id; > + char *end_p; > + uint32_t i; > + int ret; > + > + port_id = strtoul(params, &end_p, 0); > + if (errno != 0) > + return -EINVAL; > + > + if (*end_p != '\0') > + plt_err("Extra parameters passed to telemetry, ignoring it"); > + > + if (!rte_eth_dev_is_valid_port(port_id)) { > + plt_err("Invalid port id %u", port_id); > + return -EINVAL; > + } > + > + eth_dev = &rte_eth_devices[port_id]; > + if (!eth_dev) { > + plt_err("Ethdev not available"); > + return -EINVAL; > + } > + > + dev = cnxk_eth_pmd_priv(eth_dev); > + > + rte_tel_data_start_dict(d); > + > + rte_tel_data_add_dict_int(d, "nb_outb_sa", dev->outb.nb_sess); > + > + i = 0; > + 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 (ret < 0) > + return ret; > + } > + } > + > + rte_tel_data_add_dict_int(d, "nb_inb_sa", dev->inb.nb_sess); > + > + i = 0; > + 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 (ret < 0) > + return ret; > + } > + } > + > + return 0; > +} > + > +RTE_INIT(cnxk_ipsec_init_telemetry) > +{ > + rte_telemetry_register_cmd("/cnxk/ipsec/info", > + ethdev_sec_tel_handle_info, > + "Returns ipsec info. Parameters: port id"); > +} > diff --git a/drivers/net/cnxk/meson.build b/drivers/net/cnxk/meson.build > index cd8c13bd1c..83af1f4d0c 100644 > --- a/drivers/net/cnxk/meson.build > +++ b/drivers/net/cnxk/meson.build > @@ -15,6 +15,7 @@ sources = files( > 'cnxk_ethdev_ops.c', > 'cnxk_ethdev_sec.c', > 'cnxk_ethdev_telemetry.c', > + 'cnxk_ethdev_sec_telemetry.c', > 'cnxk_link.c', > 'cnxk_lookup.c', > 'cnxk_ptp.c', > -- > 2.28.0 >