PERFORCE change 161150 for review
Marko Zec
zec at FreeBSD.org
Sun Apr 26 22:27:47 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=161150
Change 161150 by zec at zec_amdx2 on 2009/04/26 22:26:59
IFC @ 161147
Affected files ...
.. //depot/projects/vimage/src/sys/compat/linux/linux_socket.c#17 integrate
.. //depot/projects/vimage/src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c#17 integrate
.. //depot/projects/vimage/src/sys/dev/ata/atapi-tape.c#9 integrate
.. //depot/projects/vimage/src/sys/kern/kern_rmlock.c#3 integrate
.. //depot/projects/vimage/src/sys/net/if_loop.c#45 integrate
.. //depot/projects/vimage/src/sys/net/route.c#48 integrate
.. //depot/projects/vimage/src/sys/net/rtsock.c#32 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_adhoc.c#9 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_hostap.c#10 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_ioctl.c#22 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_output.c#23 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_sta.c#9 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_superg.c#2 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_var.h#25 integrate
.. //depot/projects/vimage/src/sys/net80211/ieee80211_wds.c#9 integrate
.. //depot/projects/vimage/src/sys/netinet/igmp.c#34 integrate
.. //depot/projects/vimage/src/sys/netinet/in.c#33 integrate
.. //depot/projects/vimage/src/sys/netinet/in_mcast.c#25 integrate
.. //depot/projects/vimage/src/sys/netinet/in_rmx.c#32 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_carp.c#22 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_divert.c#29 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_fw2.c#74 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_mroute.c#21 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#81 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#31 integrate
.. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#52 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_rmx.c#33 integrate
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#34 integrate
.. //depot/projects/vimage/src/sys/netipx/spx_usrreq.c#5 integrate
.. //depot/projects/vimage/src/sys/sys/mbuf.h#18 integrate
.. //depot/projects/vimage/src/sys/sys/queue.h#3 integrate
.. //depot/projects/vimage/src/sys/vm/swap_pager.c#18 integrate
.. //depot/projects/vimage/src/sys/vm/vm_fault.c#15 integrate
Differences ...
==== //depot/projects/vimage/src/sys/compat/linux/linux_socket.c#17 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.80 2008/12/02 21:37:28 bz Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_socket.c,v 1.81 2009/04/26 22:06:42 zec Exp $");
/* XXX we use functions that might not exist. */
#include "opt_compat.h"
@@ -583,9 +583,11 @@
static int
linux_socket(struct thread *td, struct linux_socket_args *args)
{
-#if defined(INET6) && !defined(KLD_MODULE)
+#ifdef INET6
+#ifndef KLD_MODULE
INIT_VNET_INET6(curvnet);
#endif
+#endif
struct socket_args /* {
int domain;
int type;
==== //depot/projects/vimage/src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c#17 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c,v 1.16 2009/04/16 20:30:28 kmacy Exp $ */
+/* $FreeBSD: src/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c,v 1.17 2009/04/26 22:06:42 zec Exp $ */
/*
* Copyright (C) 1993-2003 by Darren Reed.
@@ -213,6 +213,7 @@
int ipfattach()
{
+ INIT_VNET_INET(curvnet);
#ifdef USE_SPL
int s;
#endif
@@ -266,6 +267,7 @@
*/
int ipfdetach()
{
+ INIT_VNET_INET(curvnet);
#ifdef USE_SPL
int s;
#endif
==== //depot/projects/vimage/src/sys/dev/ata/atapi-tape.c#9 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.113 2009/02/28 22:07:15 mav Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/ata/atapi-tape.c,v 1.114 2009/04/26 09:21:37 ed Exp $");
#include "opt_ata.h"
#include <sys/param.h>
@@ -138,15 +138,13 @@
DEVSTAT_NO_ORDERED_TAGS,
DEVSTAT_TYPE_SEQUENTIAL | DEVSTAT_TYPE_IF_IDE,
DEVSTAT_PRIORITY_TAPE);
- device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev),
- UID_ROOT, GID_OPERATOR, 0640, "ast%d",
- device_get_unit(dev));
+ device = make_dev(&ast_cdevsw, 0, UID_ROOT, GID_OPERATOR, 0640,
+ "ast%d", device_get_unit(dev));
device->si_drv1 = dev;
device->si_iosize_max = ch->dma.max_iosize ? ch->dma.max_iosize : DFLTPHYS;
stp->dev1 = device;
- device = make_dev(&ast_cdevsw, 2 * device_get_unit(dev) + 1,
- UID_ROOT, GID_OPERATOR, 0640, "nast%d",
- device_get_unit(dev));
+ device = make_dev(&ast_cdevsw, 1, UID_ROOT, GID_OPERATOR, 0640,
+ "nast%d", device_get_unit(dev));
device->si_drv1 = dev;
device->si_iosize_max = ch->dma.max_iosize;
stp->dev2 = device;
@@ -238,8 +236,8 @@
(stp->flags & (F_DATA_WRITTEN | F_FM_WRITTEN)) == F_DATA_WRITTEN)
ast_write_filemark(dev, ATAPI_WF_WRITE);
- /* if minor is even rewind on close */
- if (!(dev2unit(cdev) & 0x01))
+ /* if unit is zero rewind on close */
+ if (dev2unit(cdev) == 0)
ast_rewind(dev);
if (stp->cap.lock && count_dev(cdev) == 1)
==== //depot/projects/vimage/src/sys/kern/kern_rmlock.c#3 (text+ko) ====
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/kern/kern_rmlock.c,v 1.4 2008/09/10 19:13:30 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/kern/kern_rmlock.c,v 1.5 2009/04/26 21:16:03 rwatson Exp $");
#include "opt_ddb.h"
@@ -55,25 +55,23 @@
#ifdef DDB
#include <ddb/ddb.h>
#endif
-
+
#define RMPF_ONQUEUE 1
#define RMPF_SIGNAL 2
-/*
- * To support usage of rmlock in CVs and msleep
- * yet another list for the priority tracker
- * would be needed.
- * Using this lock for cv and msleep also does
- * not seem very useful
+/*
+ * To support usage of rmlock in CVs and msleep yet another list for the
+ * priority tracker would be needed. Using this lock for cv and msleep also
+ * does not seem very useful
*/
static __inline void compiler_memory_barrier(void) {
__asm __volatile("":::"memory");
}
-static void assert_rm(struct lock_object *lock, int what);
-static void lock_rm(struct lock_object *lock, int how);
-static int unlock_rm(struct lock_object *lock);
+static void assert_rm(struct lock_object *lock, int what);
+static void lock_rm(struct lock_object *lock, int how);
+static int unlock_rm(struct lock_object *lock);
struct lock_class lock_class_rm = {
.lc_name = "rm",
@@ -96,12 +94,16 @@
}
static void
-lock_rm(struct lock_object *lock, int how) {
+lock_rm(struct lock_object *lock, int how)
+{
+
panic("lock_rm called");
}
static int
-unlock_rm(struct lock_object *lock) {
+unlock_rm(struct lock_object *lock)
+{
+
panic("unlock_rm called");
}
@@ -111,75 +113,79 @@
/*
* Add or remove tracker from per cpu list.
- * The per cpu list can be traversed at any time in forward
- * direction from an interrupt on the *local* cpu.
+ *
+ * The per cpu list can be traversed at any time in forward direction from an
+ * interrupt on the *local* cpu.
*/
-
-static void inline
-rm_tracker_add(struct pcpu *pc, struct rm_priotracker* tracker) {
- struct rm_queue* next;
+static void inline
+rm_tracker_add(struct pcpu *pc, struct rm_priotracker *tracker)
+{
+ struct rm_queue *next;
+
/* Initialize all tracker pointers */
tracker->rmp_cpuQueue.rmq_prev = &pc->pc_rm_queue;
next = pc->pc_rm_queue.rmq_next;
tracker->rmp_cpuQueue.rmq_next = next;
- /* rmq_prev is not used during froward traversal */
+
+ /* rmq_prev is not used during froward traversal. */
next->rmq_prev = &tracker->rmp_cpuQueue;
- /* Update pointer to first element */
+
+ /* Update pointer to first element. */
pc->pc_rm_queue.rmq_next = &tracker->rmp_cpuQueue;
}
+static void inline
+rm_tracker_remove(struct pcpu *pc, struct rm_priotracker *tracker)
+{
+ struct rm_queue *next, *prev;
-static void inline
-rm_tracker_remove(struct pcpu *pc, struct rm_priotracker* tracker) {
- struct rm_queue *next, *prev;
- next = tracker->rmp_cpuQueue.rmq_next;
- prev = tracker->rmp_cpuQueue.rmq_prev;
- /* Not used during forward traversal */
+ next = tracker->rmp_cpuQueue.rmq_next;
+ prev = tracker->rmp_cpuQueue.rmq_prev;
+
+ /* Not used during forward traversal. */
next->rmq_prev = prev;
- /* Remove from list */
+
+ /* Remove from list. */
prev->rmq_next = next;
}
-
-
-
-static void rm_cleanIPI(void *arg) {
+static void
+rm_cleanIPI(void *arg)
+{
struct pcpu *pc;
- struct rmlock* rm = arg;
+ struct rmlock *rm = arg;
struct rm_priotracker *tracker;
- struct rm_queue* queue;
+ struct rm_queue *queue;
pc = pcpu_find(curcpu);
- for(queue = pc->pc_rm_queue.rmq_next;
- queue != &pc->pc_rm_queue;
+ for (queue = pc->pc_rm_queue.rmq_next; queue != &pc->pc_rm_queue;
queue = queue->rmq_next) {
- tracker = (struct rm_priotracker *) queue;
- if(tracker->rmp_rmlock == rm && tracker->rmp_flags == 0 ) {
+ tracker = (struct rm_priotracker *)queue;
+ if (tracker->rmp_rmlock == rm && tracker->rmp_flags == 0) {
tracker->rmp_flags = RMPF_ONQUEUE;
mtx_lock_spin(&rm_spinlock);
- LIST_INSERT_HEAD(&rm->rm_activeReaders,tracker,
+ LIST_INSERT_HEAD(&rm->rm_activeReaders, tracker,
rmp_qentry);
mtx_unlock_spin(&rm_spinlock);
}
}
- return;
}
-
-
void
rm_init(struct rmlock *rm, const char *name, int opts)
{
+
rm->rm_noreadtoken = 1;
LIST_INIT(&rm->rm_activeReaders);
mtx_init(&rm->rm_lock, name, "RM_MTX",MTX_NOWITNESS);
- lock_init(&rm->lock_object, &lock_class_rm, name, NULL, (opts & LO_RECURSABLE)| LO_WITNESS);
-
+ lock_init(&rm->lock_object, &lock_class_rm, name, NULL,
+ (opts & LO_RECURSABLE)| LO_WITNESS);
}
void
rm_destroy(struct rmlock *rm)
{
+
mtx_destroy(&rm->rm_lock);
lock_destroy(&rm->lock_object);
}
@@ -194,71 +200,64 @@
void
rm_sysinit(void *arg)
{
+
struct rm_args *args = arg;
rm_init(args->ra_rm, args->ra_desc, args->ra_opts);
}
-
static void
-_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker* tracker)
+_rm_rlock_hard(struct rmlock *rm, struct rm_priotracker *tracker)
{
struct pcpu *pc;
struct rm_queue *queue;
- struct rm_priotracker* atracker;
+ struct rm_priotracker *atracker;
critical_enter();
pc = pcpu_find(curcpu);
- /* Check if we just need to do a proper critical_exit */
+ /* Check if we just need to do a proper critical_exit. */
if (0 == rm->rm_noreadtoken) {
critical_exit();
return;
}
- /* Remove our tracker from the per cpu list */
- rm_tracker_remove(pc,tracker);
+ /* Remove our tracker from the per cpu list. */
+ rm_tracker_remove(pc, tracker);
- /* Check to see if the IPI granted us the lock after all */
- if(tracker->rmp_flags) {
- /* Just add back tracker - we hold the lock */
- rm_tracker_add(pc,tracker);
+ /* Check to see if the IPI granted us the lock after all. */
+ if (tracker->rmp_flags) {
+ /* Just add back tracker - we hold the lock. */
+ rm_tracker_add(pc, tracker);
critical_exit();
return;
}
-
-
/*
- * We allow readers to aquire a lock even if a writer
- * is blocked if the lock is recursive and the reader
- * already holds the lock
+ * We allow readers to aquire a lock even if a writer is blocked if
+ * the lock is recursive and the reader already holds the lock.
*/
-
if ((rm->lock_object.lo_flags & LO_RECURSABLE) != 0) {
/*
* Just grand the lock if this thread already have a tracker
- * for this lock on the per cpu queue
+ * for this lock on the per cpu queue.
*/
-
- for(queue = pc->pc_rm_queue.rmq_next;
- queue != &pc->pc_rm_queue;
- queue = queue->rmq_next) {
- atracker = (struct rm_priotracker *) queue;
- if (( atracker->rmp_rmlock == rm) &&
- ( atracker->rmp_thread == tracker->rmp_thread )) {
+ for (queue = pc->pc_rm_queue.rmq_next;
+ queue != &pc->pc_rm_queue; queue = queue->rmq_next) {
+ atracker = (struct rm_priotracker *)queue;
+ if ((atracker->rmp_rmlock == rm) &&
+ (atracker->rmp_thread == tracker->rmp_thread)) {
mtx_lock_spin(&rm_spinlock);
- LIST_INSERT_HEAD(&rm->rm_activeReaders,tracker,
- rmp_qentry);
+ LIST_INSERT_HEAD(&rm->rm_activeReaders,
+ tracker, rmp_qentry);
tracker->rmp_flags = RMPF_ONQUEUE;
mtx_unlock_spin(&rm_spinlock);
- rm_tracker_add(pc,tracker);
+ rm_tracker_add(pc, tracker);
critical_exit();
return;
}
}
}
-
sched_unpin();
critical_exit();
@@ -267,16 +266,15 @@
critical_enter();
pc = pcpu_find(curcpu);
- rm_tracker_add(pc,tracker);
+ rm_tracker_add(pc, tracker);
sched_pin();
critical_exit();
-
+
mtx_unlock(&rm->rm_lock);
- return;
}
void
-_rm_rlock(struct rmlock *rm, struct rm_priotracker* tracker)
+_rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker)
{
struct thread *td = curthread;
struct pcpu *pc;
@@ -291,51 +289,46 @@
pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */
- rm_tracker_add(pc,tracker);
+ rm_tracker_add(pc, tracker);
td->td_pinned++; /* sched_pin(); */
compiler_memory_barrier();
td->td_critnest--;
-
- /*
- * Fast path to combine two common conditions
- * into a single conditional jump
+
+ /*
+ * Fast path to combine two common conditions into a single
+ * conditional jump.
*/
-
- if (0 == (td->td_owepreempt | rm->rm_noreadtoken)) {
+ if (0 == (td->td_owepreempt | rm->rm_noreadtoken))
return;
- }
- /* We do not have a read token and need to acquire one */
- _rm_rlock_hard(rm,tracker);
+ /* We do not have a read token and need to acquire one. */
+ _rm_rlock_hard(rm, tracker);
}
-
static void
-_rm_unlock_hard(struct thread *td,struct rm_priotracker* tracker)
+_rm_unlock_hard(struct thread *td,struct rm_priotracker *tracker)
{
-
+
if (td->td_owepreempt) {
td->td_critnest++;
critical_exit();
}
-
- if (!tracker->rmp_flags) {
+
+ if (!tracker->rmp_flags)
return;
- }
-
mtx_lock_spin(&rm_spinlock);
- LIST_REMOVE(tracker,rmp_qentry);
+ LIST_REMOVE(tracker, rmp_qentry);
if (tracker->rmp_flags & RMPF_SIGNAL) {
struct rmlock *rm;
- struct turnstile* ts;
+ struct turnstile *ts;
rm = tracker->rmp_rmlock;
-
+
turnstile_chain_lock(&rm->lock_object);
mtx_unlock_spin(&rm_spinlock);
@@ -344,35 +337,28 @@
turnstile_signal(ts, TS_EXCLUSIVE_QUEUE);
turnstile_unpend(ts, TS_EXCLUSIVE_LOCK);
turnstile_chain_unlock(&rm->lock_object);
-
-
} else
mtx_unlock_spin(&rm_spinlock);
-
-}
+}
void
-_rm_runlock(struct rmlock *rm, struct rm_priotracker* tracker)
+_rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker)
{
struct pcpu *pc;
struct thread *td = tracker->rmp_thread;
td->td_critnest++; /* critical_enter(); */
pc = cpuid_to_pcpu[td->td_oncpu]; /* pcpu_find(td->td_oncpu); */
- rm_tracker_remove(pc,tracker);
+ rm_tracker_remove(pc, tracker);
td->td_critnest--;
td->td_pinned--; /* sched_unpin(); */
- if (0 == (td->td_owepreempt | tracker->rmp_flags))
+ if (0 == (td->td_owepreempt | tracker->rmp_flags))
return;
-
- _rm_unlock_hard(td,tracker);
-
-
+ _rm_unlock_hard(td, tracker);
}
-
void
_rm_wlock(struct rmlock *rm)
{
@@ -386,53 +372,46 @@
rm->rm_noreadtoken = 1;
- /*
- * Assumes rm->rm_noreadtoken update is visible
- * on other CPUs before rm_cleanIPI is called
+ /*
+ * Assumes rm->rm_noreadtoken update is visible on other CPUs
+ * before rm_cleanIPI is called.
*/
#ifdef SMP
smp_rendezvous(smp_no_rendevous_barrier,
rm_cleanIPI,
- smp_no_rendevous_barrier
- ,rm);
+ smp_no_rendevous_barrier,
+ rm);
#else
rm_cleanIPI(rm);
#endif
-
mtx_lock_spin(&rm_spinlock);
-
- while((prio = LIST_FIRST(&rm->rm_activeReaders)) != NULL) {
+ while ((prio = LIST_FIRST(&rm->rm_activeReaders)) != NULL) {
ts = turnstile_trywait(&rm->lock_object);
prio->rmp_flags = RMPF_ONQUEUE | RMPF_SIGNAL;
mtx_unlock_spin(&rm_spinlock);
- turnstile_wait(ts,prio->rmp_thread,
- TS_EXCLUSIVE_QUEUE);
+ turnstile_wait(ts, prio->rmp_thread,
+ TS_EXCLUSIVE_QUEUE);
mtx_lock_spin(&rm_spinlock);
-
}
-
mtx_unlock_spin(&rm_spinlock);
}
-
}
-
void
_rm_wunlock(struct rmlock *rm)
{
+
mtx_unlock(&rm->rm_lock);
}
-
#ifdef LOCK_DEBUG
void _rm_wlock_debug(struct rmlock *rm, const char *file, int line)
{
-
- WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE,
+ WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER | LOP_EXCLUSIVE,
file, line, NULL);
_rm_wlock(rm);
@@ -445,71 +424,75 @@
}
-void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line)
+void
+_rm_wunlock_debug(struct rmlock *rm, const char *file, int line)
{
+
curthread->td_locks--;
WITNESS_UNLOCK(&rm->lock_object, LOP_EXCLUSIVE, file, line);
LOCK_LOG_LOCK("RMWUNLOCK", &rm->lock_object, 0, 0, file, line);
_rm_wunlock(rm);
-}
+}
-
-void
+void
_rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
const char *file, int line)
{
+ WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER, file, line, NULL);
- WITNESS_CHECKORDER(&rm->lock_object, LOP_NEWORDER , file, line, NULL);
-
_rm_rlock(rm, tracker);
LOCK_LOG_LOCK("RMRLOCK", &rm->lock_object, 0, 0, file, line);
- WITNESS_LOCK(&rm->lock_object, 0 , file, line);
+ WITNESS_LOCK(&rm->lock_object, 0, file, line);
- curthread->td_locks++;
+ curthread->td_locks++;
}
-void
+void
_rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
- const char *file, int line) {
+ const char *file, int line)
+{
+
curthread->td_locks--;
- WITNESS_UNLOCK(&rm->lock_object, 0 , file, line);
+ WITNESS_UNLOCK(&rm->lock_object, 0, file, line);
LOCK_LOG_LOCK("RMRUNLOCK", &rm->lock_object, 0, 0, file, line);
_rm_runlock(rm, tracker);
}
-
-
-
#else
-/*
- * Just strip out file and line arguments if no lock debugging is enabled
- * in the kernel - we are called from a kernel module.
-*/
+/*
+ * Just strip out file and line arguments if no lock debugging is enabled in
+ * the kernel - we are called from a kernel module.
+ */
+void
+_rm_wlock_debug(struct rmlock *rm, const char *file, int line)
+{
-void _rm_wlock_debug(struct rmlock *rm, const char *file, int line)
-{
_rm_wlock(rm);
}
-void _rm_wunlock_debug(struct rmlock *rm, const char *file, int line)
+void
+_rm_wunlock_debug(struct rmlock *rm, const char *file, int line)
{
+
_rm_wunlock(rm);
-}
-
-void
+}
+
+void
_rm_rlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
const char *file, int line)
{
+
_rm_rlock(rm, tracker);
}
-void
+void
_rm_runlock_debug(struct rmlock *rm, struct rm_priotracker *tracker,
const char *file, int line) {
+
_rm_runlock(rm, tracker);
}
==== //depot/projects/vimage/src/sys/net/if_loop.c#45 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)if_loop.c 8.2 (Berkeley) 1/9/95
- * $FreeBSD: src/sys/net/if_loop.c,v 1.131 2009/04/16 20:30:28 kmacy Exp $
+ * $FreeBSD: src/sys/net/if_loop.c,v 1.132 2009/04/26 22:06:42 zec Exp $
*/
/*
==== //depot/projects/vimage/src/sys/net/route.c#48 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)route.c 8.3.1.1 (Berkeley) 2/23/95
- * $FreeBSD: src/sys/net/route.c,v 1.153 2009/04/14 23:05:36 kmacy Exp $
+ * $FreeBSD: src/sys/net/route.c,v 1.154 2009/04/26 22:06:42 zec Exp $
*/
/************************************************************************
* Note: In this file a 'fib' is a "forwarding information base" *
==== //depot/projects/vimage/src/sys/net/rtsock.c#32 (text+ko) ====
@@ -27,7 +27,7 @@
* SUCH DAMAGE.
*
* @(#)rtsock.c 8.7 (Berkeley) 10/12/95
- * $FreeBSD: src/sys/net/rtsock.c,v 1.169 2009/04/20 23:23:31 rwatson Exp $
+ * $FreeBSD: src/sys/net/rtsock.c,v 1.170 2009/04/26 22:06:42 zec Exp $
*/
#include "opt_sctp.h"
#include "opt_mpath.h"
@@ -1206,7 +1206,6 @@
static void
rt_dispatch(struct mbuf *m, const struct sockaddr *sa)
{
- INIT_VNET_NET(curvnet);
struct m_tag *tag;
/*
==== //depot/projects/vimage/src/sys/net80211/ieee80211_adhoc.c#9 (text+ko) ====
@@ -25,7 +25,7 @@
#include <sys/cdefs.h>
#ifdef __FreeBSD__
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_adhoc.c,v 1.10 2009/03/24 20:39:08 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_adhoc.c,v 1.13 2009/04/26 21:50:21 sam Exp $");
#endif
/*
@@ -74,6 +74,7 @@
int subtype, int rssi, int noise, uint32_t rstamp);
static void ahdemo_recv_mgmt(struct ieee80211_node *, struct mbuf *,
int subtype, int rssi, int noise, uint32_t rstamp);
+static void adhoc_recv_ctl(struct ieee80211_node *, struct mbuf *, int subtype);
void
ieee80211_adhoc_attach(struct ieee80211com *ic)
@@ -101,6 +102,7 @@
vap->iv_recv_mgmt = adhoc_recv_mgmt;
else
vap->iv_recv_mgmt = ahdemo_recv_mgmt;
+ vap->iv_recv_ctl = adhoc_recv_ctl;
vap->iv_opdetach = adhoc_vdetach;
#ifdef IEEE80211_SUPPORT_TDMA
/*
@@ -339,7 +341,8 @@
if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
IEEE80211_FC0_VERSION_0) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
- ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]);
+ ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x",
+ wh->i_fc[0], wh->i_fc[1]);
vap->iv_stats.is_rx_badversion++;
goto err;
}
@@ -637,15 +640,13 @@
vap->iv_stats.is_rx_mgtdiscard++; /* XXX */
goto out;
}
- if (bpf_peers_present(vap->iv_rawbpf))
- bpf_mtap(vap->iv_rawbpf, m);
vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp);
- m_freem(m);
- return IEEE80211_FC0_TYPE_MGT;
+ goto out;
case IEEE80211_FC0_TYPE_CTL:
vap->iv_stats.is_rx_ctl++;
IEEE80211_NODE_STAT(ni, rx_ctrl);
+ vap->iv_recv_ctl(ni, m, subtype);
goto out;
default:
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
@@ -657,7 +658,7 @@
ifp->if_ierrors++;
out:
if (m != NULL) {
- if (bpf_peers_present(vap->iv_rawbpf) && need_tap)
+ if (need_tap && bpf_peers_present(vap->iv_rawbpf))
bpf_mtap(vap->iv_rawbpf, m);
m_freem(m);
}
@@ -924,3 +925,8 @@
else
vap->iv_stats.is_rx_mgtdiscard++;
}
+
+static void
+adhoc_recv_ctl(struct ieee80211_node *ni, struct mbuf *m0, int subtype)
+{
+}
==== //depot/projects/vimage/src/sys/net80211/ieee80211_hostap.c#10 (text+ko) ====
@@ -25,7 +25,7 @@
#include <sys/cdefs.h>
#ifdef __FreeBSD__
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_hostap.c,v 1.16 2009/03/30 21:53:27 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_hostap.c,v 1.19 2009/04/26 21:50:21 sam Exp $");
#endif
/*
@@ -72,6 +72,7 @@
struct ieee80211_node *, struct mbuf *);
static void hostap_recv_mgmt(struct ieee80211_node *, struct mbuf *,
int subtype, int rssi, int noise, uint32_t rstamp);
+static void hostap_recv_ctl(struct ieee80211_node *, struct mbuf *, int);
static void hostap_recv_pspoll(struct ieee80211_node *, struct mbuf *);
void
@@ -96,6 +97,7 @@
vap->iv_newstate = hostap_newstate;
vap->iv_input = hostap_input;
vap->iv_recv_mgmt = hostap_recv_mgmt;
+ vap->iv_recv_ctl = hostap_recv_ctl;
vap->iv_opdetach = hostap_vdetach;
vap->iv_deliver_data = hostap_deliver_data;
}
@@ -473,7 +475,8 @@
if ((wh->i_fc[0] & IEEE80211_FC0_VERSION_MASK) !=
IEEE80211_FC0_VERSION_0) {
IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_ANY,
- ni->ni_macaddr, NULL, "wrong version %x", wh->i_fc[0]);
+ ni->ni_macaddr, NULL, "wrong version, fc %02x:%02x",
+ wh->i_fc[0], wh->i_fc[1]);
vap->iv_stats.is_rx_badversion++;
goto err;
}
@@ -831,23 +834,13 @@
wh = mtod(m, struct ieee80211_frame *);
wh->i_fc[1] &= ~IEEE80211_FC1_WEP;
}
- if (bpf_peers_present(vap->iv_rawbpf))
- bpf_mtap(vap->iv_rawbpf, m);
vap->iv_recv_mgmt(ni, m, subtype, rssi, noise, rstamp);
- m_freem(m);
- return IEEE80211_FC0_TYPE_MGT;
+ goto out;
case IEEE80211_FC0_TYPE_CTL:
vap->iv_stats.is_rx_ctl++;
IEEE80211_NODE_STAT(ni, rx_ctrl);
- switch (subtype) {
- case IEEE80211_FC0_SUBTYPE_PS_POLL:
- hostap_recv_pspoll(ni, m);
- break;
- case IEEE80211_FC0_SUBTYPE_BAR:
- ieee80211_recv_bar(ni, m);
- break;
- }
+ vap->iv_recv_ctl(ni, m, subtype);
goto out;
default:
IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
@@ -859,7 +852,7 @@
ifp->if_ierrors++;
out:
if (m != NULL) {
- if (bpf_peers_present(vap->iv_rawbpf) && need_tap)
+ if (need_tap && bpf_peers_present(vap->iv_rawbpf))
bpf_mtap(vap->iv_rawbpf, m);
m_freem(m);
}
@@ -2165,6 +2158,19 @@
}
}
+static void
+hostap_recv_ctl(struct ieee80211_node *ni, struct mbuf *m, int subtype)
+{
+ switch (subtype) {
+ case IEEE80211_FC0_SUBTYPE_PS_POLL:
+ hostap_recv_pspoll(ni, m);
+ break;
+ case IEEE80211_FC0_SUBTYPE_BAR:
+ ieee80211_recv_bar(ni, m);
+ break;
+ }
+}
+
/*
* Process a received ps-poll frame.
*/
==== //depot/projects/vimage/src/sys/net80211/ieee80211_ioctl.c#22 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.84 2009/03/29 21:17:08 sam Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_ioctl.c,v 1.85 2009/04/26 20:55:31 sam Exp $");
/*
* IEEE 802.11 ioctl support (FreeBSD-specific)
@@ -915,10 +915,13 @@
case IEEE80211_IOC_BSSID:
if (ireq->i_len != IEEE80211_ADDR_LEN)
return EINVAL;
- error = copyout(vap->iv_state == IEEE80211_S_RUN ?
- vap->iv_bss->ni_bssid :
- vap->iv_des_bssid,
- ireq->i_data, ireq->i_len);
+ if (vap->iv_state == IEEE80211_S_RUN) {
+ error = copyout(vap->iv_opmode == IEEE80211_M_WDS ?
+ vap->iv_bss->ni_macaddr : vap->iv_bss->ni_bssid,
+ ireq->i_data, ireq->i_len);
+ } else
+ error = copyout(vap->iv_des_bssid, ireq->i_data,
+ ireq->i_len);
break;
case IEEE80211_IOC_WPAIE:
error = ieee80211_ioctl_getwpaie(vap, ireq, ireq->i_type);
==== //depot/projects/vimage/src/sys/net80211/ieee80211_output.c#23 (text+ko) ====
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.84 2009/04/16 20:30:28 kmacy Exp $");
+__FBSDID("$FreeBSD: src/sys/net80211/ieee80211_output.c,v 1.90 2009/04/26 21:37:02 sam Exp $");
#include "opt_inet.h"
#include "opt_wlan.h"
@@ -273,6 +273,10 @@
*/
m->m_pkthdr.rcvif = (void *)ni;
+ /* XXX fragmented frames not handled */
+ if (bpf_peers_present(vap->iv_rawbpf))
+ bpf_mtap(vap->iv_rawbpf, m);
+
error = parent->if_transmit(parent, m);
if (error != 0) {
/* NB: IFQ_HANDOFF reclaims mbuf */
@@ -288,9 +292,7 @@
/*
* 802.11 output routine. This is (currently) used only to
* connect bpf write calls to the 802.11 layer for injecting
- * raw 802.11 frames. Note we locate the ieee80211com from
- * the ifnet using a spare field setup at attach time. This
- * will go away when the virtual ap support comes in.
+ * raw 802.11 frames.
*/
int
ieee80211_output(struct ifnet *ifp, struct mbuf *m,
@@ -384,7 +386,17 @@
if (ieee80211_classify(ni, m))
senderr(EIO); /* XXX */
- BPF_MTAP(ifp, m);
+ if (bpf_peers_present(vap->iv_rawbpf))
+ bpf_mtap(vap->iv_rawbpf, m);
+
+ IEEE80211_NODE_STAT(ni, tx_data);
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+ IEEE80211_NODE_STAT(ni, tx_mcast);
+ m->m_flags |= M_MCAST;
+ } else
+ IEEE80211_NODE_STAT(ni, tx_ucast);
+ /* NB: ieee80211_encap does not include 802.11 header */
+ IEEE80211_NODE_STAT_ADD(ni, tx_bytes, m->m_pkthdr.len);
/*
* NB: DLT_IEEE802_11_RADIO identifies the parameters are
@@ -412,13 +424,15 @@
static void
ieee80211_send_setup(
struct ieee80211_node *ni,
- struct ieee80211_frame *wh,
+ struct mbuf *m,
int type, int tid,
const uint8_t sa[IEEE80211_ADDR_LEN],
const uint8_t da[IEEE80211_ADDR_LEN],
const uint8_t bssid[IEEE80211_ADDR_LEN])
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list