diff options
| author | pooka <pooka@NetBSD.org> | 2009-03-01 20:50:04 +0000 |
|---|---|---|
| committer | pooka <pooka@NetBSD.org> | 2009-03-01 20:50:04 +0000 |
| commit | d8327efb56ec7d32fdc4bf8d787a77d3aa0202a2 (patch) | |
| tree | eeef8dc3f146905debd227759d6d3d2b9604e1d3 /sys/rump/net/lib/libshmif | |
| parent | c9216fc5269a361c6f1d9a5a18101dc26ac68f40 (diff) | |
Create receive thread only in if_start() to make sure it happens
after the we have been attached to the ethernet framework.
XXX: if_stop is still unimplemented
Diffstat (limited to 'sys/rump/net/lib/libshmif')
| -rw-r--r-- | sys/rump/net/lib/libshmif/if_shmem.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sys/rump/net/lib/libshmif/if_shmem.c b/sys/rump/net/lib/libshmif/if_shmem.c index 2ce5029bcc2..9cd09921344 100644 --- a/sys/rump/net/lib/libshmif/if_shmem.c +++ b/sys/rump/net/lib/libshmif/if_shmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.3 2009/03/01 07:10:41 martin Exp $ */ +/* $NetBSD: if_shmem.c,v 1.4 2009/03/01 20:50:04 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -28,10 +28,9 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.3 2009/03/01 07:10:41 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.4 2009/03/01 20:50:04 pooka Exp $"); #include <sys/param.h> -#include <sys/condvar.h> #include <sys/fcntl.h> #include <sys/kmem.h> #include <sys/kthread.h> @@ -213,16 +212,6 @@ rump_shmif_create(const char *path, int *ifnum) if (sc->sc_kq == -1) goto fail; - if (rump_threads) { - error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, - shmif_rcv, ifp, NULL, "shmif"); - if (error) { - goto fail; - } - } else { - printf("WARNING: threads not enabled, shmif NOT working\n"); - } - sprintf(ifp->if_xname, "shmif%d", mynum); ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -246,9 +235,17 @@ rump_shmif_create(const char *path, int *ifnum) static int shmif_init(struct ifnet *ifp) { + int error = 0; + + if (rump_threads) { + error = kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, + shmif_rcv, ifp, NULL, "shmif"); + } else { + printf("WARNING: threads not enabled, shmif NOT working\n"); + } ifp->if_flags |= IFF_RUNNING; - return 0; + return error; } static int |
