Commit Graph

26 Commits

Author SHA1 Message Date
Robert Watson
d374e81efd Push the assignment of a new or updated so_qlimit from solisten()
following the protocol pru_listen() call to solisten_proto(), so
that it occurs under the socket lock acquisition that also sets
SO_ACCEPTCONN.  This requires passing the new backlog parameter
to the protocol, which also allows the protocol to be aware of
changes in queue limit should it wish to do something about the
new queue limit.  This continues a move towards the socket layer
acting as a library for the protocol.

Bump __FreeBSD_version due to a change in the in-kernel protocol
interface.  This change has been tested with IPv4 and UNIX domain
sockets, but not other protocols.
2005-10-30 19:44:40 +00:00
Robert Watson
0daccb9c94 In the current world order, solisten() implements the state transition of
a socket from a regular socket to a listening socket able to accept new
connections.  As part of this state transition, solisten() calls into the
protocol to update protocol-layer state.  There were several bugs in this
implementation that could result in a race wherein a TCP SYN received
in the interval between the protocol state transition and the shortly
following socket layer transition would result in a panic in the TCP code,
as the socket would be in the TCPS_LISTEN state, but the socket would not
have the SO_ACCEPTCONN flag set.

This change does the following:

- Pushes the socket state transition from the socket layer solisten() to
  to socket "library" routines called from the protocol.  This permits
  the socket routines to be called while holding the protocol mutexes,
  preventing a race exposing the incomplete socket state transition to TCP
  after the TCP state transition has completed.  The check for a socket
  layer state transition is performed by solisten_proto_check(), and the
  actual transition is performed by solisten_proto().

- Holds the socket lock for the duration of the socket state test and set,
  and over the protocol layer state transition, which is now possible as
  the socket lock is acquired by the protocol layer, rather than vice
  versa.  This prevents additional state related races in the socket
  layer.

This permits the dual transition of socket layer and protocol layer state
to occur while holding locks for both layers, making the two changes
atomic with respect to one another.  Similar changes are likely require
elsewhere in the socket/protocol code.

Reported by:		Peter Holm <peter@holm.cc>
Review and fixes from:	emax, Antoine Brodin <antoine.brodin@laposte.net>
Philosophical head nod:	gnn
2005-02-21 21:58:17 +00:00
Warner Losh
c398230b64 /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Hartmut Brandt
ca4125f7b3 Create a subtree 'harp' of the net sysctl tree. This uses a fixed
OID as the other protocol family sub-trees do, that is equal to the
protocol family identifier. Make the ATM layer debugging flags
available under this tree.

Submitted by:	Vincent Jardin <vjardin@wanadoo.fr>
MFC after:	2 weeks
2003-07-24 10:33:01 +00:00
Hartmut Brandt
56acf6178a Constify the arguments to several pdu_print functions. 2003-07-24 09:13:03 +00:00
Jonathan Lemon
1cafed3941 Update netisr handling; Each SWI now registers its queue, and all queue
drain routines are done by swi_net, which allows for better queue control
at some future point.  Packets may also be directly dispatched to a netisr
instead of queued, this may be of interest at some installations, but
currently defaults to off.

Reviewed by: hsu, silby, jayanth, sam
Sponsored by: DARPA, NAI Labs
2003-03-04 23:19:55 +00:00
John Baldwin
672cc99ed3 - Change the ATM stack functions to use intptr_t instead of int for opaque
arguments.
- Fix a few other places that assumed that sizeof(int) == sizeof(void *).

Reviewed by:	mdodd
2002-11-08 18:27:30 +00:00
Andrew R. Reiter
fe1c49fbba - Chainsaw the storage pool code. This was being used by a bunch of code
within the HARP atm stack and the hea and hfa device drivers, but since
  all of these systems were changed to use UMA zones, there is no use for
  the api any longer.
2002-06-14 19:31:07 +00:00
Andrew R. Reiter
b6037a7953 - Turn the hea and hfa HARP storage pools into UMA zones and insert
the necesary uma_zcreate() and uma_zdestroy calls into module loading
  handler and the device attach handling.
- Change the related HARP netatm code to use UMA zone functions when
  dealing with the zones that were formerly the ATM interface (hea, hfa)
  storage pools.
- Have atm_physif_freenifs() now get passed an uma_zone_t so that we can
  properly free the allocated NIF's back to their zone.

This should be the last commit to remove any code that makes use of the
netatm storage pool api.  I will be removing the api code within the near
future.

Reviewed by:	mdodd
2002-06-14 16:59:38 +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
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
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
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
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
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
Poul-Henning Kamp
67467625e2 More HARP polishina:
unifdef -UFORE_SBUS -DFORE_PCI
s/ATM_KERNEL/_KERNER/g
2000-10-12 07:42:34 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Poul-Henning Kamp
1820df7a2d Add new files for HARP3
Host ATM Research Platform (HARP), Network Computing Services, Inc.
This software was developed with the support of the Defense Advanced
Research Projects Agency (DARPA).
1998-09-15 08:23:17 +00:00