2017-11-01 22:09:13 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
2012-10-13 17:46:48 +08:00
|
|
|
/*
|
|
|
|
* Linux ethernet bridge
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Lennert Buytenhek <buytenh@gnu.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _UAPI_LINUX_IF_BRIDGE_H
|
|
|
|
#define _UAPI_LINUX_IF_BRIDGE_H
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
2013-08-02 07:17:47 +08:00
|
|
|
#include <linux/if_ether.h>
|
2014-11-05 03:21:21 +08:00
|
|
|
#include <linux/in6.h>
|
2012-10-13 17:46:48 +08:00
|
|
|
|
|
|
|
#define SYSFS_BRIDGE_ATTR "bridge"
|
|
|
|
#define SYSFS_BRIDGE_FDB "brforward"
|
|
|
|
#define SYSFS_BRIDGE_PORT_SUBDIR "brif"
|
|
|
|
#define SYSFS_BRIDGE_PORT_ATTR "brport"
|
|
|
|
#define SYSFS_BRIDGE_PORT_LINK "bridge"
|
|
|
|
|
|
|
|
#define BRCTL_VERSION 1
|
|
|
|
|
|
|
|
#define BRCTL_GET_VERSION 0
|
|
|
|
#define BRCTL_GET_BRIDGES 1
|
|
|
|
#define BRCTL_ADD_BRIDGE 2
|
|
|
|
#define BRCTL_DEL_BRIDGE 3
|
|
|
|
#define BRCTL_ADD_IF 4
|
|
|
|
#define BRCTL_DEL_IF 5
|
|
|
|
#define BRCTL_GET_BRIDGE_INFO 6
|
|
|
|
#define BRCTL_GET_PORT_LIST 7
|
|
|
|
#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
|
|
|
|
#define BRCTL_SET_BRIDGE_HELLO_TIME 9
|
|
|
|
#define BRCTL_SET_BRIDGE_MAX_AGE 10
|
|
|
|
#define BRCTL_SET_AGEING_TIME 11
|
|
|
|
#define BRCTL_SET_GC_INTERVAL 12
|
|
|
|
#define BRCTL_GET_PORT_INFO 13
|
|
|
|
#define BRCTL_SET_BRIDGE_STP_STATE 14
|
|
|
|
#define BRCTL_SET_BRIDGE_PRIORITY 15
|
|
|
|
#define BRCTL_SET_PORT_PRIORITY 16
|
|
|
|
#define BRCTL_SET_PATH_COST 17
|
|
|
|
#define BRCTL_GET_FDB_ENTRIES 18
|
|
|
|
|
|
|
|
#define BR_STATE_DISABLED 0
|
|
|
|
#define BR_STATE_LISTENING 1
|
|
|
|
#define BR_STATE_LEARNING 2
|
|
|
|
#define BR_STATE_FORWARDING 3
|
|
|
|
#define BR_STATE_BLOCKING 4
|
|
|
|
|
|
|
|
struct __bridge_info {
|
|
|
|
__u64 designated_root;
|
|
|
|
__u64 bridge_id;
|
|
|
|
__u32 root_path_cost;
|
|
|
|
__u32 max_age;
|
|
|
|
__u32 hello_time;
|
|
|
|
__u32 forward_delay;
|
|
|
|
__u32 bridge_max_age;
|
|
|
|
__u32 bridge_hello_time;
|
|
|
|
__u32 bridge_forward_delay;
|
|
|
|
__u8 topology_change;
|
|
|
|
__u8 topology_change_detected;
|
|
|
|
__u8 root_port;
|
|
|
|
__u8 stp_enabled;
|
|
|
|
__u32 ageing_time;
|
|
|
|
__u32 gc_interval;
|
|
|
|
__u32 hello_timer_value;
|
|
|
|
__u32 tcn_timer_value;
|
|
|
|
__u32 topology_change_timer_value;
|
|
|
|
__u32 gc_timer_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct __port_info {
|
|
|
|
__u64 designated_root;
|
|
|
|
__u64 designated_bridge;
|
|
|
|
__u16 port_id;
|
|
|
|
__u16 designated_port;
|
|
|
|
__u32 path_cost;
|
|
|
|
__u32 designated_cost;
|
|
|
|
__u8 state;
|
|
|
|
__u8 top_change_ack;
|
|
|
|
__u8 config_pending;
|
|
|
|
__u8 unused0;
|
|
|
|
__u32 message_age_timer_value;
|
|
|
|
__u32 forward_delay_timer_value;
|
|
|
|
__u32 hold_timer_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct __fdb_entry {
|
2013-08-02 07:17:47 +08:00
|
|
|
__u8 mac_addr[ETH_ALEN];
|
2012-10-13 17:46:48 +08:00
|
|
|
__u8 port_no;
|
|
|
|
__u8 is_local;
|
|
|
|
__u32 ageing_timer_value;
|
|
|
|
__u8 port_hi;
|
|
|
|
__u8 pad0;
|
|
|
|
__u16 unused;
|
|
|
|
};
|
|
|
|
|
2012-10-24 16:13:03 +08:00
|
|
|
/* Bridge Flags */
|
|
|
|
#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
|
|
|
|
#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
|
2012-10-13 17:46:48 +08:00
|
|
|
|
2012-10-24 16:13:03 +08:00
|
|
|
#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
|
|
|
|
#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
|
2014-12-09 06:04:19 +08:00
|
|
|
#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
|
2012-10-24 16:13:03 +08:00
|
|
|
|
|
|
|
/* Bridge management nested attributes
|
|
|
|
* [IFLA_AF_SPEC] = {
|
|
|
|
* [IFLA_BRIDGE_FLAGS]
|
|
|
|
* [IFLA_BRIDGE_MODE]
|
2013-02-13 20:00:12 +08:00
|
|
|
* [IFLA_BRIDGE_VLAN_INFO]
|
2012-10-24 16:13:03 +08:00
|
|
|
* }
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_FLAGS,
|
|
|
|
IFLA_BRIDGE_MODE,
|
2013-02-13 20:00:12 +08:00
|
|
|
IFLA_BRIDGE_VLAN_INFO,
|
2017-02-01 14:59:53 +08:00
|
|
|
IFLA_BRIDGE_VLAN_TUNNEL_INFO,
|
2020-04-26 21:21:58 +08:00
|
|
|
IFLA_BRIDGE_MRP,
|
2012-10-24 16:13:03 +08:00
|
|
|
__IFLA_BRIDGE_MAX,
|
|
|
|
};
|
|
|
|
#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
|
2012-12-07 08:04:48 +08:00
|
|
|
|
2013-02-13 20:00:12 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
|
2013-02-13 20:00:15 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
|
2013-02-13 20:00:20 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
|
2015-01-10 23:31:12 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
|
|
|
|
#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
|
bridge: vlan: add per-vlan struct and move to rhashtables
This patch changes the bridge vlan implementation to use rhashtables
instead of bitmaps. The main motivation behind this change is that we
need extensible per-vlan structures (both per-port and global) so more
advanced features can be introduced and the vlan support can be
extended. I've tried to break this up but the moment net_port_vlans is
changed and the whole API goes away, thus this is a larger patch.
A few short goals of this patch are:
- Extensible per-vlan structs stored in rhashtables and a sorted list
- Keep user-visible behaviour (compressed vlans etc)
- Keep fastpath ingress/egress logic the same (optimizations to come
later)
Here's a brief list of some of the new features we'd like to introduce:
- per-vlan counters
- vlan ingress/egress mapping
- per-vlan igmp configuration
- vlan priorities
- avoid fdb entries replication (e.g. local fdb scaling issues)
The structure is kept single for both global and per-port entries so to
avoid code duplication where possible and also because we'll soon introduce
"port0 / aka bridge as port" which should simplify things further
(thanks to Vlad for the suggestion!).
Now we have per-vlan global rhashtable (bridge-wide) and per-vlan port
rhashtable, if an entry is added to a port it'll get a pointer to its
global context so it can be quickly accessed later. There's also a
sorted vlan list which is used for stable walks and some user-visible
behaviour such as the vlan ranges, also for error paths.
VLANs are stored in a "vlan group" which currently contains the
rhashtable, sorted vlan list and the number of "real" vlan entries.
A good side-effect of this change is that it resembles how hw keeps
per-vlan data.
One important note after this change is that if a VLAN is being looked up
in the bridge's rhashtable for filtering purposes (or to check if it's an
existing usable entry, not just a global context) then the new helper
br_vlan_should_use() needs to be used if the vlan is found. In case the
lookup is done only with a port's vlan group, then this check can be
skipped.
Things tested so far:
- basic vlan ingress/egress
- pvids
- untagged vlans
- undef CONFIG_BRIDGE_VLAN_FILTERING
- adding/deleting vlans in different scenarios (with/without global ctx,
while transmitting traffic, in ranges etc)
- loading/removing the module while having/adding/deleting vlans
- extracting bridge vlan information (user ABI), compressed requests
- adding/deleting fdbs on vlans
- bridge mac change, promisc mode
- default pvid change
- kmemleak ON during the whole time
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-26 01:00:11 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */
|
2020-01-24 19:40:21 +08:00
|
|
|
#define BRIDGE_VLAN_INFO_ONLY_OPTS (1<<6) /* Skip create/delete/flags */
|
2013-02-13 20:00:12 +08:00
|
|
|
|
|
|
|
struct bridge_vlan_info {
|
2013-02-14 13:32:31 +08:00
|
|
|
__u16 flags;
|
|
|
|
__u16 vid;
|
2013-02-13 20:00:12 +08:00
|
|
|
};
|
|
|
|
|
2017-02-01 14:59:53 +08:00
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC,
|
|
|
|
IFLA_BRIDGE_VLAN_TUNNEL_ID,
|
|
|
|
IFLA_BRIDGE_VLAN_TUNNEL_VID,
|
|
|
|
IFLA_BRIDGE_VLAN_TUNNEL_FLAGS,
|
|
|
|
__IFLA_BRIDGE_VLAN_TUNNEL_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1)
|
|
|
|
|
2016-04-30 16:25:29 +08:00
|
|
|
struct bridge_vlan_xstats {
|
|
|
|
__u64 rx_bytes;
|
|
|
|
__u64 rx_packets;
|
|
|
|
__u64 tx_bytes;
|
|
|
|
__u64 tx_packets;
|
|
|
|
__u16 vid;
|
2016-08-17 18:53:10 +08:00
|
|
|
__u16 flags;
|
2016-04-30 16:25:29 +08:00
|
|
|
__u32 pad2;
|
|
|
|
};
|
|
|
|
|
2020-04-26 21:21:58 +08:00
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_INSTANCE,
|
|
|
|
IFLA_BRIDGE_MRP_PORT_STATE,
|
|
|
|
IFLA_BRIDGE_MRP_PORT_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_RING_STATE,
|
|
|
|
IFLA_BRIDGE_MRP_RING_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST,
|
2020-07-02 16:13:05 +08:00
|
|
|
IFLA_BRIDGE_MRP_INFO,
|
2020-07-14 15:34:48 +08:00
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_IN_STATE,
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST,
|
2020-04-26 21:21:58 +08:00
|
|
|
__IFLA_BRIDGE_MRP_MAX,
|
|
|
|
};
|
|
|
|
|
2020-05-27 20:34:30 +08:00
|
|
|
#define IFLA_BRIDGE_MRP_MAX (__IFLA_BRIDGE_MRP_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_INSTANCE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_INSTANCE_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_INSTANCE_P_IFINDEX,
|
|
|
|
IFLA_BRIDGE_MRP_INSTANCE_S_IFINDEX,
|
2020-05-31 02:09:47 +08:00
|
|
|
IFLA_BRIDGE_MRP_INSTANCE_PRIO,
|
2020-05-27 20:34:30 +08:00
|
|
|
__IFLA_BRIDGE_MRP_INSTANCE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_INSTANCE_MAX (__IFLA_BRIDGE_MRP_INSTANCE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_PORT_STATE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_PORT_STATE_STATE,
|
|
|
|
__IFLA_BRIDGE_MRP_PORT_STATE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_PORT_STATE_MAX (__IFLA_BRIDGE_MRP_PORT_STATE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_PORT_ROLE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_PORT_ROLE_ROLE,
|
|
|
|
__IFLA_BRIDGE_MRP_PORT_ROLE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_PORT_ROLE_MAX (__IFLA_BRIDGE_MRP_PORT_ROLE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_RING_STATE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_RING_STATE_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_RING_STATE_STATE,
|
|
|
|
__IFLA_BRIDGE_MRP_RING_STATE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_RING_STATE_MAX (__IFLA_BRIDGE_MRP_RING_STATE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_RING_ROLE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_RING_ROLE_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_RING_ROLE_ROLE,
|
|
|
|
__IFLA_BRIDGE_MRP_RING_ROLE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_RING_ROLE_MAX (__IFLA_BRIDGE_MRP_RING_ROLE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST_INTERVAL,
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST_MAX_MISS,
|
|
|
|
IFLA_BRIDGE_MRP_START_TEST_PERIOD,
|
2020-05-31 02:09:48 +08:00
|
|
|
IFLA_BRIDGE_MRP_START_TEST_MONITOR,
|
2020-05-27 20:34:30 +08:00
|
|
|
__IFLA_BRIDGE_MRP_START_TEST_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_START_TEST_MAX (__IFLA_BRIDGE_MRP_START_TEST_MAX - 1)
|
|
|
|
|
2020-07-02 16:13:05 +08:00
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_INFO_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_P_IFINDEX,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_S_IFINDEX,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_PRIO,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_RING_STATE,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_RING_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_TEST_INTERVAL,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_TEST_MAX_MISS,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_TEST_MONITOR,
|
2020-07-14 15:34:56 +08:00
|
|
|
IFLA_BRIDGE_MRP_INFO_I_IFINDEX,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_IN_STATE,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_IN_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL,
|
|
|
|
IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS,
|
2020-07-02 16:13:05 +08:00
|
|
|
__IFLA_BRIDGE_MRP_INFO_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_INFO_MAX (__IFLA_BRIDGE_MRP_INFO_MAX - 1)
|
|
|
|
|
2020-07-14 15:34:48 +08:00
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_IN_STATE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_IN_STATE_IN_ID,
|
|
|
|
IFLA_BRIDGE_MRP_IN_STATE_STATE,
|
|
|
|
__IFLA_BRIDGE_MRP_IN_STATE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_IN_STATE_MAX (__IFLA_BRIDGE_MRP_IN_STATE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE_RING_ID,
|
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE_IN_ID,
|
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE_ROLE,
|
|
|
|
IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX,
|
|
|
|
__IFLA_BRIDGE_MRP_IN_ROLE_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_IN_ROLE_MAX (__IFLA_BRIDGE_MRP_IN_ROLE_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC,
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID,
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL,
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS,
|
|
|
|
IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD,
|
|
|
|
__IFLA_BRIDGE_MRP_START_IN_TEST_MAX,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define IFLA_BRIDGE_MRP_START_IN_TEST_MAX (__IFLA_BRIDGE_MRP_START_IN_TEST_MAX - 1)
|
|
|
|
|
2020-04-26 21:21:58 +08:00
|
|
|
struct br_mrp_instance {
|
|
|
|
__u32 ring_id;
|
|
|
|
__u32 p_ifindex;
|
|
|
|
__u32 s_ifindex;
|
2020-05-31 02:09:47 +08:00
|
|
|
__u16 prio;
|
2020-04-26 21:21:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mrp_ring_state {
|
|
|
|
__u32 ring_id;
|
|
|
|
__u32 ring_state;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mrp_ring_role {
|
|
|
|
__u32 ring_id;
|
|
|
|
__u32 ring_role;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mrp_start_test {
|
|
|
|
__u32 ring_id;
|
|
|
|
__u32 interval;
|
|
|
|
__u32 max_miss;
|
|
|
|
__u32 period;
|
2020-05-31 02:09:48 +08:00
|
|
|
__u32 monitor;
|
2020-04-26 21:21:58 +08:00
|
|
|
};
|
|
|
|
|
2020-07-14 15:34:48 +08:00
|
|
|
struct br_mrp_in_state {
|
|
|
|
__u32 in_state;
|
|
|
|
__u16 in_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mrp_in_role {
|
|
|
|
__u32 ring_id;
|
|
|
|
__u32 in_role;
|
|
|
|
__u32 i_ifindex;
|
|
|
|
__u16 in_id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mrp_start_in_test {
|
|
|
|
__u32 interval;
|
|
|
|
__u32 max_miss;
|
|
|
|
__u32 period;
|
|
|
|
__u16 in_id;
|
|
|
|
};
|
|
|
|
|
2019-12-12 09:07:10 +08:00
|
|
|
struct bridge_stp_xstats {
|
|
|
|
__u64 transition_blk;
|
|
|
|
__u64 transition_fwd;
|
|
|
|
__u64 rx_bpdu;
|
|
|
|
__u64 tx_bpdu;
|
|
|
|
__u64 rx_tcn;
|
|
|
|
__u64 tx_tcn;
|
|
|
|
};
|
|
|
|
|
2020-01-15 01:56:09 +08:00
|
|
|
/* Bridge vlan RTM header */
|
|
|
|
struct br_vlan_msg {
|
|
|
|
__u8 family;
|
|
|
|
__u8 reserved1;
|
|
|
|
__u16 reserved2;
|
|
|
|
__u32 ifindex;
|
|
|
|
};
|
|
|
|
|
2020-03-19 18:14:14 +08:00
|
|
|
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 */
|
|
|
|
|
2020-01-15 01:56:09 +08:00
|
|
|
/* Bridge vlan RTM attributes
|
|
|
|
* [BRIDGE_VLANDB_ENTRY] = {
|
|
|
|
* [BRIDGE_VLANDB_ENTRY_INFO]
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
BRIDGE_VLANDB_UNSPEC,
|
|
|
|
BRIDGE_VLANDB_ENTRY,
|
|
|
|
__BRIDGE_VLANDB_MAX,
|
|
|
|
};
|
|
|
|
#define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
BRIDGE_VLANDB_ENTRY_UNSPEC,
|
|
|
|
BRIDGE_VLANDB_ENTRY_INFO,
|
2020-01-15 01:56:12 +08:00
|
|
|
BRIDGE_VLANDB_ENTRY_RANGE,
|
2020-01-24 19:40:22 +08:00
|
|
|
BRIDGE_VLANDB_ENTRY_STATE,
|
2020-03-20 19:23:02 +08:00
|
|
|
BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
|
2020-03-19 18:14:14 +08:00
|
|
|
BRIDGE_VLANDB_ENTRY_STATS,
|
2020-01-15 01:56:09 +08:00
|
|
|
__BRIDGE_VLANDB_ENTRY_MAX,
|
|
|
|
};
|
|
|
|
#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
|
|
|
|
|
2020-03-20 19:23:02 +08:00
|
|
|
/* [BRIDGE_VLANDB_ENTRY] = {
|
|
|
|
* [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO] = {
|
|
|
|
* [BRIDGE_VLANDB_TINFO_ID]
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
BRIDGE_VLANDB_TINFO_UNSPEC,
|
|
|
|
BRIDGE_VLANDB_TINFO_ID,
|
2020-03-20 19:23:03 +08:00
|
|
|
BRIDGE_VLANDB_TINFO_CMD,
|
2020-03-20 19:23:02 +08:00
|
|
|
__BRIDGE_VLANDB_TINFO_MAX,
|
|
|
|
};
|
|
|
|
#define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
|
|
|
|
|
2020-03-19 18:14:14 +08:00
|
|
|
/* [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)
|
|
|
|
|
2012-12-07 08:04:48 +08:00
|
|
|
/* Bridge multicast database attributes
|
|
|
|
* [MDBA_MDB] = {
|
|
|
|
* [MDBA_MDB_ENTRY] = {
|
2016-02-16 19:46:54 +08:00
|
|
|
* [MDBA_MDB_ENTRY_INFO] {
|
|
|
|
* struct br_mdb_entry
|
|
|
|
* [MDBA_MDB_EATTR attributes]
|
|
|
|
* }
|
2012-12-07 08:04:48 +08:00
|
|
|
* }
|
|
|
|
* }
|
|
|
|
* [MDBA_ROUTER] = {
|
2016-02-27 04:20:04 +08:00
|
|
|
* [MDBA_ROUTER_PORT] = {
|
|
|
|
* u32 ifindex
|
|
|
|
* [MDBA_ROUTER_PATTR attributes]
|
|
|
|
* }
|
2012-12-07 08:04:48 +08:00
|
|
|
* }
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
MDBA_UNSPEC,
|
|
|
|
MDBA_MDB,
|
|
|
|
MDBA_ROUTER,
|
|
|
|
__MDBA_MAX,
|
|
|
|
};
|
|
|
|
#define MDBA_MAX (__MDBA_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MDBA_MDB_UNSPEC,
|
|
|
|
MDBA_MDB_ENTRY,
|
|
|
|
__MDBA_MDB_MAX,
|
|
|
|
};
|
|
|
|
#define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
|
|
|
|
|
|
|
|
enum {
|
|
|
|
MDBA_MDB_ENTRY_UNSPEC,
|
|
|
|
MDBA_MDB_ENTRY_INFO,
|
|
|
|
__MDBA_MDB_ENTRY_MAX,
|
|
|
|
};
|
|
|
|
#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
|
|
|
|
|
2016-02-16 19:46:54 +08:00
|
|
|
/* per mdb entry additional attributes */
|
|
|
|
enum {
|
|
|
|
MDBA_MDB_EATTR_UNSPEC,
|
|
|
|
MDBA_MDB_EATTR_TIMER,
|
2020-09-07 17:56:08 +08:00
|
|
|
MDBA_MDB_EATTR_SRC_LIST,
|
|
|
|
MDBA_MDB_EATTR_GROUP_MODE,
|
2020-09-22 15:30:19 +08:00
|
|
|
MDBA_MDB_EATTR_SOURCE,
|
2020-09-22 15:30:21 +08:00
|
|
|
MDBA_MDB_EATTR_RTPROT,
|
2016-02-16 19:46:54 +08:00
|
|
|
__MDBA_MDB_EATTR_MAX
|
|
|
|
};
|
|
|
|
#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
|
|
|
|
|
2020-09-07 17:56:08 +08:00
|
|
|
/* per mdb entry source */
|
|
|
|
enum {
|
|
|
|
MDBA_MDB_SRCLIST_UNSPEC,
|
|
|
|
MDBA_MDB_SRCLIST_ENTRY,
|
|
|
|
__MDBA_MDB_SRCLIST_MAX
|
|
|
|
};
|
|
|
|
#define MDBA_MDB_SRCLIST_MAX (__MDBA_MDB_SRCLIST_MAX - 1)
|
|
|
|
|
|
|
|
/* per mdb entry per source attributes
|
|
|
|
* these are embedded in MDBA_MDB_SRCLIST_ENTRY
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
MDBA_MDB_SRCATTR_UNSPEC,
|
|
|
|
MDBA_MDB_SRCATTR_ADDRESS,
|
|
|
|
MDBA_MDB_SRCATTR_TIMER,
|
|
|
|
__MDBA_MDB_SRCATTR_MAX
|
|
|
|
};
|
|
|
|
#define MDBA_MDB_SRCATTR_MAX (__MDBA_MDB_SRCATTR_MAX - 1)
|
|
|
|
|
2016-02-27 04:20:01 +08:00
|
|
|
/* multicast router types */
|
|
|
|
enum {
|
|
|
|
MDB_RTR_TYPE_DISABLED,
|
|
|
|
MDB_RTR_TYPE_TEMP_QUERY,
|
|
|
|
MDB_RTR_TYPE_PERM,
|
2016-02-27 04:20:03 +08:00
|
|
|
MDB_RTR_TYPE_TEMP
|
2016-02-27 04:20:01 +08:00
|
|
|
};
|
|
|
|
|
2012-12-07 08:04:48 +08:00
|
|
|
enum {
|
|
|
|
MDBA_ROUTER_UNSPEC,
|
|
|
|
MDBA_ROUTER_PORT,
|
|
|
|
__MDBA_ROUTER_MAX,
|
|
|
|
};
|
|
|
|
#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
|
|
|
|
|
2016-02-27 04:20:04 +08:00
|
|
|
/* router port attributes */
|
|
|
|
enum {
|
|
|
|
MDBA_ROUTER_PATTR_UNSPEC,
|
|
|
|
MDBA_ROUTER_PATTR_TIMER,
|
|
|
|
MDBA_ROUTER_PATTR_TYPE,
|
|
|
|
__MDBA_ROUTER_PATTR_MAX
|
|
|
|
};
|
|
|
|
#define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
|
|
|
|
|
2012-12-07 08:04:48 +08:00
|
|
|
struct br_port_msg {
|
2012-12-12 06:23:08 +08:00
|
|
|
__u8 family;
|
2012-12-07 08:04:48 +08:00
|
|
|
__u32 ifindex;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct br_mdb_entry {
|
|
|
|
__u32 ifindex;
|
2012-12-15 06:09:51 +08:00
|
|
|
#define MDB_TEMPORARY 0
|
|
|
|
#define MDB_PERMANENT 1
|
|
|
|
__u8 state;
|
2016-02-03 16:57:04 +08:00
|
|
|
#define MDB_FLAGS_OFFLOAD (1 << 0)
|
2019-07-30 20:20:41 +08:00
|
|
|
#define MDB_FLAGS_FAST_LEAVE (1 << 1)
|
net: bridge: mcast: handle port group filter modes
We need to handle group filter mode transitions and initial state.
To change a port group's INCLUDE -> EXCLUDE mode (or when we have added
a new port group in EXCLUDE mode) we need to add that port to all of
*,G ports' S,G entries for proper replication. When the EXCLUDE state is
changed from IGMPv3 report, br_multicast_fwd_filter_exclude() must be
called after the source list processing because the assumption is that
all of the group's S,G entries will be created before transitioning to
EXCLUDE mode, i.e. most importantly its blocked entries will already be
added so it will not get automatically added to them.
The transition EXCLUDE -> INCLUDE happens only when a port group timer
expires, it requires us to remove that port from all of *,G ports' S,G
entries where it was automatically added previously.
Finally when we are adding a new S,G entry we must add all of *,G's
EXCLUDE ports to it.
In order to distinguish automatically added *,G EXCLUDE ports we have a
new port group flag - MDB_PG_FLAGS_STAR_EXCL.
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-22 15:30:24 +08:00
|
|
|
#define MDB_FLAGS_STAR_EXCL (1 << 2)
|
2020-09-22 15:30:25 +08:00
|
|
|
#define MDB_FLAGS_BLOCKED (1 << 3)
|
2016-02-03 16:57:04 +08:00
|
|
|
__u8 flags;
|
2015-07-10 23:02:08 +08:00
|
|
|
__u16 vid;
|
2012-12-07 08:04:48 +08:00
|
|
|
struct {
|
|
|
|
union {
|
|
|
|
__be32 ip4;
|
|
|
|
struct in6_addr ip6;
|
|
|
|
} u;
|
|
|
|
__be16 proto;
|
|
|
|
} addr;
|
|
|
|
};
|
|
|
|
|
2012-12-12 06:23:08 +08:00
|
|
|
enum {
|
|
|
|
MDBA_SET_ENTRY_UNSPEC,
|
|
|
|
MDBA_SET_ENTRY,
|
2020-09-22 15:30:18 +08:00
|
|
|
MDBA_SET_ENTRY_ATTRS,
|
2012-12-12 06:23:08 +08:00
|
|
|
__MDBA_SET_ENTRY_MAX,
|
|
|
|
};
|
|
|
|
#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
|
|
|
|
|
2020-09-22 15:30:18 +08:00
|
|
|
/* [MDBA_SET_ENTRY_ATTRS] = {
|
|
|
|
* [MDBE_ATTR_xxx]
|
|
|
|
* ...
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
MDBE_ATTR_UNSPEC,
|
2020-09-22 15:30:19 +08:00
|
|
|
MDBE_ATTR_SOURCE,
|
2020-09-22 15:30:18 +08:00
|
|
|
__MDBE_ATTR_MAX,
|
|
|
|
};
|
|
|
|
#define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
|
|
|
|
|
2016-04-30 16:25:29 +08:00
|
|
|
/* Embedded inside LINK_XSTATS_TYPE_BRIDGE */
|
|
|
|
enum {
|
|
|
|
BRIDGE_XSTATS_UNSPEC,
|
|
|
|
BRIDGE_XSTATS_VLAN,
|
2016-06-28 22:57:06 +08:00
|
|
|
BRIDGE_XSTATS_MCAST,
|
|
|
|
BRIDGE_XSTATS_PAD,
|
2019-12-12 09:07:10 +08:00
|
|
|
BRIDGE_XSTATS_STP,
|
2016-04-30 16:25:29 +08:00
|
|
|
__BRIDGE_XSTATS_MAX
|
|
|
|
};
|
|
|
|
#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
|
|
|
|
|
2016-06-28 22:57:06 +08:00
|
|
|
enum {
|
|
|
|
BR_MCAST_DIR_RX,
|
|
|
|
BR_MCAST_DIR_TX,
|
|
|
|
BR_MCAST_DIR_SIZE
|
|
|
|
};
|
|
|
|
|
|
|
|
/* IGMP/MLD statistics */
|
|
|
|
struct br_mcast_stats {
|
2016-07-07 03:12:21 +08:00
|
|
|
__u64 igmp_v1queries[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_v2queries[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_v3queries[BR_MCAST_DIR_SIZE];
|
2016-06-28 22:57:06 +08:00
|
|
|
__u64 igmp_leaves[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_v1reports[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_v2reports[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_v3reports[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 igmp_parse_errors;
|
|
|
|
|
2016-07-07 03:12:21 +08:00
|
|
|
__u64 mld_v1queries[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 mld_v2queries[BR_MCAST_DIR_SIZE];
|
2016-06-28 22:57:06 +08:00
|
|
|
__u64 mld_leaves[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 mld_v1reports[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 mld_v2reports[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 mld_parse_errors;
|
|
|
|
|
|
|
|
__u64 mcast_bytes[BR_MCAST_DIR_SIZE];
|
|
|
|
__u64 mcast_packets[BR_MCAST_DIR_SIZE];
|
|
|
|
};
|
2018-11-24 10:34:20 +08:00
|
|
|
|
|
|
|
/* bridge boolean options
|
2018-11-24 10:34:21 +08:00
|
|
|
* BR_BOOLOPT_NO_LL_LEARN - disable learning from link-local packets
|
|
|
|
*
|
2018-11-24 10:34:20 +08:00
|
|
|
* IMPORTANT: if adding a new option do not forget to handle
|
|
|
|
* it in br_boolopt_toggle/get and bridge sysfs
|
|
|
|
*/
|
|
|
|
enum br_boolopt_id {
|
2018-11-24 10:34:21 +08:00
|
|
|
BR_BOOLOPT_NO_LL_LEARN,
|
2018-11-24 10:34:20 +08:00
|
|
|
BR_BOOLOPT_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
/* struct br_boolopt_multi - change multiple bridge boolean options
|
|
|
|
*
|
|
|
|
* @optval: new option values (bit per option)
|
|
|
|
* @optmask: options to change (bit per option)
|
|
|
|
*/
|
|
|
|
struct br_boolopt_multi {
|
|
|
|
__u32 optval;
|
|
|
|
__u32 optmask;
|
|
|
|
};
|
2012-10-13 17:46:48 +08:00
|
|
|
#endif /* _UAPI_LINUX_IF_BRIDGE_H */
|