Commit Graph

161 Commits

Author SHA1 Message Date
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
Warner Losh
19b7ffd1b8 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 07:20:27 +00:00
Bernd Walter
6ca4cf4dce Fix alignment requirements of tulip_rombuf by further increasing
tulip_boardid size.
Add a comment to tulip_rombuf about this requirement.
I have had panics on alpha while probing a de card.
2003-06-13 22:34:03 +00:00
David E. O'Brien
f4636c5959 Use __FBSDID(). 2003-06-11 06:34:30 +00:00
Poul-Henning Kamp
5a87a6f702 Move some FALLTHROUGH comments so they work.
Fix indentation error.
Make boardid string long enough.
Remove unused variable.

Found by:       FlexeLint
2003-05-31 19:46:58 +00:00
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
Matthew N. Dodd
868d8b6286 - Use if_broadcastaddr from struct ifnet rather than relying on
extern 'etherbroadcastaddr'.
- Make 'etherbroadcastaddr' static.

Reviewed by:	 imp
2003-03-21 17:53:16 +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
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
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Sam Leffler
9ef8b52020 o track either_ifattach/ether_ifdetach API changes
o use if_input for input packet processing
o don't strip the Ethernet header for input packets
o use BPF_* macros bpf tapping
o call ether_ioctl to handle default ioctl case
o track vlan changes

Reviewed by:	many
Approved by:	re
2002-11-14 23:49:09 +00:00
Philippe Charnier
93b0017f88 Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:23:09 +00:00
Jens Schweikhardt
21dc7d4f57 Fix typo in the BSD copyright: s/withough/without/
Spotted and suggested by:	des
MFC after:	3 weeks
2002-06-02 20:05:59 +00:00
Mike Barcroft
a30d4b3270 Move the new byte order function prototypes from <sys/param.h> to
<sys/endian.h>.  This puts us in line with NetBSD and OpenBSD.
2002-04-26 22:48:23 +00:00
Peter Wemm
84e5eebd09 No FreeBSD/vax here either. 2001-11-03 08:32:28 +00:00
Peter Wemm
b7a441ca87 Remove some unused stuff 2001-03-25 07:21:04 +00:00
Poul-Henning Kamp
6817526d14 Convert if_multiaddrs from LIST to TAILQ so that it can be traversed
backwards in the three drivers which want to do that.

Reviewed by:    mikeh
2001-02-06 10:12:15 +00:00
Poul-Henning Kamp
37d4006626 Another round of the <sys/queue.h> FOREACH transmogriffer.
Created with:   sed(1)
Reviewed by:    md5(1)
2001-02-04 16:08:18 +00:00
Poul-Henning Kamp
fc2ffbe604 Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)
2001-02-04 13:13:25 +00:00
Jonathan Lemon
df5e198723 Lock down the network interface queues. The queue mutex must be obtained
before adding/removing packets from the queue.  Also, the if_obytes and
if_omcasts fields should only be manipulated under protection of the mutex.

IF_ENQUEUE, IF_PREPEND, and IF_DEQUEUE perform all necessary locking on
the queue.  An IF_LOCK macro is provided, as well as the old (mutex-less)
versions of the macros in the form _IF_ENQUEUE, _IF_QFULL, for code which
needs them, but their use is discouraged.

Two new macros are introduced: IF_DRAIN() to drain a queue, and IF_HANDOFF,
which takes care of locking/enqueue, and also statistics updating/start
if necessary.
2000-11-25 07:35:38 +00:00
Mark Murray
f7261d9c5f Convert the de driver into a loadable module. Still missing is an
unload method. Lots of old cruft is removed.

Thanks to WPaul for large clue-injection and debugging services.

Reviewed by:	wpaul
2000-10-31 01:25:10 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Archie Cobbs
21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
Peter Wemm
94278c74bb Use the correct name for the PCI command register (PCIR_COMMAND). Don't
use constant that used to be a variable in our (very) old pci code.
2000-05-28 16:06:56 +00:00
Archie Cobbs
2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Doug Rabson
ff13eb73c1 Use bus_space for all register accesses. 2000-05-13 18:47:24 +00:00
Jonathan Lemon
3e48370f70 Bounce a copy of the mbuf to the bpf listener when we submit the frames
for transmit to the adapter, not when we receive a transmit interrupt
indicating that they were sent.  This fix now allows tcpdump to produce
sane results by recording the timestamp at the point where the mbuf was
actually transmitted.
2000-05-06 15:53:59 +00:00
Poul-Henning Kamp
d4032b0b10 Ignore tulip chips on LanMedia WAN cards. 2000-04-25 21:45:45 +00:00
Peter Wemm
0ae2f9bf04 A fairly simple newbusification of if_de 2000-03-20 09:18:46 +00:00
Matt Jacob
af077239b6 Include the file that defines PCIM_CMD_BUSMASTEREN. 2000-02-16 02:22:37 +00:00
Mike Smith
7af42aebc4 Ensure that the busmaster enable bit is set; we can't assume that all
BIOS code will get this right (and some certainly doesn't).

Submitted by:	W. Gerald Hicks <jhix@mindspring.com>
Approved by:	jkh
2000-02-16 01:12:09 +00:00
Poul-Henning Kamp
46783fb897 Remove NBPF conditionality of bpf calls in most of our network drivers.
This means that we will not have to have a bpf and a non-bpf version
of our driver modules.

This does not open any security hole, because the bpf core isn't loadable

The drivers left unchanged are the "cross platform" drivers where the respective
maintainers are urged to DTRT, whatever that may be.

Add a couple of missing FreeBSD tags.
1999-09-25 12:06:01 +00:00
Bill Fumerola
775ef6178d Add missing include.
Submitted by:	Mitsuru IWASAKI <iwasaki@jp.FreeBSD.org>
Reviewed by:	Alex Perel <veers@disturbed.net>
1999-08-21 21:35:59 +00:00
Mike Smith
fcb893a801 Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by:	green
1999-08-21 06:24:40 +00:00
Peter Wemm
e9fc0b372f Replace the tulip_delay_300ns() with a DELAY(1). Hammering the PCI bus
to achieve a delay is pretty mean.

Andrew reports:
"The tulip_delay_300ns() is, well, bloody stupid on machines with a
heavily loaded PCI bus.  It tries to do a delay by assuming PCI reads
will take a certain amount of time & issues a large amount of
(expensive, 5% CPU when your PCI bus is heavily loaded) pci reads.

Locally, we've replaced the calls to tulip_delay_300ns(sc) in the EMIT
macros with a simple DELAY(1) and not seen any problems.  Plus we've
gained about 50Mb/sec throughput on our gigabit network cards because
of the added PCI bus bandwidth available."

Also, I do not understand why, but this change appears to stop the
Transmit Fifo underrun on one of my systems (but not the Alpha PC164SX).
This shouldn't make that much of a difference since the mii bus isn't
touched all that often, but perhaps when it does get accessed and hence
hammers the register, it was causing the chip to get upset.

Submitted by:	Andrew Gallatin <gallatin@cs.duke.edu>
1999-08-19 15:07:20 +00:00
Peter Wemm
a063132590 A little more tidying up. 1999-08-09 14:43:39 +00:00
Peter Wemm
b2368001b4 Expand a heap of macros that obscure readability and are no longer needed
here, and do a bit of general tidy up.
1999-08-09 14:15:46 +00:00
Peter Wemm
ac6b4b7c14 More pre-lite2 support zapped and some more tidy-up. 1999-08-09 13:24:55 +00:00
Peter Wemm
48cadfb15e Unifdef -D__FreeBSD__ - and remove pre-lite2 support. 1999-08-09 13:15:53 +00:00
Peter Wemm
d1292ac4bc Unifdef -U__NetBSD__ 1999-08-09 13:07:37 +00:00
Peter Wemm
28acbab4e0 Unifdef -U__bsdi__ 1999-08-09 13:01:58 +00:00
Peter Wemm
fff7a5bef5 s/Id/FreeBSD/ 1999-08-09 12:52:49 +00:00
Peter Wemm
b46f22127f Strip __FreeBSD_version >= 300000 conditionals. 1999-08-09 12:50:12 +00:00
Peter Wemm
3d3bfc5db5 Merge changes from NetBSD rev 1.82 -> 1.86 via vendor branch.
Among the changes:  1.84: support compex 4-port cards.
1999-08-09 12:29:29 +00:00
Peter Wemm
61ec30585f s/TULUP/TULIP/ - from vendor branch. 1999-08-08 19:56:06 +00:00
Dag-Erling Smørgrav
6b5ca0d83e Rename bpfilter to bpf. 1999-07-06 19:23:32 +00:00
Peter Wemm
9929d2a045 Eliminate a bunch of #include "pci.h" and #if NPCI > 0 around entire
files.  config will leave the whole file out if configured to do so.
1999-07-03 20:17:08 +00:00
Andrew Gallatin
0f884d6cef Forgotten in previous commit:
Allow chipset drivers to specify the direct-mapped DMA window's mask in
preparation for tsunami support.  Previous chipsets' direct-mapped DMA
mask was always 1024*1024*1024.  The Tsunami chipset needs it to be
2*1024*1024*1024

Reviewed by:	Doug Rabson <dfr@nlsystems.com>
1999-05-26 23:05:23 +00:00
Peter Wemm
8dbdf6eec6 #include "pci.h" for the build dir, not <pci.h> 1999-05-10 14:12:26 +00:00
Peter Wemm
579f45fa60 Simplify the COMPAT_PCI_DRIVER/DATA_SET hack. We can add:
#define COMPAT_PCI_DRIVER(name,data) DATA_SET(pcidevice_set,data)
.. to 2.2.x and 3.x if people think it's worth it.  Driver writers can do
this if it's not defined.  (The reason for this is that I'm trying to
progressively eliminate use of linker_sets where it hurts modularity and
runtime load capability, and these DATA_SET's keep getting in the way.)
1999-05-09 17:07:30 +00:00