summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2016-05-10 11:16:19 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2016-05-10 11:16:19 +0000
commit2d7cd113433464098ebd92ae549c4815217e2d67 (patch)
tree7a28adeeac3d5ab0165707eb9a89420fe549874a /sys
parenta675a5975428bd14c2fdb8d7768d44c9eefbad21 (diff)
make qla_iocb_seg structs 4 byte aligned and use htolem32 to set it.
shaves ~256 bytes off of qla_put_data_seg on sparc64 ok kettenis@ jmatthew@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/qla.c9
-rw-r--r--sys/dev/ic/qlareg.h7
2 files changed, 10 insertions, 6 deletions
diff --git a/sys/dev/ic/qla.c b/sys/dev/ic/qla.c
index b36af8ebb7f..a0b37c7d72e 100644
--- a/sys/dev/ic/qla.c
+++ b/sys/dev/ic/qla.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: qla.c,v 1.53 2015/09/07 01:37:59 deraadt Exp $ */
+/* $OpenBSD: qla.c,v 1.54 2016/05/10 11:16:18 dlg Exp $ */
/*
* Copyright (c) 2011 David Gwynne <dlg@openbsd.org>
@@ -2187,8 +2187,11 @@ qla_put_marker(struct qla_softc *sc, void *buf)
void
qla_put_data_seg(struct qla_iocb_seg *seg, bus_dmamap_t dmap, int num)
{
- seg->seg_addr = htole64(dmap->dm_segs[num].ds_addr);
- seg->seg_len = htole32(dmap->dm_segs[num].ds_len);
+ uint64_t addr = dmap->dm_segs[num].ds_addr;
+
+ htolem32(&seg->seg_addr_lo, addr);
+ htolem32(&seg->seg_addr_hi, addr >> 32);
+ htolem32(&seg->seg_len, dmap->dm_segs[num].ds_len);
}
void
diff --git a/sys/dev/ic/qlareg.h b/sys/dev/ic/qlareg.h
index fd6840b801e..fa171a6ca11 100644
--- a/sys/dev/ic/qlareg.h
+++ b/sys/dev/ic/qlareg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: qlareg.h,v 1.7 2014/04/14 04:14:11 jmatthew Exp $ */
+/* $OpenBSD: qlareg.h,v 1.8 2016/05/10 11:16:18 dlg Exp $ */
/*
* Copyright (c) 2013, 2014 Jonathan Matthew <jmatthew@openbsd.org>
@@ -529,9 +529,10 @@ struct qla_sns_gid_ft {
#define QLA_IOCB_MARKER_SYNC_ALL 2
struct qla_iocb_seg {
- u_int64_t seg_addr;
+ u_int32_t seg_addr_lo;
+ u_int32_t seg_addr_hi;
u_int32_t seg_len;
-} __packed;
+} __packed __aligned(4);
#if 0
struct qla_iocb_cont1 {