From: Mike Christie <michaelc@cs.wisc.edu>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH 2/9] iscsi: preemt fix and cleanup
Date: Mon, 12 Sep 2005 21:01:32 -0500 [thread overview]
Message-ID: <1126576892.29245.22.camel@max> (raw)
from zhenyu.z.wang@intel.com
Delay the head digest update until xmit time, like data digest update.
[To make things cleaner and avoid prempt bug]
Signed-off-by: Alex Aizman <itn780@yahoo.com>
Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -129,14 +129,11 @@ iscsi_buf_left(struct iscsi_buf *ibuf)
}
static inline void
-iscsi_buf_init_hdr(struct iscsi_conn *conn, struct iscsi_buf *ibuf,
- char *vbuf, u8 *crc)
+iscsi_hdr_digest(struct iscsi_conn *conn, struct iscsi_buf *buf,
+ u8* crc)
{
- iscsi_buf_init_virt(ibuf, vbuf, sizeof(struct iscsi_hdr));
- if (conn->hdrdgst_en) {
- crypto_digest_digest(conn->tx_tfm, &ibuf->sg, 1, crc);
- ibuf->sg.length += sizeof(uint32_t);
- }
+ crypto_digest_digest(conn->tx_tfm, &buf->sg, 1, crc);
+ buf->sg.length += sizeof(uint32_t);
}
static void
@@ -427,8 +424,8 @@ iscsi_solicit_data_init(struct iscsi_con
r2t->sent = 0;
- iscsi_buf_init_hdr(conn, &r2t->headbuf, (char*)hdr,
- (u8 *)dtask->hdrext);
+ iscsi_buf_init_virt(&r2t->headbuf, (char*)hdr,
+ sizeof(struct iscsi_hdr));
r2t->dtask = dtask;
@@ -1494,8 +1491,8 @@ iscsi_solicit_data_cont(struct iscsi_con
}
conn->dataout_pdus_cnt++;
- iscsi_buf_init_hdr(conn, &r2t->headbuf, (char*)hdr,
- (u8 *)dtask->hdrext);
+ iscsi_buf_init_virt(&r2t->headbuf, (char*)hdr,
+ sizeof(struct iscsi_hdr));
r2t->dtask = dtask;
@@ -1541,8 +1538,8 @@ iscsi_unsolicit_data_init(struct iscsi_c
hdr->flags = ISCSI_FLAG_CMD_FINAL;
}
- iscsi_buf_init_hdr(conn, &ctask->headbuf, (char*)hdr,
- (u8 *)dtask->hdrext);
+ iscsi_buf_init_virt(&ctask->headbuf, (char*)hdr,
+ sizeof(struct iscsi_hdr));
list_add(&dtask->item, &ctask->dataqueue);
@@ -1662,8 +1659,8 @@ iscsi_cmd_init(struct iscsi_conn *conn,
zero_data(ctask->hdr.dlength);
}
- iscsi_buf_init_hdr(conn, &ctask->headbuf, (char*)&ctask->hdr,
- (u8 *)ctask->hdrext);
+ iscsi_buf_init_virt(&ctask->headbuf, (char*)&ctask->hdr,
+ sizeof(struct iscsi_hdr));
conn->scsicmd_pdus_cnt++;
}
@@ -1692,6 +1689,11 @@ iscsi_mtask_xmit(struct iscsi_conn *conn
mtask->xmstate &= ~XMSTATE_IMM_HDR;
if (mtask->data_count)
mtask->xmstate |= XMSTATE_IMM_DATA;
+ if (conn->c_stage != ISCSI_CONN_INITIAL_STAGE &&
+ conn->stop_stage != STOP_CONN_RECOVER &&
+ conn->hdrdgst_en)
+ iscsi_hdr_digest(conn, &mtask->headbuf,
+ (u8*)mtask->hdrext);
if (iscsi_sendhdr(conn, &mtask->headbuf, mtask->data_count)) {
mtask->xmstate |= XMSTATE_IMM_HDR;
if (mtask->data_count)
@@ -1723,6 +1725,8 @@ static inline int
handle_xmstate_r_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
{
ctask->xmstate &= ~XMSTATE_R_HDR;
+ if (conn->hdrdgst_en)
+ iscsi_hdr_digest(conn, &ctask->headbuf, (u8*)ctask->hdrext);
if (!iscsi_sendhdr(conn, &ctask->headbuf, 0)) {
BUG_ON(ctask->xmstate != XMSTATE_IDLE);
return 0; /* wait for Data-In */
@@ -1735,6 +1739,8 @@ static inline int
handle_xmstate_w_hdr(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask)
{
ctask->xmstate &= ~XMSTATE_W_HDR;
+ if (conn->hdrdgst_en)
+ iscsi_hdr_digest(conn, &ctask->headbuf, (u8*)ctask->hdrext);
if (iscsi_sendhdr(conn, &ctask->headbuf, ctask->imm_count)) {
ctask->xmstate |= XMSTATE_W_HDR;
return -EAGAIN;
@@ -1813,7 +1819,9 @@ handle_xmstate_uns_hdr(struct iscsi_conn
iscsi_unsolicit_data_init(conn, ctask);
BUG_ON(!ctask->dtask);
dtask = ctask->dtask;
-
+ if (conn->hdrdgst_en)
+ iscsi_hdr_digest(conn, &ctask->headbuf,
+ (u8*)dtask->hdrext);
ctask->xmstate &= ~XMSTATE_UNS_INIT;
}
if (iscsi_sendhdr(conn, &ctask->headbuf, ctask->data_count)) {
@@ -2118,7 +2126,9 @@ unsolicit_head_again:
sizeof(void*));
solicit_head_again:
r2t = ctask->r2t;
-
+ if (conn->hdrdgst_en)
+ iscsi_hdr_digest(conn, &r2t->headbuf,
+ (u8*)r2t->dtask->hdrext);
if (iscsi_sendhdr(conn, &r2t->headbuf, r2t->data_count)) {
ctask->xmstate &= ~XMSTATE_SOL_DATA;
ctask->xmstate |= XMSTATE_SOL_HDR;
@@ -2889,14 +2899,8 @@ iscsi_conn_send_generic(struct iscsi_con
memcpy(&mtask->hdr, hdr, sizeof(struct iscsi_hdr));
- if (conn->c_stage == ISCSI_CONN_INITIAL_STAGE ||
- conn->stop_stage == STOP_CONN_RECOVER)
- iscsi_buf_init_virt(&mtask->headbuf, (char*)&mtask->hdr,
+ iscsi_buf_init_virt(&mtask->headbuf, (char*)&mtask->hdr,
sizeof(struct iscsi_hdr));
- else
- /* this will update header digest */
- iscsi_buf_init_hdr(conn, &mtask->headbuf, (char*)&mtask->hdr,
- (u8 *)mtask->hdrext);
spin_unlock_bh(&session->lock);
reply other threads:[~2005-09-13 2:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1126576892.29245.22.camel@max \
--to=michaelc@cs.wisc.edu \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.