From: Akhil Goyal <gakhil@marvell.com>
To: Radu Nicolau <radu.nicolau@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
"declan.doherty@intel.com" <declan.doherty@intel.com>,
"hemant.agrawal@oss.nxp.com" <hemant.agrawal@oss.nxp.com>
Subject: Re: [dpdk-dev] [EXT] [PATCH v5 4/7] examples/ipsec-secgw: support telemetry
Date: Sun, 31 Oct 2021 20:22:39 +0000 [thread overview]
Message-ID: <CO6PR18MB4484D9D2F903C8030AB35FEBD8899@CO6PR18MB4484.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20211027114530.2244661-5-radu.nicolau@intel.com>
> +static int
> +handle_telemetry_cmd_ipsec_secgw_stats(const char *cmd __rte_unused,
> + const char *params, struct rte_tel_data *data)
> +{
> + uint64_t total_pkts_dropped = 0, total_pkts_tx = 0, total_pkts_rx = 0;
> + unsigned int coreid;
> +
> + rte_tel_data_start_dict(data);
> +
> + if (params) {
> + coreid = (uint32_t)atoi(params);
> + if (rte_lcore_is_enabled(coreid) == 0)
> + return -EINVAL;
> +
> + total_pkts_dropped = core_statistics[coreid].dropped;
> + total_pkts_tx = core_statistics[coreid].tx;
> + total_pkts_rx = core_statistics[coreid].rx;
> +
> + } else {
> + for (coreid = 0; coreid < RTE_MAX_LCORE; coreid++) {
> +
> + /* skip disabled cores */
> + if (rte_lcore_is_enabled(coreid) == 0)
> + continue;
> +
> + total_pkts_dropped +=
> core_statistics[coreid].dropped;
> + total_pkts_tx += core_statistics[coreid].tx;
> + total_pkts_rx += core_statistics[coreid].rx;
> + }
> + }
> +
> + /* add telemetry key/values pairs */
> + rte_tel_data_add_dict_u64(data, "packets received",
> + total_pkts_rx);
> +
> + rte_tel_data_add_dict_u64(data, "packets transmitted",
> + total_pkts_tx);
> +
> + rte_tel_data_add_dict_u64(data, "packets dopped",
> + total_pkts_dropped);
Fix typo dopped
> +
> +
> + return 0;
> +}
> +
> +static void
> +update_lcore_statistics(struct ipsec_core_statistics *total, uint32_t coreid)
> +{
> + struct ipsec_core_statistics *lcore_stats;
> +
> + /* skip disabled cores */
> + if (rte_lcore_is_enabled(coreid) == 0)
> + return;
> +
> + lcore_stats = &core_statistics[coreid];
> +
> + total->rx = lcore_stats->rx;
> + total->dropped = lcore_stats->dropped;
> + total->tx = lcore_stats->tx;
> +
> + /* outbound stats */
> + total->outbound.spd6.protect += lcore_stats-
> >outbound.spd6.protect;
> + total->outbound.spd6.bypass += lcore_stats-
> >outbound.spd6.bypass;
> + total->outbound.spd6.discard += lcore_stats-
> >outbound.spd6.discard;
> +
> + total->outbound.spd4.protect += lcore_stats-
> >outbound.spd4.protect;
> + total->outbound.spd4.bypass += lcore_stats-
> >outbound.spd4.bypass;
> + total->outbound.spd4.discard += lcore_stats-
> >outbound.spd4.discard;
> +
> + total->outbound.sad.miss += lcore_stats->outbound.sad.miss;
> +
> + /* inbound stats */
> + total->inbound.spd6.protect += lcore_stats->inbound.spd6.protect;
> + total->inbound.spd6.bypass += lcore_stats->inbound.spd6.bypass;
> + total->inbound.spd6.discard += lcore_stats->inbound.spd6.discard;
> +
> + total->inbound.spd4.protect += lcore_stats->inbound.spd4.protect;
> + total->inbound.spd4.bypass += lcore_stats->inbound.spd4.bypass;
> + total->inbound.spd4.discard += lcore_stats->inbound.spd4.discard;
> +
> + total->inbound.sad.miss += lcore_stats->inbound.sad.miss;
> +
> +
> + /* routing stats */
> + total->lpm4.miss += lcore_stats->lpm4.miss;
> + total->lpm6.miss += lcore_stats->lpm6.miss;
> +}
> +
> +static void
> +update_statistics(struct ipsec_core_statistics *total, uint32_t coreid)
> +{
> + memset(total, 0, sizeof(*total));
> +
> + if (coreid != UINT32_MAX) {
> + update_lcore_statistics(total, coreid);
> + } else {
> + for (coreid = 0; coreid < RTE_MAX_LCORE; coreid++)
> + update_lcore_statistics(total, coreid);
> + }
> +}
> +
> +static int
> +handle_telemetry_cmd_ipsec_secgw_stats_outbound(const char *cmd
> __rte_unused,
> + const char *params, struct rte_tel_data *data)
> +{
> + struct ipsec_core_statistics total_stats;
> +
> + struct rte_tel_data *spd4_data = rte_tel_data_alloc();
> + struct rte_tel_data *spd6_data = rte_tel_data_alloc();
> + struct rte_tel_data *sad_data = rte_tel_data_alloc();
> +
> + unsigned int coreid = UINT32_MAX;
> +
> + /* verify allocated telemetry data structures */
> + if (!spd4_data || !spd6_data || !sad_data)
> + return -ENOMEM;
> +
> + /* initialize telemetry data structs as dicts */
> + rte_tel_data_start_dict(data);
> +
> + rte_tel_data_start_dict(spd4_data);
> + rte_tel_data_start_dict(spd6_data);
> + rte_tel_data_start_dict(sad_data);
> +
> + if (params) {
> + coreid = (uint32_t)atoi(params);
> + if (rte_lcore_is_enabled(coreid) == 0)
> + return -EINVAL;
> + }
> +
> + update_statistics(&total_stats, coreid);
> +
> + /* add spd 4 telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(spd4_data, "protect",
> + total_stats.outbound.spd4.protect);
> + rte_tel_data_add_dict_u64(spd4_data, "bypass",
> + total_stats.outbound.spd4.bypass);
> + rte_tel_data_add_dict_u64(spd4_data, "discard",
> + total_stats.outbound.spd4.discard);
> +
> + rte_tel_data_add_dict_container(data, "spd4", spd4_data, 0);
> +
> + /* add spd 6 telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(spd6_data, "protect",
> + total_stats.outbound.spd6.protect);
> + rte_tel_data_add_dict_u64(spd6_data, "bypass",
> + total_stats.outbound.spd6.bypass);
> + rte_tel_data_add_dict_u64(spd6_data, "discard",
> + total_stats.outbound.spd6.discard);
> +
> + rte_tel_data_add_dict_container(data, "spd6", spd6_data, 0);
> +
> + /* add sad telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(sad_data, "miss",
> + total_stats.outbound.sad.miss);
> +
> + rte_tel_data_add_dict_container(data, "sad", sad_data, 0);
> +
> + return 0;
> +}
> +
> +static int
> +handle_telemetry_cmd_ipsec_secgw_stats_inbound(const char *cmd
> __rte_unused,
> + const char *params, struct rte_tel_data *data)
> +{
> + struct ipsec_core_statistics total_stats;
> +
> + struct rte_tel_data *spd4_data = rte_tel_data_alloc();
> + struct rte_tel_data *spd6_data = rte_tel_data_alloc();
> + struct rte_tel_data *sad_data = rte_tel_data_alloc();
> +
> + unsigned int coreid = UINT32_MAX;
> +
> + /* verify allocated telemetry data structures */
> + if (!spd4_data || !spd6_data || !sad_data)
> + return -ENOMEM;
> +
> + /* initialize telemetry data structs as dicts */
> + rte_tel_data_start_dict(data);
> + rte_tel_data_start_dict(spd4_data);
> + rte_tel_data_start_dict(spd6_data);
> + rte_tel_data_start_dict(sad_data);
> +
> + /* add children dicts to parent dict */
> +
> + if (params) {
> + coreid = (uint32_t)atoi(params);
> + if (rte_lcore_is_enabled(coreid) == 0)
> + return -EINVAL;
> + }
> +
> + update_statistics(&total_stats, coreid);
> +
> + /* add sad telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(sad_data, "miss",
> + total_stats.outbound.sad.miss);
This should be inbound I guess.
> +
> + rte_tel_data_add_dict_container(data, "sad", sad_data, 0);
> +
> + /* add spd 4 telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(spd4_data, "protect",
> + total_stats.inbound.spd4.protect);
> + rte_tel_data_add_dict_u64(spd4_data, "bypass",
> + total_stats.inbound.spd4.bypass);
> + rte_tel_data_add_dict_u64(spd4_data, "discard",
> + total_stats.inbound.spd4.discard);
> +
> + rte_tel_data_add_dict_container(data, "spd4", spd4_data, 0);
> +
> + /* add spd 6 telemetry key/values pairs */
> +
> + rte_tel_data_add_dict_u64(spd6_data, "protect",
> + total_stats.inbound.spd6.protect);
> + rte_tel_data_add_dict_u64(spd6_data, "bypass",
> + total_stats.inbound.spd6.bypass);
> + rte_tel_data_add_dict_u64(spd6_data, "discard",
> + total_stats.inbound.spd6.discard);
> +
> + rte_tel_data_add_dict_container(data, "spd6", spd6_data, 0);
> +
> + return 0;
> +}
> +
> +static int
> +handle_telemetry_cmd_ipsec_secgw_stats_routing(const char *cmd
> __rte_unused,
> + const char *params, struct rte_tel_data *data)
> +{
> + struct ipsec_core_statistics total_stats;
> +
> + struct rte_tel_data *lpm4_data = rte_tel_data_alloc();
> + struct rte_tel_data *lpm6_data = rte_tel_data_alloc();
> +
> + unsigned int coreid = UINT32_MAX;
> +
> + /* initialize telemetry data structs as dicts */
> + rte_tel_data_start_dict(data);
> + rte_tel_data_start_dict(lpm4_data);
> + rte_tel_data_start_dict(lpm6_data);
> +
> +
> + if (params) {
> + coreid = (uint32_t)atoi(params);
> + if (rte_lcore_is_enabled(coreid) == 0)
> + return -EINVAL;
> + }
> +
> + update_statistics(&total_stats, coreid);
> +
> + /* add lpm 4 telemetry key/values pairs */
> + rte_tel_data_add_dict_u64(lpm4_data, "miss",
> + total_stats.outbound.spd4.protect);
Again typo, total_stats.lpm4.miss
> +
> + rte_tel_data_add_dict_container(data, "IPv4 LPM", lpm4_data, 0);
> +
> + /* add lpm 6 telemetry key/values pairs */
> + rte_tel_data_add_dict_u64(lpm6_data, "miss",
> + total_stats.outbound.spd6.protect);
Here also
Total_stats.lpm6.miss
> +
> + rte_tel_data_add_dict_container(data, "IPv6 LPM", lpm6_data, 0);
> +
> + return 0;
> +}
> +
> +static void
> +ipsec_secgw_telemetry_init(void)
> +{
> + rte_telemetry_register_cmd("/examples/ipsec-secgw/stats",
> + handle_telemetry_cmd_ipsec_secgw_stats,
> + "Returns outbound global stats. "
Returns global stats
> + "Optional Parameters: int <logical core id>");
> +
> + rte_telemetry_register_cmd("/examples/ipsec-
> secgw/stats/outbound",
> + handle_telemetry_cmd_ipsec_secgw_stats_outbound,
> + "Returns outbound global stats. "
> + "Optional Parameters: int <logical core id>");
> +
> + rte_telemetry_register_cmd("/examples/ipsec-
> secgw/stats/inbound",
> + handle_telemetry_cmd_ipsec_secgw_stats_inbound,
> + "Returns outbound global stats. "
This should be inbound.
> + "Optional Parameters: int <logical core id>");
> +
> + rte_telemetry_register_cmd("/examples/ipsec-secgw/stats/routing",
> + handle_telemetry_cmd_ipsec_secgw_stats_routing,
> + "Returns outbound global stats. "
Returns routing stats.
Please review the patch for any other Typos before submitting v6.
next prev parent reply other threads:[~2021-10-31 20:22 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 11:22 [dpdk-dev] [PATCH 0/7] IPsec Sec GW new features Radu Nicolau
2021-09-03 11:22 ` [dpdk-dev] [PATCH 1/7] examples/ipsec-secgw: add ol_flags support Radu Nicolau
2021-09-08 12:48 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-09 8:57 ` Nicolau, Radu
2021-09-03 11:22 ` [dpdk-dev] [PATCH 2/7] examples/ipsec-secgw: add support for NAT-T Radu Nicolau
2021-09-08 10:36 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-03 11:22 ` [dpdk-dev] [PATCH 3/7] examples/ipsec-secgw: add support for TSO Radu Nicolau
2021-09-08 12:54 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-03 11:22 ` [dpdk-dev] [PATCH 4/7] examples/ipsec-secgw: enable stats by default Radu Nicolau
2021-09-03 12:50 ` Zhang, Roy Fan
2021-09-08 13:08 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-08 16:05 ` Hemant Agrawal
2021-09-03 11:22 ` [dpdk-dev] [PATCH 5/7] examples/ipsec-secgw: add support for telemetry Radu Nicolau
2021-09-08 14:09 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-03 11:22 ` [dpdk-dev] [PATCH 6/7] examples/ipsec-secgw: add support for defining initial sequence number value Radu Nicolau
2021-09-08 14:11 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-03 11:22 ` [dpdk-dev] [PATCH 7/7] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-09-08 14:24 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 0/9] IPsec Sec GW new features Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 1/9] examples/ipsec-secgw: update create inline session Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 2/9] examples/ipsec-secgw: update SA parameters with L3 options Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 3/9] examples/ipsec-secgw: add support for telemetry Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 4/9] examples/ipsec-secgw: add stats interval argument Radu Nicolau
2021-09-16 9:13 ` Hemant Agrawal
2021-09-16 9:30 ` [dpdk-dev] [EXT] " Anoob Joseph
2021-09-16 10:24 ` Nicolau, Radu
2021-09-17 12:51 ` Anoob Joseph
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 5/9] examples/ipsec-secgw: add support for TSO Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 6/9] examples/ipsec-secgw: add support for defining initial sequence number value Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 7/9] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 8/9] examples/ipsec-secgw: add support for additional algorithms Radu Nicolau
2021-09-15 13:45 ` [dpdk-dev] [PATCH v2 9/9] examples/ipsec-secgw: add support for inline crypto UDP encapsulation Radu Nicolau
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 0/8] IPsec Sec GW new features Radu Nicolau
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 1/8] examples/ipsec-secgw: add stats interval argument Radu Nicolau
2021-10-08 18:37 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 2/8] examples/ipsec-secgw: update create inline session Radu Nicolau
2021-10-08 18:38 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 3/8] examples/ipsec-secgw: add support for inline crypto UDP encapsulation Radu Nicolau
2021-10-08 18:42 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 4/8] examples/ipsec-secgw: add support for TSO Radu Nicolau
2021-10-08 18:46 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:51 ` [dpdk-dev] [PATCH v3 5/8] examples/ipsec-secgw: add support for telemetry Radu Nicolau
2021-10-08 18:51 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:52 ` [dpdk-dev] [PATCH v3 6/8] examples/ipsec-secgw: add support for defining initial sequence number value Radu Nicolau
2021-10-08 18:57 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-01 9:52 ` [dpdk-dev] [PATCH v3 7/8] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-10-01 9:52 ` [dpdk-dev] [PATCH v3 8/8] examples/ipsec-secgw: add support for additional algorithms Radu Nicolau
2021-10-08 19:07 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-11 15:40 ` Nicolau, Radu
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 0/7] IPsec Sec GW new features Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 1/7] examples/ipsec-secgw: add stats interval argument Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 2/7] examples/ipsec-secgw: update create inline session Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 3/7] examples/ipsec-secgw: add support for inline crypto UDP encapsulation Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 4/7] examples/ipsec-secgw: support telemetry Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 5/7] examples/ipsec-secgw: define initial ESN value Radu Nicolau
2021-10-18 10:28 ` [dpdk-dev] [PATCH v4 6/7] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-10-18 10:29 ` [dpdk-dev] [PATCH v4 7/7] examples/ipsec-secgw: add support for additional algorithms Radu Nicolau
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 0/7] IPsec Sec GW new features Radu Nicolau
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 1/7] examples/ipsec-secgw: add stats interval argument Radu Nicolau
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 2/7] examples/ipsec-secgw: update create inline session Radu Nicolau
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 3/7] examples/ipsec-secgw: add support for inline crypto UDP encapsulation Radu Nicolau
2021-10-31 20:03 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 4/7] examples/ipsec-secgw: support telemetry Radu Nicolau
2021-10-31 20:22 ` Akhil Goyal [this message]
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 5/7] examples/ipsec-secgw: define initial ESN value Radu Nicolau
2021-10-31 20:23 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 6/7] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-10-31 20:25 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-10-27 11:45 ` [dpdk-dev] [PATCH v5 7/7] examples/ipsec-secgw: add support for additional algorithms Radu Nicolau
2021-10-31 20:29 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 0/7] IPsec Sec GW new features Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 1/7] examples/ipsec-secgw: add stats interval argument Radu Nicolau
2021-11-03 9:23 ` [dpdk-dev] [EXT] " Akhil Goyal
2021-11-03 10:51 ` Nicolau, Radu
2021-11-03 13:20 ` Akhil Goyal
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 2/7] examples/ipsec-secgw: update create inline session Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 3/7] examples/ipsec-secgw: add support for inline crypto UDP encapsulation Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 4/7] examples/ipsec-secgw: support telemetry Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 5/7] examples/ipsec-secgw: define initial ESN value Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 6/7] examples/ipsec-secgw: add ethdev reset callback Radu Nicolau
2021-11-01 12:58 ` [dpdk-dev] [PATCH v6 7/7] examples/ipsec-secgw: add support for additional algorithms Radu Nicolau
2021-11-03 14:13 ` [dpdk-dev] [EXT] [PATCH v6 0/7] IPsec Sec GW new features Akhil Goyal
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=CO6PR18MB4484D9D2F903C8030AB35FEBD8899@CO6PR18MB4484.namprd18.prod.outlook.com \
--to=gakhil@marvell.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
--cc=hemant.agrawal@oss.nxp.com \
--cc=radu.nicolau@intel.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).