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.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index fd88777df28b..491845f18710 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -113,7 +113,7 @@ iscsi_hdr_digest(struct iscsi_conn *conn, struct iscsi_buf *buf,
113 struct iscsi_tcp_conn *tcp_conn = conn->dd_data; 113 struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
114 114
115 crypto_hash_digest(&tcp_conn->tx_hash, &buf->sg, buf->sg.length, crc); 115 crypto_hash_digest(&tcp_conn->tx_hash, &buf->sg, buf->sg.length, crc);
116 buf->sg.length += sizeof(u32); 116 buf->sg.length += ISCSI_DIGEST_SIZE;
117} 117}
118 118
119/* 119/*
@@ -220,6 +220,7 @@ static inline int
220iscsi_tcp_chunk_done(struct iscsi_chunk *chunk) 220iscsi_tcp_chunk_done(struct iscsi_chunk *chunk)
221{ 221{
222 static unsigned char padbuf[ISCSI_PAD_LEN]; 222 static unsigned char padbuf[ISCSI_PAD_LEN];
223 unsigned int pad;
223 224
224 if (chunk->copied < chunk->size) { 225 if (chunk->copied < chunk->size) {
225 iscsi_tcp_chunk_map(chunk); 226 iscsi_tcp_chunk_map(chunk);
@@ -243,10 +244,8 @@ iscsi_tcp_chunk_done(struct iscsi_chunk *chunk)
243 } 244 }
244 245
245 /* Do we need to handle padding? */ 246 /* Do we need to handle padding? */
246 if (chunk->total_copied & (ISCSI_PAD_LEN-1)) { 247 pad = iscsi_padding(chunk->total_copied);
247 unsigned int pad; 248 if (pad != 0) {
248
249 pad = ISCSI_PAD_LEN - (chunk->total_copied & (ISCSI_PAD_LEN-1));
250 debug_tcp("consume %d pad bytes\n", pad); 249 debug_tcp("consume %d pad bytes\n", pad);
251 chunk->total_size += pad; 250 chunk->total_size += pad;
252 chunk->size = pad; 251 chunk->size = pad;
@@ -1385,11 +1384,11 @@ iscsi_send_cmd_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
1385 } 1384 }
1386 1385
1387 iscsi_buf_init_iov(&tcp_ctask->headbuf, (char*)ctask->hdr, 1386 iscsi_buf_init_iov(&tcp_ctask->headbuf, (char*)ctask->hdr,
1388 sizeof(struct iscsi_hdr)); 1387 ctask->hdr_len);
1389 1388
1390 if (conn->hdrdgst_en) 1389 if (conn->hdrdgst_en)
1391 iscsi_hdr_digest(conn, &tcp_ctask->headbuf, 1390 iscsi_hdr_digest(conn, &tcp_ctask->headbuf,
1392 (u8*)tcp_ctask->hdrext); 1391 iscsi_next_hdr(ctask));
1393 tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT; 1392 tcp_ctask->xmstate &= ~XMSTATE_CMD_HDR_INIT;
1394 tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT; 1393 tcp_ctask->xmstate |= XMSTATE_CMD_HDR_XMIT;
1395 } 1394 }
@@ -2176,7 +2175,8 @@ iscsi_tcp_session_create(struct iscsi_transport *iscsit,
2176 struct iscsi_cmd_task *ctask = session->cmds[cmd_i]; 2175 struct iscsi_cmd_task *ctask = session->cmds[cmd_i];
2177 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data; 2176 struct iscsi_tcp_cmd_task *tcp_ctask = ctask->dd_data;
2178 2177
2179 ctask->hdr = &tcp_ctask->hdr; 2178 ctask->hdr = &tcp_ctask->hdr.cmd_hdr;
2179 ctask->hdr_max = sizeof(tcp_ctask->hdr) - ISCSI_DIGEST_SIZE;
2180 } 2180 }
2181 2181
2182 for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++) { 2182 for (cmd_i = 0; cmd_i < session->mgmtpool_max; cmd_i++) {