DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerinjacobk@gmail.com>
To: Ankur Dwivedi <adwivedi@marvell.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: dpdk-dev <dev@dpdk.org>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	 Kiran Kumar K <kirankumark@marvell.com>,
	Sunil Kumar Kori <skori@marvell.com>,
	 Satha Koteswara Rao Kottidi <skoteshwar@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>,
	 Anoob Joseph <anoobj@marvell.com>,
	Tejasree Kondoj <ktejasree@marvell.com>
Subject: Re: [PATCH 1/2] net/cnxk: add telemetry for inline IPsec for cn9k
Date: Thu, 17 Feb 2022 23:21:24 +0530	[thread overview]
Message-ID: <CALBAE1MGH2gQYQZCmtdb_ECC-ZvFeWLO2Bs-km6dd31S2wtSbw@mail.gmail.com> (raw)
In-Reply-To: <20220210065334.19942-2-adwivedi@marvell.com>

On Thu, Feb 10, 2022 at 12:24 PM Ankur Dwivedi <adwivedi@marvell.com> 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 <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/for-next-net. Thanks

>
> Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
> Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
> ---
>  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 <rte_telemetry.h>
> +
> +#include <roc_api.h>
> +
> +#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
>

  reply	other threads:[~2022-02-17 17:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10  6:53 [PATCH 0/2] add telemetry for inline IPsec Ankur Dwivedi
2022-02-10  6:53 ` [PATCH 1/2] net/cnxk: add telemetry for inline IPsec for cn9k Ankur Dwivedi
2022-02-17 17:51   ` Jerin Jacob [this message]
2022-02-10  6:53 ` [PATCH 2/2] net/cnxk: add telemetry for inline IPsec for cn10k Ankur Dwivedi
2022-02-10  9:12 ` [PATCH 0/2] add telemetry for inline IPsec Bruce Richardson
2022-02-10 10:04   ` [EXT] " Ankur Dwivedi
2022-02-10 11:31     ` Bruce Richardson
2022-02-10 13:29       ` Ankur Dwivedi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALBAE1MGH2gQYQZCmtdb_ECC-ZvFeWLO2Bs-km6dd31S2wtSbw@mail.gmail.com \
    --to=jerinjacobk@gmail.com \
    --cc=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=kirankumark@marvell.com \
    --cc=ktejasree@marvell.com \
    --cc=ndabilpuram@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).