aboutsummaryrefslogtreecommitdiffstats
path: root/sys/linux/socket_netlink_generic_team.txt
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-04-06 17:29:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-04-06 17:29:15 +0200
commit2d0ec246252ea185220382066519862ab8bfcd4b (patch)
tree46a9ee4ac5567fc6724f3c79bf965e8f189d7c31 /sys/linux/socket_netlink_generic_team.txt
parent8e4c2e24cb05daf27a600b570d3a774083a1210b (diff)
sys/linux: improve team descriptions
1. Create ifindex_team, because TEAM_ATTR_TEAM_IFINDEX must always point to a team device. 2. Remove output only attributes like team_attr_item_port, TEAM_ATTR_LIST_PORT, TEAM_ATTR_OPTION_CHANGED. 3. Restructure team_nl_option_policy: we always want TEAM_ATTR_OPTION_NAME/TYPE/DATA + optionally TEAM_ATTR_OPTION_ARRAY_INDEX and TEAM_ATTR_OPTION_PORT_IFINDEX. 4. Provide specialized team_nl_option_policy_per_port and team_nl_option_policy_array. 5. Make team_attr_option varlen. 6. Remove unnecessary indirection via team_attr_list_option/team_attr_list_port. 7. Fix data type for bpf_hash_func and lb_tx_hash_to_port_mapping.
Diffstat (limited to 'sys/linux/socket_netlink_generic_team.txt')
-rw-r--r--sys/linux/socket_netlink_generic_team.txt77
1 files changed, 32 insertions, 45 deletions
diff --git a/sys/linux/socket_netlink_generic_team.txt b/sys/linux/socket_netlink_generic_team.txt
index 02c2411a6..b1917169d 100644
--- a/sys/linux/socket_netlink_generic_team.txt
+++ b/sys/linux/socket_netlink_generic_team.txt
@@ -10,71 +10,58 @@ include <uapi/linux/genetlink.h>
include <uapi/linux/if_team.h>
resource genl_team_family_id[int16]
+resource ifindex_team[ifindex]
type msghdr_nl_team[CMD] msghdr_netlink[netlink_msg_t[genl_team_family_id, genlmsghdr_t[CMD], team_nl_policy]]
syz_genetlink_get_family_id$team(name ptr[in, string["team"]]) genl_team_family_id
+ioctl$ifreq_SIOCGIFINDEX_team(fd sock, cmd const[SIOCGIFINDEX], arg ptr[inout, ifreq_dev_t["team0", ifindex_team]])
sendmsg$TEAM_CMD_NOOP(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_NOOP]], f flags[send_flags])
sendmsg$TEAM_CMD_OPTIONS_SET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_OPTIONS_SET]], f flags[send_flags])
sendmsg$TEAM_CMD_OPTIONS_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_OPTIONS_GET]], f flags[send_flags])
sendmsg$TEAM_CMD_PORT_LIST_GET(fd sock_nl_generic, msg ptr[in, msghdr_nl_team[TEAM_CMD_PORT_LIST_GET]], f flags[send_flags])
-team_nl_policy [
- TEAM_ATTR_TEAM_IFINDEX nlattr[TEAM_ATTR_TEAM_IFINDEX, ifindex]
- TEAM_ATTR_LIST_OPTION nlattr[TEAM_ATTR_LIST_OPTION, array[team_attr_list_option]]
- TEAM_ATTR_LIST_PORT nlattr[TEAM_ATTR_LIST_PORT, array[team_attr_list_port]]
-] [varlen]
+team_nl_policy {
+ TEAM_ATTR_TEAM_IFINDEX nlattr[TEAM_ATTR_TEAM_IFINDEX, ifindex_team]
+ TEAM_ATTR_LIST_OPTION nlattr[TEAM_ATTR_LIST_OPTION, array[nlattr[TEAM_ATTR_ITEM_OPTION, team_attr_option]]]
+} [packed, align_4]
-team_attr_list_option [
- TEAM_ATTR_ITEM_OPTION nlattr[TEAM_ATTR_ITEM_OPTION, team_attr_item_option]
-] [varlen]
+type team_nl_option_policy[NAME, TYPE, DATA] {
+ TEAM_ATTR_OPTION_NAME nlattr[TEAM_ATTR_OPTION_NAME, string[NAME, TEAM_STRING_MAX_LEN]]
+ TEAM_ATTR_OPTION_TYPE nlattr[TEAM_ATTR_OPTION_TYPE, const[TYPE, int8]]
+ TEAM_ATTR_OPTION_DATA nlattr[TEAM_ATTR_OPTION_DATA, DATA]
+} [packed, align_4]
-team_attr_item_option [
- team_nl_options team_attr_option
- TEAM_ATTR_OPTION_REMOVED nlattr[TEAM_ATTR_OPTION_REMOVED, bool8]
+type team_nl_option_policy_per_port[NAME, TYPE, DATA] {
+ opt team_nl_option_policy[NAME, TYPE, DATA]
TEAM_ATTR_OPTION_PORT_IFINDEX nlattr[TEAM_ATTR_OPTION_PORT_IFINDEX, ifindex]
- TEAM_ATTR_OPTION_ARRAY_INDEX nlattr[TEAM_ATTR_OPTION_ARRAY_INDEX, int32]
-] [varlen]
+} [packed, align_4]
-type team_nl_option_policy[NAME, TYPE, DATA] {
- TEAM_ATTR_OPTION_NAME nlattr[TEAM_ATTR_OPTION_NAME, string[NAME, 32]]
- TEAM_ATTR_OPTION_CHANGED nlattr[TEAM_ATTR_OPTION_CHANGED, bool8]
- TEAM_ATTR_OPTION_TYPE nlattr[TEAM_ATTR_OPTION_TYPE, const[TYPE, int8]]
- TEAM_ATTR_OPTION_DATA nlattr[TEAM_ATTR_OPTION_DATA, DATA]
-} [align_4]
+type team_nl_option_policy_array[NAME, TYPE, DATA, SIZE] {
+ opt team_nl_option_policy[NAME, TYPE, DATA]
+ TEAM_ATTR_OPTION_ARRAY_INDEX nlattr[TEAM_ATTR_OPTION_ARRAY_INDEX, int32[0:SIZE]]
+} [packed, align_4]
team_attr_option [
- name team_nl_option_policy["mode", NLA_STRING, string[team_attr_option_mode, 32]]
+ name team_nl_option_policy["mode", NLA_STRING, string[team_attr_option_mode]]
notify_peers_count team_nl_option_policy["notify_peers_count", NLA_U32, int32]
notify_peers_interval team_nl_option_policy["notify_peers_interval", NLA_U32, int32]
mcast_rejoin_count team_nl_option_policy["mcast_rejoin_count", NLA_U32, int32]
mcast_rejoin_interval team_nl_option_policy["mcast_rejoin_interval", NLA_U32, int32]
- enabled team_nl_option_policy["enabled", NLA_FLAG, bool8]
- user_linkup team_nl_option_policy["user_linkup", NLA_FLAG, bool8]
- user_linkup_enabled team_nl_option_policy["user_linkup_enabled", NLA_FLAG, bool8]
- priority team_nl_option_policy["priority", NLA_S32, int32]
- queue_id team_nl_option_policy["queue_id", NLA_U32, int32]
- activeport team_nl_option_policy["activeport", NLA_U32, int32]
- bpf_hash_func team_nl_option_policy["bpf_hash_func", NLA_BINARY, int32]
- lb_tx_method team_nl_option_policy["lb_tx_method", NLA_STRING, string[team_attr_option_lb_tx_method, 32]]
- lb_tx_hash_to_port_mapping team_nl_option_policy["lb_tx_hash_to_port_mapping", NLA_U32, int32]
- lb_hash_stats team_nl_option_policy["lb_hash_stats", NLA_BINARY, int32]
- lb_port_stats team_nl_option_policy["lb_port_stats", NLA_BINARY, int32]
+# TODO: NLA_FLAG value is determined by presence of TEAM_ATTR_OPTION_DATA attr, but we always pass it.
+ enabled team_nl_option_policy_per_port["enabled", NLA_FLAG, void]
+ user_linkup team_nl_option_policy_per_port["user_linkup", NLA_FLAG, void]
+ user_linkup_enabled team_nl_option_policy_per_port["user_linkup_enabled", NLA_FLAG, void]
+ priority team_nl_option_policy_per_port["priority", NLA_S32, int32]
+ queue_id team_nl_option_policy_per_port["queue_id", NLA_U32, int32]
+ activeport team_nl_option_policy["activeport", NLA_U32, ifindex]
+ bpf_hash_func team_nl_option_policy["bpf_hash_func", NLA_BINARY, array[sock_filter]]
+ lb_tx_method team_nl_option_policy["lb_tx_method", NLA_STRING, string[team_attr_option_lb_tx_method]]
+ lb_tx_hash_to_port_mapping team_nl_option_policy_array["lb_tx_hash_to_port_mapping", NLA_U32, ifindex, 256]
+ lb_hash_stats team_nl_option_policy_array["lb_hash_stats", NLA_BINARY, int32, 256]
+ lb_port_stats team_nl_option_policy_per_port["lb_port_stats", NLA_BINARY, int32]
lb_stats_refresh_interval team_nl_option_policy["lb_stats_refresh_interval", NLA_U32, int32]
-]
+] [varlen]
team_attr_option_mode = "activebackup", "broadcast", "loadbalance", "random", "roundrobin"
team_attr_option_lb_tx_method = "hash", "hash_to_port_mapping"
-
-team_attr_list_port [
- TEAM_ATTR_ITEM_PORT team_attr_item_port
-] [varlen]
-
-team_attr_item_port [
- TEAM_ATTR_PORT_IFINDEX nlattr[TEAM_ATTR_PORT_IFINDEX, ifindex]
- TEAM_ATTR_PORT_CHANGED nlattr[TEAM_ATTR_PORT_CHANGED, bool8]
- TEAM_ATTR_PORT_LINKUP nlattr[TEAM_ATTR_PORT_LINKUP, bool8]
- TEAM_ATTR_PORT_SPEED nlattr[TEAM_ATTR_PORT_SPEED, int32]
- TEAM_ATTR_PORT_DUPLEX nlattr[TEAM_ATTR_PORT_DUPLEX, int8]
- TEAM_ATTR_PORT_REMOVED nlattr[TEAM_ATTR_PORT_REMOVED, bool8]
-] [varlen]