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

2017-09-07 Thread Jim Hanko
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 
---
 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



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

2017-09-19 Thread Jim Hanko
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 
Acked-by: Jiri Pirko 
---
 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



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

2017-09-07 Thread Jiri Pirko
Fri, Sep 08, 2017 at 04:25:12AM CEST, ha...@drivescale.com wrote:
>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 

Acked-by: Jiri Pirko 

net-next is closed for now (will open after rc1 is out). Please re-send
the patch (including my ack) then.

Thanks.


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

2017-09-19 Thread David Miller
From: Jim Hanko 
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 
> Acked-by: Jiri Pirko 

Applied, thanks.