svn commit: r281650 - in projects/ifnet/sys: arm/arm dev/cxgbe/tom dev/usb/video modules/usb net/altq netinet netinet6
Gleb Smirnoff
glebius at FreeBSD.org
Fri Apr 17 12:10:05 UTC 2015
Author: glebius
Date: Fri Apr 17 12:10:00 2015
New Revision: 281650
URL: https://svnweb.freebsd.org/changeset/base/281650
Log:
Merge head r257698 through r281649.
Deleted:
projects/ifnet/sys/net/altq/altqconf.h
Modified:
projects/ifnet/sys/arm/arm/trap-v6.c
projects/ifnet/sys/arm/arm/vm_machdep.c
projects/ifnet/sys/dev/cxgbe/tom/t4_listen.c
projects/ifnet/sys/dev/usb/video/udl.c
projects/ifnet/sys/dev/usb/video/udl.h
projects/ifnet/sys/modules/usb/Makefile
projects/ifnet/sys/net/altq/altq.h
projects/ifnet/sys/net/altq/altq_cbq.c
projects/ifnet/sys/net/altq/altq_cdnr.c
projects/ifnet/sys/net/altq/altq_classq.h
projects/ifnet/sys/net/altq/altq_hfsc.c
projects/ifnet/sys/net/altq/altq_priq.c
projects/ifnet/sys/net/altq/altq_red.c
projects/ifnet/sys/net/altq/altq_rio.c
projects/ifnet/sys/net/altq/altq_rmclass.c
projects/ifnet/sys/net/altq/altq_rmclass_debug.h
projects/ifnet/sys/net/altq/altq_subr.c
projects/ifnet/sys/net/altq/altq_var.h
projects/ifnet/sys/net/altq/if_altq.h
projects/ifnet/sys/netinet/in.c
projects/ifnet/sys/netinet/in.h
projects/ifnet/sys/netinet6/in6.c
projects/ifnet/sys/netinet6/in6.h
Directory Properties:
projects/ifnet/ (props changed)
projects/ifnet/sys/ (props changed)
Modified: projects/ifnet/sys/arm/arm/trap-v6.c
==============================================================================
--- projects/ifnet/sys/arm/arm/trap-v6.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/arm/arm/trap-v6.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_extern.h>
#include <vm/vm_param.h>
+#include <machine/acle-compat.h>
#include <machine/cpu.h>
#include <machine/cpu-v6.h>
#include <machine/frame.h>
@@ -287,7 +288,11 @@ abort_handler(struct trapframe *tf, int
#endif
td = curthread;
fsr = (prefetch) ? cp15_ifsr_get(): cp15_dfsr_get();
+#if __ARM_ARCH >= 7
+ far = (prefetch) ? cp15_ifar_get() : cp15_dfar_get();
+#else
far = (prefetch) ? TRAPF_PC(tf) : cp15_dfar_get();
+#endif
idx = FSR_TO_FAULT(fsr);
usermode = TRAPF_USERMODE(tf); /* Abort came from user mode? */
Modified: projects/ifnet/sys/arm/arm/vm_machdep.c
==============================================================================
--- projects/ifnet/sys/arm/arm/vm_machdep.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/arm/arm/vm_machdep.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -178,11 +178,7 @@ cpu_set_syscall_retval(struct thread *td
* place the returned data into r1. As the lseek and frerebsd6_lseek
* syscalls also return an off_t they do not need this fixup.
*/
-#ifdef __ARM_EABI__
call = frame->tf_r7;
-#else
- call = *(u_int32_t *)(frame->tf_pc - INSN_SIZE) & 0x000fffff;
-#endif
if (call == SYS___syscall) {
register_t *ap = &frame->tf_r0;
register_t code = ap[_QUAD_LOWWORD];
Modified: projects/ifnet/sys/dev/cxgbe/tom/t4_listen.c
==============================================================================
--- projects/ifnet/sys/dev/cxgbe/tom/t4_listen.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/dev/cxgbe/tom/t4_listen.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1090,35 +1090,6 @@ pass_accept_req_to_protohdrs(const struc
}
}
-static int
-ifnet_has_ip6(struct ifnet *ifp, struct in6_addr *ip6)
-{
- struct ifaddr *ifa;
- struct sockaddr_in6 *sin6;
- int found = 0;
- struct in6_addr in6 = *ip6;
-
- /* Just as in ip6_input */
- if (in6_clearscope(&in6) || in6_clearscope(&in6))
- return (0);
- in6_setscope(&in6, ifp, NULL);
-
- if_addr_rlock(ifp);
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
- sin6 = (void *)ifa->ifa_addr;
- if (sin6->sin6_family != AF_INET6)
- continue;
-
- if (IN6_ARE_ADDR_EQUAL(&sin6->sin6_addr, &in6)) {
- found = 1;
- break;
- }
- }
- if_addr_runlock(ifp);
-
- return (found);
-}
-
static struct l2t_entry *
get_l2te_for_nexthop(struct port_info *pi, struct ifnet *ifp,
struct in_conninfo *inc)
@@ -1166,29 +1137,6 @@ get_l2te_for_nexthop(struct port_info *p
return (e);
}
-static int
-ifnet_has_ip(struct ifnet *ifp, struct in_addr in)
-{
- struct ifaddr *ifa;
- struct sockaddr_in *sin;
- int found = 0;
-
- if_addr_rlock(ifp);
- TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) {
- sin = (void *)ifa->ifa_addr;
- if (sin->sin_family != AF_INET)
- continue;
-
- if (sin->sin_addr.s_addr == in.s_addr) {
- found = 1;
- break;
- }
- }
- if_addr_runlock(ifp);
-
- return (found);
-}
-
#define REJECT_PASS_ACCEPT() do { \
reject_reason = __LINE__; \
goto reject; \
@@ -1281,7 +1229,7 @@ do_pass_accept_req(struct sge_iq *iq, co
* SYN must be directed to an IP6 address on this ifnet. This
* is more restrictive than in6_localip.
*/
- if (!ifnet_has_ip6(ifp, &inc.inc6_laddr))
+ if (!in6_ifhasaddr(ifp, &inc.inc6_laddr))
REJECT_PASS_ACCEPT();
} else {
@@ -1293,7 +1241,7 @@ do_pass_accept_req(struct sge_iq *iq, co
* SYN must be directed to an IP address on this ifnet. This
* is more restrictive than in_localip.
*/
- if (!ifnet_has_ip(ifp, inc.inc_laddr))
+ if (!in_ifhasaddr(ifp, inc.inc_laddr))
REJECT_PASS_ACCEPT();
}
Modified: projects/ifnet/sys/dev/usb/video/udl.c
==============================================================================
--- projects/ifnet/sys/dev/usb/video/udl.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/dev/usb/video/udl.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -76,6 +76,11 @@ static int udl_fps = 25;
SYSCTL_INT(_hw_usb_udl, OID_AUTO, fps, CTLFLAG_RWTUN,
&udl_fps, 0, "Frames Per Second, 1-60");
+static struct mtx udl_buffer_mtx;
+static struct udl_buffer_head udl_buffer_head;
+
+MALLOC_DEFINE(M_USB_DL, "USB", "USB DisplayLink");
+
/*
* Prototypes.
*/
@@ -175,6 +180,56 @@ static const STRUCT_USB_HOST_ID udl_devs
{USB_VPI(USB_VENDOR_DISPLAYLINK, USB_PRODUCT_DISPLAYLINK_LT1421, DLUNK)}
};
+static void
+udl_buffer_init(void *arg)
+{
+ mtx_init(&udl_buffer_mtx, "USB", "UDL", MTX_DEF);
+ TAILQ_INIT(&udl_buffer_head);
+}
+SYSINIT(udl_buffer_init, SI_SUB_LOCK, SI_ORDER_FIRST, udl_buffer_init, NULL);
+
+CTASSERT(sizeof(struct udl_buffer) < PAGE_SIZE);
+
+static void *
+udl_buffer_alloc(uint32_t size)
+{
+ struct udl_buffer *buf;
+ mtx_lock(&udl_buffer_mtx);
+ TAILQ_FOREACH(buf, &udl_buffer_head, entry) {
+ if (buf->size == size) {
+ TAILQ_REMOVE(&udl_buffer_head, buf, entry);
+ break;
+ }
+ }
+ mtx_unlock(&udl_buffer_mtx);
+ if (buf != NULL) {
+ /* wipe and recycle buffer */
+ memset(buf, 0, size);
+ return (buf);
+ }
+ /* allocate new buffer */
+ return (malloc(size, M_USB_DL, M_WAITOK | M_ZERO));
+}
+
+static void
+udl_buffer_free(void *_buf, uint32_t size)
+{
+ struct udl_buffer *buf;
+
+ buf = (struct udl_buffer *)_buf;
+ if (buf == NULL)
+ return;
+
+ /*
+ * Memory mapped buffers should never be freed.
+ * Put display buffer into a recycle list.
+ */
+ mtx_lock(&udl_buffer_mtx);
+ buf->size = size;
+ TAILQ_INSERT_TAIL(&udl_buffer_head, buf, entry);
+ mtx_unlock(&udl_buffer_mtx);
+}
+
static uint32_t
udl_get_fb_size(struct udl_softc *sc)
{
@@ -403,11 +458,11 @@ udl_detach(device_t dev)
mtx_destroy(&sc->sc_mtx);
cv_destroy(&sc->sc_cv);
- /*
- * Free framebuffer memory, if any.
- */
- free(sc->sc_fb_addr, M_DEVBUF);
- free(sc->sc_fb_copy, M_DEVBUF);
+ /* put main framebuffer into a recycle list, if any */
+ udl_buffer_free(sc->sc_fb_addr, sc->sc_fb_size);
+
+ /* free shadow framebuffer memory, if any */
+ free(sc->sc_fb_copy, M_USB_DL);
return (0);
}
@@ -782,13 +837,15 @@ udl_fbmem_alloc(struct udl_softc *sc)
size = udl_get_fb_size(sc);
size = round_page(size);
-
+ /* check for zero size */
+ if (size == 0)
+ size = PAGE_SIZE;
/*
* It is assumed that allocations above PAGE_SIZE bytes will
* be PAGE_SIZE aligned for use with mmap()
*/
- sc->sc_fb_addr = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
- sc->sc_fb_copy = malloc(size, M_DEVBUF, M_WAITOK | M_ZERO);
+ sc->sc_fb_addr = udl_buffer_alloc(size);
+ sc->sc_fb_copy = malloc(size, M_USB_DL, M_WAITOK | M_ZERO);
sc->sc_fb_size = size;
}
Modified: projects/ifnet/sys/dev/usb/video/udl.h
==============================================================================
--- projects/ifnet/sys/dev/usb/video/udl.h Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/dev/usb/video/udl.h Fri Apr 17 12:10:00 2015 (r281650)
@@ -34,6 +34,15 @@
#define UDL_FONT_HEIGHT 16 /* pixels */
#define UDL_MAX_MODES 25 /* units */
+MALLOC_DECLARE(M_USB_DL);
+
+struct udl_buffer {
+ TAILQ_ENTRY(udl_buffer) entry;
+ uint32_t size;
+};
+
+TAILQ_HEAD(udl_buffer_head, udl_buffer);
+
struct udl_cmd_buf {
TAILQ_ENTRY(udl_cmd_buf) entry;
uint32_t off;
Modified: projects/ifnet/sys/modules/usb/Makefile
==============================================================================
--- projects/ifnet/sys/modules/usb/Makefile Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/modules/usb/Makefile Fri Apr 17 12:10:00 2015 (r281650)
@@ -56,6 +56,7 @@ SUBDIR += ${_urtwn} ${_urtwnfw}
SUBDIR += atp uhid ukbd ums udbp ufm uep wsp uled
SUBDIR += ucom u3g uark ubsa ubser uchcom ucycom ufoma uftdi ugensa uipaq ulpt \
umct umcs umodem umoscom uplcom uslcom uvisor uvscom
+SUBDIR += udl
SUBDIR += uether aue axe axge cdce cue ${_kue} mos rue smsc udav uhso ipheth
SUBDIR += urndis
SUBDIR += usfs umass urio
Modified: projects/ifnet/sys/net/altq/altq.h
==============================================================================
--- projects/ifnet/sys/net/altq/altq.h Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq.h Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq.h,v 1.10 2003/07/10 12:07:47 kjc Exp $ */
-
-/*
+/*-
* Copyright (C) 1998-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -25,6 +22,9 @@
* 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.
+ *
+ * $KAME: altq.h,v 1.10 2003/07/10 12:07:47 kjc Exp $
+ * $FreeBSD$
*/
#ifndef _ALTQ_ALTQ_H_
#define _ALTQ_ALTQ_H_
Modified: projects/ifnet/sys/net/altq/altq_cbq.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_cbq.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_cbq.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_cbq.c,v 1.19 2003/09/17 14:23:25 kjc Exp $ */
-
-/*
+/*-
* Copyright (c) Sun Microsystems, Inc. 1993-1998 All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,15 +26,14 @@
* provided "as is" without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this software.
+ *
+ * $KAME: altq_cbq.c,v 1.19 2003/09/17 14:23:25 kjc Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_CBQ /* cbq is enabled by ALTQ_CBQ option in opt_altq.h */
#include <sys/param.h>
@@ -251,11 +247,7 @@ cbq_pfattach(struct pf_altq *a)
if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
return (EINVAL);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
error = altq_attach(&ifp->if_snd, ALTQT_CBQ, a->altq_disc,
cbq_enqueue, cbq_dequeue, cbq_request, NULL, NULL);
splx(s);
Modified: projects/ifnet/sys/net/altq/altq_cdnr.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_cdnr.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_cdnr.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_cdnr.c,v 1.15 2005/04/13 03:44:24 suz Exp $ */
-
-/*
+/*-
* Copyright (C) 1999-2002
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -25,15 +22,14 @@
* 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.
+ *
+ * $KAME: altq_cdnr.c,v 1.15 2005/04/13 03:44:24 suz Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#include <sys/param.h>
#include <sys/malloc.h>
@@ -1272,11 +1268,7 @@ cdnrioctl(dev, cmd, addr, flag, p)
break;
}
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
switch (cmd) {
case CDNR_IF_ATTACH:
Modified: projects/ifnet/sys/net/altq/altq_classq.h
==============================================================================
--- projects/ifnet/sys/net/altq/altq_classq.h Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_classq.h Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,6 +1,4 @@
-/* $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $ */
-
-/*
+/*-
* Copyright (c) 1991-1997 Regents of the University of California.
* All rights reserved.
*
@@ -31,6 +29,9 @@
* 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.
+ *
+ * $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $
+ * $FreeBSD$
*/
/*
* class queue definitions extracted from rm_class.h.
Modified: projects/ifnet/sys/net/altq/altq_hfsc.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_hfsc.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_hfsc.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_hfsc.c,v 1.24 2003/12/05 05:40:46 kjc Exp $ */
-
-/*
+/*-
* Copyright (c) 1997-1999 Carnegie Mellon University. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software and
@@ -29,6 +26,9 @@
* software to return any improvements or extensions that they make,
* and to grant Carnegie Mellon the rights to redistribute these
* changes without encumbrance.
+ *
+ * $KAME: altq_hfsc.c,v 1.24 2003/12/05 05:40:46 kjc Exp $
+ * $FreeBSD$
*/
/*
* H-FSC is described in Proceedings of SIGCOMM'97,
@@ -42,13 +42,9 @@
* a class whose fit-time exceeds the current time.
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_HFSC /* hfsc is enabled by ALTQ_HFSC option in opt_altq.h */
@@ -177,11 +173,7 @@ hfsc_pfattach(struct pf_altq *a)
if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
return (EINVAL);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
error = altq_attach(&ifp->if_snd, ALTQT_HFSC, a->altq_disc,
hfsc_enqueue, hfsc_dequeue, hfsc_request, NULL, NULL);
splx(s);
@@ -483,11 +475,7 @@ hfsc_class_create(struct hfsc_if *hif, s
cl->cl_hif = hif;
cl->cl_parent = parent;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(hif->hif_ifq);
hif->hif_classes++;
@@ -567,11 +555,7 @@ hfsc_class_destroy(struct hfsc_class *cl
if (is_a_parent_class(cl))
return (EBUSY);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(cl->cl_hif->hif_ifq);
#ifdef ALTQ3_COMPAT
@@ -1771,11 +1755,7 @@ hfsc_class_modify(cl, rsc, fsc, usc)
}
cur_time = read_machclk();
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(cl->cl_hif->hif_ifq);
if (rsc != NULL) {
Modified: projects/ifnet/sys/net/altq/altq_priq.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_priq.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_priq.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,6 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_priq.c,v 1.11 2003/09/17 14:23:25 kjc Exp $ */
-/*
+/*-
* Copyright (C) 2000-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -24,18 +22,17 @@
* 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.
+ *
+ * $KAME: altq_priq.c,v 1.11 2003/09/17 14:23:25 kjc Exp $
+ * $FreeBSD$
*/
/*
* priority queue
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_PRIQ /* priq is enabled by ALTQ_PRIQ option in opt_altq.h */
@@ -113,11 +110,7 @@ priq_pfattach(struct pf_altq *a)
if ((ifp = ifunit(a->ifname)) == NULL || a->altq_disc == NULL)
return (EINVAL);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
error = altq_attach(&ifp->if_snd, ALTQT_PRIQ, a->altq_disc,
priq_enqueue, priq_dequeue, priq_request, NULL, NULL);
splx(s);
@@ -300,11 +293,7 @@ priq_class_create(struct priq_if *pif, i
if ((cl = pif->pif_classes[pri]) != NULL) {
/* modify the class instead of creating a new one */
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(cl->cl_pif->pif_ifq);
if (!qempty(cl->cl_q))
priq_purgeq(cl);
@@ -407,11 +396,7 @@ priq_class_destroy(struct priq_class *cl
struct priq_if *pif;
int s, pri;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(cl->cl_pif->pif_ifq);
#ifdef ALTQ3_CLFIER_COMPAT
Modified: projects/ifnet/sys/net/altq/altq_red.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_red.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_red.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_red.c,v 1.18 2003/09/05 22:40:36 itojun Exp $ */
-
-/*
+/*-
* Copyright (C) 1997-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -27,7 +24,7 @@
* SUCH DAMAGE.
*
*/
-/*
+/*-
* Copyright (c) 1990-1994 Regents of the University of California.
* All rights reserved.
*
@@ -58,15 +55,14 @@
* 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.
+ *
+ * $KAME: altq_red.c,v 1.18 2003/09/05 22:40:36 itojun Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_RED /* red is enabled by ALTQ_RED option in opt_altq.h */
#include <sys/param.h>
@@ -944,11 +940,7 @@ redioctl(dev, cmd, addr, flag, p)
break;
}
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
red_purgeq(rqp);
limit = fc->red_limit;
if (limit < fc->red_thmax)
Modified: projects/ifnet/sys/net/altq/altq_rio.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_rio.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_rio.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_rio.c,v 1.17 2003/07/10 12:07:49 kjc Exp $ */
-
-/*
+/*-
* Copyright (C) 1998-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -26,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/*
+/*-
* Copyright (c) 1990-1994 Regents of the University of California.
* All rights reserved.
*
@@ -57,15 +54,14 @@
* 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.
+ *
+ * $KAME: altq_rio.c,v 1.17 2003/07/10 12:07:49 kjc Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_RIO /* rio is enabled by ALTQ_RIO option in opt_altq.h */
#include <sys/param.h>
@@ -684,11 +680,7 @@ rioioctl(dev, cmd, addr, flag, p)
break;
}
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
_flushq(rqp->rq_q);
limit = fc->rio_limit;
if (limit < fc->q_params[RIO_NDROPPREC-1].th_max)
Modified: projects/ifnet/sys/net/altq/altq_rmclass.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_rmclass.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_rmclass.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $ */
-
-/*
+/*-
* Copyright (c) 1991-1997 Regents of the University of California.
* All rights reserved.
*
@@ -37,14 +34,12 @@
* For questions and/or comments, please send mail to cbq at ee.lbl.gov
*
* @(#)rm_class.c 1.48 97/12/05 SMI
+ * $KAME: altq_rmclass.c,v 1.19 2005/04/13 03:44:25 suz Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#ifdef ALTQ_CBQ /* cbq is enabled by ALTQ_CBQ option in opt_altq.h */
#include <sys/param.h>
@@ -306,11 +301,7 @@ rmc_newclass(int pri, struct rm_ifdat *i
/*
* put the class into the class tree
*/
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(ifd->ifq_);
if ((peer = ifd->active_[pri]) != NULL) {
/* find the last class at this pri */
@@ -359,11 +350,7 @@ rmc_modclass(struct rm_class *cl, u_int
ifd = cl->ifdat_;
old_allotment = cl->allotment_;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(ifd->ifq_);
cl->allotment_ = RM_NS_PER_SEC / nsecPerByte; /* Bytes per sec */
cl->qthresh_ = 0;
@@ -559,11 +546,7 @@ rmc_delete_class(struct rm_ifdat *ifd, s
if (cl->sleeping_)
CALLOUT_STOP(&cl->callout_);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(ifd->ifq_);
/*
* Free packets in the packet queue.
@@ -1531,13 +1514,8 @@ rmc_delay_action(struct rm_class *cl, st
* a 'backstop' to restart this class.
*/
if (delay > tick * 2) {
-#ifdef __FreeBSD__
/* FreeBSD rounds up the tick */
t = hzto(&cl->undertime_);
-#else
- /* other BSDs round down the tick */
- t = hzto(&cl->undertime_) + 1;
-#endif
} else
t = 2;
CALLOUT_RESET(&cl->callout_, t,
@@ -1568,11 +1546,7 @@ rmc_restart(struct rm_class *cl)
struct rm_ifdat *ifd = cl->ifdat_;
int s;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_LOCK(ifd->ifq_);
if (cl->sleeping_) {
cl->sleeping_ = 0;
Modified: projects/ifnet/sys/net/altq/altq_rmclass_debug.h
==============================================================================
--- projects/ifnet/sys/net/altq/altq_rmclass_debug.h Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_rmclass_debug.h Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,6 +1,4 @@
-/* $KAME: altq_rmclass_debug.h,v 1.3 2002/11/29 04:36:24 kjc Exp $ */
-
-/*
+/*-
* Copyright (c) Sun Microsystems, Inc. 1998 All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,6 +26,9 @@
* provided "as is" without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this software.
+ *
+ * $KAME: altq_rmclass_debug.h,v 1.3 2002/11/29 04:36:24 kjc Exp $
+ * $FreeBSD$
*/
#ifndef _ALTQ_ALTQ_RMCLASS_DEBUG_H_
Modified: projects/ifnet/sys/net/altq/altq_subr.c
==============================================================================
--- projects/ifnet/sys/net/altq/altq_subr.c Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_subr.c Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_subr.c,v 1.21 2003/11/06 06:32:53 kjc Exp $ */
-
-/*
+/*-
* Copyright (C) 1997-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -25,15 +22,14 @@
* 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.
+ *
+ * $KAME: altq_subr.c,v 1.21 2003/11/06 06:32:53 kjc Exp $
+ * $FreeBSD$
*/
-#if defined(__FreeBSD__) || defined(__NetBSD__)
#include "opt_altq.h"
#include "opt_inet.h"
-#ifdef __FreeBSD__
#include "opt_inet6.h"
-#endif
-#endif /* __FreeBSD__ || __NetBSD__ */
#include <sys/param.h>
#include <sys/malloc.h>
@@ -52,9 +48,7 @@
#include <net/if_var.h>
#include <net/if_dl.h>
#include <net/if_types.h>
-#ifdef __FreeBSD__
#include <net/vnet.h>
-#endif
#include <netinet/in.h>
#include <netinet/in_systm.h>
@@ -73,20 +67,14 @@
#endif
/* machine dependent clock related includes */
-#ifdef __FreeBSD__
#include <sys/bus.h>
#include <sys/cpu.h>
#include <sys/eventhandler.h>
#include <machine/clock.h>
-#endif
#if defined(__amd64__) || defined(__i386__)
#include <machine/cpufunc.h> /* for pentium tsc */
#include <machine/specialreg.h> /* for CPUID_TSC */
-#ifdef __FreeBSD__
#include <machine/md_var.h> /* for cpu_feature */
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
-#include <machine/cpu.h> /* for cpu_feature */
-#endif
#endif /* __amd64 || __i386__ */
/*
@@ -254,11 +242,7 @@ altq_enable(ifq)
return 0;
}
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_PURGE_NOLOCK(ifq);
ASSERT(ifq->ifq_len == 0);
ifq->ifq_drv_maxlen = 0; /* disable bulk dequeue */
@@ -283,11 +267,7 @@ altq_disable(ifq)
return 0;
}
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
IFQ_PURGE_NOLOCK(ifq);
ASSERT(ifq->ifq_len == 0);
ifq->altq_flags &= ~(ALTQF_ENABLED|ALTQF_CLASSIFY);
@@ -444,24 +424,16 @@ static void
tbr_timeout(arg)
void *arg;
{
-#ifdef __FreeBSD__
VNET_ITERATOR_DECL(vnet_iter);
-#endif
struct ifnet *ifp;
int active, s;
active = 0;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
-#ifdef __FreeBSD__
IFNET_RLOCK_NOSLEEP();
VNET_LIST_RLOCK_NOSLEEP();
VNET_FOREACH(vnet_iter) {
CURVNET_SET(vnet_iter);
-#endif
for (ifp = TAILQ_FIRST(&V_ifnet); ifp;
ifp = TAILQ_NEXT(ifp, if_list)) {
/* read from if_snd unlocked */
@@ -472,12 +444,10 @@ tbr_timeout(arg)
ifp->if_start != NULL)
(*ifp->if_start)(ifp);
}
-#ifdef __FreeBSD__
CURVNET_RESTORE();
}
VNET_LIST_RUNLOCK_NOSLEEP();
IFNET_RUNLOCK_NOSLEEP();
-#endif
splx(s);
if (active > 0)
CALLOUT_RESET(&tbr_callout, 1, tbr_timeout, (void *)0);
@@ -563,11 +533,7 @@ altq_pfdetach(struct pf_altq *a)
if (a->altq_disc == NULL || a->altq_disc != ifp->if_snd.altq_disc)
return (0);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
/* read unlocked from if_snd, _disable and _detach take care */
if (ALTQ_IS_ENABLED(&ifp->if_snd))
error = altq_disable(&ifp->if_snd);
@@ -926,12 +892,8 @@ init_machclk_setup(void)
#endif
#if defined(__amd64__) || defined(__i386__)
/* check if TSC is available */
-#ifdef __FreeBSD__
if ((cpu_feature & CPUID_TSC) == 0 ||
atomic_load_acq_64(&tsc_freq) == 0)
-#else
- if ((cpu_feature & CPUID_TSC) == 0)
-#endif
machclk_usepcc = 0;
#endif
}
@@ -962,13 +924,7 @@ init_machclk(void)
* accessible, just use it.
*/
#if defined(__amd64__) || defined(__i386__)
-#ifdef __FreeBSD__
machclk_freq = atomic_load_acq_64(&tsc_freq);
-#elif defined(__NetBSD__)
- machclk_freq = (u_int32_t)cpu_tsc_freq;
-#elif defined(__OpenBSD__) && (defined(I586_CPU) || defined(I686_CPU))
- machclk_freq = pentium_mhz * 1000000;
-#endif
#endif
/*
@@ -1449,11 +1405,7 @@ acc_add_filter(classifier, filter, class
* add this filter to the filter list.
* filters are ordered from the highest rule number.
*/
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
prev = NULL;
LIST_FOREACH(tmp, &classifier->acc_filters[i], f_chain) {
if (tmp->f_filter.ff_ruleno > afp->f_filter.ff_ruleno)
@@ -1482,11 +1434,7 @@ acc_delete_filter(classifier, handle)
if ((afp = filth_to_filtp(classifier, handle)) == NULL)
return (EINVAL);
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
LIST_REMOVE(afp, f_chain);
splx(s);
@@ -1510,11 +1458,7 @@ acc_discard_filters(classifier, class, a
struct acc_filter *afp;
int i, s;
-#ifdef __NetBSD__
s = splnet();
-#else
- s = splimp();
-#endif
for (i = 0; i < ACC_FILTER_TABLESIZE; i++) {
do {
LIST_FOREACH(afp, &classifier->acc_filters[i], f_chain)
Modified: projects/ifnet/sys/net/altq/altq_var.h
==============================================================================
--- projects/ifnet/sys/net/altq/altq_var.h Fri Apr 17 11:57:06 2015 (r281649)
+++ projects/ifnet/sys/net/altq/altq_var.h Fri Apr 17 12:10:00 2015 (r281650)
@@ -1,7 +1,4 @@
-/* $FreeBSD$ */
-/* $KAME: altq_var.h,v 1.16 2003/10/03 05:05:15 kjc Exp $ */
-
-/*
+/*-
* Copyright (C) 1998-2003
* Sony Computer Science Laboratories Inc. All rights reserved.
*
@@ -25,6 +22,9 @@
* 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.
+ *
+ * $KAME: altq_var.h,v 1.16 2003/10/03 05:05:15 kjc Exp $
+ * $FreeBSD$
*/
#ifndef _ALTQ_ALTQ_VAR_H_
#define _ALTQ_ALTQ_VAR_H_
@@ -161,7 +161,6 @@ typedef u_long ioctlcmd_t;
#endif
/* macro for timeout/untimeout */
-#if (__FreeBSD_version > 300000) || defined(__NetBSD__)
/* use callout */
#include <sys/callout.h>
@@ -175,35 +174,6 @@ typedef u_long ioctlcmd_t;
#if !defined(CALLOUT_INITIALIZER) && (__FreeBSD_version < 600000)
#define CALLOUT_INITIALIZER { { { NULL } }, 0, NULL, NULL, 0 }
#endif
-#elif defined(__OpenBSD__)
-#include <sys/timeout.h>
-/* callout structure as a wrapper of struct timeout */
-struct callout {
- struct timeout c_to;
-};
-#define CALLOUT_INIT(c) do { bzero((c), sizeof(*(c))); } while (/*CONSTCOND*/ 0)
-#define CALLOUT_RESET(c,t,f,a) do { if (!timeout_initialized(&(c)->c_to)) \
- timeout_set(&(c)->c_to, (f), (a)); \
- timeout_add(&(c)->c_to, (t)); } while (/*CONSTCOND*/ 0)
-#define CALLOUT_STOP(c) timeout_del(&(c)->c_to)
-#define CALLOUT_INITIALIZER { { { NULL }, NULL, NULL, 0, 0 } }
-#else
-/* use old-style timeout/untimeout */
-/* dummy callout structure */
-struct callout {
- void *c_arg; /* function argument */
- void (*c_func)(void *); /* functiuon to call */
-};
-#define CALLOUT_INIT(c) do { bzero((c), sizeof(*(c))); } while (/*CONSTCOND*/ 0)
-#define CALLOUT_RESET(c,t,f,a) do { (c)->c_arg = (a); \
- (c)->c_func = (f); \
- timeout((f),(a),(t)); } while (/*CONSTCOND*/ 0)
-#define CALLOUT_STOP(c) untimeout((c)->c_func,(c)->c_arg)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list