net/cxgbevf: add missing Tx byte counters
authorRahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Fri, 29 Jun 2018 19:23:55 +0000 (00:53 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 4 Jul 2018 20:52:22 +0000 (22:52 +0200)
Fixes: a0a344a8f728 ("net/cxgbe: add VF port statistics")
Cc: stable@dpdk.org
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
drivers/net/cxgbe/base/t4_regs.h
drivers/net/cxgbe/base/t4vf_hw.c
drivers/net/cxgbe/cxgbevf_ethdev.c

index cbaf415..6f872ed 100644 (file)
 #define A_MPS_STAT_RX_BG_3_LB_TRUNC_FRAME_L 0x96b8
 #define A_MPS_STAT_RX_BG_3_LB_TRUNC_FRAME_H 0x96bc
 
+#define A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L 0x80
 #define A_MPS_VF_STAT_TX_VF_BCAST_FRAMES_L 0x88
+#define A_MPS_VF_STAT_TX_VF_MCAST_BYTES_L 0x90
 #define A_MPS_VF_STAT_TX_VF_MCAST_FRAMES_L 0x98
+#define A_MPS_VF_STAT_TX_VF_UCAST_BYTES_L 0xa0
 #define A_MPS_VF_STAT_TX_VF_UCAST_FRAMES_L 0xa8
 #define A_MPS_VF_STAT_TX_VF_DROP_FRAMES_L 0xb0
 #define A_MPS_VF_STAT_RX_VF_BCAST_FRAMES_L 0xd0
index 9fd0b87..d96456b 100644 (file)
@@ -683,6 +683,9 @@ static int t4vf_get_port_stats_fw(struct adapter *adapter, int pidx,
        /*
         * Translate firmware statistics into host native statistics.
         */
+       p->tx_octets = be64_to_cpu(fwstats.tx_bcast_bytes) +
+                      be64_to_cpu(fwstats.tx_mcast_bytes) +
+                      be64_to_cpu(fwstats.tx_ucast_bytes);
        p->tx_bcast_frames = be64_to_cpu(fwstats.tx_bcast_frames);
        p->tx_mcast_frames = be64_to_cpu(fwstats.tx_mcast_frames);
        p->tx_ucast_frames = be64_to_cpu(fwstats.tx_ucast_frames);
@@ -722,6 +725,9 @@ void t4vf_get_port_stats(struct adapter *adapter, int pidx,
 #define GET_STAT(name) \
        t4_read_reg64(adapter, \
                        T4VF_MPS_BASE_ADDR + A_MPS_VF_STAT_##name##_L)
+       p->tx_octets = GET_STAT(TX_VF_BCAST_BYTES) +
+                      GET_STAT(TX_VF_MCAST_BYTES) +
+                      GET_STAT(TX_VF_UCAST_BYTES);
        p->tx_bcast_frames = GET_STAT(TX_VF_BCAST_FRAMES);
        p->tx_mcast_frames = GET_STAT(TX_VF_MCAST_FRAMES);
        p->tx_ucast_frames = GET_STAT(TX_VF_UCAST_FRAMES);
index b4770e0..3b32ca9 100644 (file)
@@ -50,6 +50,7 @@ static int cxgbevf_dev_stats_get(struct rte_eth_dev *eth_dev,
        /* TX Stats */
        eth_stats->opackets = ps.tx_bcast_frames + ps.tx_mcast_frames +
                              ps.tx_ucast_frames;
+       eth_stats->obytes = ps.tx_octets;
        eth_stats->oerrors  = ps.tx_drop;
 
        for (i = 0; i < pi->n_rx_qsets; i++) {