]> git.baikalelectronics.ru Git - kernel.git/commitdiff
s390/qeth: handle error due to unsupported transport mode
authorJulian Wiedmann <jwi@linux.ibm.com>
Wed, 18 Dec 2019 15:32:26 +0000 (16:32 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Dec 2019 05:00:27 +0000 (21:00 -0800)
Along with z/VM NICs, there's additional device types that only support
a specific transport mode (eg. external-bridged IQD).
Identify the corresponding error code, and raise a fitting error message
so that the user knows to adjust their device configuration.

On top of that also fix the subsequent error path, so that the rejected
cmd doesn't need to wait for a timeout but gets cancelled straight away.

Fixes: a5a090d6ef88 ("qeth: new qeth device driver")
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/s390/net/qeth_core_main.c
drivers/s390/net/qeth_core_mpc.h

index b9a2349e4b909b5de8a15cc728178bec9a314224..bb406eacef829aae62c959e01102cf665d48b7b0 100644 (file)
@@ -655,17 +655,17 @@ static int qeth_check_idx_response(struct qeth_card *card,
        unsigned char *buffer)
 {
        QETH_DBF_HEX(CTRL, 2, buffer, QETH_DBF_CTRL_LEN);
-       if ((buffer[2] & 0xc0) == 0xc0) {
+       if ((buffer[2] & QETH_IDX_TERMINATE_MASK) == QETH_IDX_TERMINATE) {
                QETH_DBF_MESSAGE(2, "received an IDX TERMINATE with cause code %#04x\n",
                                 buffer[4]);
                QETH_CARD_TEXT(card, 2, "ckidxres");
                QETH_CARD_TEXT(card, 2, " idxterm");
-               QETH_CARD_TEXT_(card, 2, "  rc%d", -EIO);
-               if (buffer[4] == 0xf6) {
+               QETH_CARD_TEXT_(card, 2, "rc%x", buffer[4]);
+               if (buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT ||
+                   buffer[4] == QETH_IDX_TERM_BAD_TRANSPORT_VM) {
                        dev_err(&card->gdev->dev,
-                       "The qeth device is not configured "
-                       "for the OSI layer required by z/VM\n");
-                       return -EPERM;
+                               "The device does not support the configured transport mode\n");
+                       return -EPROTONOSUPPORT;
                }
                return -EIO;
        }
@@ -742,10 +742,10 @@ static void qeth_issue_next_read_cb(struct qeth_card *card,
        case 0:
                break;
        case -EIO:
-               qeth_clear_ipacmd_list(card);
                qeth_schedule_recovery(card);
                /* fall through */
        default:
+               qeth_clear_ipacmd_list(card);
                goto out;
        }
 
index 88f4dc140751c686c958519f0655e9b8e1f02e68..6f5290fabd2cf958e68d8c975d5ddbecb54be0ff 100644 (file)
@@ -899,6 +899,11 @@ extern unsigned char IDX_ACTIVATE_WRITE[];
 #define QETH_IDX_ACT_ERR_AUTH          0x1E
 #define QETH_IDX_ACT_ERR_AUTH_USER     0x20
 
+#define QETH_IDX_TERMINATE             0xc0
+#define QETH_IDX_TERMINATE_MASK                0xc0
+#define QETH_IDX_TERM_BAD_TRANSPORT    0x41
+#define QETH_IDX_TERM_BAD_TRANSPORT_VM 0xf6
+
 #define PDU_ENCAPSULATION(buffer) \
        (buffer + *(buffer + (*(buffer + 0x0b)) + \
         *(buffer + *(buffer + 0x0b) + 0x11) + 0x07))