Lines Matching refs:team

63 static int team_port_set_team_dev_addr(struct team *team,  in team_port_set_team_dev_addr()  argument
66 return __set_port_dev_addr(port->dev, team->dev->dev_addr); in team_port_set_team_dev_addr()
69 int team_modeop_port_enter(struct team *team, struct team_port *port) in team_modeop_port_enter() argument
71 return team_port_set_team_dev_addr(team, port); in team_modeop_port_enter()
75 void team_modeop_port_change_dev_addr(struct team *team, in team_modeop_port_change_dev_addr() argument
78 team_port_set_team_dev_addr(team, port); in team_modeop_port_change_dev_addr()
116 static struct team_option *__team_find_option(struct team *team, in __team_find_option() argument
121 list_for_each_entry(option, &team->option_list, list) { in __team_find_option()
134 static void __team_option_inst_del_option(struct team *team, in __team_option_inst_del_option() argument
139 list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) { in __team_option_inst_del_option()
145 static int __team_option_inst_add(struct team *team, struct team_option *option, in __team_option_inst_add() argument
166 list_add_tail(&opt_inst->list, &team->option_inst_list); in __team_option_inst_add()
168 err = option->init(team, &opt_inst->info); in __team_option_inst_add()
177 static int __team_option_inst_add_option(struct team *team, in __team_option_inst_add_option() argument
183 err = __team_option_inst_add(team, option, NULL); in __team_option_inst_add_option()
190 __team_option_inst_del_option(team, option); in __team_option_inst_add_option()
194 static void __team_option_inst_mark_removed_option(struct team *team, in __team_option_inst_mark_removed_option() argument
199 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_option_inst_mark_removed_option()
207 static void __team_option_inst_del_port(struct team *team, in __team_option_inst_del_port() argument
212 list_for_each_entry_safe(opt_inst, tmp, &team->option_inst_list, list) { in __team_option_inst_del_port()
219 static int __team_option_inst_add_port(struct team *team, in __team_option_inst_add_port() argument
225 list_for_each_entry(option, &team->option_list, list) { in __team_option_inst_add_port()
228 err = __team_option_inst_add(team, option, port); in __team_option_inst_add_port()
235 __team_option_inst_del_port(team, port); in __team_option_inst_add_port()
239 static void __team_option_inst_mark_removed_port(struct team *team, in __team_option_inst_mark_removed_port() argument
244 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_option_inst_mark_removed_port()
252 static int __team_options_register(struct team *team, in __team_options_register() argument
265 if (__team_find_option(team, option->name)) { in __team_options_register()
277 err = __team_option_inst_add_option(team, dst_opts[i]); in __team_options_register()
280 list_add_tail(&dst_opts[i]->list, &team->option_list); in __team_options_register()
288 __team_option_inst_del_option(team, dst_opts[i]); in __team_options_register()
299 static void __team_options_mark_removed(struct team *team, in __team_options_mark_removed() argument
308 del_opt = __team_find_option(team, option->name); in __team_options_mark_removed()
310 __team_option_inst_mark_removed_option(team, del_opt); in __team_options_mark_removed()
314 static void __team_options_unregister(struct team *team, in __team_options_unregister() argument
323 del_opt = __team_find_option(team, option->name); in __team_options_unregister()
325 __team_option_inst_del_option(team, del_opt); in __team_options_unregister()
332 static void __team_options_change_check(struct team *team);
334 int team_options_register(struct team *team, in team_options_register() argument
340 err = __team_options_register(team, option, option_count); in team_options_register()
343 __team_options_change_check(team); in team_options_register()
348 void team_options_unregister(struct team *team, in team_options_unregister() argument
352 __team_options_mark_removed(team, option, option_count); in team_options_unregister()
353 __team_options_change_check(team); in team_options_unregister()
354 __team_options_unregister(team, option, option_count); in team_options_unregister()
358 static int team_option_get(struct team *team, in team_option_get() argument
364 return opt_inst->option->getter(team, ctx); in team_option_get()
367 static int team_option_set(struct team *team, in team_option_set() argument
373 return opt_inst->option->setter(team, ctx); in team_option_set()
385 void team_options_change_check(struct team *team) in team_options_change_check() argument
387 __team_options_change_check(team); in team_options_change_check()
498 static bool team_dummy_transmit(struct team *team, struct sk_buff *skb) in team_dummy_transmit() argument
504 static rx_handler_result_t team_dummy_receive(struct team *team, in team_dummy_receive() argument
515 static bool team_is_mode_set(struct team *team) in team_is_mode_set() argument
517 return team->mode != &__team_no_mode; in team_is_mode_set()
520 static void team_set_no_mode(struct team *team) in team_set_no_mode() argument
522 team->user_carrier_enabled = false; in team_set_no_mode()
523 team->mode = &__team_no_mode; in team_set_no_mode()
526 static void team_adjust_ops(struct team *team) in team_adjust_ops() argument
533 if (!team->en_port_count || !team_is_mode_set(team) || in team_adjust_ops()
534 !team->mode->ops->transmit) in team_adjust_ops()
535 team->ops.transmit = team_dummy_transmit; in team_adjust_ops()
537 team->ops.transmit = team->mode->ops->transmit; in team_adjust_ops()
539 if (!team->en_port_count || !team_is_mode_set(team) || in team_adjust_ops()
540 !team->mode->ops->receive) in team_adjust_ops()
541 team->ops.receive = team_dummy_receive; in team_adjust_ops()
543 team->ops.receive = team->mode->ops->receive; in team_adjust_ops()
551 static int __team_change_mode(struct team *team, in __team_change_mode() argument
555 if (team_is_mode_set(team)) { in __team_change_mode()
556 void (*exit_op)(struct team *team) = team->ops.exit; in __team_change_mode()
559 memset(&team->ops, 0, sizeof(struct team_mode_ops)); in __team_change_mode()
560 team_adjust_ops(team); in __team_change_mode()
563 exit_op(team); in __team_change_mode()
564 team_mode_put(team->mode); in __team_change_mode()
565 team_set_no_mode(team); in __team_change_mode()
567 memset(&team->mode_priv, 0, in __team_change_mode()
568 sizeof(struct team) - offsetof(struct team, mode_priv)); in __team_change_mode()
577 err = new_mode->ops->init(team); in __team_change_mode()
582 team->mode = new_mode; in __team_change_mode()
583 memcpy(&team->ops, new_mode->ops, sizeof(struct team_mode_ops)); in __team_change_mode()
584 team_adjust_ops(team); in __team_change_mode()
589 static int team_change_mode(struct team *team, const char *kind) in team_change_mode() argument
592 struct net_device *dev = team->dev; in team_change_mode()
595 if (!list_empty(&team->port_list)) { in team_change_mode()
600 if (team_is_mode_set(team) && strcmp(team->mode->kind, kind) == 0) { in team_change_mode()
611 err = __team_change_mode(team, new_mode); in team_change_mode()
629 struct team *team; in team_notify_peers_work() local
632 team = container_of(work, struct team, notify_peers.dw.work); in team_notify_peers_work()
635 schedule_delayed_work(&team->notify_peers.dw, 0); in team_notify_peers_work()
638 val = atomic_dec_if_positive(&team->notify_peers.count_pending); in team_notify_peers_work()
643 call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, team->dev); in team_notify_peers_work()
646 schedule_delayed_work(&team->notify_peers.dw, in team_notify_peers_work()
647 msecs_to_jiffies(team->notify_peers.interval)); in team_notify_peers_work()
650 static void team_notify_peers(struct team *team) in team_notify_peers() argument
652 if (!team->notify_peers.count || !netif_running(team->dev)) in team_notify_peers()
654 atomic_add(team->notify_peers.count, &team->notify_peers.count_pending); in team_notify_peers()
655 schedule_delayed_work(&team->notify_peers.dw, 0); in team_notify_peers()
658 static void team_notify_peers_init(struct team *team) in team_notify_peers_init() argument
660 INIT_DELAYED_WORK(&team->notify_peers.dw, team_notify_peers_work); in team_notify_peers_init()
663 static void team_notify_peers_fini(struct team *team) in team_notify_peers_fini() argument
665 cancel_delayed_work_sync(&team->notify_peers.dw); in team_notify_peers_fini()
675 struct team *team; in team_mcast_rejoin_work() local
678 team = container_of(work, struct team, mcast_rejoin.dw.work); in team_mcast_rejoin_work()
681 schedule_delayed_work(&team->mcast_rejoin.dw, 0); in team_mcast_rejoin_work()
684 val = atomic_dec_if_positive(&team->mcast_rejoin.count_pending); in team_mcast_rejoin_work()
689 call_netdevice_notifiers(NETDEV_RESEND_IGMP, team->dev); in team_mcast_rejoin_work()
692 schedule_delayed_work(&team->mcast_rejoin.dw, in team_mcast_rejoin_work()
693 msecs_to_jiffies(team->mcast_rejoin.interval)); in team_mcast_rejoin_work()
696 static void team_mcast_rejoin(struct team *team) in team_mcast_rejoin() argument
698 if (!team->mcast_rejoin.count || !netif_running(team->dev)) in team_mcast_rejoin()
700 atomic_add(team->mcast_rejoin.count, &team->mcast_rejoin.count_pending); in team_mcast_rejoin()
701 schedule_delayed_work(&team->mcast_rejoin.dw, 0); in team_mcast_rejoin()
704 static void team_mcast_rejoin_init(struct team *team) in team_mcast_rejoin_init() argument
706 INIT_DELAYED_WORK(&team->mcast_rejoin.dw, team_mcast_rejoin_work); in team_mcast_rejoin_init()
709 static void team_mcast_rejoin_fini(struct team *team) in team_mcast_rejoin_fini() argument
711 cancel_delayed_work_sync(&team->mcast_rejoin.dw); in team_mcast_rejoin_fini()
724 struct team *team; in team_handle_frame() local
734 team = port->team; in team_handle_frame()
739 res = team->ops.receive(team, port, skb); in team_handle_frame()
744 pcpu_stats = this_cpu_ptr(team->pcpu_stats); in team_handle_frame()
752 skb->dev = team->dev; in team_handle_frame()
754 this_cpu_inc(team->pcpu_stats->rx_nohandler); in team_handle_frame()
756 this_cpu_inc(team->pcpu_stats->rx_dropped); in team_handle_frame()
767 static int team_queue_override_init(struct team *team) in team_queue_override_init() argument
770 unsigned int queue_cnt = team->dev->num_tx_queues - 1; in team_queue_override_init()
779 team->qom_lists = listarr; in team_queue_override_init()
785 static void team_queue_override_fini(struct team *team) in team_queue_override_fini() argument
787 kfree(team->qom_lists); in team_queue_override_fini()
790 static struct list_head *__team_get_qom_list(struct team *team, u16 queue_id) in __team_get_qom_list() argument
792 return &team->qom_lists[queue_id - 1]; in __team_get_qom_list()
798 static bool team_queue_override_transmit(struct team *team, struct sk_buff *skb) in team_queue_override_transmit() argument
803 if (!team->queue_override_enabled || !skb->queue_mapping) in team_queue_override_transmit()
805 qom_list = __team_get_qom_list(team, skb->queue_mapping); in team_queue_override_transmit()
807 if (!team_dev_queue_xmit(team, port, skb)) in team_queue_override_transmit()
813 static void __team_queue_override_port_del(struct team *team, in __team_queue_override_port_del() argument
833 static void __team_queue_override_port_add(struct team *team, in __team_queue_override_port_add() argument
842 qom_list = __team_get_qom_list(team, port->queue_id); in __team_queue_override_port_add()
852 static void __team_queue_override_enabled_check(struct team *team) in __team_queue_override_enabled_check() argument
857 list_for_each_entry(port, &team->port_list, list) { in __team_queue_override_enabled_check()
863 if (enabled == team->queue_override_enabled) in __team_queue_override_enabled_check()
865 netdev_dbg(team->dev, "%s queue override\n", in __team_queue_override_enabled_check()
867 team->queue_override_enabled = enabled; in __team_queue_override_enabled_check()
870 static void team_queue_override_port_prio_changed(struct team *team, in team_queue_override_port_prio_changed() argument
875 __team_queue_override_port_del(team, port); in team_queue_override_port_prio_changed()
876 __team_queue_override_port_add(team, port); in team_queue_override_port_prio_changed()
877 __team_queue_override_enabled_check(team); in team_queue_override_port_prio_changed()
880 static void team_queue_override_port_change_queue_id(struct team *team, in team_queue_override_port_change_queue_id() argument
885 __team_queue_override_port_del(team, port); in team_queue_override_port_change_queue_id()
887 __team_queue_override_port_add(team, port); in team_queue_override_port_change_queue_id()
888 __team_queue_override_enabled_check(team); in team_queue_override_port_change_queue_id()
894 static void team_queue_override_port_add(struct team *team, in team_queue_override_port_add() argument
897 __team_queue_override_port_add(team, port); in team_queue_override_port_add()
898 __team_queue_override_enabled_check(team); in team_queue_override_port_add()
901 static void team_queue_override_port_del(struct team *team, in team_queue_override_port_del() argument
904 __team_queue_override_port_del(team, port); in team_queue_override_port_del()
905 __team_queue_override_enabled_check(team); in team_queue_override_port_del()
913 static bool team_port_find(const struct team *team, in team_port_find() argument
918 list_for_each_entry(cur, &team->port_list, list) in team_port_find()
930 static void team_port_enable(struct team *team, in team_port_enable() argument
935 port->index = team->en_port_count++; in team_port_enable()
937 team_port_index_hash(team, port->index)); in team_port_enable()
938 team_adjust_ops(team); in team_port_enable()
939 team_queue_override_port_add(team, port); in team_port_enable()
940 if (team->ops.port_enabled) in team_port_enable()
941 team->ops.port_enabled(team, port); in team_port_enable()
942 team_notify_peers(team); in team_port_enable()
943 team_mcast_rejoin(team); in team_port_enable()
947 static void __reconstruct_port_hlist(struct team *team, int rm_index) in __reconstruct_port_hlist() argument
952 for (i = rm_index + 1; i < team->en_port_count; i++) { in __reconstruct_port_hlist()
953 port = team_get_port_by_index(team, i); in __reconstruct_port_hlist()
957 team_port_index_hash(team, port->index)); in __reconstruct_port_hlist()
961 static void team_port_disable(struct team *team, in team_port_disable() argument
966 if (team->ops.port_disabled) in team_port_disable()
967 team->ops.port_disabled(team, port); in team_port_disable()
969 __reconstruct_port_hlist(team, port->index); in team_port_disable()
971 team->en_port_count--; in team_port_disable()
972 team_queue_override_port_del(team, port); in team_port_disable()
973 team_adjust_ops(team); in team_port_disable()
984 static void __team_compute_features(struct team *team) in __team_compute_features() argument
994 list_for_each_entry(port, &team->port_list, list) { in __team_compute_features()
1009 team->dev->vlan_features = vlan_features; in __team_compute_features()
1010 team->dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL | in __team_compute_features()
1014 team->dev->hard_header_len = max_hard_header_len; in __team_compute_features()
1016 team->dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; in __team_compute_features()
1018 team->dev->priv_flags |= IFF_XMIT_DST_RELEASE; in __team_compute_features()
1021 static void team_compute_features(struct team *team) in team_compute_features() argument
1023 mutex_lock(&team->lock); in team_compute_features()
1024 __team_compute_features(team); in team_compute_features()
1025 mutex_unlock(&team->lock); in team_compute_features()
1026 netdev_change_features(team->dev); in team_compute_features()
1029 static int team_port_enter(struct team *team, struct team_port *port) in team_port_enter() argument
1033 dev_hold(team->dev); in team_port_enter()
1034 if (team->ops.port_enter) { in team_port_enter()
1035 err = team->ops.port_enter(team, port); in team_port_enter()
1037 netdev_err(team->dev, "Device %s failed to enter team mode\n", in team_port_enter()
1046 dev_put(team->dev); in team_port_enter()
1051 static void team_port_leave(struct team *team, struct team_port *port) in team_port_leave() argument
1053 if (team->ops.port_leave) in team_port_leave()
1054 team->ops.port_leave(team, port); in team_port_leave()
1055 dev_put(team->dev); in team_port_leave()
1079 if (!port->team->dev->npinfo) in team_port_enable_netpoll()
1105 static int team_upper_dev_link(struct team *team, struct team_port *port, in team_upper_dev_link() argument
1111 lag_upper_info.tx_type = team->mode->lag_tx_type; in team_upper_dev_link()
1113 err = netdev_master_upper_dev_link(port->dev, team->dev, NULL, in team_upper_dev_link()
1121 static void team_upper_dev_unlink(struct team *team, struct team_port *port) in team_upper_dev_unlink() argument
1123 netdev_upper_dev_unlink(port->dev, team->dev); in team_upper_dev_unlink()
1131 static int team_port_add(struct team *team, struct net_device *port_dev, in team_port_add() argument
1134 struct net_device *dev = team->dev; in team_port_add()
1185 port = kzalloc(sizeof(struct team_port) + team->mode->port_priv_size, in team_port_add()
1191 port->team = team; in team_port_add()
1203 err = team_port_enter(team, port); in team_port_add()
1242 err = team_upper_dev_link(team, port, extack); in team_port_add()
1249 err = __team_option_inst_add_port(team, port); in team_port_add()
1279 list_add_tail_rcu(&port->list, &team->port_list); in team_port_add()
1280 team_port_enable(team, port); in team_port_add()
1281 __team_compute_features(team); in team_port_add()
1283 __team_options_change_check(team); in team_port_add()
1290 __team_option_inst_del_port(team, port); in team_port_add()
1293 team_upper_dev_unlink(team, port); in team_port_add()
1308 team_port_leave(team, port); in team_port_add()
1322 static int team_port_del(struct team *team, struct net_device *port_dev) in team_port_del() argument
1324 struct net_device *dev = team->dev; in team_port_del()
1329 if (!port || !team_port_find(team, port)) { in team_port_del()
1335 team_port_disable(team, port); in team_port_del()
1343 team_upper_dev_unlink(team, port); in team_port_del()
1350 team_port_leave(team, port); in team_port_del()
1352 __team_option_inst_mark_removed_port(team, port); in team_port_del()
1353 __team_options_change_check(team); in team_port_del()
1354 __team_option_inst_del_port(team, port); in team_port_del()
1361 __team_compute_features(team); in team_port_del()
1371 static int team_mode_option_get(struct team *team, struct team_gsetter_ctx *ctx) in team_mode_option_get() argument
1373 ctx->data.str_val = team->mode->kind; in team_mode_option_get()
1377 static int team_mode_option_set(struct team *team, struct team_gsetter_ctx *ctx) in team_mode_option_set() argument
1379 return team_change_mode(team, ctx->data.str_val); in team_mode_option_set()
1382 static int team_notify_peers_count_get(struct team *team, in team_notify_peers_count_get() argument
1385 ctx->data.u32_val = team->notify_peers.count; in team_notify_peers_count_get()
1389 static int team_notify_peers_count_set(struct team *team, in team_notify_peers_count_set() argument
1392 team->notify_peers.count = ctx->data.u32_val; in team_notify_peers_count_set()
1396 static int team_notify_peers_interval_get(struct team *team, in team_notify_peers_interval_get() argument
1399 ctx->data.u32_val = team->notify_peers.interval; in team_notify_peers_interval_get()
1403 static int team_notify_peers_interval_set(struct team *team, in team_notify_peers_interval_set() argument
1406 team->notify_peers.interval = ctx->data.u32_val; in team_notify_peers_interval_set()
1410 static int team_mcast_rejoin_count_get(struct team *team, in team_mcast_rejoin_count_get() argument
1413 ctx->data.u32_val = team->mcast_rejoin.count; in team_mcast_rejoin_count_get()
1417 static int team_mcast_rejoin_count_set(struct team *team, in team_mcast_rejoin_count_set() argument
1420 team->mcast_rejoin.count = ctx->data.u32_val; in team_mcast_rejoin_count_set()
1424 static int team_mcast_rejoin_interval_get(struct team *team, in team_mcast_rejoin_interval_get() argument
1427 ctx->data.u32_val = team->mcast_rejoin.interval; in team_mcast_rejoin_interval_get()
1431 static int team_mcast_rejoin_interval_set(struct team *team, in team_mcast_rejoin_interval_set() argument
1434 team->mcast_rejoin.interval = ctx->data.u32_val; in team_mcast_rejoin_interval_set()
1438 static int team_port_en_option_get(struct team *team, in team_port_en_option_get() argument
1447 static int team_port_en_option_set(struct team *team, in team_port_en_option_set() argument
1453 team_port_enable(team, port); in team_port_en_option_set()
1455 team_port_disable(team, port); in team_port_en_option_set()
1459 static int team_user_linkup_option_get(struct team *team, in team_user_linkup_option_get() argument
1468 static void __team_carrier_check(struct team *team);
1470 static int team_user_linkup_option_set(struct team *team, in team_user_linkup_option_set() argument
1477 __team_carrier_check(port->team); in team_user_linkup_option_set()
1481 static int team_user_linkup_en_option_get(struct team *team, in team_user_linkup_en_option_get() argument
1490 static int team_user_linkup_en_option_set(struct team *team, in team_user_linkup_en_option_set() argument
1497 __team_carrier_check(port->team); in team_user_linkup_en_option_set()
1501 static int team_priority_option_get(struct team *team, in team_priority_option_get() argument
1510 static int team_priority_option_set(struct team *team, in team_priority_option_set() argument
1519 team_queue_override_port_prio_changed(team, port); in team_priority_option_set()
1523 static int team_queue_id_option_get(struct team *team, in team_queue_id_option_get() argument
1532 static int team_queue_id_option_set(struct team *team, in team_queue_id_option_set() argument
1540 if (new_queue_id >= team->dev->real_num_tx_queues) in team_queue_id_option_set()
1542 team_queue_override_port_change_queue_id(team, port, new_queue_id); in team_queue_id_option_set()
1617 struct team *team = netdev_priv(dev); in team_init() local
1621 team->dev = dev; in team_init()
1622 team_set_no_mode(team); in team_init()
1624 team->pcpu_stats = netdev_alloc_pcpu_stats(struct team_pcpu_stats); in team_init()
1625 if (!team->pcpu_stats) in team_init()
1629 INIT_HLIST_HEAD(&team->en_port_hlist[i]); in team_init()
1630 INIT_LIST_HEAD(&team->port_list); in team_init()
1631 err = team_queue_override_init(team); in team_init()
1635 team_adjust_ops(team); in team_init()
1637 INIT_LIST_HEAD(&team->option_list); in team_init()
1638 INIT_LIST_HEAD(&team->option_inst_list); in team_init()
1640 team_notify_peers_init(team); in team_init()
1641 team_mcast_rejoin_init(team); in team_init()
1643 err = team_options_register(team, team_options, ARRAY_SIZE(team_options)); in team_init()
1648 lockdep_register_key(&team->team_lock_key); in team_init()
1649 __mutex_init(&team->lock, "team->team_lock_key", &team->team_lock_key); in team_init()
1655 team_mcast_rejoin_fini(team); in team_init()
1656 team_notify_peers_fini(team); in team_init()
1657 team_queue_override_fini(team); in team_init()
1659 free_percpu(team->pcpu_stats); in team_init()
1666 struct team *team = netdev_priv(dev); in team_uninit() local
1670 mutex_lock(&team->lock); in team_uninit()
1671 list_for_each_entry_safe(port, tmp, &team->port_list, list) in team_uninit()
1672 team_port_del(team, port->dev); in team_uninit()
1674 __team_change_mode(team, NULL); /* cleanup */ in team_uninit()
1675 __team_options_unregister(team, team_options, ARRAY_SIZE(team_options)); in team_uninit()
1676 team_mcast_rejoin_fini(team); in team_uninit()
1677 team_notify_peers_fini(team); in team_uninit()
1678 team_queue_override_fini(team); in team_uninit()
1679 mutex_unlock(&team->lock); in team_uninit()
1681 lockdep_unregister_key(&team->team_lock_key); in team_uninit()
1686 struct team *team = netdev_priv(dev); in team_destructor() local
1688 free_percpu(team->pcpu_stats); in team_destructor()
1706 struct team *team = netdev_priv(dev); in team_xmit() local
1710 tx_success = team_queue_override_transmit(team, skb); in team_xmit()
1712 tx_success = team->ops.transmit(team, skb); in team_xmit()
1716 pcpu_stats = this_cpu_ptr(team->pcpu_stats); in team_xmit()
1722 this_cpu_inc(team->pcpu_stats->tx_dropped); in team_xmit()
1754 struct team *team = netdev_priv(dev); in team_change_rx_flags() local
1759 list_for_each_entry_rcu(port, &team->port_list, list) { in team_change_rx_flags()
1774 struct team *team = netdev_priv(dev); in team_set_rx_mode() local
1778 list_for_each_entry_rcu(port, &team->port_list, list) { in team_set_rx_mode()
1788 struct team *team = netdev_priv(dev); in team_set_mac_address() local
1794 mutex_lock(&team->lock); in team_set_mac_address()
1795 list_for_each_entry(port, &team->port_list, list) in team_set_mac_address()
1796 if (team->ops.port_change_dev_addr) in team_set_mac_address()
1797 team->ops.port_change_dev_addr(team, port); in team_set_mac_address()
1798 mutex_unlock(&team->lock); in team_set_mac_address()
1804 struct team *team = netdev_priv(dev); in team_change_mtu() local
1812 mutex_lock(&team->lock); in team_change_mtu()
1813 team->port_mtu_change_allowed = true; in team_change_mtu()
1814 list_for_each_entry(port, &team->port_list, list) { in team_change_mtu()
1822 team->port_mtu_change_allowed = false; in team_change_mtu()
1823 mutex_unlock(&team->lock); in team_change_mtu()
1830 list_for_each_entry_continue_reverse(port, &team->port_list, list) in team_change_mtu()
1832 team->port_mtu_change_allowed = false; in team_change_mtu()
1833 mutex_unlock(&team->lock); in team_change_mtu()
1841 struct team *team = netdev_priv(dev); in team_get_stats64() local
1849 p = per_cpu_ptr(team->pcpu_stats, i); in team_get_stats64()
1879 struct team *team = netdev_priv(dev); in team_vlan_rx_add_vid() local
1887 mutex_lock(&team->lock); in team_vlan_rx_add_vid()
1888 list_for_each_entry(port, &team->port_list, list) { in team_vlan_rx_add_vid()
1893 mutex_unlock(&team->lock); in team_vlan_rx_add_vid()
1898 list_for_each_entry_continue_reverse(port, &team->port_list, list) in team_vlan_rx_add_vid()
1900 mutex_unlock(&team->lock); in team_vlan_rx_add_vid()
1907 struct team *team = netdev_priv(dev); in team_vlan_rx_kill_vid() local
1910 mutex_lock(&team->lock); in team_vlan_rx_kill_vid()
1911 list_for_each_entry(port, &team->port_list, list) in team_vlan_rx_kill_vid()
1913 mutex_unlock(&team->lock); in team_vlan_rx_kill_vid()
1923 static void __team_netpoll_cleanup(struct team *team) in __team_netpoll_cleanup() argument
1927 list_for_each_entry(port, &team->port_list, list) in __team_netpoll_cleanup()
1933 struct team *team = netdev_priv(dev); in team_netpoll_cleanup() local
1935 mutex_lock(&team->lock); in team_netpoll_cleanup()
1936 __team_netpoll_cleanup(team); in team_netpoll_cleanup()
1937 mutex_unlock(&team->lock); in team_netpoll_cleanup()
1943 struct team *team = netdev_priv(dev); in team_netpoll_setup() local
1947 mutex_lock(&team->lock); in team_netpoll_setup()
1948 list_for_each_entry(port, &team->port_list, list) { in team_netpoll_setup()
1951 __team_netpoll_cleanup(team); in team_netpoll_setup()
1955 mutex_unlock(&team->lock); in team_netpoll_setup()
1963 struct team *team = netdev_priv(dev); in team_add_slave() local
1966 mutex_lock(&team->lock); in team_add_slave()
1967 err = team_port_add(team, port_dev, extack); in team_add_slave()
1968 mutex_unlock(&team->lock); in team_add_slave()
1978 struct team *team = netdev_priv(dev); in team_del_slave() local
1981 mutex_lock(&team->lock); in team_del_slave()
1982 err = team_port_del(team, port_dev); in team_del_slave()
1983 mutex_unlock(&team->lock); in team_del_slave()
1989 lockdep_unregister_key(&team->team_lock_key); in team_del_slave()
1990 lockdep_register_key(&team->team_lock_key); in team_del_slave()
1991 lockdep_set_class(&team->lock, &team->team_lock_key); in team_del_slave()
2002 struct team *team = netdev_priv(dev); in team_fix_features() local
2010 list_for_each_entry_rcu(port, &team->port_list, list) { in team_fix_features()
2024 struct team *team = netdev_priv(dev); in team_change_carrier() local
2026 team->user_carrier_enabled = true; in team_change_carrier()
2075 struct team *team= netdev_priv(dev); in team_ethtool_get_link_ksettings() local
2083 list_for_each_entry_rcu(port, &team->port_list, list) { in team_ethtool_get_link_ksettings()
2125 struct team *team = netdev_priv(dev); in team_dev_type_check_change() local
2131 if (!list_empty(&team->port_list)) { in team_dev_type_check_change()
2217 .priv_size = sizeof(struct team),
2284 static struct team *team_nl_team_get(struct genl_info *info) in team_nl_team_get()
2289 struct team *team; in team_nl_team_get() local
2302 team = netdev_priv(dev); in team_nl_team_get()
2303 mutex_lock(&team->lock); in team_nl_team_get()
2304 return team; in team_nl_team_get()
2307 static void team_nl_team_put(struct team *team) in team_nl_team_put() argument
2309 mutex_unlock(&team->lock); in team_nl_team_put()
2310 dev_put(team->dev); in team_nl_team_put()
2314 struct team *team, u32 portid);
2316 static int team_nl_send_unicast(struct sk_buff *skb, struct team *team, u32 portid) in team_nl_send_unicast() argument
2318 return genlmsg_unicast(dev_net(team->dev), skb, portid); in team_nl_send_unicast()
2321 static int team_nl_fill_one_option_get(struct sk_buff *skb, struct team *team, in team_nl_fill_one_option_get() argument
2331 err = team_option_get(team, opt_inst, &ctx); in team_nl_fill_one_option_get()
2403 struct team *team, u32 portid, in __send_and_alloc_skb() argument
2409 err = send_func(*pskb, team, portid); in __send_and_alloc_skb()
2419 static int team_nl_send_options_get(struct team *team, u32 portid, u32 seq, in team_nl_send_options_get() argument
2436 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_options_get()
2447 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) in team_nl_send_options_get()
2456 err = team_nl_fill_one_option_get(skb, team, opt_inst); in team_nl_send_options_get()
2477 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_options_get()
2483 return send_func(skb, team, portid); in team_nl_send_options_get()
2494 struct team *team; in team_nl_cmd_options_get() local
2499 team = team_nl_team_get(info); in team_nl_cmd_options_get()
2500 if (!team) in team_nl_cmd_options_get()
2503 list_for_each_entry(opt_inst, &team->option_inst_list, list) in team_nl_cmd_options_get()
2505 err = team_nl_send_options_get(team, info->snd_portid, info->snd_seq, in team_nl_cmd_options_get()
2509 team_nl_team_put(team); in team_nl_cmd_options_get()
2514 static int team_nl_send_event_options_get(struct team *team,
2519 struct team *team; in team_nl_cmd_options_set() local
2526 team = team_nl_team_get(info); in team_nl_cmd_options_set()
2527 if (!team) { in team_nl_cmd_options_set()
2604 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in team_nl_cmd_options_set()
2645 err = team_option_set(team, opt_inst, &ctx); in team_nl_cmd_options_set()
2656 err = team_nl_send_event_options_get(team, &opt_inst_list); in team_nl_cmd_options_set()
2662 team_nl_team_put(team); in team_nl_cmd_options_set()
2698 static int team_nl_send_port_list_get(struct team *team, u32 portid, u32 seq, in team_nl_send_port_list_get() argument
2711 port = list_first_entry_or_null(&team->port_list, in team_nl_send_port_list_get()
2715 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_port_list_get()
2726 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) in team_nl_send_port_list_get()
2743 list_for_each_entry_from(port, &team->port_list, list) { in team_nl_send_port_list_get()
2766 err = __send_and_alloc_skb(&skb, team, portid, send_func); in team_nl_send_port_list_get()
2772 return send_func(skb, team, portid); in team_nl_send_port_list_get()
2784 struct team *team; in team_nl_cmd_port_list_get() local
2787 team = team_nl_team_get(info); in team_nl_cmd_port_list_get()
2788 if (!team) in team_nl_cmd_port_list_get()
2791 err = team_nl_send_port_list_get(team, info->snd_portid, info->snd_seq, in team_nl_cmd_port_list_get()
2794 team_nl_team_put(team); in team_nl_cmd_port_list_get()
2843 struct team *team, u32 portid) in team_nl_send_multicast() argument
2845 return genlmsg_multicast_netns(&team_nl_family, dev_net(team->dev), in team_nl_send_multicast()
2849 static int team_nl_send_event_options_get(struct team *team, in team_nl_send_event_options_get() argument
2852 return team_nl_send_options_get(team, 0, 0, 0, team_nl_send_multicast, in team_nl_send_event_options_get()
2856 static int team_nl_send_event_port_get(struct team *team, in team_nl_send_event_port_get() argument
2859 return team_nl_send_port_list_get(team, 0, 0, 0, team_nl_send_multicast, in team_nl_send_event_port_get()
2878 static void __team_options_change_check(struct team *team) in __team_options_change_check() argument
2884 list_for_each_entry(opt_inst, &team->option_inst_list, list) { in __team_options_change_check()
2888 err = team_nl_send_event_options_get(team, &sel_opt_inst_list); in __team_options_change_check()
2890 netdev_warn(team->dev, "Failed to send options change via netlink (err %d)\n", in __team_options_change_check()
2917 err = team_nl_send_event_port_get(port->team, port); in __team_port_change_send()
2919 netdev_warn(port->team->dev, "Failed to send port change of device %s via netlink (err %d)\n", in __team_port_change_send()
2924 static void __team_carrier_check(struct team *team) in __team_carrier_check() argument
2929 if (team->user_carrier_enabled) in __team_carrier_check()
2933 list_for_each_entry(port, &team->port_list, list) { in __team_carrier_check()
2941 netif_carrier_on(team->dev); in __team_carrier_check()
2943 netif_carrier_off(team->dev); in __team_carrier_check()
2950 __team_carrier_check(port->team); in __team_port_change_check()
2956 __team_carrier_check(port->team); in __team_port_change_port_added()
2963 __team_carrier_check(port->team); in __team_port_change_port_removed()
2968 struct team *team = port->team; in team_port_change_check() local
2970 mutex_lock(&team->lock); in team_port_change_check()
2972 mutex_unlock(&team->lock); in team_port_change_check()
3004 team_del_slave(port->team->dev, dev); in team_device_event()
3007 team_compute_features(port->team); in team_device_event()
3011 if (!port->team->port_mtu_change_allowed) in team_device_event()
3019 call_netdevice_notifiers(event, port->team->dev); in team_device_event()