Commit 60a34277 authored by Frank Blaschka's avatar Frank Blaschka Committed by David S. Miller

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: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Reviewed-by: default avatarMichał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f634a4e7
...@@ -1417,63 +1417,33 @@ int qeth_l3_set_rx_csum(struct qeth_card *card, int on) ...@@ -1417,63 +1417,33 @@ int qeth_l3_set_rx_csum(struct qeth_card *card, int on)
int rc = 0; int rc = 0;
if (on) { if (on) {
if (card->state != CARD_STATE_DOWN) { rc = qeth_l3_send_checksum_command(card);
if (!qeth_is_supported(card, if (rc)
IPA_INBOUND_CHECKSUM)) return -EIO;
return -EPERM; dev_info(&card->gdev->dev,
rc = qeth_l3_send_checksum_command(card); "HW Checksumming (inbound) enabled\n");
if (rc)
return -EIO;
}
card->dev->features |= NETIF_F_RXCSUM;
} else { } else {
if (card->state != CARD_STATE_DOWN) { rc = qeth_l3_send_simple_setassparms(card,
rc = qeth_l3_send_simple_setassparms(card, IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0);
IPA_INBOUND_CHECKSUM, IPA_CMD_ASS_STOP, 0); if (rc)
if (rc) return -EIO;
return -EIO;
}
card->dev->features &= ~NETIF_F_RXCSUM;
} }
return rc; return 0;
} }
static int qeth_l3_start_ipa_checksum(struct qeth_card *card) static int qeth_l3_start_ipa_checksum(struct qeth_card *card)
{ {
int rc = 0;
QETH_CARD_TEXT(card, 3, "strtcsum"); QETH_CARD_TEXT(card, 3, "strtcsum");
if (card->dev->features & NETIF_F_RXCSUM) { if (card->dev->features & NETIF_F_RXCSUM) {
/* hw may have changed during offline or recovery */ rtnl_lock();
if (!qeth_is_supported(card, IPA_INBOUND_CHECKSUM)) { /* force set_features call */
dev_info(&card->gdev->dev, card->dev->features &= ~NETIF_F_RXCSUM;
"Inbound HW Checksumming not " netdev_update_features(card->dev);
"supported on %s,\ncontinuing " rtnl_unlock();
"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));
return 0; 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) 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,17 +3166,20 @@ static int qeth_l3_set_features(struct net_device *dev, u32 features)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
u32 changed = dev->features ^ features; u32 changed = dev->features ^ features;
int on; int err;
if (!(changed & NETIF_F_RXCSUM)) if (!(changed & NETIF_F_RXCSUM))
return 0; return 0;
if (features & NETIF_F_RXCSUM) if (card->state == CARD_STATE_DOWN ||
on = 1; card->state == CARD_STATE_RECOVER)
else return 0;
on = 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 = { static const struct ethtool_ops qeth_l3_ethtool_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment