summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2014-03-24 04:26:58 +0000
committerdlg <dlg@openbsd.org>2014-03-24 04:26:58 +0000
commit5406696d5bc56a7a2f67021ab0ad758eb6cc73cf (patch)
tree7517b50482ecb1b8e40b13f52f02438bcb62a183
parentmpi scatter gather lists are 24 bytes long and next to each other in (diff)
downloadwireguard-openbsd-5406696d5bc56a7a2f67021ab0ad758eb6cc73cf.tar.xz
wireguard-openbsd-5406696d5bc56a7a2f67021ab0ad758eb6cc73cf.zip
use htolemXX and lemtohXX in the scsi_cmd paths.
apart from the flags handling in sgls, this shrinks the io hot path on sparc64 and powerpc a lot. its pretty much the same on i386/amd64/alpha.
-rw-r--r--sys/dev/ic/mpi.c12
-rw-r--r--sys/dev/ic/mpireg.h6
2 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index 50f595b5859..476f5054dbf 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.187 2014/03/24 04:05:11 dlg Exp $ */
+/* $OpenBSD: mpi.c,v 1.188 2014/03/24 04:26:58 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org>
@@ -1340,7 +1340,7 @@ mpi_scsi_cmd(struct scsi_xfer *xs)
io->sense_buf_len = sizeof(xs->sense);
io->msg_flags = MPI_SCSIIO_SENSE_BUF_ADDR_WIDTH_64;
- io->lun[0] = htobe16(link->lun);
+ htobem16(&io->lun[0], link->lun);
switch (xs->flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
case SCSI_DATA_IN:
@@ -1362,9 +1362,9 @@ mpi_scsi_cmd(struct scsi_xfer *xs)
memcpy(io->cdb, xs->cmd, xs->cmdlen);
- io->data_length = htole32(xs->datalen);
+ htolem32(&io->data_length, xs->datalen);
- io->sense_buf_low_addr = htole32(ccb->ccb_cmd_dva +
+ htolem32(&io->sense_buf_low_addr, ccb->ccb_cmd_dva +
((u_int8_t *)&mcb->mcb_sense - (u_int8_t *)mcb));
if (mpi_load_xs(ccb) != 0) {
@@ -1442,9 +1442,9 @@ mpi_scsi_cmd_done(struct mpi_ccb *ccb)
letoh16(sie->tag));
xs->status = sie->scsi_status;
- switch (letoh16(sie->ioc_status)) {
+ switch (lemtoh16(&sie->ioc_status)) {
case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:
- xs->resid = xs->datalen - letoh32(sie->transfer_count);
+ xs->resid = xs->datalen - lemtoh32(&sie->transfer_count);
if (sie->scsi_state & MPI_SCSIIO_ERR_STATE_NO_SCSI_STATUS) {
xs->error = XS_DRIVER_STUFFUP;
break;
diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h
index f8425cf0496..41bec279c35 100644
--- a/sys/dev/ic/mpireg.h
+++ b/sys/dev/ic/mpireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpireg.h,v 1.43 2014/03/24 04:05:11 dlg Exp $ */
+/* $OpenBSD: mpireg.h,v 1.44 2014/03/24 04:26:58 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -840,7 +840,7 @@ struct mpi_msg_scsi_io {
u_int32_t sense_buf_low_addr;
/* followed by an sgl */
-} __packed;
+} __packed __aligned(4);
struct mpi_msg_scsi_io_error {
u_int8_t target_id;
@@ -886,7 +886,7 @@ struct mpi_msg_scsi_io_error {
u_int16_t tag;
u_int16_t reserved2;
-} __packed;
+} __packed __aligned(4);
struct mpi_msg_scsi_task_request {
u_int8_t target_id;