diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2014-04-21 09:48:32 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2014-04-21 09:48:32 +0000 |
commit | a33b3f1ff69ac1886dcc8d23b71b1aeea4e1af5f (patch) | |
tree | 4be9c5e911513a9c44d32703af1cd066f7419ac9 /usr.sbin/iscsid | |
parent | 268f546cffdba9bba51cf35e3ef4e2e386b6fcb5 (diff) |
Now that we properly negotiate the session params we can enable sending
of immediate data for write commands. This gives a nice 20% performance
boost on writes compared to the solicited data transaction we did before.
Diffstat (limited to 'usr.sbin/iscsid')
-rw-r--r-- | usr.sbin/iscsid/iscsid.c | 12 | ||||
-rw-r--r-- | usr.sbin/iscsid/iscsid.h | 3 | ||||
-rw-r--r-- | usr.sbin/iscsid/vscsi.c | 26 |
3 files changed, 27 insertions, 14 deletions
diff --git a/usr.sbin/iscsid/iscsid.c b/usr.sbin/iscsid/iscsid.c index 08bcdfc35ff..df339323c24 100644 --- a/usr.sbin/iscsid/iscsid.c +++ b/usr.sbin/iscsid/iscsid.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.c,v 1.12 2014/04/20 22:18:04 claudio Exp $ */ +/* $OpenBSD: iscsid.c,v 1.13 2014/04/21 09:48:31 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -269,6 +269,16 @@ iscsid_ctrl_dispatch(void *ch, struct pdu *pdu) control_compose(ch, CTRL_VSCSI_STATS, vscsi_stats(), sizeof(struct vscsi_stats)); break; + case CTRL_SHOW_SUM: + control_compose(ch, CTRL_INITIATOR_CONFIG, &initiator->config, + sizeof(initiator->config)); + + TAILQ_FOREACH(s, &initiator->sessions, entry) + control_compose(ch, CTRL_SESSION_CONFIG, + &s->config, sizeof(s->config)); + + control_compose(ch, CTRL_SUCCESS, NULL, 0); + break; default: log_warnx("unknown control message type %d", cmh->type); control_compose(ch, CTRL_FAILURE, NULL, 0); diff --git a/usr.sbin/iscsid/iscsid.h b/usr.sbin/iscsid/iscsid.h index 1bc123d0646..a530ada3f83 100644 --- a/usr.sbin/iscsid/iscsid.h +++ b/usr.sbin/iscsid/iscsid.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iscsid.h,v 1.11 2014/04/20 22:18:04 claudio Exp $ */ +/* $OpenBSD: iscsid.h,v 1.12 2014/04/21 09:48:31 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -54,6 +54,7 @@ struct ctrlmsghdr { #define CTRL_SESSION_CONFIG 5 #define CTRL_LOG_VERBOSE 6 #define CTRL_VSCSI_STATS 7 +#define CTRL_SHOW_SUM 8 TAILQ_HEAD(session_head, session); diff --git a/usr.sbin/iscsid/vscsi.c b/usr.sbin/iscsid/vscsi.c index 0dfafc5f777..4f796eb3845 100644 --- a/usr.sbin/iscsid/vscsi.c +++ b/usr.sbin/iscsid/vscsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vscsi.c,v 1.10 2014/04/20 22:18:04 claudio Exp $ */ +/* $OpenBSD: vscsi.c,v 1.11 2014/04/21 09:48:31 claudio Exp $ */ /* * Copyright (c) 2009 Claudio Jeker <claudio@openbsd.org> @@ -71,10 +71,6 @@ vscsi_dispatch(int fd, short event, void *arg) struct session *s; struct scsi_task *t; struct pdu *p; -#if 0 - char *buf; - u_int32_t t32; -#endif if (!(event & EV_READ)) { log_debug("spurious read call"); @@ -121,16 +117,22 @@ vscsi_dispatch(int fd, short event, void *arg) memcpy(sreq->cdb, &i2t.cmd, i2t.cmdlen); -#if 0 - if (i2t.direction == VSCSI_DIR_WRITE) { - if (!(buf = pdu_alloc(i2t.datalen))) + /* include immediate data of up to FirstBurstLength bytes if allowed */ + if (i2t.direction == VSCSI_DIR_WRITE && + s->active.ImmediateData) { + char *buf; + u_int32_t t32; + size_t size; + + size = i2t.datalen > s->active.FirstBurstLength ? + s->active.FirstBurstLength : i2t.datalen; + if (!(buf = pdu_alloc(size))) fatal("vscsi_dispatch"); - t32 = htonl(i2t.datalen); + t32 = htonl(size); memcpy(&sreq->ahslen, &t32, sizeof(t32)); - vscsi_data(VSCSI_DATA_WRITE, i2t.tag, buf, i2t.datalen); - pdu_addbuf(p, buf, i2t.datalen, PDU_DATA); + vscsi_data(VSCSI_DATA_WRITE, i2t.tag, buf, size); + pdu_addbuf(p, buf, size, PDU_DATA); } -#endif task_init(&t->task, s, 0, t, vscsi_callback, vscsi_fail); task_pdu_add(&t->task, p); |