net: bridge: vlan: include stats in dumps if requested
This patch adds support for vlan stats to be included when dumping vlan information. We have to dump them only when explicitly requested (thus the flag below) because that disables the vlan range compression and will make the dump significantly larger. In order to request the stats to be included we add a new dump attribute called BRIDGE_VLANDB_DUMP_FLAGS which can affect dumps with the following first flag: - BRIDGE_VLANDB_DUMPF_STATS The stats are intentionally nested and put into separate attributes to make it easier for extending later since we plan to add per-vlan mcast stats, drop stats and possibly STP stats. This is the last missing piece from the new vlan API which makes the dumped vlan information complete. A dump request which should include stats looks like: [BRIDGE_VLANDB_DUMP_FLAGS] |= BRIDGE_VLANDB_DUMPF_STATS A vlandb entry attribute with stats looks like: [BRIDGE_VLANDB_ENTRY] = { [BRIDGE_VLANDB_ENTRY_STATS] = { [BRIDGE_VLANDB_STATS_RX_BYTES] [BRIDGE_VLANDB_STATS_RX_PACKETS] ... } } Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
0be534f5c0
commit
56d099761a
@@ -175,6 +175,16 @@ struct br_vlan_msg {
|
||||
__u32 ifindex;
|
||||
};
|
||||
|
||||
enum {
|
||||
BRIDGE_VLANDB_DUMP_UNSPEC,
|
||||
BRIDGE_VLANDB_DUMP_FLAGS,
|
||||
__BRIDGE_VLANDB_DUMP_MAX,
|
||||
};
|
||||
#define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
|
||||
|
||||
/* flags used in BRIDGE_VLANDB_DUMP_FLAGS attribute to affect dumps */
|
||||
#define BRIDGE_VLANDB_DUMPF_STATS (1 << 0) /* Include stats in the dump */
|
||||
|
||||
/* Bridge vlan RTM attributes
|
||||
* [BRIDGE_VLANDB_ENTRY] = {
|
||||
* [BRIDGE_VLANDB_ENTRY_INFO]
|
||||
@@ -194,10 +204,30 @@ enum {
|
||||
BRIDGE_VLANDB_ENTRY_RANGE,
|
||||
BRIDGE_VLANDB_ENTRY_STATE,
|
||||
BRIDGE_VLANDB_ENTRY_TUNNEL_ID,
|
||||
BRIDGE_VLANDB_ENTRY_STATS,
|
||||
__BRIDGE_VLANDB_ENTRY_MAX,
|
||||
};
|
||||
#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
|
||||
|
||||
/* [BRIDGE_VLANDB_ENTRY] = {
|
||||
* [BRIDGE_VLANDB_ENTRY_STATS] = {
|
||||
* [BRIDGE_VLANDB_STATS_RX_BYTES]
|
||||
* ...
|
||||
* }
|
||||
* ...
|
||||
* }
|
||||
*/
|
||||
enum {
|
||||
BRIDGE_VLANDB_STATS_UNSPEC,
|
||||
BRIDGE_VLANDB_STATS_RX_BYTES,
|
||||
BRIDGE_VLANDB_STATS_RX_PACKETS,
|
||||
BRIDGE_VLANDB_STATS_TX_BYTES,
|
||||
BRIDGE_VLANDB_STATS_TX_PACKETS,
|
||||
BRIDGE_VLANDB_STATS_PAD,
|
||||
__BRIDGE_VLANDB_STATS_MAX,
|
||||
};
|
||||
#define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
|
||||
|
||||
/* Bridge multicast database attributes
|
||||
* [MDBA_MDB] = {
|
||||
* [MDBA_MDB_ENTRY] = {
|
||||
|
Reference in New Issue
Block a user