Commit Graph

80 Commits

Author SHA1 Message Date
Seigo Tanimura
243917fe3b Lock down a socket, milestone 1.
o Add a mutex (sb_mtx) to struct sockbuf. This protects the data in a
  socket buffer. The mutex in the receive buffer also protects the data
  in struct socket.

o Determine the lock strategy for each members in struct socket.

o Lock down the following members:

  - so_count
  - so_options
  - so_linger
  - so_state

o Remove *_locked() socket APIs.  Make the following socket APIs
  touching the members above now require a locked socket:

 - sodisconnect()
 - soisconnected()
 - soisconnecting()
 - soisdisconnected()
 - soisdisconnecting()
 - sofree()
 - soref()
 - sorele()
 - sorwakeup()
 - sotryfree()
 - sowakeup()
 - sowwakeup()

Reviewed by:	alfred
2002-05-20 05:41:09 +00:00
Andrew R. Reiter
52550fcde1 - Remove the init routine for loop -- it broke something and I don't have
the time to fix it properly at the moment.
2002-05-07 20:50:10 +00:00
Andrew R. Reiter
3130f09161 - Use an array of init functions to be used in a for loop in our
initialization routine.
2002-05-07 20:37:40 +00:00
Andrew R. Reiter
4822f32850 - Add atm_init_fn 2002-05-07 20:36:35 +00:00
Andrew R. Reiter
bfb57eef8a - Add atm_sock_init()
- Move the Atm_pcb storage pool (atm_pcb_pool) to be an UMA zone.
2002-05-07 20:13:55 +00:00
Andrew R. Reiter
a3d5f221b4 - Change the atm_cm_init function to take no argument. 2002-05-07 20:12:29 +00:00
Andrew R. Reiter
2647924585 - Replaced the Atm_connection storage pool with an uma_zone of
Atm_connection items.
- Replaced the Atm_connvc storage pool with an uma_zone of Atm_connvc
  items.
- Created void atm_cm_init(void *) and added it to the netatm init code.
  I'm thinking that there will definetly be more ``subsystem'' init
  functions to be added so I'll probably change these calls to be a for
  loop through init routines (or something).
2002-05-02 07:27:29 +00:00
Andrew R. Reiter
cecd70a0a2 - Take advantage of the M_ZERO flag that can now be passed to uma_zalloc.
- Remove atm_uma_ctor() as the M_ZERO will zero out the memory for us.
2002-04-30 07:41:59 +00:00
Seigo Tanimura
960ed29c4b Revert the change of #includes in sys/filedesc.h and sys/socketvar.h.
Requested by:	bde

Since locking sigio_lock is usually followed by calling pgsigio(),
move the declaration of sigio_lock and the definitions of SIGIO_*() to
sys/signalvar.h.

While I am here, sort include files alphabetically, where possible.
2002-04-30 01:54:54 +00:00
Andrew R. Reiter
04a3d10ee5 - Tweak wording of panic message to make more sense. 2002-04-24 22:32:48 +00:00
Andrew R. Reiter
d98861bb51 - Turn the atm_stackq_pool into a uma_zone (and change it's name to
atm_stackq_zone).
- Change the related atm_allocate() and atm_free() calls into uma_zalloc()
  and uma_zfree() calls.
2002-04-24 20:56:23 +00:00
Andrew R. Reiter
1bbd50f9c8 - Remove atm_attributes_pool and the relating atm_allocate() and atm_free()
calls associated with the pool and the objects allocated out from the
  pool.
- Insert atm_attributes_zone which is a uma_zone that is used just as the
  atm_attributes_pool was (including the max objects value).  Also, used
  the appropriate zalloc and zfree's where necesary.
2002-04-24 18:06:18 +00:00
Andrew R. Reiter
e2a8a1af0e - Revert previous change of atm storage pools -> uma_zones until a solution
to atm_free() is written.
2002-04-22 18:26:05 +00:00
Andrew R. Reiter
27e69e45bb - Change the atm_attributes_pool and atm_stackq_pool to be uma_zone's
(with the appropriate set_max) rather than using the HARP storage pool
  code.
2002-04-22 05:11:44 +00:00
Andrew R. Reiter
64151e7a8a - Nuke some more not needed #ifdef cruft. 2002-04-21 01:41:05 +00:00
Andrew R. Reiter
e062d89cdc - Create a ``zero fill'' constructor for uma_zcreate's ctor argument.
Inspired by: jake@
2002-04-20 09:04:58 +00:00
Andrew R. Reiter
cb809c2827 - Nuke small sgi ifdef bits. 2002-04-20 00:39:32 +00:00
Andrew R. Reiter
4fba67caca - Nuke some more #ifdef sun related sections. 2002-04-19 21:38:43 +00:00
Andrew R. Reiter
c330efb1ed - Nuke some #ifdef sun4m code; it hasn't been updated in 4 years and is not
being used.
2002-04-19 20:02:03 +00:00
Andrew R. Reiter
2575dfa6d9 - Change KM_ macro calls to the appropriate function call.
- Nuke KM_ macros from port.h

  This is a leadin step towards cleaning up this code as I wait for some
  ATM cards and a ATM switch to arrive.
2002-04-19 17:45:22 +00:00
Matthew N. Dodd
41fd17a668 Fix missing commas. 2002-04-17 16:12:24 +00:00
Matthew N. Dodd
f5d1240c12 Remove a stray comment terminator that was hiding beyond 80 columns. 2002-04-17 07:04:58 +00:00
Matthew N. Dodd
1462e313d4 - Add defines for ABR and UBR traffic types.
- Add IDT bits to vendor/vendorapi/device enums.
- Add EISA to atm_bus enum.
2002-04-17 07:00:56 +00:00
Matthew N. Dodd
073bba0262 Wrap function in #ifdef DIAGNOSTIC to compile with -Werror. 2002-04-17 00:30:38 +00:00
Matthew N. Dodd
5aaf51e01d Add ESA200 to enum atm_device. 2002-04-17 00:30:06 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
John Baldwin
44731cab3b Change the suser() API to take advantage of td_ucred as well as do a
general cleanup of the API.  The entire API now consists of two functions
similar to the pre-KSE API.  The suser() function takes a thread pointer
as its only argument.  The td_ucred member of this thread must be valid
so the only valid thread pointers are curthread and a few kernel threads
such as thread0.  The suser_cred() function takes a pointer to a struct
ucred as its first argument and an integer flag as its second argument.
The flag is currently only used for the PRISON_ROOT flag.

Discussed on:	smp@
2002-04-01 21:31:13 +00:00
Alfred Perlstein
03d1b8bc94 Remove __P. 2002-03-20 08:00:54 +00:00
Alfred Perlstein
96abb1618a Remove __P. 2002-03-20 02:39:27 +00:00
Julian Elischer
497a90b418 Unbreak fore adapters from POV of warnings.
Define the atm_dev_free() routine so that its OK to free stuff that is defined
as volatile. Note this doesn't FORCE the arguemnts to be volatile,
just says that it's not an error if it is..
2002-02-27 21:12:44 +00:00
Matt Jacob
280304eb49 Replace a few more lines of code orphaned by MFREE going away.
MFC after:	1 day
2002-02-07 22:08:32 +00:00
Julian Elischer
a3aa8c3ee8 Allow this to compile again
not tested under LINT by: msmith
2002-01-30 23:38:31 +00:00
Mike Smith
bedbd47e6a Initialise the intrq_present fields at runtime, not link time. This allows
us to load protocols at runtime, and avoids the use of common variables.

Also fix the ip6_intrq assignment so that it works at all.
2002-01-08 10:34:03 +00:00
Matthew Dillon
b1e4abd246 Give struct socket structures a ref counting interface similar to
vnodes.  This will hopefully serve as a base from which we can
expand the MP code.  We currently do not attempt to obtain any
mutex or SX locks, but the door is open to add them when we nail
down exactly how that part of it is going to work.
2001-11-17 03:07:11 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Kris Kennaway
7c483fee3f Don't call log() without a format string.
MFC after:	2 weeks
2001-09-10 12:00:47 +00:00
Jonathan Lemon
f9132cebdc Wrap array accesses in macros, which also happen to be lvalues:
ifnet_addrs[i - 1]  -> ifaddr_byindex(i)
        ifindex2ifnet[i]    -> ifnet_byindex(i)

This is intended to ease the conversion to SMPng.
2001-09-06 02:40:43 +00:00
Jim Pirzyk
03b84cf051 Commited patch for uni signaling fix.
PR:		kern/28748
Submitted by:	Richard Hodges <rh@matriplex.com>
MFC after:	2 weeks
2001-07-11 16:31:50 +00:00
Alfred Perlstein
2c9e2445bb Silence some warnings
Submitted by: LINT
2001-03-20 10:42:49 +00:00
Jeroen Ruigrok van der Werven
d7d97eb0aa Preceed/preceeding are not english words. Use precede and preceding. 2001-02-18 10:43:53 +00:00
Bosko Milekic
2a0c503e7a * Rename M_WAIT mbuf subsystem flag to M_TRYWAIT.
This is because calls with M_WAIT (now M_TRYWAIT) may not wait
  forever when nothing is available for allocation, and may end up
  returning NULL. Hopefully we now communicate more of the right thing
  to developers and make it very clear that it's necessary to check whether
  calls with M_(TRY)WAIT also resulted in a failed allocation.
  M_TRYWAIT basically means "try harder, block if necessary, but don't
  necessarily wait forever." The time spent blocking is tunable with
  the kern.ipc.mbuf_wait sysctl.
  M_WAIT is now deprecated but still defined for the next little while.

* Fix a typo in a comment in mbuf.h

* Fix some code that was actually passing the mbuf subsystem's M_WAIT to
  malloc(). Made it pass M_WAITOK instead. If we were ever to redefine the
  value of the M_WAIT flag, this could have became a big problem.
2000-12-21 21:44:31 +00:00
Poul-Henning Kamp
a3671bc8c8 Add back some now needed #include <sys/systm.h>
Fix various warnings while here anyway.
2000-12-07 22:19:06 +00:00
Jonathan Lemon
df5e198723 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
Poul-Henning Kamp
8879e52387 Add back some #include <sys/systm.h> which were needed when <sys/ktr.h>
doesn't mess us up.

Noted by:	Harti Brandt <brandt@fokus.gmd.de>
2000-10-30 20:37:01 +00:00
Poul-Henning Kamp
a3b266147d Remove more unused #includes. 2000-10-30 07:42:06 +00:00
Poul-Henning Kamp
cf9fa8e725 Move suser() and suser_xxx() prototypes and a related #define from
<sys/proc.h> to <sys/systm.h>.

Correctly document the #includes needed in the manpage.

Add one now needed #include of <sys/systm.h>.
Remove the consequent 48 unused #includes of <sys/proc.h>.
2000-10-29 16:06:56 +00:00
Poul-Henning Kamp
c77dceb5d3 Remove more unused #includes. 2000-10-27 21:14:25 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Poul-Henning Kamp
991b35adf1 Forgot these files in my kerninclude limited run.
(No core powers we abused during this commit)
2000-10-12 20:21:02 +00:00
Poul-Henning Kamp
67b0d5b9ea Remove the #include kitchensink <netatm/kern_include.h> and add
the #includes to the respective source files.

Also un-nest includes in <dev/hfa/fore_include.h>

I have run src/tools/tools/kerninclude to remove 1239 clearly
unneeded #includes reducing the total from 3524 includes to 2285.
2000-10-12 08:14:20 +00:00