Commit 8fd72856 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

team: fill-up LAG changeupper info struct and pass it along

Initialize netdev_lag_upper_info structure by TX type according to
current team mode and pass it along via netdev_master_upper_dev_link.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 764f5e54
...@@ -1078,23 +1078,24 @@ static void team_port_disable_netpoll(struct team_port *port) ...@@ -1078,23 +1078,24 @@ static void team_port_disable_netpoll(struct team_port *port)
} }
#endif #endif
static int team_upper_dev_link(struct net_device *dev, static int team_upper_dev_link(struct team *team, struct team_port *port)
struct net_device *port_dev)
{ {
struct netdev_lag_upper_info lag_upper_info;
int err; int err;
err = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL); lag_upper_info.tx_type = team->mode->lag_tx_type;
err = netdev_master_upper_dev_link(port->dev, team->dev, NULL,
&lag_upper_info);
if (err) if (err)
return err; return err;
port_dev->priv_flags |= IFF_TEAM_PORT; port->dev->priv_flags |= IFF_TEAM_PORT;
return 0; return 0;
} }
static void team_upper_dev_unlink(struct net_device *dev, static void team_upper_dev_unlink(struct team *team, struct team_port *port)
struct net_device *port_dev)
{ {
netdev_upper_dev_unlink(port_dev, dev); netdev_upper_dev_unlink(port->dev, team->dev);
port_dev->priv_flags &= ~IFF_TEAM_PORT; port->dev->priv_flags &= ~IFF_TEAM_PORT;
} }
static void __team_port_change_port_added(struct team_port *port, bool linkup); static void __team_port_change_port_added(struct team_port *port, bool linkup);
...@@ -1194,7 +1195,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) ...@@ -1194,7 +1195,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
goto err_handler_register; goto err_handler_register;
} }
err = team_upper_dev_link(dev, port_dev); err = team_upper_dev_link(team, port);
if (err) { if (err) {
netdev_err(dev, "Device %s failed to set upper link\n", netdev_err(dev, "Device %s failed to set upper link\n",
portname); portname);
...@@ -1220,7 +1221,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) ...@@ -1220,7 +1221,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
return 0; return 0;
err_option_port_add: err_option_port_add:
team_upper_dev_unlink(dev, port_dev); team_upper_dev_unlink(team, port);
err_set_upper_link: err_set_upper_link:
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
...@@ -1264,7 +1265,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev) ...@@ -1264,7 +1265,7 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
team_port_disable(team, port); team_port_disable(team, port);
list_del_rcu(&port->list); list_del_rcu(&port->list);
team_upper_dev_unlink(dev, port_dev); team_upper_dev_unlink(team, port);
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
team_port_disable_netpoll(port); team_port_disable_netpoll(port);
vlan_vids_del_by_dev(port_dev, dev); vlan_vids_del_by_dev(port_dev, dev);
......
...@@ -127,6 +127,7 @@ static const struct team_mode ab_mode = { ...@@ -127,6 +127,7 @@ static const struct team_mode ab_mode = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.priv_size = sizeof(struct ab_priv), .priv_size = sizeof(struct ab_priv),
.ops = &ab_mode_ops, .ops = &ab_mode_ops,
.lag_tx_type = NETDEV_LAG_TX_TYPE_ACTIVEBACKUP,
}; };
static int __init ab_init_module(void) static int __init ab_init_module(void)
......
...@@ -56,6 +56,7 @@ static const struct team_mode bc_mode = { ...@@ -56,6 +56,7 @@ static const struct team_mode bc_mode = {
.kind = "broadcast", .kind = "broadcast",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ops = &bc_mode_ops, .ops = &bc_mode_ops,
.lag_tx_type = NETDEV_LAG_TX_TYPE_BROADCAST,
}; };
static int __init bc_init_module(void) static int __init bc_init_module(void)
......
...@@ -661,6 +661,7 @@ static const struct team_mode lb_mode = { ...@@ -661,6 +661,7 @@ static const struct team_mode lb_mode = {
.priv_size = sizeof(struct lb_priv), .priv_size = sizeof(struct lb_priv),
.port_priv_size = sizeof(struct lb_port_priv), .port_priv_size = sizeof(struct lb_port_priv),
.ops = &lb_mode_ops, .ops = &lb_mode_ops,
.lag_tx_type = NETDEV_LAG_TX_TYPE_HASH,
}; };
static int __init lb_init_module(void) static int __init lb_init_module(void)
......
...@@ -46,6 +46,7 @@ static const struct team_mode rnd_mode = { ...@@ -46,6 +46,7 @@ static const struct team_mode rnd_mode = {
.kind = "random", .kind = "random",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.ops = &rnd_mode_ops, .ops = &rnd_mode_ops,
.lag_tx_type = NETDEV_LAG_TX_TYPE_RANDOM,
}; };
static int __init rnd_init_module(void) static int __init rnd_init_module(void)
......
...@@ -58,6 +58,7 @@ static const struct team_mode rr_mode = { ...@@ -58,6 +58,7 @@ static const struct team_mode rr_mode = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.priv_size = sizeof(struct rr_priv), .priv_size = sizeof(struct rr_priv),
.ops = &rr_mode_ops, .ops = &rr_mode_ops,
.lag_tx_type = NETDEV_LAG_TX_TYPE_ROUNDROBIN,
}; };
static int __init rr_init_module(void) static int __init rr_init_module(void)
......
...@@ -164,6 +164,7 @@ struct team_mode { ...@@ -164,6 +164,7 @@ struct team_mode {
size_t priv_size; size_t priv_size;
size_t port_priv_size; size_t port_priv_size;
const struct team_mode_ops *ops; const struct team_mode_ops *ops;
enum netdev_lag_tx_type lag_tx_type;
}; };
#define TEAM_PORT_HASHBITS 4 #define TEAM_PORT_HASHBITS 4
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment