Commit 39423440 authored by Ursula Braun's avatar Ursula Braun Committed by David S. Miller

qeth: postpone open till recovery is finished

The open function of qeth is not executed if the qeth device is in
state DOWN or HARDSETUP. A recovery switches from state SOFTSETUP to
HARDSETUP to DOWN to HARDSETUP and back to SOFTSETUP. If open and
recover are running concurrently, open fails if it hits the states
HARDSETUP or DOWN. This patch inserts waiting for recovery finish
in the qeth open functions to enable successful qeth device opening
in spite of a running recovery.
Signed-off-by: default avatarUrsula Braun <ursula.braun@de.ibm.com>
Signed-off-by: default avatarFrank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0f73f2c5
...@@ -831,12 +831,14 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -831,12 +831,14 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
static int qeth_l2_open(struct net_device *dev) static int __qeth_l2_open(struct net_device *dev)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
int rc = 0; int rc = 0;
QETH_CARD_TEXT(card, 4, "qethopen"); QETH_CARD_TEXT(card, 4, "qethopen");
if (card->state == CARD_STATE_UP)
return rc;
if (card->state != CARD_STATE_SOFTSETUP) if (card->state != CARD_STATE_SOFTSETUP)
return -ENODEV; return -ENODEV;
...@@ -857,6 +859,18 @@ static int qeth_l2_open(struct net_device *dev) ...@@ -857,6 +859,18 @@ static int qeth_l2_open(struct net_device *dev)
return rc; return rc;
} }
static int qeth_l2_open(struct net_device *dev)
{
struct qeth_card *card = dev->ml_priv;
QETH_CARD_TEXT(card, 5, "qethope_");
if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) {
QETH_CARD_TEXT(card, 3, "openREC");
return -ERESTARTSYS;
}
return __qeth_l2_open(dev);
}
static int qeth_l2_stop(struct net_device *dev) static int qeth_l2_stop(struct net_device *dev)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
...@@ -1046,7 +1060,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -1046,7 +1060,7 @@ static int __qeth_l2_set_online(struct ccwgroup_device *gdev, int recovery_mode)
if (recover_flag == CARD_STATE_RECOVER) { if (recover_flag == CARD_STATE_RECOVER) {
if (recovery_mode && if (recovery_mode &&
card->info.type != QETH_CARD_TYPE_OSN) { card->info.type != QETH_CARD_TYPE_OSN) {
qeth_l2_open(card->dev); __qeth_l2_open(card->dev);
} else { } else {
rtnl_lock(); rtnl_lock();
dev_open(card->dev); dev_open(card->dev);
......
...@@ -3240,12 +3240,14 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -3240,12 +3240,14 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
static int qeth_l3_open(struct net_device *dev) static int __qeth_l3_open(struct net_device *dev)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
int rc = 0; int rc = 0;
QETH_CARD_TEXT(card, 4, "qethopen"); QETH_CARD_TEXT(card, 4, "qethopen");
if (card->state == CARD_STATE_UP)
return rc;
if (card->state != CARD_STATE_SOFTSETUP) if (card->state != CARD_STATE_SOFTSETUP)
return -ENODEV; return -ENODEV;
card->data.state = CH_STATE_UP; card->data.state = CH_STATE_UP;
...@@ -3260,6 +3262,18 @@ static int qeth_l3_open(struct net_device *dev) ...@@ -3260,6 +3262,18 @@ static int qeth_l3_open(struct net_device *dev)
return rc; return rc;
} }
static int qeth_l3_open(struct net_device *dev)
{
struct qeth_card *card = dev->ml_priv;
QETH_CARD_TEXT(card, 5, "qethope_");
if (qeth_wait_for_threads(card, QETH_RECOVER_THREAD)) {
QETH_CARD_TEXT(card, 3, "openREC");
return -ERESTARTSYS;
}
return __qeth_l3_open(dev);
}
static int qeth_l3_stop(struct net_device *dev) static int qeth_l3_stop(struct net_device *dev)
{ {
struct qeth_card *card = dev->ml_priv; struct qeth_card *card = dev->ml_priv;
...@@ -3564,7 +3578,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode) ...@@ -3564,7 +3578,7 @@ static int __qeth_l3_set_online(struct ccwgroup_device *gdev, int recovery_mode)
netif_carrier_off(card->dev); netif_carrier_off(card->dev);
if (recover_flag == CARD_STATE_RECOVER) { if (recover_flag == CARD_STATE_RECOVER) {
if (recovery_mode) if (recovery_mode)
qeth_l3_open(card->dev); __qeth_l3_open(card->dev);
else { else {
rtnl_lock(); rtnl_lock();
dev_open(card->dev); dev_open(card->dev);
......
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