aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/team/team.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/team/team.c')
-rw-r--r--drivers/net/team/team.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 341b65dbbcd3..f8cd61f449a4 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -848,7 +848,7 @@ static struct netpoll_info *team_netpoll_info(struct team *team)
848} 848}
849#endif 849#endif
850 850
851static void __team_port_change_check(struct team_port *port, bool linkup); 851static void __team_port_change_port_added(struct team_port *port, bool linkup);
852 852
853static int team_port_add(struct team *team, struct net_device *port_dev) 853static int team_port_add(struct team *team, struct net_device *port_dev)
854{ 854{
@@ -948,7 +948,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
948 team_port_enable(team, port); 948 team_port_enable(team, port);
949 list_add_tail_rcu(&port->list, &team->port_list); 949 list_add_tail_rcu(&port->list, &team->port_list);
950 __team_compute_features(team); 950 __team_compute_features(team);
951 __team_port_change_check(port, !!netif_carrier_ok(port_dev)); 951 __team_port_change_port_added(port, !!netif_carrier_ok(port_dev));
952 __team_options_change_check(team); 952 __team_options_change_check(team);
953 953
954 netdev_info(dev, "Port device %s added\n", portname); 954 netdev_info(dev, "Port device %s added\n", portname);
@@ -983,6 +983,8 @@ err_set_mtu:
983 return err; 983 return err;
984} 984}
985 985
986static void __team_port_change_port_removed(struct team_port *port);
987
986static int team_port_del(struct team *team, struct net_device *port_dev) 988static int team_port_del(struct team *team, struct net_device *port_dev)
987{ 989{
988 struct net_device *dev = team->dev; 990 struct net_device *dev = team->dev;
@@ -999,8 +1001,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
999 __team_option_inst_mark_removed_port(team, port); 1001 __team_option_inst_mark_removed_port(team, port);
1000 __team_options_change_check(team); 1002 __team_options_change_check(team);
1001 __team_option_inst_del_port(team, port); 1003 __team_option_inst_del_port(team, port);
1002 port->removed = true; 1004 __team_port_change_port_removed(port);
1003 __team_port_change_check(port, false);
1004 team_port_disable(team, port); 1005 team_port_disable(team, port);
1005 list_del_rcu(&port->list); 1006 list_del_rcu(&port->list);
1006 netdev_rx_handler_unregister(port_dev); 1007 netdev_rx_handler_unregister(port_dev);
@@ -1652,8 +1653,8 @@ static int team_nl_cmd_noop(struct sk_buff *skb, struct genl_info *info)
1652 1653
1653 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq, 1654 hdr = genlmsg_put(msg, info->snd_pid, info->snd_seq,
1654 &team_nl_family, 0, TEAM_CMD_NOOP); 1655 &team_nl_family, 0, TEAM_CMD_NOOP);
1655 if (IS_ERR(hdr)) { 1656 if (!hdr) {
1656 err = PTR_ERR(hdr); 1657 err = -EMSGSIZE;
1657 goto err_msg_put; 1658 goto err_msg_put;
1658 } 1659 }
1659 1660
@@ -1847,8 +1848,8 @@ start_again:
1847 1848
1848 hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI, 1849 hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags | NLM_F_MULTI,
1849 TEAM_CMD_OPTIONS_GET); 1850 TEAM_CMD_OPTIONS_GET);
1850 if (IS_ERR(hdr)) 1851 if (!hdr)
1851 return PTR_ERR(hdr); 1852 return -EMSGSIZE;
1852 1853
1853 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) 1854 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
1854 goto nla_put_failure; 1855 goto nla_put_failure;
@@ -2067,8 +2068,8 @@ static int team_nl_fill_port_list_get(struct sk_buff *skb,
2067 2068
2068 hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags, 2069 hdr = genlmsg_put(skb, pid, seq, &team_nl_family, flags,
2069 TEAM_CMD_PORT_LIST_GET); 2070 TEAM_CMD_PORT_LIST_GET);
2070 if (IS_ERR(hdr)) 2071 if (!hdr)
2071 return PTR_ERR(hdr); 2072 return -EMSGSIZE;
2072 2073
2073 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex)) 2074 if (nla_put_u32(skb, TEAM_ATTR_TEAM_IFINDEX, team->dev->ifindex))
2074 goto nla_put_failure; 2075 goto nla_put_failure;
@@ -2251,13 +2252,11 @@ static void __team_options_change_check(struct team *team)
2251} 2252}
2252 2253
2253/* rtnl lock is held */ 2254/* rtnl lock is held */
2254static void __team_port_change_check(struct team_port *port, bool linkup) 2255
2256static void __team_port_change_send(struct team_port *port, bool linkup)
2255{ 2257{
2256 int err; 2258 int err;
2257 2259
2258 if (!port->removed && port->state.linkup == linkup)
2259 return;
2260
2261 port->changed = true; 2260 port->changed = true;
2262 port->state.linkup = linkup; 2261 port->state.linkup = linkup;
2263 team_refresh_port_linkup(port); 2262 team_refresh_port_linkup(port);
@@ -2282,6 +2281,23 @@ send_event:
2282 2281
2283} 2282}
2284 2283
2284static void __team_port_change_check(struct team_port *port, bool linkup)
2285{
2286 if (port->state.linkup != linkup)
2287 __team_port_change_send(port, linkup);
2288}
2289
2290static void __team_port_change_port_added(struct team_port *port, bool linkup)
2291{
2292 __team_port_change_send(port, linkup);
2293}
2294
2295static void __team_port_change_port_removed(struct team_port *port)
2296{
2297 port->removed = true;
2298 __team_port_change_send(port, false);
2299}
2300
2285static void team_port_change_check(struct team_port *port, bool linkup) 2301static void team_port_change_check(struct team_port *port, bool linkup)
2286{ 2302{
2287 struct team *team = port->team; 2303 struct team *team = port->team;