Rename rx_oversize_errors to rx_oversize_cnt since it depends on giant
packet size limit instead of MTU, by hardware design.
Rename rx_drop_packets and tx_drop_packets to rx_dma_drop and tx_dma_drop
to indicate the drop location.
And add tx_dma_drop to extended statistics.

Fixes: 8b433d04adc9 ("net/ngbe: support device xstats")
Cc: sta...@dpdk.org

Signed-off-by: Jiawen Wu <jiawe...@trustnetic.com>
---
 drivers/net/ngbe/base/ngbe_type.h |  5 ++---
 drivers/net/ngbe/ngbe_ethdev.c    | 10 +++++-----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ngbe/base/ngbe_type.h 
b/drivers/net/ngbe/base/ngbe_type.h
index 4a6c273f1e..73111f7950 100644
--- a/drivers/net/ngbe/base/ngbe_type.h
+++ b/drivers/net/ngbe/base/ngbe_type.h
@@ -142,9 +142,8 @@ struct ngbe_hw_stats {
        u64 mng_bmc2host_packets;
        u64 mng_host2bmc_packets;
        /* Basix RxTx */
-       u64 rx_drop_packets;
-       u64 tx_drop_packets;
        u64 rx_dma_drop;
+       u64 tx_dma_drop;
        u64 tx_secdrp_packets;
        u64 rx_packets;
        u64 tx_packets;
@@ -170,7 +169,7 @@ struct ngbe_hw_stats {
        u64 rx_length_errors;
        u64 rx_undersize_errors;
        u64 rx_fragment_errors;
-       u64 rx_oversize_errors;
+       u64 rx_oversize_cnt;
        u64 rx_jabber_errors;
        u64 rx_l3_l4_xsum_error;
        u64 mac_local_errors;
diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c
index 86c28099c4..df32bf64ff 100644
--- a/drivers/net/ngbe/ngbe_ethdev.c
+++ b/drivers/net/ngbe/ngbe_ethdev.c
@@ -165,6 +165,7 @@ static const struct rte_ngbe_xstats_name_off 
rte_ngbe_stats_strings[] = {
        HW_XSTAT(tx_management_packets),
        HW_XSTAT(rx_management_dropped),
        HW_XSTAT(rx_dma_drop),
+       HW_XSTAT(tx_dma_drop),
        HW_XSTAT(tx_secdrp_packets),
 
        /* Basic Error */
@@ -175,7 +176,7 @@ static const struct rte_ngbe_xstats_name_off 
rte_ngbe_stats_strings[] = {
        HW_XSTAT(rx_length_errors),
        HW_XSTAT(rx_undersize_errors),
        HW_XSTAT(rx_fragment_errors),
-       HW_XSTAT(rx_oversize_errors),
+       HW_XSTAT(rx_oversize_cnt),
        HW_XSTAT(rx_jabber_errors),
        HW_XSTAT(rx_l3_l4_xsum_error),
        HW_XSTAT(mac_local_errors),
@@ -1374,9 +1375,8 @@ ngbe_read_stats_registers(struct ngbe_hw *hw,
        hw_stats->rx_xoff_packets += rd32(hw, NGBE_PBRXLNKXOFF);
 
        /* DMA Stats */
-       hw_stats->rx_drop_packets += rd32(hw, NGBE_DMARXDROP);
-       hw_stats->tx_drop_packets += rd32(hw, NGBE_DMATXDROP);
        hw_stats->rx_dma_drop += rd32(hw, NGBE_DMARXDROP);
+       hw_stats->tx_dma_drop += rd32(hw, NGBE_DMATXDROP);
        hw_stats->tx_secdrp_packets += rd32(hw, NGBE_DMATXSECDROP);
        hw_stats->rx_packets += rd32(hw, NGBE_DMARXPKT);
        hw_stats->tx_packets += rd32(hw, NGBE_DMATXPKT);
@@ -1413,7 +1413,7 @@ ngbe_read_stats_registers(struct ngbe_hw *hw,
                        rd64(hw, NGBE_MACTX1024TOMAXL);
 
        hw_stats->rx_undersize_errors += rd64(hw, NGBE_MACRXERRLENL);
-       hw_stats->rx_oversize_errors += rd32(hw, NGBE_MACRXOVERSIZE);
+       hw_stats->rx_oversize_cnt += rd32(hw, NGBE_MACRXOVERSIZE);
        hw_stats->rx_jabber_errors += rd32(hw, NGBE_MACRXJABBER);
 
        /* MNG Stats */
@@ -1512,7 +1512,7 @@ ngbe_dev_stats_get(struct rte_eth_dev *dev, struct 
rte_eth_stats *stats)
                          hw_stats->rx_mac_short_packet_dropped +
                          hw_stats->rx_length_errors +
                          hw_stats->rx_undersize_errors +
-                         hw_stats->rx_oversize_errors +
+                         hw_stats->rdb_drp_cnt +
                          hw_stats->rx_illegal_byte_errors +
                          hw_stats->rx_error_bytes +
                          hw_stats->rx_fragment_errors;
-- 
2.27.0

Reply via email to