diff options
author | Jim Hanko <hanko@drivescale.com> | 2017-09-19 20:33:39 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-09-20 01:18:58 +0200 |
commit | bd7d2106b63adfd0dfd08331344e356461c29d70 (patch) | |
tree | 6a31e8ceb55ae95bf40d798a30f00c2a092c2e30 /drivers/net | |
parent | Merge branch 'test_rhashtable-dont-allocate-huge-static-array' (diff) | |
download | linux-bd7d2106b63adfd0dfd08331344e356461c29d70.tar.xz linux-bd7d2106b63adfd0dfd08331344e356461c29d70.zip |
team: fall back to hash if table entry is empty
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>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/team/team_mode_loadbalance.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c index 1468ddf424cc..a5ef97010eb3 100644 --- a/drivers/net/team/team_mode_loadbalance.c +++ b/drivers/net/team/team_mode_loadbalance.c @@ -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 { |