| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_shmem.c,v 1.9 2009/10/20 23:29:57 pooka Exp $ */ | | 1 | /* $NetBSD: if_shmem.c,v 1.10 2009/11/30 11:14:58 pooka Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Development of this software was supported by The Nokia Foundation. | | 6 | * Development of this software was supported by The Nokia Foundation. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -18,27 +18,27 @@ | | | @@ -18,27 +18,27 @@ |
18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 20 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
27 | * SUCH DAMAGE. | | 27 | * SUCH DAMAGE. |
28 | */ | | 28 | */ |
29 | | | 29 | |
30 | #include <sys/cdefs.h> | | 30 | #include <sys/cdefs.h> |
31 | __KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.9 2009/10/20 23:29:57 pooka Exp $"); | | 31 | __KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.10 2009/11/30 11:14:58 pooka Exp $"); |
32 | | | 32 | |
33 | #include <sys/param.h> | | 33 | #include <sys/param.h> |
34 | #include <sys/fcntl.h> | | 34 | #include <sys/fcntl.h> |
35 | #include <sys/kmem.h> | | 35 | #include <sys/kmem.h> |
36 | #include <sys/kthread.h> | | 36 | #include <sys/kthread.h> |
37 | #include <sys/lock.h> | | 37 | #include <sys/lock.h> |
38 | #include <sys/atomic.h> | | 38 | #include <sys/atomic.h> |
39 | | | 39 | |
40 | #include <net/if.h> | | 40 | #include <net/if.h> |
41 | #include <net/if_ether.h> | | 41 | #include <net/if_ether.h> |
42 | | | 42 | |
43 | #include <netinet/in.h> | | 43 | #include <netinet/in.h> |
44 | #include <netinet/in_var.h> | | 44 | #include <netinet/in_var.h> |
| @@ -363,23 +363,23 @@ shmif_rcv(void *arg) | | | @@ -363,23 +363,23 @@ shmif_rcv(void *arg) |
363 | busread(sc, &pktlen, nextpkt, 4); | | 363 | busread(sc, &pktlen, nextpkt, 4); |
364 | busread(sc, mtod(m, void *), advance(nextpkt, 4), pktlen); | | 364 | busread(sc, mtod(m, void *), advance(nextpkt, 4), pktlen); |
365 | | | 365 | |
366 | DPRINTF(("shmif_rcv: read packet of length %d at %d\n", | | 366 | DPRINTF(("shmif_rcv: read packet of length %d at %d\n", |
367 | pktlen, nextpkt)); | | 367 | pktlen, nextpkt)); |
368 | | | 368 | |
369 | sc->sc_nextpacket = nextpktoff(sc, nextpkt); | | 369 | sc->sc_nextpacket = nextpktoff(sc, nextpkt); |
370 | sc->sc_prevgen = busgen; | | 370 | sc->sc_prevgen = busgen; |
371 | unlockbus(sc); | | 371 | unlockbus(sc); |
372 | | | 372 | |
373 | m->m_len = m->m_pkthdr.len = pktlen; | | 373 | m->m_len = m->m_pkthdr.len = pktlen; |
374 | m->m_pkthdr.rcvif = ifp; | | 374 | m->m_pkthdr.rcvif = ifp; |
375 | | | 375 | |
376 | /* if it's to us, don't pass up and reuse storage space */ | | 376 | /* if it's from us, don't pass up and reuse storage space */ |
377 | eth = mtod(m, struct ether_header *); | | 377 | eth = mtod(m, struct ether_header *); |
378 | if (memcmp(eth->ether_shost, sc->sc_myaddr, 6) != 0) { | | 378 | if (memcmp(eth->ether_shost, sc->sc_myaddr, 6) != 0) { |
379 | ifp->if_input(ifp, m); | | 379 | ifp->if_input(ifp, m); |
380 | m = NULL; | | 380 | m = NULL; |
381 | } | | 381 | } |
382 | } | | 382 | } |
383 | | | 383 | |
384 | panic("shmif_worker is a lazy boy %d\n", error); | | 384 | panic("shmif_worker is a lazy boy %d\n", error); |
385 | } | | 385 | } |