Skip to content

Commit e830baa

Browse files
Hans Wippeldavem330
authored andcommitted
qeth: restore device features after recovery
After device recovery, only a basic set of network device features is enabled on the device. If features like checksum offloading or TSO were enabled by the user before the recovery, this results in a mismatch between the network device features, that the kernel assumes to be enabled on the device, and the features actually enabled on the device. This patch tries to restore previously set features, that require changes on the device, after the recovery of a device. In case of an error, the network device's features are changed to contain only the features that are actually turned on. Signed-off-by: Hans Wippel <[email protected]> Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bc6c03f commit e830baa

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

drivers/s390/net/qeth_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ struct qeth_cmd_buffer *qeth_get_setassparms_cmd(struct qeth_card *,
999999
__u16, __u16,
10001000
enum qeth_prot_versions);
10011001
int qeth_set_features(struct net_device *, netdev_features_t);
1002+
int qeth_recover_features(struct net_device *);
10021003
netdev_features_t qeth_fix_features(struct net_device *, netdev_features_t);
10031004

10041005
/* exports for OSN */

drivers/s390/net/qeth_core_main.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6131,6 +6131,35 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on)
61316131
return rc;
61326132
}
61336133

6134+
/* try to restore device features on a device after recovery */
6135+
int qeth_recover_features(struct net_device *dev)
6136+
{
6137+
struct qeth_card *card = dev->ml_priv;
6138+
netdev_features_t recover = dev->features;
6139+
6140+
if (recover & NETIF_F_IP_CSUM) {
6141+
if (qeth_set_ipa_csum(card, 1, IPA_OUTBOUND_CHECKSUM))
6142+
recover ^= NETIF_F_IP_CSUM;
6143+
}
6144+
if (recover & NETIF_F_RXCSUM) {
6145+
if (qeth_set_ipa_csum(card, 1, IPA_INBOUND_CHECKSUM))
6146+
recover ^= NETIF_F_RXCSUM;
6147+
}
6148+
if (recover & NETIF_F_TSO) {
6149+
if (qeth_set_ipa_tso(card, 1))
6150+
recover ^= NETIF_F_TSO;
6151+
}
6152+
6153+
if (recover == dev->features)
6154+
return 0;
6155+
6156+
dev_warn(&card->gdev->dev,
6157+
"Device recovery failed to restore all offload features\n");
6158+
dev->features = recover;
6159+
return -EIO;
6160+
}
6161+
EXPORT_SYMBOL_GPL(qeth_recover_features);
6162+
61346163
int qeth_set_features(struct net_device *dev, netdev_features_t features)
61356164
{
61366165
struct qeth_card *card = dev->ml_priv;

drivers/s390/net/qeth_l2_main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,9 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
12461246
}
12471247
/* this also sets saved unicast addresses */
12481248
qeth_l2_set_rx_mode(card->dev);
1249+
rtnl_lock();
1250+
qeth_recover_features(card->dev);
1251+
rtnl_unlock();
12491252
}
12501253
/* let user_space know that device is online */
12511254
kobject_uevent(&gdev->dev.kobj, KOBJ_CHANGE);

drivers/s390/net/qeth_l3_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3269,6 +3269,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
32693269
else
32703270
dev_open(card->dev);
32713271
qeth_l3_set_multicast_list(card->dev);
3272+
qeth_recover_features(card->dev);
32723273
rtnl_unlock();
32733274
}
32743275
qeth_trace_features(card);

0 commit comments

Comments
 (0)