]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.109/bonding-require-speed-duplex-only-for-802.3ad-alb-and-tlb.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.9.109 / bonding-require-speed-duplex-only-for-802.3ad-alb-and-tlb.patch
CommitLineData
08ef39ec
GKH
1From ad729bc9acfb7c47112964b4877ef5404578ed13 Mon Sep 17 00:00:00 2001
2From: Andreas Born <futur.andy@googlemail.com>
3Date: Thu, 10 Aug 2017 06:41:44 +0200
4Subject: bonding: require speed/duplex only for 802.3ad, alb and tlb
5
6From: Andreas Born <futur.andy@googlemail.com>
7
8commit ad729bc9acfb7c47112964b4877ef5404578ed13 upstream.
9
10The patch c4adfc822bf5 ("bonding: make speed, duplex setting consistent
11with link state") puts the link state to down if
12bond_update_speed_duplex() cannot retrieve speed and duplex settings.
13Assumably the patch was written with 802.3ad mode in mind which relies
14on link speed/duplex settings. For other modes like active-backup these
15settings are not required. Thus, only for these other modes, this patch
16reintroduces support for slaves that do not support reporting speed or
17duplex such as wireless devices. This fixes the regression reported in
18bug 196547 (https://bugzilla.kernel.org/show_bug.cgi?id=196547).
19
20Fixes: c4adfc822bf5 ("bonding: make speed, duplex setting consistent
21with link state")
22Signed-off-by: Andreas Born <futur.andy@googlemail.com>
23Acked-by: Mahesh Bandewar <maheshb@google.com>
24Signed-off-by: David S. Miller <davem@davemloft.net>
25Cc: Nate Clark <nate@neworld.us>
26Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
27
28---
29 drivers/net/bonding/bond_main.c | 6 ++++--
30 include/net/bonding.h | 5 +++++
31 2 files changed, 9 insertions(+), 2 deletions(-)
32
33--- a/drivers/net/bonding/bond_main.c
34+++ b/drivers/net/bonding/bond_main.c
35@@ -1531,7 +1531,8 @@ int bond_enslave(struct net_device *bond
36 new_slave->delay = 0;
37 new_slave->link_failure_count = 0;
38
39- if (bond_update_speed_duplex(new_slave))
40+ if (bond_update_speed_duplex(new_slave) &&
41+ bond_needs_speed_duplex(bond))
42 new_slave->link = BOND_LINK_DOWN;
43
44 new_slave->last_rx = jiffies -
45@@ -2136,7 +2137,8 @@ static void bond_miimon_commit(struct bo
46 continue;
47
48 case BOND_LINK_UP:
49- if (bond_update_speed_duplex(slave)) {
50+ if (bond_update_speed_duplex(slave) &&
51+ bond_needs_speed_duplex(bond)) {
52 slave->link = BOND_LINK_DOWN;
53 netdev_warn(bond->dev,
54 "failed to get link speed/duplex for %s\n",
55--- a/include/net/bonding.h
56+++ b/include/net/bonding.h
57@@ -277,6 +277,11 @@ static inline bool bond_is_lb(const stru
58 BOND_MODE(bond) == BOND_MODE_ALB;
59 }
60
61+static inline bool bond_needs_speed_duplex(const struct bonding *bond)
62+{
63+ return BOND_MODE(bond) == BOND_MODE_8023AD || bond_is_lb(bond);
64+}
65+
66 static inline bool bond_is_nondyn_tlb(const struct bonding *bond)
67 {
68 return (BOND_MODE(bond) == BOND_MODE_TLB) &&