Add "total TX fail" count to "dp core stats" command output 51/68051/1
authorPatrice Buriez <patrice.buriez@intel.com>
Wed, 12 Jun 2019 16:39:15 +0000 (18:39 +0200)
committerPatrice Buriez <patrice.buriez@intel.com>
Fri, 14 Jun 2019 14:43:03 +0000 (16:43 +0200)
Warning:
This change breaks backward-compatibility of PROX socket scripting API,
because the "total TX fail" count is reported before the "last TSC"
field.
As a result, PROX scripts that make use of the "dp core stats" command,
such as the core_stats() method in helper-scripts/openstackrapid/prox_ctrl.py,
MUST be reworked to correctly parse the returned set of fields.

Change-Id: I3fe7f37dccee19f5f0b2719f262c6cfa7bad850f
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>
VNFs/DPPD-PROX/cmd_parser.c
VNFs/DPPD-PROX/stats_task.c
VNFs/DPPD-PROX/stats_task.h

index 927abc2..4f79359 100644 (file)
@@ -1657,6 +1657,7 @@ static int parse_cmd_dp_core_stats(const char *str, struct input *input)
                        lcore_id = lcores[i];
                        uint64_t tot_rx = stats_core_task_tot_rx(lcore_id, task_id);
                        uint64_t tot_tx = stats_core_task_tot_tx(lcore_id, task_id);
+                       uint64_t tot_tx_fail = stats_core_task_tot_tx_fail(lcore_id, task_id);
                        uint64_t tot_rx_non_dp = stats_core_task_tot_rx_non_dp(lcore_id, task_id);
                        uint64_t tot_tx_non_dp = stats_core_task_tot_tx_non_dp(lcore_id, task_id);
                        uint64_t tot_drop = stats_core_task_tot_drop(lcore_id, task_id);
@@ -1665,13 +1666,13 @@ static int parse_cmd_dp_core_stats(const char *str, struct input *input)
                        if (input->reply) {
                                char buf[128];
                                snprintf(buf, sizeof(buf),
-                                       "%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64"\n",
-                                       tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop, last_tsc, rte_get_tsc_hz());
+                                       "%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64",%"PRIu64"\n",
+                                       tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop, tot_tx_fail, last_tsc, rte_get_tsc_hz());
                                input->reply(input, buf, strlen(buf));
                        }
                        else {
-                               plog_info("RX: %"PRIu64", TX: %"PRIu64", RX_NON_DP:  %"PRIu64", TX_NON_DP: %"PRIu64", DROP: %"PRIu64"\n",
-                                       tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop);
+                               plog_info("RX: %"PRIu64", TX: %"PRIu64", RX_NON_DP: %"PRIu64", TX_NON_DP: %"PRIu64", DROP: %"PRIu64", TX_FAIL: %"PRIu64"\n",
+                                       tot_rx, tot_tx, tot_rx_non_dp, tot_tx_non_dp, tot_drop, tot_tx_fail);
                        }
                }
        }
index 2aed772..3f13898 100644 (file)
@@ -73,6 +73,11 @@ uint64_t stats_core_task_tot_tx(uint8_t lcore_id, uint8_t task_id)
        return lcore_task_stats_all[lcore_id].task_stats[task_id].tot_tx_pkt_count;
 }
 
+uint64_t stats_core_task_tot_tx_fail(uint8_t lcore_id, uint8_t task_id)
+{
+       return lcore_task_stats_all[lcore_id].task_stats[task_id].tot_drop_tx_fail;
+}
+
 uint64_t stats_core_task_tot_drop(uint8_t lcore_id, uint8_t task_id)
 {
        return lcore_task_stats_all[lcore_id].task_stats[task_id].tot_drop_tx_fail +
index 362b718..7dc54ea 100644 (file)
@@ -153,6 +153,7 @@ void stats_task_get_host_rx_tx_packets(uint64_t *rx, uint64_t *tx, uint64_t *tsc
 
 uint64_t stats_core_task_tot_rx(uint8_t lcore_id, uint8_t task_id);
 uint64_t stats_core_task_tot_tx(uint8_t lcore_id, uint8_t task_id);
+uint64_t stats_core_task_tot_tx_fail(uint8_t lcore_id, uint8_t task_id);
 uint64_t stats_core_task_tot_drop(uint8_t lcore_id, uint8_t task_id);
 uint64_t stats_core_task_last_tsc(uint8_t lcore_id, uint8_t task_id);
 uint64_t stats_core_task_tot_rx_non_dp(uint8_t lcore_id, uint8_t task_id);