summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/stats_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs/DPPD-PROX/stats_port.c')
-rw-r--r--VNFs/DPPD-PROX/stats_port.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/VNFs/DPPD-PROX/stats_port.c b/VNFs/DPPD-PROX/stats_port.c
index b5e70dcc..fb6cf10a 100644
--- a/VNFs/DPPD-PROX/stats_port.c
+++ b/VNFs/DPPD-PROX/stats_port.c
@@ -18,6 +18,9 @@
#include <stdio.h>
#include <rte_version.h>
+#if RTE_VERSION >= RTE_VERSION_NUM(21,11,0,0)
+#include <ethdev_driver.h> // Please configure DPDK with meson option -Denable_driver_sdk=true
+#endif
#include <rte_ethdev.h>
#include <rte_cycles.h>
#include <rte_byteorder.h>
@@ -28,6 +31,7 @@
#include "stats_port.h"
#include "prox_port_cfg.h"
#include "rw_reg.h"
+#include "prox_compat.h"
#if defined(PROX_STATS) && defined(PROX_HW_DIRECT_STATS)
@@ -168,7 +172,10 @@ void stats_port_init(void)
for (uint8_t port_id = 0; port_id < nb_interface; ++port_id) {
if (prox_port_cfg[port_id].active) {
#if RTE_VERSION >= RTE_VERSION_NUM(16,7,0,0)
- num_xstats[port_id] = rte_eth_xstats_get_names(port_id, NULL, 0);
+ if ((num_xstats[port_id] = rte_eth_xstats_get_names(port_id, NULL, 0)) < 0) {
+ plog_err("\tport %u: rte_eth_xstats_get_names returns %d\n", port_id, num_xstats[port_id]);
+ continue;
+ }
eth_xstat_names[port_id] = prox_zmalloc(num_xstats[port_id] * sizeof(struct rte_eth_xstat_name), prox_port_cfg[port_id].socket);
PROX_PANIC(eth_xstat_names[port_id] == NULL, "Error allocating memory for xstats");
num_xstats[port_id] = rte_eth_xstats_get_names(port_id, eth_xstat_names[port_id], num_xstats[port_id]);
@@ -285,12 +292,23 @@ static void nic_read_stats(uint8_t port_id)
dropped by the nic". Note that in case CRC
is stripped on ixgbe, the CRC bytes are not
counted. */
- if (prox_port_cfg[port_id].port_conf.rxmode.hw_strip_crc == 1)
+#if defined (RTE_ETH_RX_OFFLOAD_CRC_STRIP)
+ if (prox_port_cfg[port_id].requested_rx_offload & RTE_ETH_RX_OFFLOAD_CRC_STRIP)
stats->rx_bytes = eth_stat.ibytes +
(24 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
else
stats->rx_bytes = eth_stat.ibytes +
(20 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+#else
+#if defined (RTE_ETH_RX_OFFLOAD_KEEP_CRC)
+ if (prox_port_cfg[port_id].requested_rx_offload & RTE_ETH_RX_OFFLOAD_KEEP_CRC)
+ stats->rx_bytes = eth_stat.ibytes +
+ (20 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+ else
+ stats->rx_bytes = eth_stat.ibytes +
+ (24 * eth_stat.ipackets - 20 * (eth_stat.ierrors + eth_stat.imissed));
+#endif
+#endif
}
} else if (strcmp(prox_port_cfg[port_id].short_name, "i40e_vf") == 0) {
// For I40E VF, imissed already part of received packets