Commit Graph

151 Commits

Author SHA1 Message Date
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
Doug Rabson
84b399de51 Changes to support diskless booting on the alpha:
* Make the network code in the bootstrap more chatty (helps debugging)
* Add nfs root stuff to cpu_rootconf(). I also added a check to make sure
  it really was netbooting which allows the use of the same kernel for local
  and network boots.
* Tweak the de driver so that it takes the speed setting from the console
  for the alpha (some PWSs have broken de chipsets). This is the same
  behaviour as NetBSD/alpha.

Submitted by: Andrew Gallatin <gallatin@cs.duke.edu>
1999-05-03 09:36:29 +00:00
Peter Wemm
96b3554e5c Use COMPAT_PCI_DRIVER() for registration if it exists. This shouldn't
hurt the driver portability to 3.x too much for where drivers are shared.
1999-04-24 20:17:05 +00:00
Luigi Rizzo
ab090e5b4e MF22... add bridging support to the device drivers. Without this
bridging cannot work on -current/releng3!
1999-03-17 16:44:53 +00:00
Peter Wemm
ac3101276b Merge NetBSD 1.80->1.82 changes from vendor branch into mainline. 1999-03-14 08:32:52 +00:00
Peter Wemm
3b419f5843 set if_snd.ifq_maxlen to something reasonable - note that if_de.c has
a wierd double-queue arrangement..  It always empties the if_snd queue
then puts the transmit packets into a different queue that is limited
by the number of TX descriptors and does it's own discards...
This should stop the boot-time XXX warning anyway.
1999-03-13 09:21:27 +00:00
Luigi Rizzo
d560f7208b Fix handling of IFF_ALLMULTI. The code did not call
tulip_addr_filter() on SIOCSIFFLAGS, and was nuking the IFF_ALLMULTI
on entering tulip_addr_filter(). As a result it was impossible to run
a multicast router on a machine with a "de" interface.
1999-03-01 16:54:28 +00:00
Bruce Evans
d12895f90b Removed a bogus cast to v_caddr_t. This is part of terminating
v_caddr_t with extreme prejudice.  Here the bogons were originally
the same as for c_caddr_t (half-baked K&R support), but rev.1.95
changed one wrong cast and one harmless cast to 2 wrong casts,
and rev.1.96 only fixed the originally wrong cast.
1999-01-29 11:31:45 +00:00
Bruce Evans
9e26dd2a54 Removed bogus casts to c_caddr_t. This is part of terminating
c_caddr_t with extreme prejudice.  Here the original casts to
caddr_t were to support K&R compilers (or missing prototypes),
but the relevant source files require an ANSI compiler.
1999-01-29 08:29:05 +00:00
Matthew Dillon
697457a133 Fix warnings related to -Wall -Wcast-qual 1999-01-28 17:32:05 +00:00
Matthew Dillon
8aef171243 Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile
1999-01-28 00:57:57 +00:00