diff options
| author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2016-06-28 10:57:06 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-06-30 06:18:24 -0400 |
| commit | 1080ab95e3c7bdd77870e209aff83c763fdcf439 (patch) | |
| tree | 16ffa738a90a36411886403ed92f5e1fef115486 /include/uapi/linux | |
| parent | 80e73cc563c4359be809a03bcb8e7e28141a813a (diff) | |
net: bridge: add support for IGMP/MLD stats and export them via netlink
This patch adds stats support for the currently used IGMP/MLD types by the
bridge. The stats are per-port (plus one stat per-bridge) and per-direction
(RX/TX). The stats are exported via netlink via the new linkxstats API
(RTM_GETSTATS). In order to minimize the performance impact, a new option
is used to enable/disable the stats - multicast_stats_enabled, similar to
the recent vlan stats. Also in order to avoid multiple IGMP/MLD type
lookups and checks, we make use of the current "igmp" member of the bridge
private skb->cb region to record the type on Rx (both host-generated and
external packets pass by multicast_rcv()). We can do that since the igmp
member was used as a boolean and all the valid IGMP/MLD types are positive
values. The normal bridge fast-path is not affected at all, the only
affected paths are the flooding ones and since we make use of the IGMP/MLD
type, we can quickly determine if the packet should be counted using
cache-hot data (cb's igmp member). We add counters for:
* IGMP Queries
* IGMP Leaves
* IGMP v1/v2/v3 reports
* MLD Queries
* MLD Leaves
* MLD v1/v2 reports
These are invaluable when monitoring or debugging complex multicast setups
with bridges.
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/if_bridge.h | 26 | ||||
| -rw-r--r-- | include/uapi/linux/if_link.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/include/uapi/linux/if_bridge.h b/include/uapi/linux/if_bridge.h index 397d503fdedb..8304fe6f0561 100644 --- a/include/uapi/linux/if_bridge.h +++ b/include/uapi/linux/if_bridge.h | |||
| @@ -247,8 +247,34 @@ enum { | |||
| 247 | enum { | 247 | enum { |
| 248 | BRIDGE_XSTATS_UNSPEC, | 248 | BRIDGE_XSTATS_UNSPEC, |
| 249 | BRIDGE_XSTATS_VLAN, | 249 | BRIDGE_XSTATS_VLAN, |
| 250 | BRIDGE_XSTATS_MCAST, | ||
| 251 | BRIDGE_XSTATS_PAD, | ||
| 250 | __BRIDGE_XSTATS_MAX | 252 | __BRIDGE_XSTATS_MAX |
| 251 | }; | 253 | }; |
| 252 | #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) | 254 | #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1) |
| 253 | 255 | ||
| 256 | enum { | ||
| 257 | BR_MCAST_DIR_RX, | ||
| 258 | BR_MCAST_DIR_TX, | ||
| 259 | BR_MCAST_DIR_SIZE | ||
| 260 | }; | ||
| 261 | |||
| 262 | /* IGMP/MLD statistics */ | ||
| 263 | struct br_mcast_stats { | ||
| 264 | __u64 igmp_queries[BR_MCAST_DIR_SIZE]; | ||
| 265 | __u64 igmp_leaves[BR_MCAST_DIR_SIZE]; | ||
| 266 | __u64 igmp_v1reports[BR_MCAST_DIR_SIZE]; | ||
| 267 | __u64 igmp_v2reports[BR_MCAST_DIR_SIZE]; | ||
| 268 | __u64 igmp_v3reports[BR_MCAST_DIR_SIZE]; | ||
| 269 | __u64 igmp_parse_errors; | ||
| 270 | |||
| 271 | __u64 mld_queries[BR_MCAST_DIR_SIZE]; | ||
| 272 | __u64 mld_leaves[BR_MCAST_DIR_SIZE]; | ||
| 273 | __u64 mld_v1reports[BR_MCAST_DIR_SIZE]; | ||
| 274 | __u64 mld_v2reports[BR_MCAST_DIR_SIZE]; | ||
| 275 | __u64 mld_parse_errors; | ||
| 276 | |||
| 277 | __u64 mcast_bytes[BR_MCAST_DIR_SIZE]; | ||
| 278 | __u64 mcast_packets[BR_MCAST_DIR_SIZE]; | ||
| 279 | }; | ||
| 254 | #endif /* _UAPI_LINUX_IF_BRIDGE_H */ | 280 | #endif /* _UAPI_LINUX_IF_BRIDGE_H */ |
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index db2458ade81c..4285ac31e865 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h | |||
| @@ -273,6 +273,7 @@ enum { | |||
| 273 | IFLA_BR_VLAN_DEFAULT_PVID, | 273 | IFLA_BR_VLAN_DEFAULT_PVID, |
| 274 | IFLA_BR_PAD, | 274 | IFLA_BR_PAD, |
| 275 | IFLA_BR_VLAN_STATS_ENABLED, | 275 | IFLA_BR_VLAN_STATS_ENABLED, |
| 276 | IFLA_BR_MCAST_STATS_ENABLED, | ||
| 276 | __IFLA_BR_MAX, | 277 | __IFLA_BR_MAX, |
| 277 | }; | 278 | }; |
| 278 | 279 | ||
