net/cnxk: add inline IPsec telemetry for CN10K

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 <jerinj@marvell.com>
This commit is contained in:
Ankur Dwivedi 2022-02-10 12:23:34 +05:30 committed by Jerin Jacob
parent 41cc645c21
commit 622ee0bf35

View File

@ -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;
}