[SCSI] lpfc 8.3.41: Fixed Receive Queue varied frame size handling
authorJames Smart <james.smart@emulex.com>
Mon, 15 Jul 2013 22:32:28 +0000 (18:32 -0400)
committerJames Bottomley <JBottomley@Parallels.com>
Fri, 23 Aug 2013 17:15:43 +0000 (13:15 -0400)
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/lpfc/lpfc_sli.c

index 437740f65d1e19026958ce5f1db533f1550fbc71..230f9eddb797267209ecb4994875f67af7b9c2c6 100644 (file)
@@ -14703,14 +14703,20 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
                first_iocbq->iocb.unsli3.rcvsli3.vpi =
                        vport->phba->vpi_ids[vport->vpi];
                /* put the first buffer into the first IOCBq */
+               tot_len = bf_get(lpfc_rcqe_length,
+                                      &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
+
                first_iocbq->context2 = &seq_dmabuf->dbuf;
                first_iocbq->context3 = NULL;
                first_iocbq->iocb.ulpBdeCount = 1;
-               first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
+               if (tot_len > LPFC_DATA_BUF_SIZE)
+                       first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
                                                        LPFC_DATA_BUF_SIZE;
+               else
+                       first_iocbq->iocb.un.cont64[0].tus.f.bdeSize = tot_len;
+
                first_iocbq->iocb.un.rcvels.remoteID = sid;
-               tot_len = bf_get(lpfc_rcqe_length,
-                                      &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
+
                first_iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;
        }
        iocbq = first_iocbq;
@@ -14726,14 +14732,17 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
                if (!iocbq->context3) {
                        iocbq->context3 = d_buf;
                        iocbq->iocb.ulpBdeCount++;
-                       pbde = (struct ulp_bde64 *)
-                                       &iocbq->iocb.unsli3.sli3Words[4];
-                       pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
-
                        /* We need to get the size out of the right CQE */
                        hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
                        len = bf_get(lpfc_rcqe_length,
                                       &hbq_buf->cq_event.cqe.rcqe_cmpl);
+                       pbde = (struct ulp_bde64 *)
+                                       &iocbq->iocb.unsli3.sli3Words[4];
+                       if (len > LPFC_DATA_BUF_SIZE)
+                               pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
+                       else
+                               pbde->tus.f.bdeSize = len;
+
                        iocbq->iocb.unsli3.rcvsli3.acc_len += len;
                        tot_len += len;
                } else {
@@ -14748,16 +14757,19 @@ lpfc_prep_seq(struct lpfc_vport *vport, struct hbq_dmabuf *seq_dmabuf)
                                lpfc_in_buf_free(vport->phba, d_buf);
                                continue;
                        }
+                       /* We need to get the size out of the right CQE */
+                       hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
+                       len = bf_get(lpfc_rcqe_length,
+                                      &hbq_buf->cq_event.cqe.rcqe_cmpl);
                        iocbq->context2 = d_buf;
                        iocbq->context3 = NULL;
                        iocbq->iocb.ulpBdeCount = 1;
-                       iocbq->iocb.un.cont64[0].tus.f.bdeSize =
+                       if (len > LPFC_DATA_BUF_SIZE)
+                               iocbq->iocb.un.cont64[0].tus.f.bdeSize =
                                                        LPFC_DATA_BUF_SIZE;
+                       else
+                               iocbq->iocb.un.cont64[0].tus.f.bdeSize = len;
 
-                       /* We need to get the size out of the right CQE */
-                       hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
-                       len = bf_get(lpfc_rcqe_length,
-                                      &hbq_buf->cq_event.cqe.rcqe_cmpl);
                        tot_len += len;
                        iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;