]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
team: fall back to hash if table entry is empty
authorJim Hanko <hanko@drivescale.com>
Tue, 19 Sep 2017 18:33:39 +0000 (11:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 19 Sep 2017 23:18:58 +0000 (16:18 -0700)
If the hash to port mapping table does not have a valid port (i.e. when
a port goes down), fall back to the simple hashing mechanism to avoid
dropping packets.

Signed-off-by: Jim Hanko <hanko@drivescale.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/team/team_mode_loadbalance.c

index 1468ddf424ccbca9636bc2ea91f17f80660e7d59..a5ef97010eb344c1f5c9cc09d4c63d2103a8c719 100644 (file)
@@ -137,7 +137,13 @@ static struct team_port *lb_htpm_select_tx_port(struct team *team,
                                                struct sk_buff *skb,
                                                unsigned char hash)
 {
-       return rcu_dereference_bh(LB_HTPM_PORT_BY_HASH(lb_priv, hash));
+       struct team_port *port;
+
+       port = rcu_dereference_bh(LB_HTPM_PORT_BY_HASH(lb_priv, hash));
+       if (likely(port))
+               return port;
+       /* If no valid port in the table, fall back to simple hash */
+       return lb_hash_select_tx_port(team, lb_priv, skb, hash);
 }
 
 struct lb_select_tx_port {