2 * drivers/net/team/team_mode_broadcast.c - Broadcast mode for team
3 * Copyright (c) 2012 Jiri Pirko <jpirko@redhat.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
11 #include <linux/kernel.h>
12 #include <linux/types.h>
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/errno.h>
16 #include <linux/netdevice.h>
17 #include <linux/if_team.h>
19 static bool bc_transmit(struct team
*team
, struct sk_buff
*skb
)
21 struct team_port
*cur
;
22 struct team_port
*last
= NULL
;
27 list_for_each_entry_rcu(cur
, &team
->port_list
, list
) {
28 if (team_port_txable(cur
)) {
30 skb2
= skb_clone(skb
, GFP_ATOMIC
);
32 ret
= !team_dev_queue_xmit(team
, last
,
42 ret
= !team_dev_queue_xmit(team
, last
, skb
);
49 static const struct team_mode_ops bc_mode_ops
= {
50 .transmit
= bc_transmit
,
51 .port_enter
= team_modeop_port_enter
,
52 .port_change_dev_addr
= team_modeop_port_change_dev_addr
,
55 static const struct team_mode bc_mode
= {
59 .lag_tx_type
= NETDEV_LAG_TX_TYPE_BROADCAST
,
62 static int __init
bc_init_module(void)
64 return team_mode_register(&bc_mode
);
67 static void __exit
bc_cleanup_module(void)
69 team_mode_unregister(&bc_mode
);
72 module_init(bc_init_module
);
73 module_exit(bc_cleanup_module
);
75 MODULE_LICENSE("GPL v2");
76 MODULE_AUTHOR("Jiri Pirko <jpirko@redhat.com>");
77 MODULE_DESCRIPTION("Broadcast mode for team");
78 MODULE_ALIAS_TEAM_MODE("broadcast");