Commit 607638fa authored by Peter Oberparleiter's avatar Peter Oberparleiter Committed by Alexander Gordeev

s390/qdio: handle deferred cc1

A deferred condition code 1 response indicates that I/O was not started
and should be retried. The current QDIO implementation handles a cc1
response as I/O error, resulting in a failed QDIO setup. This can happen
for example when a path verification request arrives at the same time
as QDIO setup I/O is started.

Fix this by retrying the QDIO setup I/O when a cc1 response is received.

Note that since

commit 2297791c ("s390/cio: dont unregister subchannel from child-drivers")
commit 5ef1dc40 ("s390/cio: fix invalid -EBUSY on ccw_device_start")

deferred cc1 responses are much more likely to occur. See the commit
message of the latter for more background information.

Fixes: 2297791c ("s390/cio: dont unregister subchannel from child-drivers")
Reviewed-by: default avatarAlexandra Winter <wintera@linux.ibm.com>
Signed-off-by: default avatarPeter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
parent 378ca2d2
...@@ -722,8 +722,8 @@ static void qdio_handle_activate_check(struct qdio_irq *irq_ptr, ...@@ -722,8 +722,8 @@ static void qdio_handle_activate_check(struct qdio_irq *irq_ptr,
lgr_info_log(); lgr_info_log();
} }
static void qdio_establish_handle_irq(struct qdio_irq *irq_ptr, int cstat, static int qdio_establish_handle_irq(struct qdio_irq *irq_ptr, int cstat,
int dstat) int dstat, int dcc)
{ {
DBF_DEV_EVENT(DBF_INFO, irq_ptr, "qest irq"); DBF_DEV_EVENT(DBF_INFO, irq_ptr, "qest irq");
...@@ -731,15 +731,18 @@ static void qdio_establish_handle_irq(struct qdio_irq *irq_ptr, int cstat, ...@@ -731,15 +731,18 @@ static void qdio_establish_handle_irq(struct qdio_irq *irq_ptr, int cstat,
goto error; goto error;
if (dstat & ~(DEV_STAT_DEV_END | DEV_STAT_CHN_END)) if (dstat & ~(DEV_STAT_DEV_END | DEV_STAT_CHN_END))
goto error; goto error;
if (dcc == 1)
return -EAGAIN;
if (!(dstat & DEV_STAT_DEV_END)) if (!(dstat & DEV_STAT_DEV_END))
goto error; goto error;
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ESTABLISHED); qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ESTABLISHED);
return; return 0;
error: error:
DBF_ERROR("%4x EQ:error", irq_ptr->schid.sch_no); DBF_ERROR("%4x EQ:error", irq_ptr->schid.sch_no);
DBF_ERROR("ds: %2x cs:%2x", dstat, cstat); DBF_ERROR("ds: %2x cs:%2x", dstat, cstat);
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR); qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
return -EIO;
} }
/* qdio interrupt handler */ /* qdio interrupt handler */
...@@ -748,7 +751,7 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, ...@@ -748,7 +751,7 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
{ {
struct qdio_irq *irq_ptr = cdev->private->qdio_data; struct qdio_irq *irq_ptr = cdev->private->qdio_data;
struct subchannel_id schid; struct subchannel_id schid;
int cstat, dstat; int cstat, dstat, rc, dcc;
if (!intparm || !irq_ptr) { if (!intparm || !irq_ptr) {
ccw_device_get_schid(cdev, &schid); ccw_device_get_schid(cdev, &schid);
...@@ -768,10 +771,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, ...@@ -768,10 +771,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
qdio_irq_check_sense(irq_ptr, irb); qdio_irq_check_sense(irq_ptr, irb);
cstat = irb->scsw.cmd.cstat; cstat = irb->scsw.cmd.cstat;
dstat = irb->scsw.cmd.dstat; dstat = irb->scsw.cmd.dstat;
dcc = scsw_cmd_is_valid_cc(&irb->scsw) ? irb->scsw.cmd.cc : 0;
rc = 0;
switch (irq_ptr->state) { switch (irq_ptr->state) {
case QDIO_IRQ_STATE_INACTIVE: case QDIO_IRQ_STATE_INACTIVE:
qdio_establish_handle_irq(irq_ptr, cstat, dstat); rc = qdio_establish_handle_irq(irq_ptr, cstat, dstat, dcc);
break; break;
case QDIO_IRQ_STATE_CLEANUP: case QDIO_IRQ_STATE_CLEANUP:
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE);
...@@ -785,12 +790,25 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, ...@@ -785,12 +790,25 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm,
if (cstat || dstat) if (cstat || dstat)
qdio_handle_activate_check(irq_ptr, intparm, cstat, qdio_handle_activate_check(irq_ptr, intparm, cstat,
dstat); dstat);
else if (dcc == 1)
rc = -EAGAIN;
break; break;
case QDIO_IRQ_STATE_STOPPED: case QDIO_IRQ_STATE_STOPPED:
break; break;
default: default:
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
} }
if (rc == -EAGAIN) {
DBF_DEV_EVENT(DBF_INFO, irq_ptr, "qint retry");
rc = ccw_device_start(cdev, irq_ptr->ccw, intparm, 0, 0);
if (!rc)
return;
DBF_ERROR("%4x RETRY ERR", irq_ptr->schid.sch_no);
DBF_ERROR("rc:%4x", rc);
qdio_set_state(irq_ptr, QDIO_IRQ_STATE_ERR);
}
wake_up(&cdev->private->wait_q); wake_up(&cdev->private->wait_q);
} }
......
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