Commit Graph

94 Commits

Author SHA1 Message Date
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
David Malone
01399f34a5 Fix some long standing bugs in writing to the BPF device attached to
a DLT_NULL interface. In particular:

        1) Consistently use type u_int32_t for the header of a
           DLT_NULL device - it continues to represent the address
           family as always.
        2) In the DLT_NULL case get bpf_movein to store the u_int32_t
           in a sockaddr rather than in the mbuf, to be consistent
           with all the DLT types.
        3) Consequently fix a bug in bpf_movein/bpfwrite which
           only permitted packets up to 4 bytes less than the MTU
           to be written.
        4) Fix all DLT_NULL devices to have the code required to
           allow writing to their bpf devices.
        5) Move the code to allow writing to if_lo from if_simloop
           to looutput, because it only applies to DLT_NULL devices
           but was being applied to other devices that use if_simloop
           possibly incorrectly.

PR:		82157
Submitted by:	Matthew Luckie <mjl@luckie.org.nz>
Approved by:	re (scottl)
2005-06-26 18:11:11 +00:00
Brooks Davis
becbf981db Fix a number of now bogus casts I missed the first time around (I must
have failed to grep this file properly).

Reported by:	Hans Petter Selasky <hselasky at c2i dot net>
Approved by:	re (ifnet blanket)
2005-06-17 23:54:48 +00:00
Brooks Davis
81b6f2cf42 Refer to the correct file/function in panic messages.
Reported by:	Hans Petter Selasky <hselasky at c2i dot net>
Approved by:	re (ifnet blanket)
2005-06-17 17:14:57 +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
Warner Losh
86cb007f9f /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
Robert Watson
71e7578499 Mark i4b IPR and SPPP drivers as NET_NEEDS_GIANT(), as they both
interface with the network stack but are not yet sufficiently
synchronized to run without the Giant lock.  It migh be possible
to mark the interfaces as IFF_NEEDSGIANT, but I'm unable to test
that configuration and am unfamiliar with the architecture of
i4b.
2004-10-12 09:25:52 +00:00
Peter Wemm
f37a929ca1 Kill count device support from config. I've changed the last few
remaining consumers to have the count passed as an option.  This is
i4b, pc98/wdc, and coda.

Bump configvers.h from 500013 to 600000.

Remove heuristics that tried to parse "device ed5" as 5 units of the ed
device.  This broke things like the snd_emu10k1 device, which required
quotes to make it parse right.  The no-longer-needed quotes have been
removed from NOTES, GENERIC etc.  eg, I've removed the quotes from:
   device  snd_maestro
   device  "snd_maestro3"
   device  snd_mss

I believe everything will still compile and work after this.
2004-08-30 23:03:58 +00:00
Andre Oppermann
3161f583ca Apply error and success logic consistently to the function netisr_queue() and
its users.

netisr_queue() now returns (0) on success and ERRNO on failure.  At the
moment ENXIO (netisr queue not functional) and ENOBUFS (netisr queue full)
are supported.

Previously it would return (1) on success but the return value of IF_HANDOFF()
was interpreted wrongly and (0) was actually returned on success.  Due to this
schednetisr() was never called to kick the scheduling of the isr.  However this
was masked by other normal packets coming through netisr_dispatch() causing the
dequeueing of waiting packets.

PR:		kern/70988
Found by:	MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
MFC after:	3 days
2004-08-27 18:33:08 +00:00
Ruslan Ermilov
f29897b67d Catch up with the new world order of Netgraph metas.
(This one was the last, according to grep(1).)

Submitted by:	Gleb Smirnoff
2004-07-06 06:43:45 +00:00
Warner Losh
436e887e9c Add another ifdef... 2004-07-05 17:58:03 +00:00
Warner Losh
1877e5a42f meta_p is a void *, so a variable that's of type void * can't be
dereferenced directly.  Toss an ifdef around it for the moment and
allow this to compile.  This likely means that priority packets aren't
queued to the special high priority queue.  The maintainer of this
should look into the problem.

This is likely fallout from the netgraph migration to using a more
generic meta tag from the mbug recently.

Fixes: pc98 tinerbox
2004-07-04 16:10:36 +00:00
Poul-Henning Kamp
c1f7e1d994 Be BURN_BRIDGES compliant 2004-06-21 21:59:00 +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
Max Laier
02b199f158 Link ALTQ to the build and break with ABI for struct ifnet. Please recompile
your (network) modules as well as any userland that might make sense of
sizeof(struct ifnet).
This does not change the queueing yet. These changes will follow in a
seperate commit. Same with the driver changes, which need case by case
evaluation.

__FreeBSD_version bump will follow.

Tested-by:	(i386)LINT
2004-06-13 17:29:10 +00:00
Julian Elischer
f8aae7776f Switch to using C99 sparse initialisers for the type methods array.
Should make no binary difference.

Submitted by:	Gleb Smirnoff <glebius@cell.sick.ru>
Reviewed by:	Harti Brandt <harti@freebsd.org>
MFC after:	1 week
2004-05-29 00:51:19 +00:00
Poul-Henning Kamp
dc08ffec87 Device megapatch 4/6:
Introduce d_version field in struct cdevsw, this must always be
initialized to D_VERSION.

Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing
four D_NOGIANT flags and adding 145 D_NEEDGIANT flags.
2004-02-21 21:10:55 +00:00
Poul-Henning Kamp
c9c7976f7f Device megapatch 1/6:
Free approx 86 major numbers with a mostly automatically generated patch.

A number of strategic drivers have been left behind by caution, and a few
because they still (ab)use their major number.
2004-02-21 19:42:58 +00:00
Gary Jennejohn
ebb5694a4b Based on an excellent suggestion from tanimura@ define I4BPRI and use it
in place of TTIPRI.
2003-11-10 14:20:34 +00:00
Gary Jennejohn
84df55b1f4 Fix breakage cuased by the selwakeuppri commit by defining TTIPRI for
recent versions of FreeBSD (based on __FreeBSD_version check).
2003-11-10 14:02:22 +00:00
Seigo Tanimura
512824f8f7 - Implement selwakeuppri() which allows raising the priority of a
thread being waken up.  The thread waken up can run at a priority as
  high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
  priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
  threads.  Used by selwakeuppri() if collision occurs.

Not objected in:	-arch, -current
2003-11-09 09:17:26 +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
Brooks Davis
915897a895 Initialize if_softc and use it in favor of &ipr_softc[ifp->if_unit] to
get the softc.
2003-10-31 00:44:56 +00:00
David E. O'Brien
a75fe74844 Use __FBSDID(). 2003-06-10 23:23:33 +00:00
Poul-Henning Kamp
8e5d2c7eca Fix systematic off-by-one errors in unit number range checks.
Found by:       FlexeLint
2003-05-31 16:57:01 +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
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
Dag-Erling Smørgrav
521f364b80 More low-hanging fruit: kill caddr_t in calls to wakeup(9) / [mt]sleep(9). 2003-03-02 16:54:40 +00:00
Poul-Henning Kamp
73f936c5ac NODEVFS cleanup:
Don't call cdevsw_{add,remove}()
Remove remnants of the previous DEVFS.
2003-02-26 21:10:04 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Gary Jennejohn
b54c65a9b7 Fix another typo in a comment which I noticed while doing the MFC. 2003-02-06 14:52:47 +00:00
Gary Jennejohn
6a622ac3a3 Fix some typos in 3 comments.
Reported by: marius@alchemy.franken.de
2003-02-01 14:43:24 +00:00
Gary Jennejohn
68e12ba37e Add a fix for the case where the dialout fails. In this case the isp
interface was left in an active, but not connected, state, which resulted
in data being sent to it and the transmit queue filling up. This happened
because the driver never informed sppp that it shoulkd clean up the
connection. This fix informs sppp that it should clean things up.

The fix was actually developed and tested under -stable, so a short MFC
period seems appropriate, say 2 days.

Contributed by: Ari Suutari <ari.suutari@syncrontech.com>
2003-01-30 14:19:58 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Sam Leffler
6fc32a2495 network interface and link layer changes:
o on input don't strip the Ethernet header from packets
o input packet handling is now done with if_input
o track changes to ether_ifattach/ether_ifdetach API
o track changes to bpf tapping
o call ether_ioctl for default handling of ioctl's
o use constants from net/ethernet.h where possible

Reviewed by:	many
Approved by:	re
2002-11-15 00:00:15 +00:00
Brooks Davis
a5066cff3a Don't include the depricated "bpf.h" and always compile in bpf support
as per current practice.
2002-10-21 05:05:43 +00:00
Brooks Davis
5906e69ac2 Continue de-counting i4b. Devices i4bctl, i4bcapi, iavc, i4bq921,
i4bq931, i4b, isic, iwic, ifpi, ifpi2, ifpnp, ihfc, and itjc are
no longer count devices.  Also remove a few other instances of N<DEVICE>
being used to control compilation of whole files.

Reviewed by:    hm
2002-09-02 00:52:11 +00:00
Hellmuth Michaelis
52b5377d2f Bugfix to enable dialer "connected" response. 2002-08-27 14:19:28 +00:00
Philippe Charnier
93b0017f88 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
Alfred Perlstein
7e743e3a41 Unbreak LINT by compensating for the
ng_parse_struct_info -> ng_parse_struct_field change.
2002-06-01 19:54:21 +00:00
Peter Wemm
b01d78f42f Oops, I missed this warning. Comment out extra junk after #endif 2002-05-24 06:22:48 +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
Hellmuth Michaelis
e0d83003c4 Clean up the i4b kernel part: remove unmaintained #if(def)s for NetBSD,
OpenBSD and BSD/OS and respective code, remove pre $FreeBSD CVS id's,
remove #if(def)s and respective code for FreeBSD versions < 5 .
2002-03-17 09:33:15 +00:00
Hellmuth Michaelis
cd987b48ab remove BSD/OS specific ppp-interface file since the FreeBSD-BSD/OS merger
is IMHO likely not to happen anymore ...
2002-03-09 13:18:24 +00:00
Hellmuth Michaelis
b25b877461 After joergs merge of i4b's sppp with the main sppp, remove obsolete file. 2002-03-09 13:14:49 +00:00
Joerg Wunsch
c4552f53b1 Remove unused includes. 2001-12-31 09:31:30 +00:00
Joerg Wunsch
230ce3668b Fix two typos in previous commit. 2001-12-30 19:37:41 +00:00
Joerg Wunsch
734b6a9ee0 Remove references to i4b/driver/i4b_ispppsubr.c, now that
net/if_spppsubr.c has all its features.

Hooray, it's gone!

MFC after:	1 month
2001-12-30 18:48:24 +00:00
Gary Jennejohn
1c6126426b Protect mtx_init() invocations with mtx_intialized() checks to avoid a
reported panic.

Submitted by:	Alexander Leidinger <Alexander@Leidinger.net> (partly)
MFC after:	4 weeks
2001-12-30 09:27:28 +00:00