Skip to content

Commit c5a9f6f

Browse files
Eugenia EmantayevSaeed Mahameed
authored andcommitted
net/core: Add drop counters to VF statistics
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 <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 4312782 commit c5a9f6f

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

include/linux/if_link.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ struct ifla_vf_stats {
1313
__u64 tx_bytes;
1414
__u64 broadcast;
1515
__u64 multicast;
16+
__u64 rx_dropped;
17+
__u64 tx_dropped;
1618
};
1719

1820
struct ifla_vf_info {

include/uapi/linux/if_link.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,8 @@ enum {
732732
IFLA_VF_STATS_BROADCAST,
733733
IFLA_VF_STATS_MULTICAST,
734734
IFLA_VF_STATS_PAD,
735+
IFLA_VF_STATS_RX_DROPPED,
736+
IFLA_VF_STATS_TX_DROPPED,
735737
__IFLA_VF_STATS_MAX,
736738
};
737739

net/core/rtnetlink.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,10 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev,
904904
nla_total_size_64bit(sizeof(__u64)) +
905905
/* IFLA_VF_STATS_MULTICAST */
906906
nla_total_size_64bit(sizeof(__u64)) +
907+
/* IFLA_VF_STATS_RX_DROPPED */
908+
nla_total_size_64bit(sizeof(__u64)) +
909+
/* IFLA_VF_STATS_TX_DROPPED */
910+
nla_total_size_64bit(sizeof(__u64)) +
907911
nla_total_size(sizeof(struct ifla_vf_trust)));
908912
return size;
909913
} else
@@ -1258,7 +1262,11 @@ static noinline_for_stack int rtnl_fill_vfinfo(struct sk_buff *skb,
12581262
nla_put_u64_64bit(skb, IFLA_VF_STATS_BROADCAST,
12591263
vf_stats.broadcast, IFLA_VF_STATS_PAD) ||
12601264
nla_put_u64_64bit(skb, IFLA_VF_STATS_MULTICAST,
1261-
vf_stats.multicast, IFLA_VF_STATS_PAD)) {
1265+
vf_stats.multicast, IFLA_VF_STATS_PAD) ||
1266+
nla_put_u64_64bit(skb, IFLA_VF_STATS_RX_DROPPED,
1267+
vf_stats.rx_dropped, IFLA_VF_STATS_PAD) ||
1268+
nla_put_u64_64bit(skb, IFLA_VF_STATS_TX_DROPPED,
1269+
vf_stats.tx_dropped, IFLA_VF_STATS_PAD)) {
12621270
nla_nest_cancel(skb, vfstats);
12631271
goto nla_put_vf_failure;
12641272
}

0 commit comments

Comments
 (0)