On 2/24/2021 1:28 AM, Lijun Ou wrote:
From: "Min Hu (Connor)" <humi...@huawei.com>
In current HNS3 PMD, Rx/Tx bytes from packet stats are not
implemented.
This patch implemented Rx/Tx bytes using soft counters.
Rx/Tx bytes stats will be enabled if the macro
RTE_LIBRTE_HNS3_PMD_SOFT_COUNTERS is defined.
Signed-off-by: Min Hu (Connor) <humi...@huawei.com>
Signed-off-by: Lijun Ou <ouli...@huawei.com>
---
drivers/net/hns3/hns3_rxtx.c | 24 ++++++++++++++++++++++++
drivers/net/hns3/hns3_rxtx_vec_neon.h | 15 +++++++++++++++
drivers/net/hns3/hns3_rxtx_vec_sve.c | 11 +++++++++++
drivers/net/hns3/hns3_stats.c | 22 ++++++++++++++++++----
4 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index 5e79177..a8bd2cc 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -2181,6 +2181,10 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf
**rx_pkts, uint16_t nb_pkts)
cksum_err);
hns3_rxd_to_vlan_tci(rxq, rxm, l234_info, &rxd);
+#ifdef RTE_LIBRTE_HNS3_PMD_SOFT_COUNTERS
+ /* Increment bytes counter */
+ rxq->basic_stats.bytes += rxm->pkt_len;
+#endif
Why statistics enabled only with macro?
It is not common to use macro to enable the stats, what do you think to remove
it, to be consistent with rest of the PMDs?