PERFORCE change 115209 for review
Florent Thoumie
flz at FreeBSD.org
Thu Mar 1 15:55:38 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=115209
Change 115209 by flz at flz_work on 2007/03/01 15:55:01
IFC.
Affected files ...
.. //depot/projects/soc2005/launchd/includes/launchd.h#13 edit
.. //depot/user/flz/intel_fw/src/sys/arm/at91/ohci_atmelarm.c#2 integrate
.. //depot/user/flz/intel_fw/src/sys/kern/kern_mutex.c#3 integrate
.. //depot/user/flz/intel_fw/src/sys/kern/kern_sx.c#3 integrate
.. //depot/user/flz/intel_fw/src/sys/kern/uipc_usrreq.c#3 integrate
.. //depot/user/flz/intel_fw/src/sys/net/if_vlan_var.h#2 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet/ip_mroute.c#2 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet/ip_output.c#2 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet/tcp_input.c#3 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet/tcp_output.c#3 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet6/ip6_mroute.c#2 integrate
.. //depot/user/flz/intel_fw/src/sys/netinet6/ip6_mroute.h#2 integrate
.. //depot/user/flz/intel_fw/src/sys/sys/mbuf.h#2 integrate
.. //depot/user/flz/v4l/src/sys/dev/v4l/v4l_var.h#2 edit
.. //depot/user/flz/v4l/src/sys/dev/v4l/videodev.h#2 edit
Differences ...
==== //depot/projects/soc2005/launchd/includes/launchd.h#13 (text+ko) ====
@@ -41,7 +41,7 @@
* Use launchd_assert() for core initialization routines.
*/
#define launchd_assumes(e) \
- (__builtin_expect(!(e), 0) ? syslog(LOG_NOTICE, "Please file a bug report: %s:%u in %s(): (%s) == %u", __FILE__, __LINE__, __func__, #e, errno), false : true)
+ (__builtin_expect(!(e), 0) ? syslog(LOG_NOTICE, "Please file a bug report: %s:%u in %s(): (%s) == %u (%s)", __FILE__, __LINE__, __func__, #e, errno, strerror(errno)), false : true)
#define launchd_assert(e) launchd_assumes(e) ? true : abort();
==== //depot/user/flz/intel_fw/src/sys/arm/at91/ohci_atmelarm.c#2 (text) ====
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/arm/at91/ohci_atmelarm.c,v 1.1 2006/03/18 01:45:29 imp Exp $");
+__FBSDID("$FreeBSD: src/sys/arm/at91/ohci_atmelarm.c,v 1.2 2007/03/01 09:10:55 piso Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -99,8 +99,8 @@
}
device_set_ivars(sc->sc_ohci.sc_bus.bdev, &sc->sc_ohci.sc_bus);
- err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, ohci_intr, sc,
- &sc->sc_ohci.ih);
+ err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, NULL,
+ ohci_intr, sc, &sc->sc_ohci.ih);
if (err) {
err = ENXIO;
goto error;
==== //depot/user/flz/intel_fw/src/sys/kern/kern_mutex.c#3 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.181 2007/02/27 06:42:04 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_mutex.c,v 1.182 2007/03/01 09:35:48 kmacy Exp $");
#include "opt_adaptive_mutexes.h"
#include "opt_ddb.h"
@@ -157,9 +157,9 @@
void
_mtx_unlock_flags(struct mtx *m, int opts, const char *file, int line)
{
-
+#ifdef LOCK_PROFILING
struct lock_object lo;
-
+#endif
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock() of destroyed mutex @ %s:%d", file, line));
@@ -176,7 +176,9 @@
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_sleep_lock(m, curthread, opts, file, line);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
void
@@ -200,9 +202,9 @@
void
_mtx_unlock_spin_flags(struct mtx *m, int opts, const char *file, int line)
{
-
+#ifdef LOCK_PROFILING
struct lock_object lo;
-
+#endif
MPASS(curthread != NULL);
KASSERT(m->mtx_lock != MTX_DESTROYED,
("mtx_unlock_spin() of destroyed mutex @ %s:%d", file, line));
@@ -218,7 +220,9 @@
m->mtx_object.lo_flags &= ~LO_CONTESTED;
#endif
_rel_spin_lock(m);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
/*
==== //depot/user/flz/intel_fw/src/sys/kern/kern_sx.c#3 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.34 2007/02/27 06:42:04 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_sx.c,v 1.35 2007/03/01 09:35:48 kmacy Exp $");
#include "opt_ddb.h"
@@ -228,9 +228,10 @@
void
_sx_sunlock(struct sx *sx, const char *file, int line)
{
+#ifdef LOCK_PROFILING
struct lock_object lo;
int count = -1;
-
+#endif
_sx_assert(sx, SX_SLOCKED, file, line);
mtx_lock(sx->sx_lock);
@@ -262,15 +263,18 @@
LOCK_LOG_LOCK("SUNLOCK", &sx->sx_object, 0, 0, file, line);
mtx_unlock(sx->sx_lock);
+#ifdef LOCK_PROFILING
if (count == 0)
lock_profile_release_lock(&lo);
-
+#endif
}
void
_sx_xunlock(struct sx *sx, const char *file, int line)
{
+#ifdef LOCK_PROFILING
struct lock_object lo;
+#endif
_sx_assert(sx, SX_XLOCKED, file, line);
mtx_lock(sx->sx_lock);
@@ -298,7 +302,9 @@
LOCK_LOG_LOCK("XUNLOCK", &sx->sx_object, 0, 0, file, line);
mtx_unlock(sx->sx_lock);
+#ifdef LOCK_PROFILING
lock_profile_release_lock(&lo);
+#endif
}
int
==== //depot/user/flz/intel_fw/src/sys/kern/uipc_usrreq.c#3 (text+ko) ====
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.198 2007/02/28 08:08:50 rwatson Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/uipc_usrreq.c,v 1.199 2007/03/01 09:00:42 rwatson Exp $");
#include "opt_mac.h"
@@ -774,21 +774,18 @@
unp2 = unp->unp_conn;
if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
if (unp2 != NULL) {
error = EISCONN;
- UNP_PCB_LOCK(unp);
break;
}
error = unp_connect(so, nam, td);
- UNP_PCB_LOCK(unp);
if (error)
break;
unp2 = unp->unp_conn;
} else {
- UNP_PCB_LOCK(unp);
if (unp2 == NULL) {
error = ENOTCONN;
- UNP_PCB_LOCK(unp);
break;
}
}
@@ -799,19 +796,19 @@
* return the slightly counter-intuitive but otherwise
* correct error that the socket is not connected.
*/
- UNP_PCB_LOCK_ASSERT(unp);
if (unp2 == NULL) {
error = ENOTCONN;
break;
}
- UNP_PCB_LOCK(unp2);
- so2 = unp2->unp_socket;
+ /* Lockless read. */
+ if (unp2->unp_flags & UNP_WANTCRED)
+ control = unp_addsockcred(td, control);
+ UNP_PCB_LOCK(unp);
if (unp->unp_addr != NULL)
from = (struct sockaddr *)unp->unp_addr;
else
from = &sun_noname;
- if (unp2->unp_flags & UNP_WANTCRED)
- control = unp_addsockcred(td, control);
+ so2 = unp2->unp_socket;
SOCKBUF_LOCK(&so2->so_rcv);
if (sbappendaddr_locked(&so2->so_rcv, from, m, control)) {
sorwakeup_locked(so2);
@@ -821,9 +818,13 @@
SOCKBUF_UNLOCK(&so2->so_rcv);
error = ENOBUFS;
}
- if (nam != NULL)
+ if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
+ UNP_PCB_LOCK(unp2);
unp_disconnect(unp, unp2);
- UNP_PCB_UNLOCK(unp2);
+ UNP_PCB_UNLOCK(unp2);
+ }
+ UNP_PCB_UNLOCK(unp);
break;
}
@@ -836,18 +837,15 @@
*/
if ((so->so_state & SS_ISCONNECTED) == 0) {
if (nam != NULL) {
+ UNP_GLOBAL_WLOCK_ASSERT();
error = unp_connect(so, nam, td);
- UNP_PCB_LOCK(unp);
if (error)
break; /* XXX */
} else {
error = ENOTCONN;
- UNP_PCB_LOCK(unp);
break;
}
- } else
- UNP_PCB_LOCK(unp);
- UNP_PCB_LOCK_ASSERT(unp);
+ }
/* Lockless read. */
if (so->so_snd.sb_state & SBS_CANTSENDMORE) {
@@ -874,13 +872,12 @@
error = ENOTCONN;
break;
}
+ so2 = unp2->unp_socket;
UNP_PCB_LOCK(unp2);
- so2 = unp2->unp_socket;
SOCKBUF_LOCK(&so2->so_rcv);
if (unp2->unp_flags & UNP_WANTCRED) {
/*
- * Credentials are passed only once on
- * SOCK_STREAM.
+ * Credentials are passed only once on SOCK_STREAM.
*/
unp2->unp_flags &= ~UNP_WANTCRED;
control = unp_addsockcred(td, control);
@@ -915,14 +912,14 @@
}
/*
- * SEND_EOF is equivalent to a SEND followed by
- * a SHUTDOWN.
+ * SEND_EOF is equivalent to a SEND followed by a SHUTDOWN.
*/
if (flags & PRUS_EOF) {
+ UNP_PCB_LOCK(unp);
socantsendmore(so);
unp_shutdown(unp);
+ UNP_PCB_UNLOCK(unp);
}
- UNP_PCB_UNLOCK(unp);
if ((nam != NULL) || (flags & PRUS_EOF))
UNP_GLOBAL_WUNLOCK();
==== //depot/user/flz/intel_fw/src/sys/net/if_vlan_var.h#2 (text+ko) ====
@@ -26,7 +26,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.25 2006/09/17 13:33:29 andre Exp $
+ * $FreeBSD: src/sys/net/if_vlan_var.h,v 1.26 2007/02/28 22:05:30 bms Exp $
*/
#ifndef _NET_IF_VLAN_VAR_H_
@@ -40,9 +40,40 @@
u_int16_t evl_proto;
};
-#define EVL_VLID_MASK 0x0FFF
-#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
-#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
+#define EVL_VLID_MASK 0x0FFF
+#define EVL_PRI_MASK 0xE000
+#define EVL_VLANOFTAG(tag) ((tag) & EVL_VLID_MASK)
+#define EVL_PRIOFTAG(tag) (((tag) >> 13) & 7)
+#define EVL_CFIOFTAG(tag) (((tag) >> 12) & 1)
+#define EVL_MAKETAG(vlid, pri, cfi) \
+ ((((((pri) & 7) << 1) | ((cfi) & 1)) << 12) | ((vlid) & EVL_VLID_MASK))
+
+/* Set the VLAN ID in an mbuf packet header non-destructively. */
+#define EVL_APPLY_VLID(m, vlid) \
+ do { \
+ if ((m)->m_flags & M_VLANTAG) { \
+ (m)->m_pkthdr.ether_vtag &= EVL_VLID_MASK; \
+ (m)->m_pkthdr.ether_vtag |= (vlid); \
+ } else { \
+ (m)->m_pkthdr.ether_vtag = (vlid); \
+ (m)->m_flags |= M_VLANTAG; \
+ } \
+ } while (0)
+
+/* Set the priority ID in an mbuf packet header non-destructively. */
+#define EVL_APPLY_PRI(m, pri) \
+ do { \
+ if ((m)->m_flags & M_VLANTAG) { \
+ uint16_t __vlantag = (m)->m_pkthdr.ether_vtag; \
+ (m)->m_pkthdr.ether_vtag |= EVL_MAKETAG( \
+ EVL_VLANOFTAG(__vlantag), (pri), \
+ EVL_CFIOFTAG(__vlantag)); \
+ } else { \
+ (m)->m_pkthdr.ether_vtag = \
+ EVL_MAKETAG(0, (pri), 0); \
+ (m)->m_flags |= M_VLANTAG; \
+ } \
+ } while (0)
/* sysctl(3) tags, for compatibility purposes */
#define VLANCTL_PROTO 1
==== //depot/user/flz/intel_fw/src/sys/netinet/ip_mroute.c#2 (text+ko) ====
@@ -52,7 +52,7 @@
* and PIM-SMv2 and PIM-DM support, advanced API support,
* bandwidth metering and signaling
*
- * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.131 2007/02/25 14:22:03 bms Exp $
+ * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.132 2007/02/28 20:02:24 bms Exp $
*/
#include "opt_inet.h"
@@ -146,6 +146,17 @@
&mfctable, sizeof(mfctable), "S,*mfc[MFCTBLSIZ]",
"Multicast Forwarding Table (struct *mfc[MFCTBLSIZ], netinet/ip_mroute.h)");
+static struct mtx mrouter_mtx;
+#define MROUTER_LOCK() mtx_lock(&mrouter_mtx)
+#define MROUTER_UNLOCK() mtx_unlock(&mrouter_mtx)
+#define MROUTER_LOCK_ASSERT() do { \
+ mtx_assert(&mrouter_mtx, MA_OWNED); \
+ NET_ASSERT_GIANT(); \
+} while (0)
+#define MROUTER_LOCK_INIT() \
+ mtx_init(&mrouter_mtx, "IPv4 multicast forwarding", NULL, MTX_DEF)
+#define MROUTER_LOCK_DESTROY() mtx_destroy(&mrouter_mtx)
+
static struct mtx mfc_mtx;
#define MFC_LOCK() mtx_lock(&mfc_mtx)
#define MFC_UNLOCK() mtx_unlock(&mfc_mtx)
@@ -637,8 +648,6 @@
callout_init(&bw_meter_ch, NET_CALLOUT_MPSAFE);
}
-static struct mtx mrouter_mtx;
-
static void
if_detached_event(void *arg __unused, struct ifnet *ifp)
{
@@ -650,9 +659,9 @@
struct rtdetq *pq;
struct rtdetq *npq;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
}
/*
@@ -696,7 +705,7 @@
MFC_UNLOCK();
VIF_UNLOCK();
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
}
/*
@@ -715,17 +724,17 @@
if (version != 1)
return ENOPROTOOPT;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter != NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return EADDRINUSE;
}
if_detach_event_tag = EVENTHANDLER_REGISTER(ifnet_departure_event,
if_detached_event, NULL, EVENTHANDLER_PRI_ANY);
if (if_detach_event_tag == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return (ENOMEM);
}
@@ -737,7 +746,7 @@
ip_mrouter = so;
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
if (mrtdebug)
log(LOG_DEBUG, "ip_mrouter_init\n");
@@ -758,10 +767,10 @@
struct mfc *rt;
struct rtdetq *rte;
- mtx_lock(&mrouter_mtx);
+ MROUTER_LOCK();
if (ip_mrouter == NULL) {
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
return EINVAL;
}
@@ -826,7 +835,7 @@
reg_vif_num = VIFI_INVALID;
- mtx_unlock(&mrouter_mtx);
+ MROUTER_UNLOCK();
if (mrtdebug)
log(LOG_DEBUG, "ip_mrouter_done\n");
@@ -3027,7 +3036,7 @@
{
switch (type) {
case MOD_LOAD:
- mtx_init(&mrouter_mtx, "mrouter initialization", NULL, MTX_DEF);
+ MROUTER_LOCK_INIT();
MFC_LOCK_INIT();
VIF_LOCK_INIT();
ip_mrouter_reset();
@@ -3040,7 +3049,7 @@
printf("ip_mroute: unable to attach pim encap\n");
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
return (EINVAL);
}
@@ -3055,7 +3064,7 @@
}
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
return (EINVAL);
}
#endif
@@ -3131,7 +3140,7 @@
VIF_LOCK_DESTROY();
MFC_LOCK_DESTROY();
- mtx_destroy(&mrouter_mtx);
+ MROUTER_LOCK_DESTROY();
break;
default:
==== //depot/user/flz/intel_fw/src/sys/netinet/ip_output.c#2 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)ip_output.c 8.3 (Berkeley) 1/21/94
- * $FreeBSD: src/sys/netinet/ip_output.c,v 1.269 2006/12/10 13:44:00 bms Exp $
+ * $FreeBSD: src/sys/netinet/ip_output.c,v 1.270 2007/03/01 13:29:30 bms Exp $
*/
#include "opt_ipfw.h"
@@ -188,30 +188,33 @@
dst->sin_addr = ip->ip_dst;
}
/*
- * If routing to interface only,
- * short circuit routing lookup.
+ * If routing to interface only, short circuit routing lookup.
+ * The use of an all-ones broadcast address implies this; an
+ * interface is specified by the broadcast address of an interface,
+ * or the destination address of a ptp interface.
*/
- if (flags & IP_ROUTETOIF) {
- if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
- (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) {
+ if (flags & IP_SENDONES) {
+ if ((ia = ifatoia(ifa_ifwithbroadaddr(sintosa(dst)))) == NULL &&
+ (ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL) {
ipstat.ips_noroute++;
error = ENETUNREACH;
goto bad;
}
+ ip->ip_dst.s_addr = INADDR_BROADCAST;
+ dst->sin_addr = ip->ip_dst;
ifp = ia->ia_ifp;
ip->ip_ttl = 1;
- isbroadcast = in_broadcast(dst->sin_addr, ifp);
- } else if (flags & IP_SENDONES) {
- if ((ia = ifatoia(ifa_ifwithbroadaddr(sintosa(dst)))) == NULL) {
+ isbroadcast = 1;
+ } else if (flags & IP_ROUTETOIF) {
+ if ((ia = ifatoia(ifa_ifwithdstaddr(sintosa(dst)))) == NULL &&
+ (ia = ifatoia(ifa_ifwithnet(sintosa(dst)))) == NULL) {
ipstat.ips_noroute++;
error = ENETUNREACH;
goto bad;
}
ifp = ia->ia_ifp;
- ip->ip_dst.s_addr = INADDR_BROADCAST;
- dst->sin_addr = ip->ip_dst;
ip->ip_ttl = 1;
- isbroadcast = 1;
+ isbroadcast = in_broadcast(dst->sin_addr, ifp);
} else if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) &&
imo != NULL && imo->imo_multicast_ifp != NULL) {
/*
==== //depot/user/flz/intel_fw/src/sys/netinet/tcp_input.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_input.c 8.12 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.314 2007/02/26 22:25:20 mohans Exp $
+ * $FreeBSD: src/sys/netinet/tcp_input.c,v 1.315 2007/02/28 20:48:00 mohans Exp $
*/
#include "opt_ipfw.h" /* for ipfw_fwd */
@@ -1155,6 +1155,8 @@
tp->ts_recent = to.to_tsval;
tp->ts_recent_age = ticks;
}
+ /* Initial send window, already scaled. */
+ tp->snd_wnd = th->th_win;
if (to.to_flags & TOF_MSS)
tcp_mss(tp, to.to_mss);
if (tp->sack_enable) {
@@ -1484,9 +1486,6 @@
if ((thflags & TH_SYN) == 0)
goto drop;
- /* Initial send window, already scaled. */
- tp->snd_wnd = th->th_win;
-
tp->irs = th->th_seq;
tcp_rcvseqinit(tp);
if (thflags & TH_ACK) {
==== //depot/user/flz/intel_fw/src/sys/netinet/tcp_output.c#3 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)tcp_output.c 8.4 (Berkeley) 5/24/95
- * $FreeBSD: src/sys/netinet/tcp_output.c,v 1.124 2007/02/28 12:47:49 glebius Exp $
+ * $FreeBSD: src/sys/netinet/tcp_output.c,v 1.125 2007/03/01 13:12:09 andre Exp $
*/
#include "opt_inet.h"
@@ -801,13 +801,14 @@
* IP, TCP and Options length to keep ip->ip_len from
* overflowing. Prevent the last segment from being
* fractional thus making them all equal sized and set
- * the flag to continue sending.
+ * the flag to continue sending. TSO is disabled when
+ * IP options or IPSEC are present.
*/
if (len + optlen + ipoptlen > tp->t_maxopd) {
flags &= ~TH_FIN;
if (tso) {
if (len > TCP_MAXWIN - hdrlen) {
- len = TCP_MAXWIN - hdrlen;
+ len = TCP_MAXWIN - hdrlen - optlen;
len = len - (len % (tp->t_maxopd - optlen));
sendalot = 1;
} else if (tp->t_flags & TF_NEEDFIN)
==== //depot/user/flz/intel_fw/src/sys/netinet6/ip6_mroute.c#2 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_mroute.c,v 1.41 2007/02/24 21:09:35 bms Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_mroute.c,v 1.44 2007/02/28 21:58:37 bms Exp $ */
/* $KAME: ip6_mroute.c,v 1.58 2001/12/18 02:36:31 itojun Exp $ */
/*-
@@ -121,6 +121,7 @@
static MALLOC_DEFINE(M_MRTABLE6, "mf6c", "multicast forwarding cache entry");
+/* XXX: this is a very common idiom; move to <sys/mbuf.h> ? */
#define M_HASCL(m) ((m)->m_flags & M_EXT)
static int ip6_mdq __P((struct mbuf *, struct ifnet *, struct mf6c *));
@@ -133,6 +134,8 @@
struct mbuf *));
extern struct domain inet6domain;
+
+/* XXX: referenced from ip_mroute.c for dynamically loading this code. */
struct ip6protosw in6_pim_protosw = {
.pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
@@ -144,18 +147,13 @@
.pr_usrreqs = &rip6_usrreqs
};
-/*
- * Globals. All but ip6_mrtproto and mrt6stat could be static,
- * except for netstat or debugging purposes.
- */
-int ip6_mrouter_ver = 0;
-int ip6_mrtproto = IPPROTO_PIM; /* for netstat only */
+static int ip6_mrouter_ver = 0;
SYSCTL_DECL(_net_inet6);
SYSCTL_DECL(_net_inet6_ip6);
SYSCTL_NODE(_net_inet6, IPPROTO_PIM, pim, CTLFLAG_RW, 0, "PIM");
-struct mrt6stat mrt6stat;
+static struct mrt6stat mrt6stat;
SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, mrt6stat, CTLFLAG_RW,
&mrt6stat, mrt6stat,
"Multicast Routing Statistics (struct mrt6stat, netinet6/ip6_mroute.h)");
@@ -163,13 +161,13 @@
#define NO_RTE_FOUND 0x1
#define RTE_FOUND 0x2
-struct mf6c *mf6ctable[MF6CTBLSIZ];
+static struct mf6c *mf6ctable[MF6CTBLSIZ];
SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mf6ctable, CTLFLAG_RD,
&mf6ctable, sizeof(mf6ctable), "S,*mf6ctable[MF6CTBLSIZ]",
"Multicast Forwarding Table (struct *mf6ctable[MF6CTBLSIZ], "
"netinet6/ip6_mroute.h)");
-u_char n6expire[MF6CTBLSIZ];
+static u_char n6expire[MF6CTBLSIZ];
static struct mif6 mif6table[MAXMIFS];
SYSCTL_OPAQUE(_net_inet6_ip6, OID_AUTO, mif6table, CTLFLAG_RD,
@@ -177,7 +175,7 @@
"Multicast Interfaces (struct mif[MAXMIFS], netinet6/ip6_mroute.h)");
#ifdef MRT6DEBUG
-u_int mrt6debug = 0; /* debug level */
+static u_int mrt6debug = 0; /* debug level */
#define DEBUG_MFC 0x02
#define DEBUG_FORWARD 0x04
#define DEBUG_EXPIRE 0x08
@@ -234,9 +232,7 @@
/*
* Find a route for a given origin IPv6 address and Multicast group address.
- * Quality of service parameter to be added in the future!!!
*/
-
#define MF6CFIND(o, g, rt) do { \
struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \
rt = NULL; \
@@ -258,6 +254,7 @@
/*
* Macros to compute elapsed time efficiently
* Borrowed from Van Jacobson's scheduling code
+ * XXX: replace with timersub() ?
*/
#define TV_DELTA(a, b, delta) do { \
int xxs; \
@@ -277,12 +274,13 @@
} \
} while (/*CONSTCOND*/ 0)
+/* XXX: replace with timercmp(a, b, <) ? */
#define TV_LT(a, b) (((a).tv_usec < (b).tv_usec && \
(a).tv_sec <= (b).tv_sec) || (a).tv_sec < (b).tv_sec)
#ifdef UPCALL_TIMING
#define UPCALL_MAX 50
-u_long upcall_data[UPCALL_MAX + 1];
+static u_long upcall_data[UPCALL_MAX + 1];
static void collate();
#endif /* UPCALL_TIMING */
@@ -546,10 +544,6 @@
}
}
}
-#ifdef notyet
- bzero((caddr_t)qtable, sizeof(qtable));
- bzero((caddr_t)tbftable, sizeof(tbftable));
-#endif
bzero((caddr_t)mif6table, sizeof(mif6table));
nummifs = 0;
@@ -615,9 +609,6 @@
struct mif6 *mifp;
struct ifnet *ifp;
int error, s;
-#ifdef notyet
- struct tbf *m_tbf = tbftable + mifcp->mif6c_mifi;
-#endif
if (mifcp->mif6c_mifi >= MAXMIFS)
return (EINVAL);
@@ -663,10 +654,7 @@
s = splnet();
mifp->m6_flags = mifcp->mif6c_flags;
mifp->m6_ifp = ifp;
-#ifdef notyet
- /* scaling up here allows division by 1024 in critical code */
- mifp->m6_rate_limit = mifcp->mif6c_rate_limit * 1024 / 1000;
-#endif
+
/* initialize per mif pkt counters */
mifp->m6_pkt_in = 0;
mifp->m6_pkt_out = 0;
@@ -726,10 +714,6 @@
}
}
-#ifdef notyet
- bzero((caddr_t)qtable[*mifip], sizeof(qtable[*mifip]));
- bzero((caddr_t)mifp->m6_tbf, sizeof(*(mifp->m6_tbf)));
-#endif
bzero((caddr_t)mifp, sizeof(*mifp));
/* Adjust nummifs down */
==== //depot/user/flz/intel_fw/src/sys/netinet6/ip6_mroute.h#2 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.10 2007/02/24 11:38:47 bms Exp $ */
+/* $FreeBSD: src/sys/netinet6/ip6_mroute.h,v 1.11 2007/02/28 20:32:25 bms Exp $ */
/* $KAME: ip6_mroute.h,v 1.19 2001/06/14 06:12:55 suz Exp $ */
/*-
@@ -103,9 +103,6 @@
mifi_t mif6c_mifi; /* the index of the mif to be added */
u_char mif6c_flags; /* MIFF_ flags defined below */
u_short mif6c_pifi; /* the index of the physical IF */
-#ifdef notyet
- u_int mif6c_rate_limit; /* max rate */
-#endif
};
#define MIFF_REGISTER 0x1 /* mif represents a register end-point */
@@ -209,9 +206,6 @@
struct mif6 {
u_char m6_flags; /* MIFF_ flags defined above */
u_int m6_rate_limit; /* max rate */
-#ifdef notyet
- struct tbf *m6_tbf; /* token bucket structure at intf. */
-#endif
struct in6_addr m6_lcl_addr; /* local interface address */
struct ifnet *m6_ifp; /* pointer to interface */
u_quad_t m6_pkt_in; /* # pkts in on interface */
==== //depot/user/flz/intel_fw/src/sys/sys/mbuf.h#2 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)mbuf.h 8.5 (Berkeley) 2/19/95
- * $FreeBSD: src/sys/sys/mbuf.h,v 1.202 2007/01/25 01:05:23 mohans Exp $
+ * $FreeBSD: src/sys/sys/mbuf.h,v 1.203 2007/03/01 14:38:08 bms Exp $
*/
#ifndef _SYS_MBUF_H_
@@ -182,6 +182,7 @@
#define M_FIRSTFRAG 0x1000 /* packet is first fragment */
#define M_LASTFRAG 0x2000 /* packet is last fragment */
#define M_VLANTAG 0x10000 /* ether_vtag is valid */
+#define M_PROMISC 0x20000 /* packet was not for us */
/*
* External buffer types: identify ext_buf type.
@@ -203,7 +204,7 @@
#define M_COPYFLAGS (M_PKTHDR|M_EOR|M_RDONLY|M_PROTO1|M_PROTO1|M_PROTO2|\
M_PROTO3|M_PROTO4|M_PROTO5|M_SKIP_FIREWALL|\
M_BCAST|M_MCAST|M_FRAG|M_FIRSTFRAG|M_LASTFRAG|\
- M_VLANTAG)
+ M_VLANTAG|M_PROMISC)
/*
* Flags to purge when crossing layers.
==== //depot/user/flz/v4l/src/sys/dev/v4l/v4l_var.h#2 (text+ko) ====
@@ -36,6 +36,32 @@
#define DPRINTF(x, params) if (v4l_debug >= x) printf params
+struct v4l2_device
+{
+ char name[32];
+ int type;
+ int minor;
+
+ int (*open)(struct v4l2_device *v, int flag, int otyp, struct thread *td);
+ void (*close)(struct v4l2_device *v, int flag, int otyp, struct thread *td);
+ long (*read)(struct v4l2_device *v, struct uio *uio, int ioflag);
+ long (*write)(struct v4l2_device *v, struct uio *uio, int ioflag);
+ int (*ioctl)(struct v4l2_device *v, u_long cmd, caddr_t arg, int mode, struct thread *td);
+ int (*mmap)(void /*struct vm_area_struct *vma*/);
+ int (*poll)(void /*struct file *file, poll_table *table*/);
+
+ int (*initialize)(struct v4l2_device *v);
+ void *priv; /* may be used by the driver */
+
+ int busy; /* open count maintained by videodev.c */
+ void *v4l2_priv; /* for V4L2 use */
+ int v4l2_reserved[4]; /* for V4L2 use */
+
+ struct cdev * devfs_handle;
+ char devfs_devname[16];
+ struct mtx mtx;
+};
+
extern int v4l_debug;
extern struct cdevsw v4l_cdevsw;
extern struct v4l2_device *video_devices[V4L_NUM_DEVICES];
==== //depot/user/flz/v4l/src/sys/dev/v4l/videodev.h#2 (text+ko) ====
@@ -910,35 +910,6 @@
#define V4L2_STD_SECAM_L 28 /* (France, Luxembourg, Monaco) */
#define V4L2_STD_SECAM_M 29 /* (Jamaica) */
-/*
- * D E V I C E D R I V E R R E G I S T R A T I O N
- *
- */
-struct v4l2_device
-{
- char name[32];
- int type;
- int minor;
-
- int (*open)(struct v4l2_device *v, int flag, int otyp, struct thread *td);
- void (*close)(struct v4l2_device *v, int flag, int otyp, struct thread *td);
- long (*read)(struct v4l2_device *v, struct uio *uio, int ioflag);
- long (*write)(struct v4l2_device *v, struct uio *uio, int ioflag);
- int (*ioctl)(struct v4l2_device *v, u_long cmd, caddr_t arg, int mode, struct thread *td);
- int (*mmap)(void /*struct vm_area_struct *vma*/);
- int (*poll)(void /*struct file *file, poll_table *table*/);
-
- int (*initialize)(struct v4l2_device *v);
- void *priv; /* may be used by the driver */
-
- int busy; /* open count maintained by videodev.c */
- void *v4l2_priv; /* for V4L2 use */
- int v4l2_reserved[4]; /* for V4L2 use */
-
- struct cdev * devfs_handle;
- char devfs_devname[16];
-};
-
/* Size of kernel ioctl arg buffer used in ioctl handler */
#define V4L2_MAX_IOCTL_SIZE 256
More information about the p4-projects
mailing list