History

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.

Nikolay Aleksandrov committed 10 years ago

Commit 1080ab91 parent 80e73cc10 files · +390 −46Browse files

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

Unified · Split

2 files
  1. include/uapi/linux/if_bridge.h +26 −0
  2. include/uapi/linux/if_link.h +1 −0
include/uapi/linux/if_bridge.h+26−0
@@ -247,8 +247,34 @@ enum { · 246 unmodified lines
247247 enum {
248248 BRIDGE_XSTATS_UNSPEC,
249249 BRIDGE_XSTATS_VLAN,
250+ BRIDGE_XSTATS_MCAST,
251+ BRIDGE_XSTATS_PAD,
250252 __BRIDGE_XSTATS_MAX
251253 };
252254 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
253255
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+};
254280 #endif /* _UAPI_LINUX_IF_BRIDGE_H */
include/uapi/linux/if_link.h+1−0
@@ -273,6 +273,7 @@ enum { · 272 unmodified lines
273273 IFLA_BR_VLAN_DEFAULT_PVID,
274274 IFLA_BR_PAD,
275275 IFLA_BR_VLAN_STATS_ENABLED,
276+ IFLA_BR_MCAST_STATS_ENABLED,
276277 __IFLA_BR_MAX,
277278 };
278279

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t