freebsd-dev/sys/netgraph
Gleb Smirnoff d1426d7fc5 Locking and cleanup of tty netgraph node. Tty stack is Giant-locked,
so we need to acquire Giant in netgraph methods, so that we don't
race with line discipline methods. Remove NET_NEEDS_GIANT.

- Packets coming into node from netgraph are queued in ifqueue
  attached to node private data.
- Mutex in struct ifqueue is used to lock not only the queue, but
  the whole private data, and tp->t_lsc field.
- tp->t_lsc pointer is used to indicate whether line discipline is
  attached to netgraph or not.
- Use FLG_DIE flag to indicate that node may be destroyed.
  (This protection doesn't work, and it didn't before. Must be redesigned.)
- Increment ngt_unit atomically, removing mutex.
- Acquire Giant, when executing ngt_start() from netgraph context.
- Acquire Giant, when {,de}registering line discipline.
- Uncomment forcing queue mode on peers hook, since this is reasonable.
- Force queue mode on our hook, to avoid acquiring Giant when coming from
  network stack. We may already hold some mutexes at this point.

Cleanups:
- Use callout_pending() instead of our own flag.
- Remove spl(9) calls. Now we can use return() instead of ERROUT().

style(9):
- Sort includes.
- Sparse initializer for struct linesw.
- Remove some empty lines, sort declarations.

Reviewed by:	julian, phk
MFC after:	1 month
2005-01-13 07:43:12 +00:00
..
atm /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
bluetooth - Use ng_callout() instead of home-grown implementation. 2005-01-11 11:55:56 +00:00
netflow - Plug a memory leak in ng_netflow_cache_init(). 2004-12-28 12:11:32 +00:00
netgraph.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_async.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_async.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_atmllc.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_atmllc.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_base.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_bpf.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_bpf.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_bridge.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_bridge.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_cisco.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_cisco.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_device.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_device.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_echo.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_echo.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_eiface.c Remove orphaned comment about Meta data. 2004-09-11 08:59:06 +00:00
ng_eiface.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_etf.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_etf.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ether.c This change adds reliability for Ethernet trunks built with ng_one2many: 2005-01-08 12:42:03 +00:00
ng_ether.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_fec.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_fec.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_frame_relay.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_frame_relay.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_gif_demux.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_gif_demux.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_gif.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_gif.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_hole.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_hole.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_hub.c Having moved metadata usage to mbuf tags, remove code that supports 2004-06-26 22:24:16 +00:00
ng_hub.h A simple packet distribution node type that acts like an Ethernet hub. 2004-04-17 12:42:17 +00:00
ng_iface.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_iface.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ip_input.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ip_input.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ksocket.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ksocket.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_l2tp.c - Use ng_callout() instead of callout_reset(9). 2005-01-11 11:51:17 +00:00
ng_l2tp.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_lmi.c - Use ng_callout() instead of timeout(9). 2005-01-11 11:59:59 +00:00
ng_lmi.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_message.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_mppc.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_mppc.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_one2many.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_one2many.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_parse.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_parse.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_ppp.c Utilize callout_pending() macro 2005-01-11 12:20:28 +00:00
ng_ppp.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_pppoe.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_pppoe.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_pptpgre.c Utilize callout_pending() macro 2005-01-11 12:20:28 +00:00
ng_pptpgre.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_rfc1490.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_rfc1490.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_sample.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_sample.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_socket.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_socket.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_socketvar.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_source.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_source.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_split.c Switch to using C99 sparse initialisers for the type methods array. 2004-05-29 00:51:19 +00:00
ng_split.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_sppp.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_sppp.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_tee.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_tee.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_tty.c Locking and cleanup of tty netgraph node. Tty stack is Giant-locked, 2005-01-13 07:43:12 +00:00
ng_tty.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_UI.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_UI.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_vjc.c /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_vjc.h /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
ng_vlan.c Switch to using C99 sparse initialisers for the type methods array. 2004-05-29 00:51:19 +00:00
ng_vlan.h Netgraph node type for IEEE 802.1Q VLAN tagging. 2004-03-01 17:22:16 +00:00
NOTES