]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/core: Add drop counters to VF statistics
authorEugenia Emantayev <eugenia@mellanox.com>
Mon, 17 Jul 2017 10:47:07 +0000 (13:47 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Tue, 9 Jan 2018 05:40:48 +0000 (07:40 +0200)
Modern hardware can decide to drop packets going to/from a VF.
Add receive and transmit drop counters to be displayed at hypervisor
layer in iproute2 per VF statistics.

Signed-off-by: Eugenia Emantayev <eugenia@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
include/linux/if_link.h
include/uapi/linux/if_link.h
net/core/rtnetlink.c

index 4c54611e03e967afe6a9eaa4fd35a6113db91632..622658dfbf0a98a610c82808ef4ff8d7a51a0044 100644 (file)
@@ -13,6 +13,8 @@ struct ifla_vf_stats {
        __u64 tx_bytes;
        __u64 broadcast;
        __u64 multicast;
+       __u64 rx_dropped;
+       __u64 tx_dropped;
 };
 
 struct ifla_vf_info {
index 19fc02660e0c0e466a38cc4516f1054012b8e978..f8f04fed61861b6b5f881d62ea55fae3623e1094 100644 (file)
@@ -732,6 +732,8 @@ enum {
        IFLA_VF_STATS_BROADCAST,
        IFLA_VF_STATS_MULTICAST,
        IFLA_VF_STATS_PAD,
+       IFLA_VF_STATS_RX_DROPPED,
+       IFLA_VF_STATS_TX_DROPPED,
        __IFLA_VF_STATS_MAX,
 };
 
index c688dc564b119acf6850f7354d76a26fd0ab2ed8..5421a3fd3ba1287d56d85f2167706c71c252b90a 100644 (file)
@@ -904,6 +904,10 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
                         nla_total_size_64bit(sizeof(__u64)) +
                         /* IFLA_VF_STATS_MULTICAST */
                         nla_total_size_64bit(sizeof(__u64)) +
+                        /* IFLA_VF_STATS_RX_DROPPED */
+                        nla_total_size_64bit(sizeof(__u64)) +
+                        /* IFLA_VF_STATS_TX_DROPPED */
+                        nla_total_size_64bit(sizeof(__u64)) +
                         nla_total_size(sizeof(struct ifla_vf_trust)));
                return size;
        } else
@@ -1258,7 +1262,11 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
            nla_put_u64_64bit(skb, IFLA_VF_STATS_BROADCAST,
                              vf_stats.broadcast, IFLA_VF_STATS_PAD) ||
            nla_put_u64_64bit(skb, IFLA_VF_STATS_MULTICAST,
-                             vf_stats.multicast, IFLA_VF_STATS_PAD)) {
+                             vf_stats.multicast, IFLA_VF_STATS_PAD) ||
+           nla_put_u64_64bit(skb, IFLA_VF_STATS_RX_DROPPED,
+                             vf_stats.rx_dropped, IFLA_VF_STATS_PAD) ||
+           nla_put_u64_64bit(skb, IFLA_VF_STATS_TX_DROPPED,
+                             vf_stats.tx_dropped, IFLA_VF_STATS_PAD)) {
                nla_nest_cancel(skb, vfstats);
                goto nla_put_vf_failure;
        }