aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index d94038eafb9b..7c2ed7bb7e94 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -71,14 +71,6 @@ module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO);
71static kmem_cache_t *taskcache; 71static kmem_cache_t *taskcache;
72 72
73static inline void 73static inline void
74iscsi_buf_init_virt(struct iscsi_buf *ibuf, char *vbuf, int size)
75{
76 sg_init_one(&ibuf->sg, (u8 *)vbuf, size);
77 ibuf->sent = 0;
78 ibuf->use_sendmsg = 0;
79}
80
81static inline void
82iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) 74iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size)
83{ 75{
84 ibuf->sg.page = virt_to_page(vbuf); 76 ibuf->sg.page = virt_to_page(vbuf);
@@ -324,7 +316,7 @@ iscsi_solicit_data_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
324 316
325 r2t->sent = 0; 317 r2t->sent = 0;
326 318
327 iscsi_buf_init_virt(&r2t->headbuf, (char*)hdr, 319 iscsi_buf_init_iov(&r2t->headbuf, (char*)hdr,
328 sizeof(struct iscsi_hdr)); 320 sizeof(struct iscsi_hdr));
329 321
330 r2t->dtask = dtask; 322 r2t->dtask = dtask;
@@ -1208,7 +1200,7 @@ iscsi_digest_final_send(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1208 if (final) 1200 if (final)
1209 crypto_digest_final(tcp_conn->data_tx_tfm, (u8*)digest); 1201 crypto_digest_final(tcp_conn->data_tx_tfm, (u8*)digest);
1210 1202
1211 iscsi_buf_init_virt(buf, (char*)digest, 4); 1203 iscsi_buf_init_iov(buf, (char*)digest, 4);
1212 rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent); 1204 rc = iscsi_sendpage(conn, buf, &tcp_ctask->digest_count, &sent);
1213 if (rc) { 1205 if (rc) {
1214 tcp_ctask->datadigest = *digest; 1206 tcp_ctask->datadigest = *digest;
@@ -1265,7 +1257,7 @@ iscsi_solicit_data_cont(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
1265 } 1257 }
1266 conn->dataout_pdus_cnt++; 1258 conn->dataout_pdus_cnt++;
1267 1259
1268 iscsi_buf_init_virt(&r2t->headbuf, (char*)hdr, 1260 iscsi_buf_init_iov(&r2t->headbuf, (char*)hdr,
1269 sizeof(struct iscsi_hdr)); 1261 sizeof(struct iscsi_hdr));
1270 1262
1271 r2t->dtask = dtask; 1263 r2t->dtask = dtask;
@@ -1294,7 +1286,7 @@ iscsi_unsolicit_data_init(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1294 1286
1295 iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr, 1287 iscsi_prep_unsolicit_data_pdu(ctask, &dtask->hdr,
1296 tcp_ctask->r2t_data_count); 1288 tcp_ctask->r2t_data_count);
1297 iscsi_buf_init_virt(&tcp_ctask->headbuf, (char*)&dtask->hdr, 1289 iscsi_buf_init_iov(&tcp_ctask->headbuf, (char*)&dtask->hdr,
1298 sizeof(struct iscsi_hdr)); 1290 sizeof(struct iscsi_hdr));
1299 1291
1300 list_add(&dtask->item, &tcp_ctask->dataqueue); 1292 list_add(&dtask->item, &tcp_ctask->dataqueue);
@@ -1361,7 +1353,7 @@ iscsi_tcp_cmd_init(struct iscsi_cmd_task *ctask)
1361 } else 1353 } else
1362 tcp_ctask->xmstate = XMSTATE_R_HDR; 1354 tcp_ctask->xmstate = XMSTATE_R_HDR;
1363 1355
1364 iscsi_buf_init_virt(&tcp_ctask->headbuf, (char*)ctask->hdr, 1356 iscsi_buf_init_iov(&tcp_ctask->headbuf, (char*)ctask->hdr,
1365 sizeof(struct iscsi_hdr)); 1357 sizeof(struct iscsi_hdr));
1366} 1358}
1367 1359
@@ -1758,7 +1750,7 @@ handle_xmstate_w_pad(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1758 int sent; 1750 int sent;
1759 1751
1760 tcp_ctask->xmstate &= ~XMSTATE_W_PAD; 1752 tcp_ctask->xmstate &= ~XMSTATE_W_PAD;
1761 iscsi_buf_init_virt(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad, 1753 iscsi_buf_init_iov(&tcp_ctask->sendbuf, (char*)&tcp_ctask->pad,
1762 tcp_ctask->pad_count); 1754 tcp_ctask->pad_count);
1763 if (iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count, 1755 if (iscsi_sendpage(conn, &tcp_ctask->sendbuf, &tcp_ctask->pad_count,
1764 &sent)) { 1756 &sent)) {
@@ -2078,8 +2070,8 @@ iscsi_tcp_mgmt_init(struct iscsi_conn *conn, struct iscsi_mgmt_task *mtask,
2078{ 2070{
2079 struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data; 2071 struct iscsi_tcp_mgmt_task *tcp_mtask = mtask->dd_data;
2080 2072
2081 iscsi_buf_init_virt(&tcp_mtask->headbuf, (char*)mtask->hdr, 2073 iscsi_buf_init_iov(&tcp_mtask->headbuf, (char*)mtask->hdr,
2082 sizeof(struct iscsi_hdr)); 2074 sizeof(struct iscsi_hdr));
2083 tcp_mtask->xmstate = XMSTATE_IMM_HDR; 2075 tcp_mtask->xmstate = XMSTATE_IMM_HDR;
2084 2076
2085 if (mtask->data_count) 2077 if (mtask->data_count)