2727#include <net/sch_generic.h>
2828#include <linux/if_team.h>
2929
30+ #include "team_nl.h"
31+
3032#define DRV_NAME "team"
3133
3234
@@ -2254,28 +2256,7 @@ static struct rtnl_link_ops team_link_ops __read_mostly = {
22542256
22552257static struct genl_family team_nl_family ;
22562258
2257- static const struct nla_policy team_nl_policy [TEAM_ATTR_MAX + 1 ] = {
2258- [TEAM_ATTR_UNSPEC ] = { .type = NLA_UNSPEC , },
2259- [TEAM_ATTR_TEAM_IFINDEX ] = { .type = NLA_U32 },
2260- [TEAM_ATTR_LIST_OPTION ] = { .type = NLA_NESTED },
2261- [TEAM_ATTR_LIST_PORT ] = { .type = NLA_NESTED },
2262- };
2263-
2264- static const struct nla_policy
2265- team_nl_option_policy [TEAM_ATTR_OPTION_MAX + 1 ] = {
2266- [TEAM_ATTR_OPTION_UNSPEC ] = { .type = NLA_UNSPEC , },
2267- [TEAM_ATTR_OPTION_NAME ] = {
2268- .type = NLA_STRING ,
2269- .len = TEAM_STRING_MAX_LEN ,
2270- },
2271- [TEAM_ATTR_OPTION_CHANGED ] = { .type = NLA_FLAG },
2272- [TEAM_ATTR_OPTION_TYPE ] = { .type = NLA_U8 },
2273- [TEAM_ATTR_OPTION_DATA ] = { .type = NLA_BINARY },
2274- [TEAM_ATTR_OPTION_PORT_IFINDEX ] = { .type = NLA_U32 },
2275- [TEAM_ATTR_OPTION_ARRAY_INDEX ] = { .type = NLA_U32 },
2276- };
2277-
2278- static int team_nl_cmd_noop (struct sk_buff * skb , struct genl_info * info )
2259+ int team_nl_noop_doit (struct sk_buff * skb , struct genl_info * info )
22792260{
22802261 struct sk_buff * msg ;
22812262 void * hdr ;
@@ -2513,7 +2494,7 @@ static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq,
25132494 return err ;
25142495}
25152496
2516- static int team_nl_cmd_options_get (struct sk_buff * skb , struct genl_info * info )
2497+ int team_nl_options_get_doit (struct sk_buff * skb , struct genl_info * info )
25172498{
25182499 struct team * team ;
25192500 struct team_option_inst * opt_inst ;
@@ -2538,7 +2519,7 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info)
25382519static int team_nl_send_event_options_get (struct team * team ,
25392520 struct list_head * sel_opt_inst_list );
25402521
2541- static int team_nl_cmd_options_set (struct sk_buff * skb , struct genl_info * info )
2522+ int team_nl_options_set_doit (struct sk_buff * skb , struct genl_info * info )
25422523{
25432524 struct team * team ;
25442525 int err = 0 ;
@@ -2579,7 +2560,7 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
25792560 err = nla_parse_nested_deprecated (opt_attrs ,
25802561 TEAM_ATTR_OPTION_MAX ,
25812562 nl_option ,
2582- team_nl_option_policy ,
2563+ team_attr_option_nl_policy ,
25832564 info -> extack );
25842565 if (err )
25852566 goto team_put ;
@@ -2802,8 +2783,8 @@ static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq,
28022783 return err ;
28032784}
28042785
2805- static int team_nl_cmd_port_list_get (struct sk_buff * skb ,
2806- struct genl_info * info )
2786+ int team_nl_port_list_get_doit (struct sk_buff * skb ,
2787+ struct genl_info * info )
28072788{
28082789 struct team * team ;
28092790 int err ;
@@ -2820,40 +2801,14 @@ static int team_nl_cmd_port_list_get(struct sk_buff *skb,
28202801 return err ;
28212802}
28222803
2823- static const struct genl_small_ops team_nl_ops [] = {
2824- {
2825- .cmd = TEAM_CMD_NOOP ,
2826- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP ,
2827- .doit = team_nl_cmd_noop ,
2828- },
2829- {
2830- .cmd = TEAM_CMD_OPTIONS_SET ,
2831- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP ,
2832- .doit = team_nl_cmd_options_set ,
2833- .flags = GENL_ADMIN_PERM ,
2834- },
2835- {
2836- .cmd = TEAM_CMD_OPTIONS_GET ,
2837- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP ,
2838- .doit = team_nl_cmd_options_get ,
2839- .flags = GENL_ADMIN_PERM ,
2840- },
2841- {
2842- .cmd = TEAM_CMD_PORT_LIST_GET ,
2843- .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP ,
2844- .doit = team_nl_cmd_port_list_get ,
2845- .flags = GENL_ADMIN_PERM ,
2846- },
2847- };
2848-
28492804static const struct genl_multicast_group team_nl_mcgrps [] = {
28502805 { .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME , },
28512806};
28522807
28532808static struct genl_family team_nl_family __ro_after_init = {
28542809 .name = TEAM_GENL_NAME ,
28552810 .version = TEAM_GENL_VERSION ,
2856- .maxattr = TEAM_ATTR_MAX ,
2811+ .maxattr = ARRAY_SIZE ( team_nl_policy ) ,
28572812 .policy = team_nl_policy ,
28582813 .netnsok = true,
28592814 .module = THIS_MODULE ,
0 commit comments