s390/qeth: gather more detailed RX dropped/error statistics
authorJulian Wiedmann <jwi@linux.ibm.com>
Thu, 14 Nov 2019 10:19:14 +0000 (11:19 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Nov 2019 02:16:50 +0000 (18:16 -0800)
Where available, use the fine-grained counters in rtnl_link_stats64 to
indicate different RX error causes. For drop reasons, use driver-private
ethtool counters.

In particular this patch allows us to keep track of driver-side drops due
to unknown/unsupported HW descriptor format.

Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core.h
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_ethtool.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c

index d081545..14edc89 100644 (file)
@@ -477,12 +477,15 @@ struct qeth_card_stats {
        u64 rx_sg_frags;
        u64 rx_sg_alloc_page;
 
+       u64 rx_dropped_nomem;
+       u64 rx_dropped_notsupp;
+
        /* rtnl_link_stats64 */
        u64 rx_packets;
        u64 rx_bytes;
-       u64 rx_errors;
-       u64 rx_dropped;
        u64 rx_multicast;
+       u64 rx_length_errors;
+       u64 rx_fifo_errors;
 };
 
 struct qeth_out_q_stats {
index 9e8bd8e..4e113f3 100644 (file)
@@ -3093,7 +3093,7 @@ static int qeth_check_qdio_errors(struct qeth_card *card,
                               buf->element[14].sflags);
                QETH_CARD_TEXT_(card, 2, " qerr=%X", qdio_error);
                if ((buf->element[15].sflags) == 0x12) {
-                       QETH_CARD_STAT_INC(card, rx_dropped);
+                       QETH_CARD_STAT_INC(card, rx_fifo_errors);
                        return 0;
                } else
                        return 1;
@@ -4346,7 +4346,7 @@ static int qeth_mdio_read(struct net_device *dev, int phy_id, int regnum)
        case MII_NWAYTEST: /* N-way auto-neg test register */
                break;
        case MII_RERRCOUNTER: /* rx error counter */
-               rc = card->stats.rx_errors;
+               rc = card->stats.rx_length_errors + card->stats.rx_fifo_errors;
                break;
        case MII_SREVISION: /* silicon revision */
                break;
@@ -5092,6 +5092,7 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card,
                headroom = sizeof(struct qeth_hdr);
                break;
        default:
+               QETH_CARD_STAT_INC(card, rx_dropped_notsupp);
                break;
        }
 
@@ -5134,7 +5135,7 @@ struct sk_buff *qeth_core_get_next_skb(struct qeth_card *card,
                                QETH_CARD_TEXT(card, 4, "unexeob");
                                QETH_CARD_HEX(card, 2, buffer, sizeof(void *));
                                dev_kfree_skb_any(skb);
-                               QETH_CARD_STAT_INC(card, rx_errors);
+                               QETH_CARD_STAT_INC(card, rx_length_errors);
                                return NULL;
                        }
                        element++;
@@ -5156,7 +5157,7 @@ no_mem:
        if (net_ratelimit()) {
                QETH_CARD_TEXT(card, 2, "noskbmem");
        }
-       QETH_CARD_STAT_INC(card, rx_dropped);
+       QETH_CARD_STAT_INC(card, rx_dropped_nomem);
        return NULL;
 }
 EXPORT_SYMBOL_GPL(qeth_core_get_next_skb);
@@ -6236,9 +6237,13 @@ void qeth_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 
        stats->rx_packets = card->stats.rx_packets;
        stats->rx_bytes = card->stats.rx_bytes;
-       stats->rx_errors = card->stats.rx_errors;
-       stats->rx_dropped = card->stats.rx_dropped;
+       stats->rx_errors = card->stats.rx_length_errors +
+                          card->stats.rx_fifo_errors;
+       stats->rx_dropped = card->stats.rx_dropped_nomem +
+                           card->stats.rx_dropped_notsupp;
        stats->multicast = card->stats.rx_multicast;
+       stats->rx_length_errors = card->stats.rx_length_errors;
+       stats->rx_fifo_errors = card->stats.rx_fifo_errors;
 
        for (i = 0; i < card->qdio.no_out_queues; i++) {
                queue = card->qdio.out_qs[i];
index 096698d..f7485c6 100644 (file)
@@ -49,6 +49,8 @@ static const struct qeth_stats card_stats[] = {
        QETH_CARD_STAT("rx0 SG skbs", rx_sg_skbs),
        QETH_CARD_STAT("rx0 SG page frags", rx_sg_frags),
        QETH_CARD_STAT("rx0 SG page allocs", rx_sg_alloc_page),
+       QETH_CARD_STAT("rx0 dropped, no memory", rx_dropped_nomem),
+       QETH_CARD_STAT("rx0 dropped, bad format", rx_dropped_notsupp),
 };
 
 #define TXQ_STATS_LEN  ARRAY_SIZE(txq_stats)
index 8f3093d..1e85956 100644 (file)
@@ -336,6 +336,7 @@ static int qeth_l2_process_inbound_buffer(struct qeth_card *card,
                        dev_kfree_skb_any(skb);
                        QETH_CARD_TEXT(card, 3, "inbunkno");
                        QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
+                       QETH_CARD_STAT_INC(card, rx_dropped_notsupp);
                        continue;
                }
                work_done++;
index 70d4586..72c61fa 100644 (file)
@@ -1391,6 +1391,7 @@ static int qeth_l3_process_inbound_buffer(struct qeth_card *card,
                        dev_kfree_skb_any(skb);
                        QETH_CARD_TEXT(card, 3, "inbunkno");
                        QETH_DBF_HEX(CTRL, 3, hdr, sizeof(*hdr));
+                       QETH_CARD_STAT_INC(card, rx_dropped_notsupp);
                        continue;
                }
                work_done++;