summaryrefslogtreecommitdiff
path: root/drivers/s390
diff options
context:
space:
mode:
authorFrank Blaschka <frank.blaschka@de.ibm.com>2011-05-18 07:28:35 +0400
committerDavid S. Miller <davem@davemloft.net>2011-05-19 01:27:39 +0400
commit60a34277d5da958e7f39a942e0ed1016a904f6c6 (patch)
treebd7250eef5422574edd3a2769d1e0b02e4df5250 /drivers/s390
parentf634a4e7074f66ac3dfaf2cc6786e0ec3080a2d1 (diff)
downloadlinux-60a34277d5da958e7f39a942e0ed1016a904f6c6.tar.xz
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.c77
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)
int rc = 0;
if (on) {
- if (card->state != CARD_STATE_DOWN) {
- if (!qeth_is_supported(card,
- IPA_INBOUND_CHECKSUM))
- return -EPERM;
- rc = qeth_l3_send_checksum_command(card);
- if (rc)
- return -EIO;
- }
- card->dev->features |= NETIF_F_RXCSUM;
+ rc = qeth_l3_send_checksum_command(card);
+ if (rc)
+ return -EIO;
+ dev_info(&card->gdev->dev,
+ "HW Checksumming (inbound) enabled\n");
} else {
- if (card->state != CARD_STATE_DOWN) {
- rc = qeth_l3_send_simple_setassparms(card,
- IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
- if (rc)
- return -EIO;
- }
- card->dev->features &= ~NETIF_F_RXCSUM;
+ rc = qeth_l3_send_simple_setassparms(card,
+ IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
+ if (rc)
+ return -EIO;
}
- return rc;
+ return 0;
}
static int qeth_l3_start_ipa_checksum(struct qeth_card *card)
{
- int rc = 0;
-
QETH_CARD_TEXT(card, 3, "strtcsum");
if (card->dev->features & NETIF_F_RXCSUM) {
- /* hw may have changed during offline or recovery */
- if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) {
- dev_info(&card->gdev->dev,
- "Inbound HW Checksumming not "
- "supported on %s,\ncontinuing "
- "using Inbound SW Checksumming\n",
- QETH_CARD_IFNAME(card));
- goto update_feature;
- }
-
- rc = qeth_l3_send_checksum_command(card);
- if (!rc)
- dev_info(&card->gdev->dev,
- "HW Checksumming (inbound) enabled\n");
- else
- goto update_feature;
- } else
- dev_info(&card->gdev->dev,
- "Using SW checksumming on %s.\n",
- QETH_CARD_IFNAME(card));
+ rtnl_lock();
+ /* force set_features call */
+ card->dev->features &= ~NETIF_F_RXCSUM;
+ netdev_update_features(card->dev);
+ rtnl_unlock();
+ }
return 0;
-
-update_feature:
- rtnl_lock();
- card->dev->features &= ~NETIF_F_RXCSUM;
- netdev_update_features(card->dev);
- rtnl_unlock();
- return rc;
}
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)
{
struct qeth_card *card = dev->ml_priv;
u32 changed = dev->features ^ features;
- int on;
+ int err;
if (!(changed & NETIF_F_RXCSUM))
return 0;
- if (features & NETIF_F_RXCSUM)
- on = 1;
- else
- on = 0;
+ if (card->state == CARD_STATE_DOWN ||
+ card->state == CARD_STATE_RECOVER)
+ return 0;
+
+ err = qeth_l3_set_rx_csum(card, features & NETIF_F_RXCSUM);
+ if (err)
+ dev->features = features ^ NETIF_F_RXCSUM;
- return qeth_l3_set_rx_csum(card, on);
+ return err;
}
static const struct ethtool_ops qeth_l3_ethtool_ops = {