History

net: rtnetlink: Add UAPI for obtaining L3 offload xstats

Add a new IFLA_STATS_LINK_OFFLOAD_XSTATS child attribute, IFLA_OFFLOAD_XSTATS_L3_STATS, to carry statistics for traffic that takes place in a HW router. The offloaded HW stats are designed to allow per-netdevice enablement and disablement. Additionally, as a netdevice is configured, it may become or cease being suitable for binding of a HW counter. Both of these aspects need to be communicated to the userspace. To that end, add another child attribute, IFLA_OFFLOAD_XSTATS_HW_S_INFO: - attr nest IFLA_OFFLOAD_XSTATS_HW_S_INFO - attr nest IFLA_OFFLOAD_XSTATS_L3_STATS - attr IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST - {0,1} as u8 - attr IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED - {0,1} as u8 Thus this one attribute is a nest that can be used to carry information about various types of HW statistics, and indexing is very simply done by wrapping the information for a given statistics suite into the attribute that carries the suite is the RTM_GETSTATS query. At the same time, because _HW_S_INFO is nested directly below IFLA_STATS_LINK_OFFLOAD_XSTATS, it is possible through filtering to request only the metadata about individual statistics suites, without having to hit the HW to get the actual counters.

Petr Machata committed 4 years ago

Commit 0e7788f1 parent 9309f972 files · +181 −0Browse files

Showing the changes to include/uapi (1 of 2 files). Show all

Unified · Split

include/uapi/linux/if_link.h+11−0
@@ -1249,10 +1249,21 @@ enum { · 1248 unmodified lines
1249enum {1249enum {
1250 IFLA_OFFLOAD_XSTATS_UNSPEC,1250 IFLA_OFFLOAD_XSTATS_UNSPEC,
1251 IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */1251 IFLA_OFFLOAD_XSTATS_CPU_HIT, /* struct rtnl_link_stats64 */
1252 IFLA_OFFLOAD_XSTATS_HW_S_INFO, /* HW stats info. A nest */
1253 IFLA_OFFLOAD_XSTATS_L3_STATS, /* struct rtnl_hw_stats64 */
1252 __IFLA_OFFLOAD_XSTATS_MAX1254 __IFLA_OFFLOAD_XSTATS_MAX
1253};1255};
1254#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1)1256#define IFLA_OFFLOAD_XSTATS_MAX (__IFLA_OFFLOAD_XSTATS_MAX - 1)
1255 1257
1258enum {
1259 IFLA_OFFLOAD_XSTATS_HW_S_INFO_UNSPEC,
1260 IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST, /* u8 */
1261 IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED, /* u8 */
1262 __IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX,
1263};
1264#define IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX \
1265 (__IFLA_OFFLOAD_XSTATS_HW_S_INFO_MAX - 1)
1266
1256/* XDP section */1267/* XDP section */
1257 1268
1258#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0)1269#define XDP_FLAGS_UPDATE_IF_NOEXIST (1U << 0)