aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libfc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libfc')
-rw-r--r--drivers/scsi/libfc/fc_fcp.c13
-rw-r--r--drivers/scsi/libfc/fc_libfc.c8
-rw-r--r--drivers/scsi/libfc/fc_libfc.h2
-rw-r--r--drivers/scsi/libfc/fc_lport.c2
4 files changed, 11 insertions, 14 deletions
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index f607314810ac..f7357308655a 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -485,11 +485,11 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
485 485
486 if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED)) { 486 if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED)) {
487 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, 487 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents,
488 &offset, KM_SOFTIRQ0, NULL); 488 &offset, NULL);
489 } else { 489 } else {
490 crc = crc32(~0, (u8 *) fh, sizeof(*fh)); 490 crc = crc32(~0, (u8 *) fh, sizeof(*fh));
491 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, 491 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents,
492 &offset, KM_SOFTIRQ0, &crc); 492 &offset, &crc);
493 buf = fc_frame_payload_get(fp, 0); 493 buf = fc_frame_payload_get(fp, 0);
494 if (len % 4) 494 if (len % 4)
495 crc = crc32(crc, buf + len, 4 - (len % 4)); 495 crc = crc32(crc, buf + len, 4 - (len % 4));
@@ -650,10 +650,10 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq,
650 * The scatterlist item may be bigger than PAGE_SIZE, 650 * The scatterlist item may be bigger than PAGE_SIZE,
651 * but we must not cross pages inside the kmap. 651 * but we must not cross pages inside the kmap.
652 */ 652 */
653 page_addr = kmap_atomic(page, KM_SOFTIRQ0); 653 page_addr = kmap_atomic(page);
654 memcpy(data, (char *)page_addr + (off & ~PAGE_MASK), 654 memcpy(data, (char *)page_addr + (off & ~PAGE_MASK),
655 sg_bytes); 655 sg_bytes);
656 kunmap_atomic(page_addr, KM_SOFTIRQ0); 656 kunmap_atomic(page_addr);
657 data += sg_bytes; 657 data += sg_bytes;
658 } 658 }
659 offset += sg_bytes; 659 offset += sg_bytes;
@@ -1074,8 +1074,7 @@ static int fc_fcp_pkt_send(struct fc_lport *lport, struct fc_fcp_pkt *fsp)
1074 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1074 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
1075 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK; 1075 fsp->cdb_cmd.fc_flags = fsp->req_flags & ~FCP_CFL_LEN_MASK;
1076 1076
1077 int_to_scsilun(fsp->cmd->device->lun, 1077 int_to_scsilun(fsp->cmd->device->lun, &fsp->cdb_cmd.fc_lun);
1078 (struct scsi_lun *)fsp->cdb_cmd.fc_lun);
1079 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len); 1078 memcpy(fsp->cdb_cmd.fc_cdb, fsp->cmd->cmnd, fsp->cmd->cmd_len);
1080 1079
1081 spin_lock_irqsave(&si->scsi_queue_lock, flags); 1080 spin_lock_irqsave(&si->scsi_queue_lock, flags);
@@ -1257,7 +1256,7 @@ static int fc_lun_reset(struct fc_lport *lport, struct fc_fcp_pkt *fsp,
1257 1256
1258 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len); 1257 fsp->cdb_cmd.fc_dl = htonl(fsp->data_len);
1259 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET; 1258 fsp->cdb_cmd.fc_tm_flags = FCP_TMF_LUN_RESET;
1260 int_to_scsilun(lun, (struct scsi_lun *)fsp->cdb_cmd.fc_lun); 1259 int_to_scsilun(lun, &fsp->cdb_cmd.fc_lun);
1261 1260
1262 fsp->wait_for_comp = 1; 1261 fsp->wait_for_comp = 1;
1263 init_completion(&fsp->tm_done); 1262 init_completion(&fsp->tm_done);
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c
index 1bf9841ef154..8d65a51a7598 100644
--- a/drivers/scsi/libfc/fc_libfc.c
+++ b/drivers/scsi/libfc/fc_libfc.c
@@ -105,14 +105,13 @@ module_exit(libfc_exit);
105 * @sg: pointer to the pointer of the SG list. 105 * @sg: pointer to the pointer of the SG list.
106 * @nents: pointer to the remaining number of entries in the SG list. 106 * @nents: pointer to the remaining number of entries in the SG list.
107 * @offset: pointer to the current offset in the SG list. 107 * @offset: pointer to the current offset in the SG list.
108 * @km_type: dedicated page table slot type for kmap_atomic.
109 * @crc: pointer to the 32-bit crc value. 108 * @crc: pointer to the 32-bit crc value.
110 * If crc is NULL, CRC is not calculated. 109 * If crc is NULL, CRC is not calculated.
111 */ 110 */
112u32 fc_copy_buffer_to_sglist(void *buf, size_t len, 111u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
113 struct scatterlist *sg, 112 struct scatterlist *sg,
114 u32 *nents, size_t *offset, 113 u32 *nents, size_t *offset,
115 enum km_type km_type, u32 *crc) 114 u32 *crc)
116{ 115{
117 size_t remaining = len; 116 size_t remaining = len;
118 u32 copy_len = 0; 117 u32 copy_len = 0;
@@ -142,12 +141,11 @@ u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
142 off = *offset + sg->offset; 141 off = *offset + sg->offset;
143 sg_bytes = min(sg_bytes, 142 sg_bytes = min(sg_bytes,
144 (size_t)(PAGE_SIZE - (off & ~PAGE_MASK))); 143 (size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
145 page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT), 144 page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT));
146 km_type);
147 if (crc) 145 if (crc)
148 *crc = crc32(*crc, buf, sg_bytes); 146 *crc = crc32(*crc, buf, sg_bytes);
149 memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes); 147 memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes);
150 kunmap_atomic(page_addr, km_type); 148 kunmap_atomic(page_addr);
151 buf += sg_bytes; 149 buf += sg_bytes;
152 *offset += sg_bytes; 150 *offset += sg_bytes;
153 remaining -= sg_bytes; 151 remaining -= sg_bytes;
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h
index c7d071289af5..c2830cc66d6a 100644
--- a/drivers/scsi/libfc/fc_libfc.h
+++ b/drivers/scsi/libfc/fc_libfc.h
@@ -134,6 +134,6 @@ extern void fc_fc4_conf_lport_params(struct fc_lport *, enum fc_fh_type);
134u32 fc_copy_buffer_to_sglist(void *buf, size_t len, 134u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
135 struct scatterlist *sg, 135 struct scatterlist *sg,
136 u32 *nents, size_t *offset, 136 u32 *nents, size_t *offset,
137 enum km_type km_type, u32 *crc); 137 u32 *crc);
138 138
139#endif /* _FC_LIBFC_H_ */ 139#endif /* _FC_LIBFC_H_ */
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 9a0b2a9caad6..bd5d31d022d9 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1919,7 +1919,7 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
1919 1919
1920 job->reply->reply_payload_rcv_len += 1920 job->reply->reply_payload_rcv_len +=
1921 fc_copy_buffer_to_sglist(buf, len, info->sg, &info->nents, 1921 fc_copy_buffer_to_sglist(buf, len, info->sg, &info->nents,
1922 &info->offset, KM_BIO_SRC_IRQ, NULL); 1922 &info->offset, NULL);
1923 1923
1924 if (fr_eof(fp) == FC_EOF_T && 1924 if (fr_eof(fp) == FC_EOF_T &&
1925 (ntoh24(fh->fh_f_ctl) & (FC_FC_LAST_SEQ | FC_FC_END_SEQ)) == 1925 (ntoh24(fh->fh_f_ctl) & (FC_FC_LAST_SEQ | FC_FC_END_SEQ)) ==