Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1735151 > unrolled thread

[patch net-next] team: fall back to hash if table entry is empty

Started byJim Hanko <hanko@drivescale.com>
First post2017-09-19 20:40 +0200
Last post2017-09-20 01:20 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch net-next] team: fall back to hash if table entry is empty Jim Hanko <hanko@drivescale.com> - 2017-09-19 20:40 +0200
    Re: [patch net-next] team: fall back to hash if table entry is  empty David Miller <davem@davemloft.net> - 2017-09-20 01:20 +0200

#1735151 — [patch net-next] team: fall back to hash if table entry is empty

FromJim Hanko <hanko@drivescale.com>
Date2017-09-19 20:40 +0200
Subject[patch net-next] team: fall back to hash if table entry is empty
Message-ID<urvB8-tP-3@gated-at.bofh.it>
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>
---
 drivers/net/team/team_mode_loadbalance.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/team/team_mode_loadbalance.c b/drivers/net/team/team_mode_loadbalance.c
index 1468ddf..a5ef970 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 {
-- 
2.7.4

[toc] | [next] | [standalone]


#1735347 — Re: [patch net-next] team: fall back to hash if table entry is empty

FromDavid Miller <davem@davemloft.net>
Date2017-09-20 01:20 +0200
SubjectRe: [patch net-next] team: fall back to hash if table entry is empty
Message-ID<urzY6-3k6-35@gated-at.bofh.it>
In reply to#1735151
From: Jim Hanko <hanko@drivescale.com>
Date: Tue, 19 Sep 2017 11:33:39 -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>

Applied, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web