diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2011-05-17 23:28:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-05-18 17:27:39 -0400 |
commit | 60a34277d5da958e7f39a942e0ed1016a904f6c6 (patch) | |
tree | bd7250eef5422574edd3a2769d1e0b02e4df5250 /drivers/s390 | |
parent | f634a4e7074f66ac3dfaf2cc6786e0ec3080a2d1 (diff) |
qeth: use ndo_set_features callback for initial setup and recovery
This patch uses the ndo_set_features callback during normal device
startup or recovery to turn on hardware RX checksum. Patch was done
with much help from Michal Miroslaw, thx!!!
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/net/qeth_l3_main.c | 77 |
1 files changed, 25 insertions, 52 deletions
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index bbe7e1c058ab..fd69da3fa6b4 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c | |||
@@ -1417,63 +1417,33 @@ int qeth_l3_set_rx_csum(struct qeth_card *card, int on) | |||
1417 | int rc = 0; | 1417 | int rc = 0; |
1418 | 1418 | ||
1419 | if (on) { | 1419 | if (on) { |
1420 | if (card->state != CARD_STATE_DOWN) { | 1420 | rc = qeth_l3_send_checksum_command(card); |
1421 | if (!qeth_is_supported(card, | 1421 | if (rc) |
1422 | IPA_INBOUND_CHECKSUM)) | 1422 | return -EIO; |
1423 | return -EPERM; | 1423 | dev_info(&card->gdev->dev, |
1424 | rc = qeth_l3_send_checksum_command(card); | 1424 | "HW Checksumming (inbound) enabled\n"); |
1425 | if (rc) | ||
1426 | return -EIO; | ||
1427 | } | ||
1428 | card->dev->features |= NETIF_F_RXCSUM; | ||
1429 | } else { | 1425 | } else { |
1430 | if (card->state != CARD_STATE_DOWN) { | 1426 | rc = qeth_l3_send_simple_setassparms(card, |
1431 | rc = qeth_l3_send_simple_setassparms(card, | 1427 | IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0); |
1432 | IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0); | 1428 | if (rc) |
1433 | if (rc) | 1429 | return -EIO; |
1434 | return -EIO; | ||
1435 | } | ||
1436 | card->dev->features &= ~NETIF_F_RXCSUM; | ||
1437 | } | 1430 | } |
1438 | 1431 | ||
1439 | return rc; | 1432 | return 0; |
1440 | } | 1433 | } |
1441 | 1434 | ||
1442 | static int qeth_l3_start_ipa_checksum(struct qeth_card *card) | 1435 | static int qeth_l3_start_ipa_checksum(struct qeth_card *card) |
1443 | { | 1436 | { |
1444 | int rc = 0; | ||
1445 | |||
1446 | QETH_CARD_TEXT(card, 3, "strtcsum"); | 1437 | QETH_CARD_TEXT(card, 3, "strtcsum"); |
1447 | 1438 | ||
1448 | if (card->dev->features & NETIF_F_RXCSUM) { | 1439 | if (card->dev->features & NETIF_F_RXCSUM) { |
1449 | /* hw may have changed during offline or recovery */ | 1440 | rtnl_lock(); |
1450 | if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) { | 1441 | /* force set_features call */ |
1451 | dev_info(&card->gdev->dev, | 1442 | card->dev->features &= ~NETIF_F_RXCSUM; |
1452 | "Inbound HW Checksumming not " | 1443 | netdev_update_features(card->dev); |
1453 | "supported on %s,\ncontinuing " | 1444 | rtnl_unlock(); |
1454 | "using Inbound SW Checksumming\n", | 1445 | } |
1455 | QETH_CARD_IFNAME(card)); | ||
1456 | goto update_feature; | ||
1457 | } | ||
1458 | |||
1459 | rc = qeth_l3_send_checksum_command(card); | ||
1460 | if (!rc) | ||
1461 | dev_info(&card->gdev->dev, | ||
1462 | "HW Checksumming (inbound) enabled\n"); | ||
1463 | else | ||
1464 | goto update_feature; | ||
1465 | } else | ||
1466 | dev_info(&card->gdev->dev, | ||
1467 | "Using SW checksumming on %s.\n", | ||
1468 | QETH_CARD_IFNAME(card)); | ||
1469 | return 0; | 1446 | return 0; |
1470 | |||
1471 | update_feature: | ||
1472 | rtnl_lock(); | ||
1473 | card->dev->features &= ~NETIF_F_RXCSUM; | ||
1474 | netdev_update_features(card->dev); | ||
1475 | rtnl_unlock(); | ||
1476 | return rc; | ||
1477 | } | 1447 | } |
1478 | 1448 | ||
1479 | static int qeth_l3_start_ipa_tx_checksum(struct qeth_card *card) | 1449 | static int qeth_l3_start_ipa_tx_checksum(struct qeth_card *card) |
@@ -3196,17 +3166,20 @@ static int qeth_l3_set_features(struct net_device *dev, u32 features) | |||
3196 | { | 3166 | { |
3197 | struct qeth_card *card = dev->ml_priv; | 3167 | struct qeth_card *card = dev->ml_priv; |
3198 | u32 changed = dev->features ^ features; | 3168 | u32 changed = dev->features ^ features; |
3199 | int on; | 3169 | int err; |
3200 | 3170 | ||
3201 | if (!(changed & NETIF_F_RXCSUM)) | 3171 | if (!(changed & NETIF_F_RXCSUM)) |
3202 | return 0; | 3172 | return 0; |
3203 | 3173 | ||
3204 | if (features & NETIF_F_RXCSUM) | 3174 | if (card->state == CARD_STATE_DOWN || |
3205 | on = 1; | 3175 | card->state == CARD_STATE_RECOVER) |
3206 | else | 3176 | return 0; |
3207 | on = 0; | 3177 | |
3178 | err = qeth_l3_set_rx_csum(card, features & NETIF_F_RXCSUM); | ||
3179 | if (err) | ||
3180 | dev->features = features ^ NETIF_F_RXCSUM; | ||
3208 | 3181 | ||
3209 | return qeth_l3_set_rx_csum(card, on); | 3182 | return err; |
3210 | } | 3183 | } |
3211 | 3184 | ||
3212 | static const struct ethtool_ops qeth_l3_ethtool_ops = { | 3185 | static const struct ethtool_ops qeth_l3_ethtool_ops = { |