Module Name: src
Committed By: pooka
Date: Wed Aug 11 10:30:30 UTC 2010
Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c
Log Message:
Change bus header a little: reserve only 32bits for the lock and
use 32bit atomic ops to handle it. Begin data from 0x10 instead
of 0x14.
To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/net/lib/libshmif/if_shmem.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.13 src/sys/rump/net/lib/libshmif/if_shmem.c:1.14
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.13 Tue Aug 10 18:17:12 2010
+++ src/sys/rump/net/lib/libshmif/if_shmem.c Wed Aug 11 10:30:30 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.13 2010/08/10 18:17:12 pooka Exp $ */
+/* $NetBSD: if_shmem.c,v 1.14 2010/08/11 10:30:30 pooka Exp $ */
/*
* Copyright (c) 2009 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.13 2010/08/10 18:17:12 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.14 2010/08/11 10:30:30 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -76,11 +76,11 @@
uint32_t sc_nextpacket;
uint32_t sc_prevgen;
};
-#define IFMEM_LOCK (0)
-#define IFMEM_GENERATION (8)
-#define IFMEM_LASTPACKET (12)
-#define IFMEM_WAKEUP (16)
-#define IFMEM_DATA (20)
+#define IFMEM_LOCK (0x00)
+#define IFMEM_GENERATION (0x04)
+#define IFMEM_LASTPACKET (0x08)
+#define IFMEM_WAKEUP (0x0c)
+#define IFMEM_DATA (0x10)
#define BUSCTRL_ATOFF(sc, off) ((uint32_t *)(sc->sc_busmem+(off)))
@@ -102,7 +102,7 @@
lockbus(struct shmif_sc *sc)
{
- while (atomic_cas_uint((void *)sc->sc_busmem,
+ while (atomic_cas_32((uint32_t *)sc->sc_busmem,
LOCK_UNLOCKED, LOCK_LOCKED) == LOCK_LOCKED)
continue;
membar_enter();
@@ -114,7 +114,7 @@
unsigned int old;
membar_exit();
- old = atomic_swap_uint((void *)sc->sc_busmem, LOCK_UNLOCKED);
+ old = atomic_swap_32((uint32_t *)sc->sc_busmem, LOCK_UNLOCKED);
KASSERT(old == LOCK_LOCKED);
}