DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ankur Dwivedi <adwivedi@marvell.com>
To: <dev@dpdk.org>
Cc: <ndabilpuram@marvell.com>, <kirankumark@marvell.com>,
	<skori@marvell.com>,  <skoteshwar@marvell.com>,
	<jerinj@marvell.com>, <anoobj@marvell.com>,
	<ktejasree@marvell.com>, Ankur Dwivedi <adwivedi@marvell.com>
Subject: [PATCH 2/2] net/cnxk: add telemetry for inline IPsec for cn10k
Date: Thu, 10 Feb 2022 12:23:34 +0530	[thread overview]
Message-ID: <20220210065334.19942-3-adwivedi@marvell.com> (raw)
In-Reply-To: <20220210065334.19942-1-adwivedi@marvell.com>

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 <adwivedi@marvell.com>
Reviewed-by: Jerin Jacob Kollanukkaran <jerinj@marvell.com>
---
 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


  parent reply	other threads:[~2022-02-10  6:54 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
2022-02-10  6:53 ` Ankur Dwivedi [this message]
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=20220210065334.19942-3-adwivedi@marvell.com \
    --to=adwivedi@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --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).