Lines Matching refs:team

64 static int team_port_set_team_dev_addr(struct team *team,  in team_port_set_team_dev_addr()  argument
67 return __set_port_dev_addr(port->dev, team->dev->dev_addr); in team_port_set_team_dev_addr()
70 int team_modeop_port_enter(struct team *team, struct team_port *port) in team_modeop_port_enter() argument
72 return team_port_set_team_dev_addr(team, port); in team_modeop_port_enter()
76 void team_modeop_port_change_dev_addr(struct team *team, in team_modeop_port_change_dev_addr() argument
79 team_port_set_team_dev_addr(team, port); in team_modeop_port_change_dev_addr()
117 static struct team_option *__team_find_option(struct team *team, in __team_find_option() argument
122 list_for_each_entry(option, &team->option_list, list) { in __team_find_option()
135 static void __team_option_inst_del_option(struct team *team, in __team_option_inst_del_option() argument
140 list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) { in __team_option_inst_del_option()
146 static int __team_option_inst_add(struct team *team, struct team_option *option, in __team_option_inst_add() argument
167 list_add_tail(&opt_inst->list, &team->option_inst_list); in __team_option_inst_add()
169 err = option->init(team, &opt_inst->info); in __team_option_inst_add()
178 static int __team_option_inst_add_option(struct team *team, in __team_option_inst_add_option() argument
184 err = __team_option_inst_add(team, option, NULL); in __team_option_inst_add_option()
191 __team_option_inst_del_option(team, option); in __team_option_inst_add_option()
195 static void __team_option_inst_mark_removed_option(struct team *team, in __team_option_inst_mark_removed_option() argument
200 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_option_inst_mark_removed_option()
208 static void __team_option_inst_del_port(struct team *team, in __team_option_inst_del_port() argument
213 list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) { in __team_option_inst_del_port()
220 static int __team_option_inst_add_port(struct team *team, in __team_option_inst_add_port() argument
226 list_for_each_entry(option, &team->option_list, list) { in __team_option_inst_add_port()
229 err = __team_option_inst_add(team, option, port); in __team_option_inst_add_port()
236 __team_option_inst_del_port(team, port); in __team_option_inst_add_port()
240 static void __team_option_inst_mark_removed_port(struct team *team, in __team_option_inst_mark_removed_port() argument
245 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_option_inst_mark_removed_port()
253 static int __team_options_register(struct team *team, in __team_options_register() argument
266 if (__team_find_option(team, option->name)) { in __team_options_register()
278 err = __team_option_inst_add_option(team, dst_opts[i]); in __team_options_register()
281 list_add_tail(&dst_opts[i]->list, &team->option_list); in __team_options_register()
289 __team_option_inst_del_option(team, dst_opts[i]); in __team_options_register()
300 static void __team_options_mark_removed(struct team *team, in __team_options_mark_removed() argument
309 del_opt = __team_find_option(team, option->name); in __team_options_mark_removed()
311 __team_option_inst_mark_removed_option(team, del_opt); in __team_options_mark_removed()
315 static void __team_options_unregister(struct team *team, in __team_options_unregister() argument
324 del_opt = __team_find_option(team, option->name); in __team_options_unregister()
326 __team_option_inst_del_option(team, del_opt); in __team_options_unregister()
333 static void __team_options_change_check(struct team *team);
335 int team_options_register(struct team *team, in team_options_register() argument
341 err = __team_options_register(team, option, option_count); in team_options_register()
344 __team_options_change_check(team); in team_options_register()
349 void team_options_unregister(struct team *team, in team_options_unregister() argument
353 __team_options_mark_removed(team, option, option_count); in team_options_unregister()
354 __team_options_change_check(team); in team_options_unregister()
355 __team_options_unregister(team, option, option_count); in team_options_unregister()
359 static int team_option_get(struct team *team, in team_option_get() argument
365 return opt_inst->option->getter(team, ctx); in team_option_get()
368 static int team_option_set(struct team *team, in team_option_set() argument
374 return opt_inst->option->setter(team, ctx); in team_option_set()
386 void team_options_change_check(struct team *team) in team_options_change_check() argument
388 __team_options_change_check(team); in team_options_change_check()
499 static bool team_dummy_transmit(struct team *team, struct sk_buff *skb) in team_dummy_transmit() argument
505 static rx_handler_result_t team_dummy_receive(struct team *team, in team_dummy_receive() argument
516 static bool team_is_mode_set(struct team *team) in team_is_mode_set() argument
518 return team->mode != &__team_no_mode; in team_is_mode_set()
521 static void team_set_no_mode(struct team *team) in team_set_no_mode() argument
523 team->user_carrier_enabled = false; in team_set_no_mode()
524 team->mode = &__team_no_mode; in team_set_no_mode()
527 static void team_adjust_ops(struct team *team) in team_adjust_ops() argument
534 if (!team->en_port_count || !team_is_mode_set(team) || in team_adjust_ops()
535 !team->mode->ops->transmit) in team_adjust_ops()
536 team->ops.transmit = team_dummy_transmit; in team_adjust_ops()
538 team->ops.transmit = team->mode->ops->transmit; in team_adjust_ops()
540 if (!team->en_port_count || !team_is_mode_set(team) || in team_adjust_ops()
541 !team->mode->ops->receive) in team_adjust_ops()
542 team->ops.receive = team_dummy_receive; in team_adjust_ops()
544 team->ops.receive = team->mode->ops->receive; in team_adjust_ops()
552 static int __team_change_mode(struct team *team, in __team_change_mode() argument
556 if (team_is_mode_set(team)) { in __team_change_mode()
557 void (*exit_op)(struct team *team) = team->ops.exit; in __team_change_mode()
560 memset(&team->ops, 0, sizeof(struct team_mode_ops)); in __team_change_mode()
561 team_adjust_ops(team); in __team_change_mode()
564 exit_op(team); in __team_change_mode()
565 team_mode_put(team->mode); in __team_change_mode()
566 team_set_no_mode(team); in __team_change_mode()
568 memset(&team->mode_priv, 0, in __team_change_mode()
569 sizeof(struct team) - offsetof(struct team, mode_priv)); in __team_change_mode()
578 err = new_mode->ops->init(team); in __team_change_mode()
583 team->mode = new_mode; in __team_change_mode()
584 memcpy(&team->ops, new_mode->ops, sizeof(struct team_mode_ops)); in __team_change_mode()
585 team_adjust_ops(team); in __team_change_mode()
590 static int team_change_mode(struct team *team, const char *kind) in team_change_mode() argument
593 struct net_device *dev = team->dev; in team_change_mode()
596 if (!list_empty(&team->port_list)) { in team_change_mode()
601 if (team_is_mode_set(team) && strcmp(team->mode->kind, kind) == 0) { in team_change_mode()
612 err = __team_change_mode(team, new_mode); in team_change_mode()
630 struct team *team; in team_notify_peers_work() local
633 team = container_of(work, struct team, notify_peers.dw.work); in team_notify_peers_work()
636 schedule_delayed_work(&team->notify_peers.dw, 0); in team_notify_peers_work()
639 val = atomic_dec_if_positive(&team->notify_peers.count_pending); in team_notify_peers_work()
644 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); in team_notify_peers_work()
647 schedule_delayed_work(&team->notify_peers.dw, in team_notify_peers_work()
648 msecs_to_jiffies(team->notify_peers.interval)); in team_notify_peers_work()
651 static void team_notify_peers(struct team *team) in team_notify_peers() argument
653 if (!team->notify_peers.count || !netif_running(team->dev)) in team_notify_peers()
655 atomic_add(team->notify_peers.count, &team->notify_peers.count_pending); in team_notify_peers()
656 schedule_delayed_work(&team->notify_peers.dw, 0); in team_notify_peers()
659 static void team_notify_peers_init(struct team *team) in team_notify_peers_init() argument
661 INIT_DELAYED_WORK(&team->notify_peers.dw, team_notify_peers_work); in team_notify_peers_init()
664 static void team_notify_peers_fini(struct team *team) in team_notify_peers_fini() argument
666 cancel_delayed_work_sync(&team->notify_peers.dw); in team_notify_peers_fini()
676 struct team *team; in team_mcast_rejoin_work() local
679 team = container_of(work, struct team, mcast_rejoin.dw.work); in team_mcast_rejoin_work()
682 schedule_delayed_work(&team->mcast_rejoin.dw, 0); in team_mcast_rejoin_work()
685 val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending); in team_mcast_rejoin_work()
690 call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); in team_mcast_rejoin_work()
693 schedule_delayed_work(&team->mcast_rejoin.dw, in team_mcast_rejoin_work()
694 msecs_to_jiffies(team->mcast_rejoin.interval)); in team_mcast_rejoin_work()
697 static void team_mcast_rejoin(struct team *team) in team_mcast_rejoin() argument
699 if (!team->mcast_rejoin.count || !netif_running(team->dev)) in team_mcast_rejoin()
701 atomic_add(team->mcast_rejoin.count, &team->mcast_rejoin.count_pending); in team_mcast_rejoin()
702 schedule_delayed_work(&team->mcast_rejoin.dw, 0); in team_mcast_rejoin()
705 static void team_mcast_rejoin_init(struct team *team) in team_mcast_rejoin_init() argument
707 INIT_DELAYED_WORK(&team->mcast_rejoin.dw, team_mcast_rejoin_work); in team_mcast_rejoin_init()
710 static void team_mcast_rejoin_fini(struct team *team) in team_mcast_rejoin_fini() argument
712 cancel_delayed_work_sync(&team->mcast_rejoin.dw); in team_mcast_rejoin_fini()
725 struct team *team; in team_handle_frame() local
735 team = port->team; in team_handle_frame()
745 res = team->ops.receive(team, port, skb); in team_handle_frame()
750 pcpu_stats = this_cpu_ptr(team->pcpu_stats); in team_handle_frame()
758 skb->dev = team->dev; in team_handle_frame()
760 this_cpu_inc(team->pcpu_stats->rx_nohandler); in team_handle_frame()
762 this_cpu_inc(team->pcpu_stats->rx_dropped); in team_handle_frame()
773 static int team_queue_override_init(struct team *team) in team_queue_override_init() argument
776 unsigned int queue_cnt = team->dev->num_tx_queues - 1; in team_queue_override_init()
785 team->qom_lists = listarr; in team_queue_override_init()
791 static void team_queue_override_fini(struct team *team) in team_queue_override_fini() argument
793 kfree(team->qom_lists); in team_queue_override_fini()
796 static struct list_head *__team_get_qom_list(struct team *team, u16 queue_id) in __team_get_qom_list() argument
798 return &team->qom_lists[queue_id - 1]; in __team_get_qom_list()
804 static bool team_queue_override_transmit(struct team *team, struct sk_buff *skb) in team_queue_override_transmit() argument
809 if (!team->queue_override_enabled || !skb->queue_mapping) in team_queue_override_transmit()
811 qom_list = __team_get_qom_list(team, skb->queue_mapping); in team_queue_override_transmit()
813 if (!team_dev_queue_xmit(team, port, skb)) in team_queue_override_transmit()
819 static void __team_queue_override_port_del(struct team *team, in __team_queue_override_port_del() argument
839 static void __team_queue_override_port_add(struct team *team, in __team_queue_override_port_add() argument
848 qom_list = __team_get_qom_list(team, port->queue_id); in __team_queue_override_port_add()
858 static void __team_queue_override_enabled_check(struct team *team) in __team_queue_override_enabled_check() argument
863 list_for_each_entry(port, &team->port_list, list) { in __team_queue_override_enabled_check()
869 if (enabled == team->queue_override_enabled) in __team_queue_override_enabled_check()
871 netdev_dbg(team->dev, "%s queue override\n", in __team_queue_override_enabled_check()
873 team->queue_override_enabled = enabled; in __team_queue_override_enabled_check()
876 static void team_queue_override_port_prio_changed(struct team *team, in team_queue_override_port_prio_changed() argument
881 __team_queue_override_port_del(team, port); in team_queue_override_port_prio_changed()
882 __team_queue_override_port_add(team, port); in team_queue_override_port_prio_changed()
883 __team_queue_override_enabled_check(team); in team_queue_override_port_prio_changed()
886 static void team_queue_override_port_change_queue_id(struct team *team, in team_queue_override_port_change_queue_id() argument
891 __team_queue_override_port_del(team, port); in team_queue_override_port_change_queue_id()
893 __team_queue_override_port_add(team, port); in team_queue_override_port_change_queue_id()
894 __team_queue_override_enabled_check(team); in team_queue_override_port_change_queue_id()
900 static void team_queue_override_port_add(struct team *team, in team_queue_override_port_add() argument
903 __team_queue_override_port_add(team, port); in team_queue_override_port_add()
904 __team_queue_override_enabled_check(team); in team_queue_override_port_add()
907 static void team_queue_override_port_del(struct team *team, in team_queue_override_port_del() argument
910 __team_queue_override_port_del(team, port); in team_queue_override_port_del()
911 __team_queue_override_enabled_check(team); in team_queue_override_port_del()
919 static bool team_port_find(const struct team *team, in team_port_find() argument
924 list_for_each_entry(cur, &team->port_list, list) in team_port_find()
936 static void team_port_enable(struct team *team, in team_port_enable() argument
941 port->index = team->en_port_count++; in team_port_enable()
943 team_port_index_hash(team, port->index)); in team_port_enable()
944 team_adjust_ops(team); in team_port_enable()
945 team_queue_override_port_add(team, port); in team_port_enable()
946 if (team->ops.port_enabled) in team_port_enable()
947 team->ops.port_enabled(team, port); in team_port_enable()
948 team_notify_peers(team); in team_port_enable()
949 team_mcast_rejoin(team); in team_port_enable()
953 static void __reconstruct_port_hlist(struct team *team, int rm_index) in __reconstruct_port_hlist() argument
958 for (i = rm_index + 1; i < team->en_port_count; i++) { in __reconstruct_port_hlist()
959 port = team_get_port_by_index(team, i); in __reconstruct_port_hlist()
963 team_port_index_hash(team, port->index)); in __reconstruct_port_hlist()
967 static void team_port_disable(struct team *team, in team_port_disable() argument
972 if (team->ops.port_disabled) in team_port_disable()
973 team->ops.port_disabled(team, port); in team_port_disable()
975 __reconstruct_port_hlist(team, port->index); in team_port_disable()
977 team->en_port_count--; in team_port_disable()
978 team_queue_override_port_del(team, port); in team_port_disable()
979 team_adjust_ops(team); in team_port_disable()
990 static void __team_compute_features(struct team *team) in __team_compute_features() argument
1001 list_for_each_entry_rcu(port, &team->port_list, list) { in __team_compute_features()
1017 team->dev->vlan_features = vlan_features; in __team_compute_features()
1018 team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | in __team_compute_features()
1021 team->dev->hard_header_len = max_hard_header_len; in __team_compute_features()
1023 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; in __team_compute_features()
1025 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; in __team_compute_features()
1028 static void team_compute_features(struct team *team) in team_compute_features() argument
1030 __team_compute_features(team); in team_compute_features()
1031 netdev_change_features(team->dev); in team_compute_features()
1034 static int team_port_enter(struct team *team, struct team_port *port) in team_port_enter() argument
1038 dev_hold(team->dev); in team_port_enter()
1039 if (team->ops.port_enter) { in team_port_enter()
1040 err = team->ops.port_enter(team, port); in team_port_enter()
1042 netdev_err(team->dev, "Device %s failed to enter team mode\n", in team_port_enter()
1051 dev_put(team->dev); in team_port_enter()
1056 static void team_port_leave(struct team *team, struct team_port *port) in team_port_leave() argument
1058 if (team->ops.port_leave) in team_port_leave()
1059 team->ops.port_leave(team, port); in team_port_leave()
1060 dev_put(team->dev); in team_port_leave()
1084 if (!port->team->dev->npinfo) in team_port_enable_netpoll()
1110 static int team_upper_dev_link(struct team *team, struct team_port *port, in team_upper_dev_link() argument
1116 lag_upper_info.tx_type = team->mode->lag_tx_type; in team_upper_dev_link()
1118 err = netdev_master_upper_dev_link(port->dev, team->dev, NULL, in team_upper_dev_link()
1126 static void team_upper_dev_unlink(struct team *team, struct team_port *port) in team_upper_dev_unlink() argument
1128 netdev_upper_dev_unlink(port->dev, team->dev); in team_upper_dev_unlink()
1136 static int team_port_add(struct team *team, struct net_device *port_dev, in team_port_add() argument
1139 struct net_device *dev = team->dev; in team_port_add()
1190 port = kzalloc(sizeof(struct team_port) + team->mode->port_priv_size, in team_port_add()
1196 port->team = team; in team_port_add()
1208 err = team_port_enter(team, port); in team_port_add()
1247 err = team_upper_dev_link(team, port, extack); in team_port_add()
1254 err = __team_option_inst_add_port(team, port); in team_port_add()
1284 list_add_tail_rcu(&port->list, &team->port_list); in team_port_add()
1285 team_port_enable(team, port); in team_port_add()
1286 __team_compute_features(team); in team_port_add()
1288 __team_options_change_check(team); in team_port_add()
1295 __team_option_inst_del_port(team, port); in team_port_add()
1298 team_upper_dev_unlink(team, port); in team_port_add()
1313 team_port_leave(team, port); in team_port_add()
1327 static int team_port_del(struct team *team, struct net_device *port_dev) in team_port_del() argument
1329 struct net_device *dev = team->dev; in team_port_del()
1334 if (!port || !team_port_find(team, port)) { in team_port_del()
1340 team_port_disable(team, port); in team_port_del()
1348 team_upper_dev_unlink(team, port); in team_port_del()
1355 team_port_leave(team, port); in team_port_del()
1357 __team_option_inst_mark_removed_port(team, port); in team_port_del()
1358 __team_options_change_check(team); in team_port_del()
1359 __team_option_inst_del_port(team, port); in team_port_del()
1366 __team_compute_features(team); in team_port_del()
1376 static int team_mode_option_get(struct team *team, struct team_gsetter_ctx *ctx) in team_mode_option_get() argument
1378 ctx->data.str_val = team->mode->kind; in team_mode_option_get()
1382 static int team_mode_option_set(struct team *team, struct team_gsetter_ctx *ctx) in team_mode_option_set() argument
1384 return team_change_mode(team, ctx->data.str_val); in team_mode_option_set()
1387 static int team_notify_peers_count_get(struct team *team, in team_notify_peers_count_get() argument
1390 ctx->data.u32_val = team->notify_peers.count; in team_notify_peers_count_get()
1394 static int team_notify_peers_count_set(struct team *team, in team_notify_peers_count_set() argument
1397 team->notify_peers.count = ctx->data.u32_val; in team_notify_peers_count_set()
1401 static int team_notify_peers_interval_get(struct team *team, in team_notify_peers_interval_get() argument
1404 ctx->data.u32_val = team->notify_peers.interval; in team_notify_peers_interval_get()
1408 static int team_notify_peers_interval_set(struct team *team, in team_notify_peers_interval_set() argument
1411 team->notify_peers.interval = ctx->data.u32_val; in team_notify_peers_interval_set()
1415 static int team_mcast_rejoin_count_get(struct team *team, in team_mcast_rejoin_count_get() argument
1418 ctx->data.u32_val = team->mcast_rejoin.count; in team_mcast_rejoin_count_get()
1422 static int team_mcast_rejoin_count_set(struct team *team, in team_mcast_rejoin_count_set() argument
1425 team->mcast_rejoin.count = ctx->data.u32_val; in team_mcast_rejoin_count_set()
1429 static int team_mcast_rejoin_interval_get(struct team *team, in team_mcast_rejoin_interval_get() argument
1432 ctx->data.u32_val = team->mcast_rejoin.interval; in team_mcast_rejoin_interval_get()
1436 static int team_mcast_rejoin_interval_set(struct team *team, in team_mcast_rejoin_interval_set() argument
1439 team->mcast_rejoin.interval = ctx->data.u32_val; in team_mcast_rejoin_interval_set()
1443 static int team_port_en_option_get(struct team *team, in team_port_en_option_get() argument
1452 static int team_port_en_option_set(struct team *team, in team_port_en_option_set() argument
1458 team_port_enable(team, port); in team_port_en_option_set()
1460 team_port_disable(team, port); in team_port_en_option_set()
1464 static int team_user_linkup_option_get(struct team *team, in team_user_linkup_option_get() argument
1473 static void __team_carrier_check(struct team *team);
1475 static int team_user_linkup_option_set(struct team *team, in team_user_linkup_option_set() argument
1482 __team_carrier_check(port->team); in team_user_linkup_option_set()
1486 static int team_user_linkup_en_option_get(struct team *team, in team_user_linkup_en_option_get() argument
1495 static int team_user_linkup_en_option_set(struct team *team, in team_user_linkup_en_option_set() argument
1502 __team_carrier_check(port->team); in team_user_linkup_en_option_set()
1506 static int team_priority_option_get(struct team *team, in team_priority_option_get() argument
1515 static int team_priority_option_set(struct team *team, in team_priority_option_set() argument
1524 team_queue_override_port_prio_changed(team, port); in team_priority_option_set()
1528 static int team_queue_id_option_get(struct team *team, in team_queue_id_option_get() argument
1537 static int team_queue_id_option_set(struct team *team, in team_queue_id_option_set() argument
1545 if (new_queue_id >= team->dev->real_num_tx_queues) in team_queue_id_option_set()
1547 team_queue_override_port_change_queue_id(team, port, new_queue_id); in team_queue_id_option_set()
1622 struct team *team = netdev_priv(dev); in team_init() local
1626 team->dev = dev; in team_init()
1627 team_set_no_mode(team); in team_init()
1629 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats); in team_init()
1630 if (!team->pcpu_stats) in team_init()
1634 INIT_HLIST_HEAD(&team->en_port_hlist[i]); in team_init()
1635 INIT_LIST_HEAD(&team->port_list); in team_init()
1636 err = team_queue_override_init(team); in team_init()
1640 team_adjust_ops(team); in team_init()
1642 INIT_LIST_HEAD(&team->option_list); in team_init()
1643 INIT_LIST_HEAD(&team->option_inst_list); in team_init()
1645 team_notify_peers_init(team); in team_init()
1646 team_mcast_rejoin_init(team); in team_init()
1648 err = team_options_register(team, team_options, ARRAY_SIZE(team_options)); in team_init()
1653 lockdep_register_key(&team->team_lock_key); in team_init()
1654 __mutex_init(&team->lock, "team->team_lock_key", &team->team_lock_key); in team_init()
1660 team_mcast_rejoin_fini(team); in team_init()
1661 team_notify_peers_fini(team); in team_init()
1662 team_queue_override_fini(team); in team_init()
1664 free_percpu(team->pcpu_stats); in team_init()
1671 struct team *team = netdev_priv(dev); in team_uninit() local
1675 mutex_lock(&team->lock); in team_uninit()
1676 list_for_each_entry_safe(port, tmp, &team->port_list, list) in team_uninit()
1677 team_port_del(team, port->dev); in team_uninit()
1679 __team_change_mode(team, NULL); /* cleanup */ in team_uninit()
1680 __team_options_unregister(team, team_options, ARRAY_SIZE(team_options)); in team_uninit()
1681 team_mcast_rejoin_fini(team); in team_uninit()
1682 team_notify_peers_fini(team); in team_uninit()
1683 team_queue_override_fini(team); in team_uninit()
1684 mutex_unlock(&team->lock); in team_uninit()
1686 lockdep_unregister_key(&team->team_lock_key); in team_uninit()
1691 struct team *team = netdev_priv(dev); in team_destructor() local
1693 free_percpu(team->pcpu_stats); in team_destructor()
1711 struct team *team = netdev_priv(dev); in team_xmit() local
1715 tx_success = team_queue_override_transmit(team, skb); in team_xmit()
1717 tx_success = team->ops.transmit(team, skb); in team_xmit()
1721 pcpu_stats = this_cpu_ptr(team->pcpu_stats); in team_xmit()
1727 this_cpu_inc(team->pcpu_stats->tx_dropped); in team_xmit()
1759 struct team *team = netdev_priv(dev); in team_change_rx_flags() local
1764 list_for_each_entry_rcu(port, &team->port_list, list) { in team_change_rx_flags()
1779 struct team *team = netdev_priv(dev); in team_set_rx_mode() local
1783 list_for_each_entry_rcu(port, &team->port_list, list) { in team_set_rx_mode()
1793 struct team *team = netdev_priv(dev); in team_set_mac_address() local
1799 mutex_lock(&team->lock); in team_set_mac_address()
1800 list_for_each_entry(port, &team->port_list, list) in team_set_mac_address()
1801 if (team->ops.port_change_dev_addr) in team_set_mac_address()
1802 team->ops.port_change_dev_addr(team, port); in team_set_mac_address()
1803 mutex_unlock(&team->lock); in team_set_mac_address()
1809 struct team *team = netdev_priv(dev); in team_change_mtu() local
1817 mutex_lock(&team->lock); in team_change_mtu()
1818 team->port_mtu_change_allowed = true; in team_change_mtu()
1819 list_for_each_entry(port, &team->port_list, list) { in team_change_mtu()
1827 team->port_mtu_change_allowed = false; in team_change_mtu()
1828 mutex_unlock(&team->lock); in team_change_mtu()
1835 list_for_each_entry_continue_reverse(port, &team->port_list, list) in team_change_mtu()
1837 team->port_mtu_change_allowed = false; in team_change_mtu()
1838 mutex_unlock(&team->lock); in team_change_mtu()
1846 struct team *team = netdev_priv(dev); in team_get_stats64() local
1854 p = per_cpu_ptr(team->pcpu_stats, i); in team_get_stats64()
1884 struct team *team = netdev_priv(dev); in team_vlan_rx_add_vid() local
1892 mutex_lock(&team->lock); in team_vlan_rx_add_vid()
1893 list_for_each_entry(port, &team->port_list, list) { in team_vlan_rx_add_vid()
1898 mutex_unlock(&team->lock); in team_vlan_rx_add_vid()
1903 list_for_each_entry_continue_reverse(port, &team->port_list, list) in team_vlan_rx_add_vid()
1905 mutex_unlock(&team->lock); in team_vlan_rx_add_vid()
1912 struct team *team = netdev_priv(dev); in team_vlan_rx_kill_vid() local
1915 mutex_lock(&team->lock); in team_vlan_rx_kill_vid()
1916 list_for_each_entry(port, &team->port_list, list) in team_vlan_rx_kill_vid()
1918 mutex_unlock(&team->lock); in team_vlan_rx_kill_vid()
1928 static void __team_netpoll_cleanup(struct team *team) in __team_netpoll_cleanup() argument
1932 list_for_each_entry(port, &team->port_list, list) in __team_netpoll_cleanup()
1938 struct team *team = netdev_priv(dev); in team_netpoll_cleanup() local
1940 mutex_lock(&team->lock); in team_netpoll_cleanup()
1941 __team_netpoll_cleanup(team); in team_netpoll_cleanup()
1942 mutex_unlock(&team->lock); in team_netpoll_cleanup()
1948 struct team *team = netdev_priv(dev); in team_netpoll_setup() local
1952 mutex_lock(&team->lock); in team_netpoll_setup()
1953 list_for_each_entry(port, &team->port_list, list) { in team_netpoll_setup()
1956 __team_netpoll_cleanup(team); in team_netpoll_setup()
1960 mutex_unlock(&team->lock); in team_netpoll_setup()
1968 struct team *team = netdev_priv(dev); in team_add_slave() local
1971 mutex_lock(&team->lock); in team_add_slave()
1972 err = team_port_add(team, port_dev, extack); in team_add_slave()
1973 mutex_unlock(&team->lock); in team_add_slave()
1983 struct team *team = netdev_priv(dev); in team_del_slave() local
1986 mutex_lock(&team->lock); in team_del_slave()
1987 err = team_port_del(team, port_dev); in team_del_slave()
1988 mutex_unlock(&team->lock); in team_del_slave()
1994 lockdep_unregister_key(&team->team_lock_key); in team_del_slave()
1995 lockdep_register_key(&team->team_lock_key); in team_del_slave()
1996 lockdep_set_class(&team->lock, &team->team_lock_key); in team_del_slave()
2007 struct team *team = netdev_priv(dev); in team_fix_features() local
2015 list_for_each_entry_rcu(port, &team->port_list, list) { in team_fix_features()
2029 struct team *team = netdev_priv(dev); in team_change_carrier() local
2031 team->user_carrier_enabled = true; in team_change_carrier()
2080 struct team *team= netdev_priv(dev); in team_ethtool_get_link_ksettings() local
2088 list_for_each_entry_rcu(port, &team->port_list, list) { in team_ethtool_get_link_ksettings()
2130 struct team *team = netdev_priv(dev); in team_dev_type_check_change() local
2136 if (!list_empty(&team->port_list)) { in team_dev_type_check_change()
2222 .priv_size = sizeof(struct team),
2289 static struct team *team_nl_team_get(struct genl_info *info) in team_nl_team_get()
2294 struct team *team; in team_nl_team_get() local
2307 team = netdev_priv(dev); in team_nl_team_get()
2308 mutex_lock(&team->lock); in team_nl_team_get()
2309 return team; in team_nl_team_get()
2312 static void team_nl_team_put(struct team *team) in team_nl_team_put() argument
2314 mutex_unlock(&team->lock); in team_nl_team_put()
2315 dev_put(team->dev); in team_nl_team_put()
2319 struct team *team, u32 portid);
2321 static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 portid) in team_nl_send_unicast() argument
2323 return genlmsg_unicast(dev_net(team->dev), skb, portid); in team_nl_send_unicast()
2326 static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team, in team_nl_fill_one_option_get() argument
2336 err = team_option_get(team, opt_inst, &ctx); in team_nl_fill_one_option_get()
2408 struct team *team, u32 portid, in __send_and_alloc_skb() argument
2414 err = send_func(*pskb, team, portid); in __send_and_alloc_skb()
2424 static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq, in team_nl_send_options_get() argument
2441 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_options_get()
2452 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) in team_nl_send_options_get()
2461 err = team_nl_fill_one_option_get(skb, team, opt_inst); in team_nl_send_options_get()
2482 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_options_get()
2488 return send_func(skb, team, portid); in team_nl_send_options_get()
2499 struct team *team; in team_nl_cmd_options_get() local
2504 team = team_nl_team_get(info); in team_nl_cmd_options_get()
2505 if (!team) in team_nl_cmd_options_get()
2508 list_for_each_entry(opt_inst, &team->option_inst_list, list) in team_nl_cmd_options_get()
2510 err = team_nl_send_options_get(team, info->snd_portid, info->snd_seq, in team_nl_cmd_options_get()
2514 team_nl_team_put(team); in team_nl_cmd_options_get()
2519 static int team_nl_send_event_options_get(struct team *team,
2524 struct team *team; in team_nl_cmd_options_set() local
2531 team = team_nl_team_get(info); in team_nl_cmd_options_set()
2532 if (!team) { in team_nl_cmd_options_set()
2609 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in team_nl_cmd_options_set()
2650 err = team_option_set(team, opt_inst, &ctx); in team_nl_cmd_options_set()
2661 err = team_nl_send_event_options_get(team, &opt_inst_list); in team_nl_cmd_options_set()
2667 team_nl_team_put(team); in team_nl_cmd_options_set()
2703 static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, in team_nl_send_port_list_get() argument
2716 port = list_first_entry_or_null(&team->port_list, in team_nl_send_port_list_get()
2720 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_port_list_get()
2731 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) in team_nl_send_port_list_get()
2748 list_for_each_entry_from(port, &team->port_list, list) { in team_nl_send_port_list_get()
2771 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_port_list_get()
2777 return send_func(skb, team, portid); in team_nl_send_port_list_get()
2789 struct team *team; in team_nl_cmd_port_list_get() local
2792 team = team_nl_team_get(info); in team_nl_cmd_port_list_get()
2793 if (!team) in team_nl_cmd_port_list_get()
2796 err = team_nl_send_port_list_get(team, info->snd_portid, info->snd_seq, in team_nl_cmd_port_list_get()
2799 team_nl_team_put(team); in team_nl_cmd_port_list_get()
2848 struct team *team, u32 portid) in team_nl_send_multicast() argument
2850 return genlmsg_multicast_netns(&team_nl_family, dev_net(team->dev), in team_nl_send_multicast()
2854 static int team_nl_send_event_options_get(struct team *team, in team_nl_send_event_options_get() argument
2857 return team_nl_send_options_get(team, 0, 0, 0, team_nl_send_multicast, in team_nl_send_event_options_get()
2861 static int team_nl_send_event_port_get(struct team *team, in team_nl_send_event_port_get() argument
2864 return team_nl_send_port_list_get(team, 0, 0, 0, team_nl_send_multicast, in team_nl_send_event_port_get()
2883 static void __team_options_change_check(struct team *team) in __team_options_change_check() argument
2889 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_options_change_check()
2893 err = team_nl_send_event_options_get(team, &sel_opt_inst_list); in __team_options_change_check()
2895 netdev_warn(team->dev, "Failed to send options change via netlink (err %d)\n", in __team_options_change_check()
2922 err = team_nl_send_event_port_get(port->team, port); in __team_port_change_send()
2924 netdev_warn(port->team->dev, "Failed to send port change of device %s via netlink (err %d)\n", in __team_port_change_send()
2929 static void __team_carrier_check(struct team *team) in __team_carrier_check() argument
2934 if (team->user_carrier_enabled) in __team_carrier_check()
2938 list_for_each_entry(port, &team->port_list, list) { in __team_carrier_check()
2946 netif_carrier_on(team->dev); in __team_carrier_check()
2948 netif_carrier_off(team->dev); in __team_carrier_check()
2955 __team_carrier_check(port->team); in __team_port_change_check()
2961 __team_carrier_check(port->team); in __team_port_change_port_added()
2968 __team_carrier_check(port->team); in __team_port_change_port_removed()
2973 struct team *team = port->team; in team_port_change_check() local
2975 mutex_lock(&team->lock); in team_port_change_check()
2977 mutex_unlock(&team->lock); in team_port_change_check()
3009 team_del_slave(port->team->dev, dev); in team_device_event()
3012 team_compute_features(port->team); in team_device_event()
3016 if (!port->team->port_mtu_change_allowed) in team_device_event()
3024 call_netdevice_notifiers(event, port->team->dev); in team_device_event()