diff options
author | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-11-19 12:21:47 +0000 |
---|---|---|
committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2013-11-19 12:21:47 +0000 |
commit | 654957c2c861b1483df873678439699c0dfeeb94 (patch) | |
tree | da4bb950ab9bcbca6266ddf2c978e5e941ecf865 /sys/net | |
parent | f053058ceee274352b1ad18f292f8e52b2e69027 (diff) | |
parent | c5068af5594315529520fdcd0de57d586e732d45 (diff) | |
download | src-654957c2c861b1483df873678439699c0dfeeb94.tar.gz src-654957c2c861b1483df873678439699c0dfeeb94.zip |
Merge head up to r258343.
Notes
Notes:
svn path=/projects/pf/head/; revision=258344
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/ieee_oui.h | 67 | ||||
-rw-r--r-- | sys/net/if_ethersubr.c | 20 | ||||
-rw-r--r-- | sys/net/if_gif.c | 37 |
3 files changed, 91 insertions, 33 deletions
diff --git a/sys/net/ieee_oui.h b/sys/net/ieee_oui.h new file mode 100644 index 000000000000..3fcb96b597a1 --- /dev/null +++ b/sys/net/ieee_oui.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 The FreeBSD Foundation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + * + * Author: George V. Neville-Neil + * + */ + +/* Organizationally Unique Identifier assigned by IEEE 14 Nov 2013 */ +#define OUI_FREEBSD_BASE 0x589cfc000000 +#define OUI_FREEBSD(nic) (OUI_FREEBSD_BASE | (nic)) + +/* + * OUIs are most often used to uniquely identify network interfaces + * and occupy the first 3 bytes of both destination and source MAC + * addresses. The following allocations exist so that various + * software systems associated with FreeBSD can have unique IDs in the + * absence of hardware. The use of OUIs for this purpose is not fully + * fleshed out but is now in common use in virtualization technology. + * + * Allocations from this range are expected to be made using COMMON + * SENSE by developers. Do NOT take a large range just because + * they're currently wide open. Take the smallest useful range for + * your system. We have (2^24 - 2) available addresses (see Reserved + * Values below) but that is far from infinite. + * + * In the event of a conflict arbitration of allocation in this file + * is subject to core@ approval. + * + * Applications are differentiated based on the high order bit(s) of + * the remaining three bytes. Our first allocation has all 0s, the + * next allocation has the highest bit set. Allocating in this way + * gives us 254 allocations of 64K addresses. Address blocks can be + * concatenated if necessary. + * + * Reserved Values: 0x000000 and 0xffffff are reserved and MUST NOT BE + * allocated for any reason. + */ + +/* Allocate 64K to bhyve */ +#define OUI_FREEBSD_BHYVE_LOW OUI_FREEBSD(0x000001) +#define OUI_FREEBSD_BHYVE_HIGH OUI_FREEBSD(0x00ffff) diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index c4a9125c9f45..04b94defc956 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -708,13 +708,25 @@ static void ether_input(struct ifnet *ifp, struct mbuf *m) { + struct mbuf *mn; + /* - * We will rely on rcvif being set properly in the deferred context, - * so assert it is correct here. + * The drivers are allowed to pass in a chain of packets linked with + * m_nextpkt. We split them up into separate packets here and pass + * them up. This allows the drivers to amortize the receive lock. */ - KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + while (m) { + mn = m->m_nextpkt; + m->m_nextpkt = NULL; - netisr_dispatch(NETISR_ETHER, m); + /* + * We will rely on rcvif being set properly in the deferred context, + * so assert it is correct here. + */ + KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + netisr_dispatch(NETISR_ETHER, m); + m = mn; + } } /* diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 10ff5dfa8d42..6cf04373a4d8 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -153,10 +153,7 @@ static const u_char etherbroadcastaddr[ETHER_ADDR_LEN] = #endif static int -gif_clone_create(ifc, unit, params) - struct if_clone *ifc; - int unit; - caddr_t params; +gif_clone_create(struct if_clone *ifc, int unit, caddr_t params) { struct gif_softc *sc; @@ -200,8 +197,7 @@ gif_clone_create(ifc, unit, params) } static void -gif_clone_destroy(ifp) - struct ifnet *ifp; +gif_clone_destroy(struct ifnet *ifp) { #if defined(INET) || defined(INET6) int err; @@ -247,10 +243,7 @@ VNET_SYSINIT(vnet_gif_init, SI_SUB_PSEUDO, SI_ORDER_MIDDLE, vnet_gif_init, NULL); static int -gifmodevent(mod, type, data) - module_t mod; - int type; - void *data; +gifmodevent(module_t mod, int type, void *data) { switch (type) { @@ -280,11 +273,7 @@ DECLARE_MODULE(if_gif, gif_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_gif, 1); int -gif_encapcheck(m, off, proto, arg) - const struct mbuf *m; - int off; - int proto; - void *arg; +gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) { struct ip ip; struct gif_softc *sc; @@ -529,10 +518,7 @@ gif_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, } void -gif_input(m, af, ifp) - struct mbuf *m; - int af; - struct ifnet *ifp; +gif_input(struct mbuf *m, int af, struct ifnet *ifp) { int isr, n; struct gif_softc *sc; @@ -669,10 +655,7 @@ gif_input(m, af, ifp) /* XXX how should we handle IPv6 scope on SIOC[GS]IFPHYADDR? */ int -gif_ioctl(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; +gif_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct gif_softc *sc = ifp->if_softc; struct ifreq *ifr = (struct ifreq*)data; @@ -914,10 +897,7 @@ gif_ioctl(ifp, cmd, data) * a mutex. */ int -gif_set_tunnel(ifp, src, dst) - struct ifnet *ifp; - struct sockaddr *src; - struct sockaddr *dst; +gif_set_tunnel(struct ifnet *ifp, struct sockaddr *src, struct sockaddr *dst) { struct gif_softc *sc = ifp->if_softc; struct gif_softc *sc2; @@ -1023,8 +1003,7 @@ gif_set_tunnel(ifp, src, dst) } void -gif_delete_tunnel(ifp) - struct ifnet *ifp; +gif_delete_tunnel(struct ifnet *ifp) { struct gif_softc *sc = ifp->if_softc; |