hv_netvsc: track memory allocation failures in ethtool stats
[platform/kernel/linux-starfive.git] / drivers / net / hyperv / netvsc_drv.c
index dc70de6..1061551 100644 (file)
 #include "hyperv_net.h"
 
 #define RING_SIZE_MIN          64
-#define NETVSC_MIN_TX_SECTIONS 10
-#define NETVSC_DEFAULT_TX      192     /* ~1M */
-#define NETVSC_MIN_RX_SECTIONS 10      /* ~64K */
-#define NETVSC_DEFAULT_RX      10485   /* Max ~16M */
 
 #define LINKCHANGE_INT (2 * HZ)
 #define VF_TAKEOVER_INT (HZ / 10)
@@ -777,8 +773,8 @@ int netvsc_recv_callback(struct net_device *net,
        skb = netvsc_alloc_recv_skb(net, &nvchan->napi,
                                    csum_info, vlan, data, len);
        if (unlikely(!skb)) {
+               ++net_device_ctx->eth_stats.rx_no_memory;
 drop:
-               ++net->stats.rx_dropped;
                rcu_read_unlock();
                return NVSP_STAT_FAIL;
        }
@@ -1129,12 +1125,13 @@ static const struct {
        u16 offset;
 } netvsc_stats[] = {
        { "tx_scattered", offsetof(struct netvsc_ethtool_stats, tx_scattered) },
-       { "tx_no_memory",  offsetof(struct netvsc_ethtool_stats, tx_no_memory) },
+       { "tx_no_memory", offsetof(struct netvsc_ethtool_stats, tx_no_memory) },
        { "tx_no_space",  offsetof(struct netvsc_ethtool_stats, tx_no_space) },
        { "tx_too_big",   offsetof(struct netvsc_ethtool_stats, tx_too_big) },
        { "tx_busy",      offsetof(struct netvsc_ethtool_stats, tx_busy) },
        { "tx_send_full", offsetof(struct netvsc_ethtool_stats, tx_send_full) },
        { "rx_comp_busy", offsetof(struct netvsc_ethtool_stats, rx_comp_busy) },
+       { "rx_no_memory", offsetof(struct netvsc_ethtool_stats, rx_no_memory) },
        { "stop_queue", offsetof(struct netvsc_ethtool_stats, stop_queue) },
        { "wake_queue", offsetof(struct netvsc_ethtool_stats, wake_queue) },
 }, vf_stats[] = {