scsi: qedf: Correct xid range overlap between offloaded requests and libfc requests
authorChad Dupuis <cdupuis@marvell.com>
Tue, 26 Mar 2019 07:38:34 +0000 (00:38 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 28 Mar 2019 01:54:51 +0000 (21:54 -0400)
There is currently an overlap where exchange IDs between what is used for
offloaded commands and by libfc for ELS commands.  Correct this so that
exchange ID range is:

Offloaded requests: 0 to 0xfff
libfc requests: 0x1000 to 0xfffe

Signed-off-by: Chad Dupuis <cdupuis@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qedf/qedf.h
drivers/scsi/qedf/qedf_io.c
drivers/scsi/qedf/qedf_main.c

index 2c78d8fb9122be63659dbdd5c2a7f3a174c8bb9d..8e75c21b18b95cf18d0e84dc09c1cb20e8c5317f 100644 (file)
@@ -35,9 +35,6 @@
 #define QEDF_DESCR "QLogic FCoE Offload Driver"
 #define QEDF_MODULE_NAME "qedf"
 
-#define QEDF_MIN_XID           0
-#define QEDF_MAX_SCSI_XID      (NUM_TASKS_PER_CONNECTION - 1)
-#define QEDF_MAX_ELS_XID       4095
 #define QEDF_FLOGI_RETRY_CNT   3
 #define QEDF_RPORT_RETRY_CNT   255
 #define QEDF_MAX_SESSIONS      1024
@@ -295,8 +292,6 @@ struct qedf_ctx {
 #define QEDF_DCBX_PENDING      0
 #define QEDF_DCBX_DONE         1
        atomic_t dcbx;
-       uint16_t max_scsi_xid;
-       uint16_t max_els_xid;
 #define QEDF_NULL_VLAN_ID      -1
 #define QEDF_FALLBACK_VLAN     1002
 #define QEDF_DEFAULT_PRIO      3
index 6ca583bdde23ca4b7603da6901822e252e133d21..7c2ecf35036bfb42b2a7fa020e52137775c39544 100644 (file)
@@ -103,7 +103,7 @@ void qedf_cmd_mgr_free(struct qedf_cmd_mgr *cmgr)
        struct io_bdt *bdt_info;
        struct qedf_ctx *qedf = cmgr->qedf;
        size_t bd_tbl_sz;
-       u16 min_xid = QEDF_MIN_XID;
+       u16 min_xid = 0;
        u16 max_xid = (FCOE_PARAMS_NUM_TASKS - 1);
        int num_ios;
        int i;
@@ -169,7 +169,7 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf)
        u16 xid;
        int i;
        int num_ios;
-       u16 min_xid = QEDF_MIN_XID;
+       u16 min_xid = 0;
        u16 max_xid = (FCOE_PARAMS_NUM_TASKS - 1);
 
        /* Make sure num_queues is already set before calling this function */
@@ -201,7 +201,7 @@ struct qedf_cmd_mgr *qedf_cmd_mgr_alloc(struct qedf_ctx *qedf)
        /*
         * Initialize I/O request fields.
         */
-       xid = QEDF_MIN_XID;
+       xid = 0;
 
        for (i = 0; i < num_ios; i++) {
                io_req = &cmgr->cmds[i];
index 9f9431a4cc0e32acbca56df1aac5ed1a022b0321..2de7fd93478c35b5b047f3845d792ddd76f89ef6 100644 (file)
@@ -1501,8 +1501,8 @@ static int qedf_lport_setup(struct qedf_ctx *qedf)
        fcoe_libfc_config(lport, &qedf->ctlr, &qedf_lport_template, 0);
 
        /* Allocate the exchange manager */
-       fc_exch_mgr_alloc(lport, FC_CLASS_3, qedf->max_scsi_xid + 1,
-           qedf->max_els_xid, NULL);
+       fc_exch_mgr_alloc(lport, FC_CLASS_3, FCOE_PARAMS_NUM_TASKS,
+                         0xfffe, NULL);
 
        if (fc_lport_init_stats(lport))
                return -ENOMEM;
@@ -1625,7 +1625,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled)
        vport_qedf->wwpn = vn_port->wwpn;
 
        vn_port->host->transportt = qedf_fc_vport_transport_template;
-       vn_port->host->can_queue = QEDF_MAX_ELS_XID;
+       vn_port->host->can_queue = FCOE_PARAMS_NUM_TASKS;
        vn_port->host->max_lun = qedf_max_lun;
        vn_port->host->sg_tablesize = QEDF_MAX_BDS_PER_CMD;
        vn_port->host->max_cmd_len = QEDF_MAX_CDB_LEN;
@@ -3181,11 +3181,6 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
        sprintf(host_buf, "host_%d", host->host_no);
        qed_ops->common->set_name(qedf->cdev, host_buf);
 
-
-       /* Set xid max values */
-       qedf->max_scsi_xid = QEDF_MAX_SCSI_XID;
-       qedf->max_els_xid = QEDF_MAX_ELS_XID;
-
        /* Allocate cmd mgr */
        qedf->cmd_mgr = qedf_cmd_mgr_alloc(qedf);
        if (!qedf->cmd_mgr) {
@@ -3196,9 +3191,9 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 
        if (mode != QEDF_MODE_RECOVERY) {
                host->transportt = qedf_fc_transport_template;
-               host->can_queue = QEDF_MAX_ELS_XID;
                host->max_lun = qedf_max_lun;
                host->max_cmd_len = QEDF_MAX_CDB_LEN;
+               host->can_queue = FCOE_PARAMS_NUM_TASKS;
                rc = scsi_add_host(host, &pdev->dev);
                if (rc)
                        goto err6;