Commit 91cc98f5 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: remove duplicated carrier state tracking

The netdevice is always available, apply any carrier state changes to it
without caching them.
On a STARTLAN event (ie. carrier-up), defer updating the state to
qeth_core_hardsetup_card() in the subsequent recovery action.

Also remove the carrier-state checks from the xmit routines. Stopping
transmission on carrier-down is the responsibility of upper-level code
(eg see dev_direct_xmit()).
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d782d80f
...@@ -763,7 +763,6 @@ struct qeth_switch_info { ...@@ -763,7 +763,6 @@ struct qeth_switch_info {
struct qeth_card { struct qeth_card {
struct list_head list; struct list_head list;
enum qeth_card_states state; enum qeth_card_states state;
int lan_online;
spinlock_t lock; spinlock_t lock;
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
struct qeth_channel read; struct qeth_channel read;
......
...@@ -652,16 +652,13 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card, ...@@ -652,16 +652,13 @@ static struct qeth_ipa_cmd *qeth_check_ipa_data(struct qeth_card *card,
"The link for interface %s on CHPID 0x%X failed\n", "The link for interface %s on CHPID 0x%X failed\n",
QETH_CARD_IFNAME(card), card->info.chpid); QETH_CARD_IFNAME(card), card->info.chpid);
qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card); qeth_issue_ipa_msg(cmd, cmd->hdr.return_code, card);
}
card->lan_online = 0;
netif_carrier_off(card->dev); netif_carrier_off(card->dev);
}
return NULL; return NULL;
case IPA_CMD_STARTLAN: case IPA_CMD_STARTLAN:
dev_info(&card->gdev->dev, dev_info(&card->gdev->dev,
"The link for %s on CHPID 0x%X has been restored\n", "The link for %s on CHPID 0x%X has been restored\n",
QETH_CARD_IFNAME(card), card->info.chpid); QETH_CARD_IFNAME(card), card->info.chpid);
netif_carrier_on(card->dev);
card->lan_online = 1;
if (card->info.hwtrap) if (card->info.hwtrap)
card->info.hwtrap = 2; card->info.hwtrap = 2;
qeth_schedule_recovery(card); qeth_schedule_recovery(card);
...@@ -5133,13 +5130,14 @@ int qeth_core_hardsetup_card(struct qeth_card *card) ...@@ -5133,13 +5130,14 @@ int qeth_core_hardsetup_card(struct qeth_card *card)
if (rc == IPA_RC_LAN_OFFLINE) { if (rc == IPA_RC_LAN_OFFLINE) {
dev_warn(&card->gdev->dev, dev_warn(&card->gdev->dev,
"The LAN is offline\n"); "The LAN is offline\n");
card->lan_online = 0; netif_carrier_off(card->dev);
} else { } else {
rc = -ENODEV; rc = -ENODEV;
goto out; goto out;
} }
} else } else {
card->lan_online = 1; netif_carrier_on(card->dev);
}
card->options.ipa4.supported_funcs = 0; card->options.ipa4.supported_funcs = 0;
card->options.ipa6.supported_funcs = 0; card->options.ipa6.supported_funcs = 0;
......
...@@ -31,10 +31,9 @@ static ssize_t qeth_dev_state_show(struct device *dev, ...@@ -31,10 +31,9 @@ static ssize_t qeth_dev_state_show(struct device *dev,
case CARD_STATE_SOFTSETUP: case CARD_STATE_SOFTSETUP:
return sprintf(buf, "SOFTSETUP\n"); return sprintf(buf, "SOFTSETUP\n");
case CARD_STATE_UP: case CARD_STATE_UP:
if (card->lan_online) return sprintf(buf, "UP (LAN %s)\n",
return sprintf(buf, "UP (LAN ONLINE)\n"); netif_carrier_ok(card->dev) ? "ONLINE" :
else "OFFLINE");
return sprintf(buf, "UP (LAN OFFLINE)\n");
case CARD_STATE_RECOVER: case CARD_STATE_RECOVER:
return sprintf(buf, "RECOVER\n"); return sprintf(buf, "RECOVER\n");
default: default:
......
...@@ -694,7 +694,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb, ...@@ -694,7 +694,7 @@ static netdev_tx_t qeth_l2_hard_start_xmit(struct sk_buff *skb,
int tx_bytes = skb->len; int tx_bytes = skb->len;
int rc; int rc;
if ((card->state != CARD_STATE_UP) || !card->lan_online) { if (card->state != CARD_STATE_UP) {
card->stats.tx_carrier_errors++; card->stats.tx_carrier_errors++;
goto tx_drop; goto tx_drop;
} }
...@@ -997,10 +997,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -997,10 +997,6 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
goto out_remove; goto out_remove;
} }
card->state = CARD_STATE_SOFTSETUP; card->state = CARD_STATE_SOFTSETUP;
if (card->lan_online)
netif_carrier_on(card->dev);
else
netif_carrier_off(card->dev);
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
......
...@@ -2233,7 +2233,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb, ...@@ -2233,7 +2233,7 @@ static netdev_tx_t qeth_l3_hard_start_xmit(struct sk_buff *skb,
goto tx_drop; goto tx_drop;
} }
if (card->state != CARD_STATE_UP || !card->lan_online) { if (card->state != CARD_STATE_UP) {
card->stats.tx_carrier_errors++; card->stats.tx_carrier_errors++;
goto tx_drop; goto tx_drop;
} }
...@@ -2573,10 +2573,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -2573,10 +2573,6 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
qeth_set_allowed_threads(card, 0xffffffff, 0); qeth_set_allowed_threads(card, 0xffffffff, 0);
qeth_l3_recover_ip(card); qeth_l3_recover_ip(card);
if (card->lan_online)
netif_carrier_on(card->dev);
else
netif_carrier_off(card->dev);
qeth_enable_hw_features(card->dev); qeth_enable_hw_features(card->dev);
if (recover_flag == CARD_STATE_RECOVER) { if (recover_flag == CARD_STATE_RECOVER) {
......
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