net/bnx2x: fix dropped packet count in stats
authorRasesh Mody <rasesh.mody@qlogic.com>
Thu, 12 May 2016 00:06:21 +0000 (17:06 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 15 Jun 2016 15:13:55 +0000 (17:13 +0200)
Fix stats_get() routine to display drop counters under imissed counter.

Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Rasesh Mody <rasesh.mody@qlogic.com>
Signed-off-by: Harish Patil <harish.patil@qlogic.com>
drivers/net/bnx2x/bnx2x_ethdev.c
drivers/net/bnx2x/bnx2x_rxtx.c

index 071b44f..3ff57c4 100644 (file)
@@ -276,6 +276,9 @@ static void
 bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
        struct bnx2x_softc *sc = dev->data->dev_private;
+       uint32_t brb_truncate_discard;
+       uint64_t brb_drops;
+       uint64_t brb_truncates;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -316,6 +319,19 @@ bnx2x_dev_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
        stats->rx_nombuf =
                HILO_U64(sc->eth_stats.no_buff_discard_hi,
                                sc->eth_stats.no_buff_discard_lo);
+
+       brb_drops =
+               HILO_U64(sc->eth_stats.brb_drop_hi,
+                        sc->eth_stats.brb_drop_lo);
+
+       brb_truncates =
+               HILO_U64(sc->eth_stats.brb_truncate_hi,
+                        sc->eth_stats.brb_truncate_lo);
+
+       brb_truncate_discard = sc->eth_stats.brb_truncate_discard;
+
+       stats->imissed = brb_drops + brb_truncates +
+                        brb_truncate_discard + stats->rx_nombuf;
 }
 
 static void
index 55d2bd7..a20f217 100644 (file)
@@ -397,6 +397,8 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
                new_mb = rte_mbuf_raw_alloc(rxq->mb_pool);
                if (unlikely(!new_mb)) {
                        PMD_RX_LOG(ERR, "mbuf alloc fail fp[%02d]", fp->index);
+                       rte_eth_devices[rxq->port_id].data->
+                                       rx_mbuf_alloc_failed++;
                        goto next_rx;
                }