]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.17.19/s390-qeth-consistently-re-enable-device-features.patch
Linux 4.14.112
[thirdparty/kernel/stable-queue.git] / releases / 4.17.19 / s390-qeth-consistently-re-enable-device-features.patch
1 From foo@baz Wed Aug 22 09:16:56 CEST 2018
2 From: Julian Wiedmann <jwi@linux.ibm.com>
3 Date: Fri, 29 Jun 2018 19:45:54 +0200
4 Subject: s390/qeth: consistently re-enable device features
5
6 From: Julian Wiedmann <jwi@linux.ibm.com>
7
8 [ Upstream commit d025da9eb1e48d3e5f2a2ff13ac5ac536ba4be43 ]
9
10 commit e830baa9c3f0 ("qeth: restore device features after recovery") and
11 commit ce3443564145 ("s390/qeth: rely on kernel for feature recovery")
12 made sure that the HW functions for device features get re-programmed
13 after recovery.
14
15 But we missed that the same handling is also required when a card is
16 first set offline (destroying all HW context), and then online again.
17 Fix this by moving the re-enable action out of the recovery-only path.
18
19 Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
20 Signed-off-by: David S. Miller <davem@davemloft.net>
21 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
22 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 ---
24 drivers/s390/net/qeth_core.h | 2 +-
25 drivers/s390/net/qeth_core_main.c | 23 +++++++++++------------
26 drivers/s390/net/qeth_l2_main.c | 5 ++---
27 drivers/s390/net/qeth_l3_main.c | 3 ++-
28 4 files changed, 16 insertions(+), 17 deletions(-)
29
30 --- a/drivers/s390/net/qeth_core.h
31 +++ b/drivers/s390/net/qeth_core.h
32 @@ -1003,7 +1003,7 @@ struct qeth_cmd_buffer *qeth_get_setassp
33 __u16, __u16,
34 enum qeth_prot_versions);
35 int qeth_set_features(struct net_device *, netdev_features_t);
36 -void qeth_recover_features(struct net_device *dev);
37 +void qeth_enable_hw_features(struct net_device *dev);
38 netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t);
39 netdev_features_t qeth_features_check(struct sk_buff *skb,
40 struct net_device *dev,
41 --- a/drivers/s390/net/qeth_core_main.c
42 +++ b/drivers/s390/net/qeth_core_main.c
43 @@ -6432,28 +6432,27 @@ static int qeth_set_ipa_tso(struct qeth_
44 #define QETH_HW_FEATURES (NETIF_F_RXCSUM | NETIF_F_IP_CSUM | NETIF_F_TSO)
45
46 /**
47 - * qeth_recover_features() - Restore device features after recovery
48 - * @dev: the recovering net_device
49 - *
50 - * Caller must hold rtnl lock.
51 + * qeth_enable_hw_features() - (Re-)Enable HW functions for device features
52 + * @dev: a net_device
53 */
54 -void qeth_recover_features(struct net_device *dev)
55 +void qeth_enable_hw_features(struct net_device *dev)
56 {
57 - netdev_features_t features = dev->features;
58 struct qeth_card *card = dev->ml_priv;
59 + netdev_features_t features;
60
61 + rtnl_lock();
62 + features = dev->features;
63 /* force-off any feature that needs an IPA sequence.
64 * netdev_update_features() will restart them.
65 */
66 dev->features &= ~QETH_HW_FEATURES;
67 netdev_update_features(dev);
68 -
69 - if (features == dev->features)
70 - return;
71 - dev_warn(&card->gdev->dev,
72 - "Device recovery failed to restore all offload features\n");
73 + if (features != dev->features)
74 + dev_warn(&card->gdev->dev,
75 + "Device recovery failed to restore all offload features\n");
76 + rtnl_unlock();
77 }
78 -EXPORT_SYMBOL_GPL(qeth_recover_features);
79 +EXPORT_SYMBOL_GPL(qeth_enable_hw_features);
80
81 int qeth_set_features(struct net_device *dev, netdev_features_t features)
82 {
83 --- a/drivers/s390/net/qeth_l2_main.c
84 +++ b/drivers/s390/net/qeth_l2_main.c
85 @@ -1130,6 +1130,8 @@ static int __qeth_l2_set_online(struct c
86 netif_carrier_off(card->dev);
87
88 qeth_set_allowed_threads(card, 0xffffffff, 0);
89 +
90 + qeth_enable_hw_features(card->dev);
91 if (recover_flag == CARD_STATE_RECOVER) {
92 if (recovery_mode &&
93 card->info.type != QETH_CARD_TYPE_OSN) {
94 @@ -1141,9 +1143,6 @@ static int __qeth_l2_set_online(struct c
95 }
96 /* this also sets saved unicast addresses */
97 qeth_l2_set_rx_mode(card->dev);
98 - rtnl_lock();
99 - qeth_recover_features(card->dev);
100 - rtnl_unlock();
101 }
102 /* let user_space know that device is online */
103 kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);
104 --- a/drivers/s390/net/qeth_l3_main.c
105 +++ b/drivers/s390/net/qeth_l3_main.c
106 @@ -2792,6 +2792,8 @@ static int __qeth_l3_set_online(struct c
107 netif_carrier_on(card->dev);
108 else
109 netif_carrier_off(card->dev);
110 +
111 + qeth_enable_hw_features(card->dev);
112 if (recover_flag == CARD_STATE_RECOVER) {
113 rtnl_lock();
114 if (recovery_mode)
115 @@ -2799,7 +2801,6 @@ static int __qeth_l3_set_online(struct c
116 else
117 dev_open(card->dev);
118 qeth_l3_set_rx_mode(card->dev);
119 - qeth_recover_features(card->dev);
120 rtnl_unlock();
121 }
122 qeth_trace_features(card);