Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/rump/net/lib/libshmif Pull up following revision(s) (...
details: https://anonhg.NetBSD.org/src/rev/0e78ef778de1
branches: netbsd-7
changeset: 798258:0e78ef778de1
user: riz <riz%NetBSD.org@localhost>
date: Sun Aug 17 03:26:51 2014 +0000
description:
Pull up following revision(s) (requested by ozaki-r in ticket #28):
sys/rump/net/lib/libshmif/shmifvar.h: revision 1.8
sys/rump/net/lib/libshmif/if_shmem.c: revision 1.63
sys/rump/net/lib/libshmif/shmifvar.h: revision 1.9
Make shmif SIMPLEX
Add a sender field to a packet header on a shmif bus to identify
and ignore packets sent by itself.
This makes shmif work with bridges.
ok pooka@
Bump SHMIF_VERSION
diffstat:
sys/rump/net/lib/libshmif/if_shmem.c | 14 ++++++++++----
sys/rump/net/lib/libshmif/shmifvar.h | 6 ++++--
2 files changed, 14 insertions(+), 6 deletions(-)
diffs (88 lines):
diff -r d928d0afc564 -r 0e78ef778de1 sys/rump/net/lib/libshmif/if_shmem.c
--- a/sys/rump/net/lib/libshmif/if_shmem.c Fri Aug 15 23:59:39 2014 +0000
+++ b/sys/rump/net/lib/libshmif/if_shmem.c Sun Aug 17 03:26:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_shmem.c,v 1.62 2014/08/09 09:43:49 ozaki-r Exp $ */
+/* $NetBSD: if_shmem.c,v 1.62.2.1 2014/08/17 03:26:51 riz Exp $ */
/*
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.62 2014/08/09 09:43:49 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.62.2.1 2014/08/17 03:26:51 riz Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -97,6 +97,8 @@
struct lwp *sc_rcvl;
bool sc_dying;
+
+ uint64_t sc_uuid;
};
static void shmif_rcv(void *);
@@ -167,12 +169,13 @@
sc = kmem_zalloc(sizeof(*sc), KM_SLEEP);
sc->sc_memfd = -1;
sc->sc_unit = unit;
+ sc->sc_uuid = cprng_fast64();
ifp = &sc->sc_ec.ec_if;
snprintf(ifp->if_xname, sizeof(ifp->if_xname), "shmif%d", unit);
ifp->if_softc = sc;
- ifp->if_flags = IFF_BROADCAST | IFF_MULTICAST;
+ ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
ifp->if_init = shmif_init;
ifp->if_ioctl = shmif_ioctl;
ifp->if_start = shmif_start;
@@ -540,6 +543,7 @@
sp.sp_len = pktsize;
sp.sp_sec = tv.tv_sec;
sp.sp_usec = tv.tv_usec;
+ sp.sp_sender = sc->sc_uuid;
bpf_mtap(ifp, m0);
@@ -743,7 +747,9 @@
* Test if we want to pass the packet upwards
*/
eth = mtod(m, struct ether_header *);
- if (memcmp(eth->ether_dhost, CLLADDR(ifp->if_sadl),
+ if (sp.sp_sender == sc->sc_uuid) {
+ passup = false;
+ } else if (memcmp(eth->ether_dhost, CLLADDR(ifp->if_sadl),
ETHER_ADDR_LEN) == 0) {
passup = true;
} else if (ETHER_IS_MULTICAST(eth->ether_dhost)) {
diff -r d928d0afc564 -r 0e78ef778de1 sys/rump/net/lib/libshmif/shmifvar.h
--- a/sys/rump/net/lib/libshmif/shmifvar.h Fri Aug 15 23:59:39 2014 +0000
+++ b/sys/rump/net/lib/libshmif/shmifvar.h Sun Aug 17 03:26:51 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: shmifvar.h,v 1.7 2013/12/20 09:06:35 pooka Exp $ */
+/* $NetBSD: shmifvar.h,v 1.7.4.1 2014/08/17 03:26:51 riz Exp $ */
/*-
* Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved.
@@ -31,7 +31,7 @@
#define _RUMP_NET_SHMIFVAR_H_
#define SHMIF_MAGIC 0xca11d054
-#define SHMIF_VERSION 2
+#define SHMIF_VERSION 3
struct shmif_mem {
uint32_t shm_magic;
@@ -56,6 +56,8 @@
uint32_t sp_sec;
uint32_t sp_usec;
+
+ uint64_t sp_sender;
};
#define BUSMEM_SIZE (1024*1024)
Home |
Main Index |
Thread Index |
Old Index