Skip to content

Commit 35b384b

Browse files
Jiri Pirkodavem330
authored andcommitted
team: ensure correct order of netlink messages delivery
currently, when port is created and per-port options are present, there options are sent to userspace with ifindex of port which userspace does not know about. Port add message goes right after. This patch corrects message ordering so userspace would not be confused. Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9b00cf2 commit 35b384b

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

drivers/net/team/team.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -347,24 +347,6 @@ void team_options_unregister(struct team *team,
347347
}
348348
EXPORT_SYMBOL(team_options_unregister);
349349

350-
static int team_option_port_add(struct team *team, struct team_port *port)
351-
{
352-
int err;
353-
354-
err = __team_option_inst_add_port(team, port);
355-
if (err)
356-
return err;
357-
__team_options_change_check(team);
358-
return 0;
359-
}
360-
361-
static void team_option_port_del(struct team *team, struct team_port *port)
362-
{
363-
__team_option_inst_mark_removed_port(team, port);
364-
__team_options_change_check(team);
365-
__team_option_inst_del_port(team, port);
366-
}
367-
368350
static int team_option_get(struct team *team,
369351
struct team_option_inst *opt_inst,
370352
struct team_gsetter_ctx *ctx)
@@ -891,7 +873,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
891873
goto err_handler_register;
892874
}
893875

894-
err = team_option_port_add(team, port);
876+
err = __team_option_inst_add_port(team, port);
895877
if (err) {
896878
netdev_err(dev, "Device %s failed to add per-port options\n",
897879
portname);
@@ -904,6 +886,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
904886
team_adjust_ops(team);
905887
__team_compute_features(team);
906888
__team_port_change_check(port, !!netif_carrier_ok(port_dev));
889+
__team_options_change_check(team);
907890

908891
netdev_info(dev, "Port device %s added\n", portname);
909892

@@ -947,12 +930,14 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
947930
return -ENOENT;
948931
}
949932

933+
__team_option_inst_mark_removed_port(team, port);
934+
__team_options_change_check(team);
935+
__team_option_inst_del_port(team, port);
950936
port->removed = true;
951937
__team_port_change_check(port, false);
952938
team_port_disable(team, port);
953939
list_del_rcu(&port->list);
954940
team_adjust_ops(team);
955-
team_option_port_del(team, port);
956941
netdev_rx_handler_unregister(port_dev);
957942
netdev_set_master(port_dev, NULL);
958943
vlan_vids_del_by_dev(port_dev, dev);

0 commit comments

Comments
 (0)