summaryrefslogtreecommitdiffstats
path: root/sys/netgraph
Commit message (Collapse)AuthorAgeFilesLines
* Reverse a lock/unlock pair that were the wrong way around in some code thatjulian2004-07-181-2/+2
| | | | | | is obviously not run a lot. (but is in some test cases). This code is not usually run because it covers a case that doesn't happen a lot (removing a node that has data traversing it).
* Use qsort_r() instead of qsort() when sorting links by latencyglebius2004-07-161-20/+5
| | | | | | | This helps us to remove a global variable and a mutex protecting it. Reviewed by: rwatson Approved by: julian (mentor)
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPphk2004-07-151-1/+1
| | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything".
* Add a note indicating that the eh_prototype field used to constructrwatson2004-07-141-0/+4
| | | | ethernet headers is unsynchronized.
* Add a mutex ng_tty_mtx to protect the global variable ngt_unit. Noterwatson2004-07-141-0/+10
| | | | | that the locking of globals here isn't complete, and there's also a locking issue relating to calling into and out of the tty code.
* Add ng_ppp_latencies_mtx, a global mutex to protect the latency list.rwatson2004-07-141-0/+11
| | | | | | Note that the table is a hack, and so is this mutex. Reviewed by: glebius
* Introduce a new mutex, ng_fec_mtx, to protect the global unit list torwatson2004-07-141-1/+10
| | | | | | synchronization allocation of FEC unit numbers. Reviewed by: glebius
* Introduce a new mutex, ng_eiface_mtx, to protect the global unit listrwatson2004-07-141-1/+11
| | | | | | | lock used to synchronize allocation of unit numbers for new netgraph ethernet interfaces. Reviewed by: glebius
* Introduce a new mutex, ng_iface_mtx, to protect the global unit listrwatson2004-07-141-1/+12
| | | | | | | | lock used to synchronize allocation of unit numbers for new netgraph interfaces. Reviewed by: glebius Tested by: glebius
* Introduce a global mtx 'ngsocketlist_mtx' to protect the globalrwatson2004-07-121-0/+8
| | | | ng_socket list during insert/delete.
* Mark 'makeup' in ng_frame_relay as const, as its values are immutable.rwatson2004-07-121-1/+1
|
* Update for the KDB framework:marcel2004-07-102-5/+6
| | | | | o Call kdb_enter() instead of Debugger(). o Change comments accordingly.
* Consistently use __inline instead of __inline__ as the former is an empty macrostefanf2004-07-046-17/+17
| | | | in <sys/cdefs.h> for compilers without support for inline.
* Remove the home-grown metadata facility in favour of the now genericjulian2004-06-302-120/+31
| | | | | | mbuf tags facility. Netgraph modules will all need a recompile. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Remove 3rd clause from the licence.marks2004-06-292-4/+0
| | | | Approved by: njl
* MFp4: Last references to dev/usb/usbdevs.h converted.imp2004-06-272-2/+4
|
* Having moved metadata usage to mbuf tags, remove code that supportsjulian2004-06-2612-142/+55
| | | | | | the old way of doing it. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Catch up with usbd_get_string_desc() change.le2004-06-261-1/+1
| | | | Spotted by: Tai-hwa Liang <avatar@mmlab.cse.yzu.edu.tw>
* Fix line discipline switching issues: If opening a new ldisc fails,phk2004-06-262-19/+3
| | | | | | | | | | | | | we have to revert to TTYDISC which we know will successfully open rather than try the previous ldisc which might also fail to open. Do not let ldisc implementations muck about with ->t_line, and remove code which checks for reopens, it should never happen. Move ldisc->l_hotchar to tty->t_hotchar and have ldisc implementation initialize it in their open routines. Reset to zero when we enter TTYDISC. ("no" should really be -1 since zero could be a valid hotchar for certain old european mainframe protocols.)
* Not quite sure how that one got past me..julian2004-06-261-1/+1
|
* Add '#include <sys/mbuf.h>' to fix the kernel build.emax2004-06-251-0/+1
|
* oops from Gleb..julian2004-06-251-0/+3
| | | | | | This shouldn't be visible from userland. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Make the frameworkl responsible for not passing the nodes a NULL mbuf pointer.julian2004-06-256-13/+11
| | | | | | this allows the nodes to not test for this.. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Convert Netgraph to use mbuf tags to pass its meta information around.julian2004-06-256-55/+54
| | | | | | | | Thanks to Sam for importing tags in a way that allowed this to be done. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Also allow the sr and ar drivers to create netgraph versions of their modules. Document the change to the ksocket node.
* Clean up use of ng_hdhasb_mtx a little:rwatson2004-06-241-0/+5
| | | | | | | | - Assert the mutex in NG_IDHASH_FIND() since the mutex is required to safely walk the node lists in the ng_ID_hash table. - Acquire the ng_nodelist_mtx when walking ng_allnodes or ng_allhooks to generate state dump output from the netgraph sysctls.
* Avoid calling bpf_filter() with len == 0, which causes a change in semanticsarchie2004-06-231-1/+4
| | | | | | | (it treats the buffer pointer as an mbuf pointer) and subsequent panic. MFC after: 3 days Reported by: Tony Hariman <tony@cbn.net.id>
* Fix a problem with multiple-delivery (i.e. broadcast) in ng_bridge.green2004-06-221-3/+5
| | | | | | | | | Only the first link0..link$NLINKS hooks would be utilized, whereas the link hooks may be connected sparsely. Add a counter variable so that the link hook array is only traversed while there is still work to do, but that it continues up to the end if it has to.
* Remove one more unneeded reference to arpcom.ac_netgraph.wpaul2004-06-201-10/+34
| | | | | | | | | | | | | | | | Tweak things so that ng_fec has a chance of working with things other than ethernet. Use ifp->if_output of the underlying interfaces and use IF_HANDOFF() rather than depending on ether_output() and ether_output_frame() explicitly. Also, don't insist that underlying devices be IFM_ETHER when checking their link states in the link monitor code. With these changes, I was able to create a two channel bundle consisting of one ethernet interface and one 802.11 wireless device (via ndis). Note that this only works because both devices use the same if_output vector: ng_fec will not let you bundle devices with different output vectors together (it really doesn't make sense to do that).
* Stash our node context pointer somewhere else within struct ifnet ofwpaul2004-06-201-2/+18
| | | | | | underlying interfaces rather than using ac_netgraph in struct arpcom. The latter is meant only for use by ng_ether, and using it breaks interoperability with the rest of netgraph.
* Correct merge-o: make sure to unlock symmetrically socket bufferrwatson2004-06-181-2/+2
| | | | | | locks on bluetooth sockets when clearing upcall flags. Submitted by: emax
* Merge additional socket buffer locking from rwatson_netperf:rwatson2004-06-172-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | - Lock down low hanging fruit use of sb_flags with socket buffer lock. - Lock down low hanging fruit use of so_state with socket lock. - Lock down low hanging fruit use of so_options. - Lock down low-hanging fruit use of sb_lowwat and sb_hiwat with socket buffer lock. - Annotate situations in which we unlock the socket lock and then grab the receive socket buffer lock, which are currently actually the same lock. Depending on how we want to play our cards, we may want to coallesce these lock uses to reduce overhead. - Convert a if()->panic() into a KASSERT relating to so_state in soaccept(). - Remove a number of splnet()/splx() references. More complex merging of socket and socket buffer locking to follow.
* Second half of the dev_t cleanup.phk2004-06-172-21/+21
| | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-166-29/+29
| | | | Bump __FreeBSD_version accordingly.
* The socket field so_state is used to hold a variety of socket relatedrwatson2004-06-142-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | flags relating to several aspects of socket functionality. This change breaks out several bits relating to send and receive operation into a new per-socket buffer field, sb_state, in order to facilitate locking. This is required because, in order to provide more granular locking of sockets, different state fields have different locking properties. The following fields are moved to sb_state: SS_CANTRCVMORE (so_state) SS_CANTSENDMORE (so_state) SS_RCVATMARK (so_state) Rename respectively to: SBS_CANTRCVMORE (so_rcv.sb_state) SBS_CANTSENDMORE (so_snd.sb_state) SBS_RCVATMARK (so_rcv.sb_state) This facilitates locking by isolating fields to be located with other identically locked fields, and permits greater granularity in socket locking by avoiding storing fields with different locking semantics in the same short (avoiding locking conflicts). In the future, we may wish to coallesce sb_state and sb_flags; for the time being I leave them separate and there is no additional memory overhead due to the packing/alignment of shorts in the socket buffer structure.
* Add the capacity for the rfc1490 node to handle cisco style encasulationjulian2004-06-132-23/+154
| | | | | | which is often used alongside rfc1490 in frame relay links. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Extend coverage of SOCK_LOCK(so) to include so_count, the socketrwatson2004-06-125-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | reference count: - Assert SOCK_LOCK(so) macros that directly manipulate so_count: soref(), sorele(). - Assert SOCK_LOCK(so) in macros/functions that rely on the state of so_count: sofree(), sotryfree(). - Acquire SOCK_LOCK(so) before calling these functions or macros in various contexts in the stack, both at the socket and protocol layers. - In some cases, perform soisdisconnected() before sotryfree(), as this could result in frobbing of a non-present socket if sotryfree() actually frees the socket. - Note that sofree()/sotryfree() will release the socket lock even if they don't free the socket. Submitted by: sam Sponsored by: FreeBSD Foundation Obtained from: BSD/OS
* Now that mbufs are allocated using uma,julian2004-06-071-4/+0
| | | | | don't check for accidental usage of mbuf 'how' flags as they are the same thing.
* Integrate accept locking from rwatson_netperf, introducing a newrwatson2004-06-022-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | global mutex, accept_mtx, which serializes access to the following fields across all sockets: so_qlen so_incqlen so_qstate so_comp so_incomp so_list so_head While providing only coarse granularity, this approach avoids lock order issues between sockets by avoiding ownership of the fields by a specific socket and its per-socket mutexes. While here, rewrite soclose(), sofree(), soaccept(), and sonewconn() to add assertions, close additional races and address lock order concerns. In particular: - Reorganize the optimistic concurrency behavior in accept1() to always allocate a file descriptor with falloc() so that if we do find a socket, we don't have to encounter the "Oh, there wasn't a socket" race that can occur if falloc() sleeps in the current code, which broke inbound accept() ordering, not to mention requiring backing out socket state changes in a way that raced with the protocol level. We may want to add a lockless read of the queue state if polling of empty queues proves to be important to optimize. - In accept1(), soref() the socket while holding the accept lock so that the socket cannot be free'd in a race with the protocol layer. Likewise in netgraph equivilents of the accept1() code. - In sonewconn(), loop waiting for the queue to be small enough to insert our new socket once we've committed to inserting it, or races can occur that cause the incomplete socket queue to overfill. In the previously implementation, it was sufficient to simply tested once since calling soabort() didn't release synchronization permitting another thread to insert a socket as we discard a previous one. - In soclose()/sofree()/et al, it is the responsibility of the caller to remove a socket from the incomplete connection queue before calling soabort(), which prevents soabort() from having to walk into the accept socket to release the socket from its queue, and avoids races when releasing the accept mutex to enter soabort(), permitting soabort() to avoid lock ordering issues with the caller. - Generally cluster accept queue related operations together throughout these functions in order to facilitate locking. Annotate new locking in socketvar.h.
* Removed a leftover from the previous change.ru2004-06-011-4/+0
| | | | Submitted by: Gleb Smirnoff
* The SS_COMP and SS_INCOMP flags in the so_state field indicate whetherrwatson2004-06-012-2/+2
| | | | | | | | the socket is on an accept queue of a listen socket. This change renames the flags to SQ_COMP and SQ_INCOMP, and moves them to a new state field on the socket, so_qstate, as the locking for these flags is substantially different for the locking on the remainder of the flags in so_state.
* add missing #include <sys/module.h>phk2004-05-303-0/+3
|
* Add a new netgraph method to allow restoration of somejulian2004-05-293-10/+28
| | | | | | | | | | behaviour lost in the change from 4.x style netgraph tee nodes. Alter the tee node to use the new method. Document the behaviour. Step the ABI version number... old netgraph klds will refuse to load. Better than just crashing. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru>
* Missed these in the last commit.julian2004-05-293-36/+31
| | | | Change to C99 structure initialisation for the type method structure.
* Switch to using C99 sparse initialisers for the type methods array.julian2004-05-2946-554/+416
| | | | | | | | Should make no binary difference. Submitted by: Gleb Smirnoff <glebius@cell.sick.ru> Reviewed by: Harti Brandt <harti@freebsd.org> MFC after: 1 week
* Move to generating pccarddevs.h on the fly, both for the kernel andimp2004-05-261-1/+1
| | | | | | | the modules. Also generate usbdevs.h automatically now, but a non-kernel file is stopping that at the moment.
* Use NG_HOOKSIZ instead of the deprecated (NG_HOOKLEN + 1)julian2004-05-241-1/+1
|
* Whitespace nit.ru2004-05-191-1/+1
|
* Maintain statistics about the received frames.ru2004-05-192-3/+147
|
* Allow ng_ether "lower" and "orphans" hooks to be connected at the same time.archie2004-05-161-42/+20
| | | | | Reviewed by: julian PR: kern/63317
* Mode few Bluetooth defines into system include filesemax2004-05-103-21/+1
| | | | Reviewed by: imp
OpenPOWER on IntegriCloud