ionic: add Rx dropped packet counter
authorShannon Nelson <snelson@pensando.io>
Tue, 7 Jan 2020 03:43:47 +0000 (19:43 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jan 2020 21:05:06 +0000 (13:05 -0800)
Add a counter for packets dropped by the driver, typically
for bad size or a receive error seen by the device.

Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/pensando/ionic/ionic_lif.h
drivers/net/ethernet/pensando/ionic/ionic_stats.c
drivers/net/ethernet/pensando/ionic/ionic_txrx.c

index a55fd1f8c31b9d6722fa10065694be936ea3dfd8..9c5a7dd45f9d2b54e1ae3655658857606f29047d 100644 (file)
@@ -37,6 +37,7 @@ struct ionic_rx_stats {
        u64 csum_complete;
        u64 csum_error;
        u64 buffers_posted;
+       u64 dropped;
 };
 
 #define IONIC_QCQ_F_INITED             BIT(0)
index 03916b6d47f2236308415b925f7e3d7f280562b4..a1e9796a660a4f95a33a68cab9a5f0a410c9545f 100644 (file)
@@ -39,6 +39,7 @@ static const struct ionic_stat_desc ionic_rx_stats_desc[] = {
        IONIC_RX_STAT_DESC(csum_none),
        IONIC_RX_STAT_DESC(csum_complete),
        IONIC_RX_STAT_DESC(csum_error),
+       IONIC_RX_STAT_DESC(dropped),
 };
 
 static const struct ionic_stat_desc ionic_txq_stats_desc[] = {
index 97e79949b35946c32693841ac674ed5ab8223996..a009bbe9f9be5489ab0d3c54732ecba19528fff2 100644 (file)
@@ -152,12 +152,16 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_desc_info *desc_i
        stats = q_to_rx_stats(q);
        netdev = q->lif->netdev;
 
-       if (comp->status)
+       if (comp->status) {
+               stats->dropped++;
                return;
+       }
 
        /* no packet processing while resetting */
-       if (unlikely(test_bit(IONIC_LIF_QUEUE_RESET, q->lif->state)))
+       if (unlikely(test_bit(IONIC_LIF_QUEUE_RESET, q->lif->state))) {
+               stats->dropped++;
                return;
+       }
 
        stats->pkts++;
        stats->bytes += le16_to_cpu(comp->len);
@@ -167,8 +171,10 @@ static void ionic_rx_clean(struct ionic_queue *q, struct ionic_desc_info *desc_i
        else
                skb = ionic_rx_frags(q, desc_info, cq_info);
 
-       if (unlikely(!skb))
+       if (unlikely(!skb)) {
+               stats->dropped++;
                return;
+       }
 
        skb_record_rx_queue(skb, q->index);