Commit Graph

64 Commits

Author SHA1 Message Date
John Baldwin
3d32c12abf Always use a private timer instead of if_watchdog and if_timer to drive
the transmit watchdog.  These drivers already used a private timer when
compiled to use Netgraph.  This change just makes them always use the
private timer.  Note that these drivers do not compile and are disconnected
from the build due to TTY changes.
2009-11-17 16:43:02 +00:00
Warner Losh
2b9a8a330f Use new spelling of the NG_*LEN constants. 2009-06-09 07:14:32 +00:00
Robert Watson
8a520db77d if_cx is currently disconnected from the build due to a dependence on
the old TTY implementation; however, take a cut at stripping its
optional Giant-protected code paths enabled using debug.cx.mpsafenet,
which will no longer work once IFF_NEEDSGIANT is removed.
2009-02-19 00:06:01 +00:00
Roman Kurakin
259edd2800 Do not set IFF_DEBUG directly from the driver.
MFC after:	1 month.
2008-06-30 21:18:27 +00:00
Kevin Lo
976b010645 Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
Robert Watson
33d2bb9ca3 First in a series of changes to remove the now-unused Giant compatibility
framework for non-MPSAFE network protocols:

- Remove debug_mpsafenet variable, sysctl, and tunable.
- Remove NET_NEEDS_GIANT() and associate SYSINITSs used by it to force
  debug.mpsafenet=0 if non-MPSAFE protocols are compiled into the kernel.
- Remove logic to automatically flag interrupt handlers as non-MPSAFE if
  debug.mpsafenet is set for an INTR_TYPE_NET handler.
- Remove logic to automatically flag netisr handlers as non-MPSAFE if
  debug.mpsafenet is set.
- Remove references in a few subsystems, including NFS and Cronyx drivers,
  which keyed off debug_mpsafenet to determine various aspects of their own
  locking behavior.
- Convert NET_LOCK_GIANT(), NET_UNLOCK_GIANT(), and NET_ASSERT_GIANT into
  no-op's, as their entire behavior was determined by the value in
  debug_mpsafenet.
- Alias NET_CALLOUT_MPSAFE to CALLOUT_MPSAFE.

Many remaining references to NET_.*_GIANT() and NET_CALLOUT_MPSAFE are still
present in subsystems, and will be removed in followup commits.

Reviewed by:	bz, jhb
Approved by:	re (kensmith)
2007-07-27 11:59:57 +00:00
Yoshihiro Takahashi
41f5bd0f6d Don't call bus_deactivate_resource() explicitly before calling
bus_release_resource().  This is needed for pc98 by upcoming nexus related
change.
2007-03-21 03:38:37 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
John Baldwin
0dea849ae9 Various bpf(4) related fixes to catch places up to the new bpf(4)
semantics.
- Stop testing bpf pointers for NULL.  In some cases use
  bpf_peers_present() and then call the function directly inside the
  conditional block instead of the macro.
- For places where the entire conditional block is the macro, remove the
  test and make the macro unconditional.
- Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of
  the old semantics.

Reviewed by:	csjp (older version)
2006-12-29 13:59:50 +00:00
Robert Watson
acd3428b7d Sweep kernel replacing suser(9) calls with priv(9) calls, assigning
specific privilege names to a broad range of privileges.  These may
require some future tweaking.

Sponsored by:           nCircle Network Security, Inc.
Obtained from:          TrustedBSD Project
Discussed on:           arch@
Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri,
                        Alex Lyashkov <umka at sevcity dot net>,
                        Skip Ford <skip dot ford at verizon dot net>,
                        Antoine Brodin <antoine dot brodin at laposte dot net>
2006-11-06 13:42:10 +00:00
Poul-Henning Kamp
c40da00ca3 Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.
2006-05-16 14:37:58 +00:00
John Baldwin
284b6708c4 - Use swi_remove() to teardown swi handlers rather than
intr_event_remove_handler().
- Remove tty: prefix from a couple of swi handler names.
2005-10-26 15:52:16 +00:00
Ruslan Ermilov
c9003bc7fa Catch up with new interrupt handling code. 2005-10-26 06:44:59 +00:00
Poul-Henning Kamp
733634738e Eliminate two unused arguments to ttycreate(). 2005-10-16 20:22:56 +00:00
Roman Kurakin
3dde86fe4c Backout if_cp 1.26, if_ct 1.27, if_cx 1.47 by obrien:
----------------------------
	revision 1.26
	date: 2005/09/07 09:53:35;  author: obrien;  state: Exp;  lines: +1452 -1453
	Reorder code to not depend on an ISO-C illegal forward extern declaration.
	----------------------------

Reason: do not move large functions location without serious reason. The same
could be done by forward function declaration. Please do not enlarge diff
without a reason any more.

Backout if_cp 1.27
----------------------------
	revision 1.27
	date: 2005/09/19 03:10:16;  author: imp;  state: Exp;  lines: +3 -2
	Make sure that we call if_free(ifp) after bus_teardown_intr.  Since we
	could get an interrupt after we free the ifp, and the interrupt
	handler depended on the ifp being still alive, this could, in theory,
	cause a crash.  Eliminate this possibility by moving the if_free to
	after the bus_teardown_intr() call.

Reason: bad previous commit. Would be restored by next commit.
2005-09-27 16:12:49 +00:00
David E. O'Brien
8070a603b2 Reorder code to not depend on an ISO-C illegal forward extern declaration. 2005-09-07 09:53:35 +00:00
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +00:00
Roman Kurakin
0541e456c9 Use m_length (m, NULL) instead of m->m_pkthdr.len.
Problems reported by: strijar at urai dot ru
Approved by:	re (scottl)
2005-07-09 16:14:05 +00:00
Roman Kurakin
ea78cad4bf Lost cx_mpsafenet check.
Pointy hat:	me
Approved by:	re (scottl)
2005-07-09 14:31:48 +00:00
Roman Kurakin
6cfa1c438b Lost t_oproc() callback assignment.
Pointyhats:	phk (who lost it), me (who didn't notice that)
Approved by:	re (scottl)
2005-07-09 14:27:35 +00:00
Roman Kurakin
cc8895afc9 Lost CX_UNLOCK().
Pointy hat:	me
Approved by:	re (scottl)
2005-07-09 14:23:42 +00:00
Roman Kurakin
de66928b86 Protect from partially initialized channels.
Approved by:	re (scottl)
2005-07-09 14:03:02 +00:00
Roman Kurakin
23f924934d Space & alignment nits.
Approved by:	re (scottl)
2005-07-09 13:44:36 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Joerg Wunsch
a5f50ef9e4 netchild's mega-patch to isolate compiler dependencies into a central
place.

This moves the dependency on GCC's and other compiler's features into
the central sys/cdefs.h file, while the individual source files can
then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to
refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42.

By now, GCC and ICC (the Intel compiler) have been actively tested on
IA32 platforms by netchild.  Extension to other compilers is supposed
to be possible, of course.

Submitted by:	netchild
Reviewed by:	various developers on arch@, some time ago
2005-03-02 21:33:29 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Roman Kurakin
f41d84e53a Make code MPSAFE.
You could turn this off by debug.mpsafenet=0 for full network
stack or via debug.{cp|cx|ctau}.mpsafenet for cp(4), cx(4) and
ctau(4) accordingly.

MFC after:	10 days
2004-12-13 22:07:23 +00:00
Roman Kurakin
deb66525ae Partially backout 1.34. These ioctls and function cx_modem_status () are
used by sync part of driver, so put them back.
2004-12-09 23:43:03 +00:00
Roman Kurakin
052bf4427f Don not call pp_down()/pp_up() form XX_tlf()/XX_tls() in non PPP mode
to privent running of PPP's state machine in non PPP mode.

MFC: after 3 days.
2004-12-03 16:57:15 +00:00
Poul-Henning Kamp
6c3f1a47fe Use generic tty code instead of local copy. 2004-10-13 09:27:18 +00:00
Poul-Henning Kamp
1acd87a81f First half of tty code rework: unifdef -D__FreeBSD_Version=600000
The changes in the next commit would make the code totally unreadable
if the #ifdef'ing were maintained.

It might make a lot of sense to split if_cx.c in a netgraph related
and in a tty related file but I will not attempt that without hardware.
2004-10-13 07:02:56 +00:00
Poul-Henning Kamp
3ad06fbb46 Remove bogus cdevsw frobbing code which tries to prevent double
loading of modules.

MODULE_VERSION() should be used for this I belive.
2004-09-23 12:21:11 +00:00
Roman Kurakin
6b1cbdfc68 Make code ready to switch debug.mpsafenet to 1 since I've not able to
commit MPSAFE code for now it is just IFF_NEEDSGIANT.
2004-08-27 22:14:26 +00:00
Roman Kurakin
47a1257e20 Fix resource check while autodetection. 2004-08-13 12:35:52 +00:00
Roman Kurakin
a162fe531c White space cleanup. 2004-08-13 12:14:39 +00:00
Julian Elischer
be4252b367 Slight cosmetic changes.
Also introduce a macro to be called by persistent nodes to signal their
persistence during shutdown to hide this mechanism from the node author.

Make node flags have a consistent style in naming.

Document the change.
2004-07-20 17:15:38 +00:00
Poul-Henning Kamp
672c05d49c Preparation commit for the tty cleanups that will follow in the near
future:

rename ttyopen() -> tty_open() and ttyclose() -> tty_close().

We need the ttyopen() and ttyclose() for the new generic cdevsw
functions for tty devices in order to have consistent naming.
2004-07-15 20:47:41 +00:00
Poul-Henning Kamp
911dbd84c7 Introduce ttygone() which indicates that the hardware is detached.
Move dtrwait logic to the generic TTY level.
2004-07-11 15:18:39 +00:00
John Baldwin
3df6c4de7e - Shorten the names for the TTY related swi interrupt handlers as the
'tty:' prefix is largely redundant.
- Fix the priority of the low-priority TTY SWIs that are hung off of the
  softclock thread.

Submitted by:	bde (2)
2004-06-28 16:17:11 +00:00
Julian Elischer
327b288e5c Convert Netgraph to use mbuf tags to pass its meta information around.
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.
2004-06-25 19:22:05 +00:00
Roman Kurakin
de98a7eeee Use bus_dma* instead of contigmalloc()+vtophys() for RELENG_5. 2004-06-23 18:13:10 +00:00
Roman Kurakin
3cc90ff9d1 Make code more clean: backout support for 3.x branch. 2004-06-23 11:23:54 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
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.
2004-06-17 17:16:53 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Roman Kurakin
2a8436eae5 Free tty at detach().
Tested by:	`pstat -t`
Requested by:	phk
2004-06-10 13:50:28 +00:00
Roman Kurakin
daac3fffc8 Check if we control device. Else we will go to panic cause we don't have
properly initialized dev_t structure at open.
2004-06-09 17:58:51 +00:00
Roman Kurakin
a5d60d8852 1. struct tty => struct tty *tty.
Requested by:	phk
2004-06-08 10:38:20 +00:00
Poul-Henning Kamp
5df76176f7 Make linesw[] an array of pointers to linedesc instead of an array of
linedisc.
2004-06-07 20:45:45 +00:00
Poul-Henning Kamp
13e84a71e0 Centralize the line discipline optimization determination in a function
called ttyldoptim().

Use this function from all the relevant drivers.

I belive no drivers finger linesw[] directly anymore, paving the way for
locking and refcounting.
2004-06-04 21:55:55 +00:00
Poul-Henning Kamp
fe3ec6224a Manual edits to change linesw[]-frobbing to ttyld_*() calls. 2004-06-04 20:04:52 +00:00