Commit bd7d2106 authored by Jim Hanko's avatar Jim Hanko Committed by David S. Miller

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: default avatarJim Hanko <hanko@drivescale.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d3b55771
...@@ -137,7 +137,13 @@ static struct team_port *lb_htpm_select_tx_port(struct team *team, ...@@ -137,7 +137,13 @@ static struct team_port *lb_htpm_select_tx_port(struct team *team,
struct sk_buff *skb, struct sk_buff *skb,
unsigned char hash) 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 { struct lb_select_tx_port {
......
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