aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorHans Wippel <hwippel@linux.vnet.ibm.com>2016-06-16 10:19:01 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-17 01:16:13 -0400
commit6c7cd7124493de05d01ea53bdbfcf35918dae4c3 (patch)
tree188c731ef8b450eb157f12c90a0b982f3b7d8095 /drivers/s390
parent9bdc441102f012b70f51e1ca73b603312fff8b5d (diff)
qeth: improve set_features error handling
The function set_features is called to configure network device features on the hardware. If errors occur, the network device features should reflect the changed hardware state and the function should return an error in order to notify the user. In case of an error, the current implementation does not necessarily save the changed hardware state in the network device features before an error is returned. This patch improves error handling by saving features, that could be changed, to the network device features before returning an error. If the device is not running, an additional check in fix_features removes features, that require hardware changes, before they are passed to set_features. Thus, the corresponding check was removed in set_features. Signed-off-by: Hans Wippel <hwippel@linux.vnet.ibm.com> Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/net/qeth_core_main.c38
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index 19a6ee01bee3..44d32000a09e 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -6125,27 +6125,38 @@ static int qeth_set_ipa_tso(struct qeth_card *card, int on)
6125int qeth_set_features(struct net_device *dev, netdev_features_t features) 6125int qeth_set_features(struct net_device *dev, netdev_features_t features)
6126{ 6126{
6127 struct qeth_card *card = dev->ml_priv; 6127 struct qeth_card *card = dev->ml_priv;
6128 netdev_features_t changed = card->dev->features ^ features; 6128 netdev_features_t changed = dev->features ^ features;
6129 int rc = 0; 6129 int rc = 0;
6130 6130
6131 QETH_DBF_TEXT(SETUP, 2, "setfeat"); 6131 QETH_DBF_TEXT(SETUP, 2, "setfeat");
6132 QETH_DBF_HEX(SETUP, 2, &features, sizeof(features)); 6132 QETH_DBF_HEX(SETUP, 2, &features, sizeof(features));
6133 6133
6134 if (card->state == CARD_STATE_DOWN || 6134 if ((changed & NETIF_F_IP_CSUM)) {
6135 card->state == CARD_STATE_RECOVER)
6136 return 0;
6137
6138 if ((changed & NETIF_F_IP_CSUM))
6139 rc = qeth_set_ipa_csum(card, 6135 rc = qeth_set_ipa_csum(card,
6140 features & NETIF_F_IP_CSUM ? 1 : 0, 6136 features & NETIF_F_IP_CSUM ? 1 : 0,
6141 IPA_OUTBOUND_CHECKSUM); 6137 IPA_OUTBOUND_CHECKSUM);
6142 if ((changed & NETIF_F_RXCSUM)) 6138 if (rc)
6143 rc |= qeth_set_ipa_csum(card, 6139 changed ^= NETIF_F_IP_CSUM;
6140 }
6141 if ((changed & NETIF_F_RXCSUM)) {
6142 rc = qeth_set_ipa_csum(card,
6144 features & NETIF_F_RXCSUM ? 1 : 0, 6143 features & NETIF_F_RXCSUM ? 1 : 0,
6145 IPA_INBOUND_CHECKSUM); 6144 IPA_INBOUND_CHECKSUM);
6146 if ((changed & NETIF_F_TSO)) 6145 if (rc)
6147 rc |= qeth_set_ipa_tso(card, features & NETIF_F_TSO ? 1 : 0); 6146 changed ^= NETIF_F_RXCSUM;
6148 return rc ? -EIO : 0; 6147 }
6148 if ((changed & NETIF_F_TSO)) {
6149 rc = qeth_set_ipa_tso(card, features & NETIF_F_TSO ? 1 : 0);
6150 if (rc)
6151 changed ^= NETIF_F_TSO;
6152 }
6153
6154 /* everything changed successfully? */
6155 if ((dev->features ^ features) == changed)
6156 return 0;
6157 /* something went wrong. save changed features and return error */
6158 dev->features ^= changed;
6159 return -EIO;
6149} 6160}
6150EXPORT_SYMBOL_GPL(qeth_set_features); 6161EXPORT_SYMBOL_GPL(qeth_set_features);
6151 6162
@@ -6164,6 +6175,11 @@ netdev_features_t qeth_fix_features(struct net_device *dev,
6164 dev_info(&card->gdev->dev, "Outbound TSO not supported on %s\n", 6175 dev_info(&card->gdev->dev, "Outbound TSO not supported on %s\n",
6165 QETH_CARD_IFNAME(card)); 6176 QETH_CARD_IFNAME(card));
6166 } 6177 }
6178 /* if the card isn't up, remove features that require hw changes */
6179 if (card->state == CARD_STATE_DOWN ||
6180 card->state == CARD_STATE_RECOVER)
6181 features = features & ~(NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
6182 NETIF_F_TSO);
6167 QETH_DBF_HEX(SETUP, 2, &features, sizeof(features)); 6183 QETH_DBF_HEX(SETUP, 2, &features, sizeof(features));
6168 return features; 6184 return features;
6169} 6185}