History log of /freebsd-9.3-release/sys/dev/ed/if_ed.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 264943 25-Apr-2014 marius

MFC: r260050, r261528

- Switch to using the common MII bitbang'ing code instead of duplicating it.
- Based on lessons learnt with dc(4) (see r185750), add bus space barriers to
the MII bitbang read and write functions as well as to instances of page
switching.
- Add missing locking to ed_ifmedia_{upd,sts}().
- Canonicalize some messages.
- Based on actual functionality, ED_TC5299J_MII_DIROUT should be rather named
ED_TC5299J_MII_DIRIN.
- Remove unused headers.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.


# 248078 08-Mar-2013 marius

MFC: r243857 (partial)

Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.


# 229648 05-Jan-2012 yongari

MFC r228286:
Fix off by one error in mbuf access. Previously it caused panic.
While I'm here use NULL to compare mbuf pointer and add additional
check for zero length mbuf before accessing the mbuf.

PR: kern/162932


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 217323 12-Jan-2011 mdf

sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.

Commit the rest of the devices.


# 211721 23-Aug-2010 yongari

Fix a possible unaligned access to savebyte array.

PR: kern/122195


# 207554 03-May-2010 sobomax

Add new tunable 'net.link.ifqmaxlen' to set default send interface
queue length. The default value for this parameter is 50, which is
quite low for many of today's uses and the only way to modify this
parameter right now is to edit if_var.h file. Also add read-only
sysctl with the same name, so that it's possible to retrieve the
current value.

MFC after: 1 month


# 199380 17-Nov-2009 jhb

Use a private callout timer to drive the transmit watchdog instead of using
if_watchdog and if_timer. The driver already contained an optional stats
timer that individual attachments could use to provide a 'tick' event. The
stats timer only ran if the tick function pointer was non-NULL and the
attachment's tick routine had to call callout_reset(), etc. Now the driver
always schedules a stat timer and manages the callout_reset() internally.
This timer is used to drive the watchdog and will also call the attachment's
'tick' handler if one is provided.

Tested by: WATANABE Kazuhiro


# 195049 26-Jun-2009 rwatson

Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs. This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by: re (kib)
MFC after: 6 weeks


# 192043 13-May-2009 imp

ifp->if_softc is managed entirely by the driver. We never set it to
NULL or change it. We initialize it before we set if_ioctl. It can
therefore never be NULL, and most other drivers don't bother with this
sanity check.


# 191321 20-Apr-2009 imp

Sometimes we can call ed_detach() before the mtx has been initialized.
Avoid it if it hasn't been initialized.


# 191299 19-Apr-2009 imp

Cleanup resource allocation code a bit. Store the rids on the
resources rather than on the softc. When we allocate resources for PC
Card, if we only get 16 ports, try again to get the others.


# 190794 07-Apr-2009 imp

Provide a generic ifmedia set of routines as a fallback. The
DP8390-based cards have no generic way of reporting status of the link
or setting the media type. Some specific versions of these cards do,
however, allow for this, and we already support some of them. Make
the 'ed' experience more uniform by providing "autoselect" as the
meida and status "active" always. This won't affect the chips that
provide more specific details.


# 190562 30-Mar-2009 imp

Two fixes:
(1) Delete all children when detaching to keep from adding a phy each
driver reload.
(2) All AX88x90 chips have the RST issue.


# 190559 30-Mar-2009 imp

This is a major reworking of the AX88x90 support.

o Introduce new chip_type AX88790. There's a few places we need to know the
exact chip for workaronds.
o Explain the AX88190 workaround for the ISR bits being stuck, and don't
apply them to the AX88790. The datasheet says the bits are fixed, and
experience confirms.
o Fix mii bit-bang read code to read and discard the 'floating' bit.
o Remove empty ed_pccard_ax88x90_mii_reset routine
o Report error from mii_phy_probe
o Don't use ed_probe_Novel_generic for ax88x90 chips. It puts them into
an odd state sometimes. Instead, use a more stream-lined version that
avoids the trouble spots. This was copied and tweaked from the original.
o Move chip reset into its own routine.
o Minor code optimiation on getting MAC address
o Add code for coping with AX88790 cards that are in power down state and
need to be kicked before the PHY registers for the internal phy read right.
o Remove ugly cap of PHYs at 17.
o For AX88790, we need to set a special bit for accessig phy 16 (the internal
phy) and clear it for all others according to a chip erratum.
o streamline the bit-bang code for AX88x90: the delays aren't needed according
to the datasheet timing diagrams and also the Linux driver
o Fix minor bit definition for direction bit.
o Generally: Some comments reformatted
o Only try the toshiba probe on cards labelled as toshiba

# From another Akihabara card (this one from a few years ago from a
# friend in Japan). Fix the Corega FEther II PCC-TXD. This one is
# still on sale new, as of a few weeks ago. should fix all other AX88x90
# based cards, but I have some testing left to finish on my collection...


# 190488 28-Mar-2009 imp

When reading via memory, read in (amount + 1) / 2 (to properly round
up) rather than amount + 1 / 2, which is the same as amount, or 2x too
many words which leads to data corruption.

# This fixes the sbdrop panics I was seeing with the Toshiba LANCT00A.


# 190446 26-Mar-2009 imp

Allow the attach routine to fail gracefully and not panic the system.


# 190431 25-Mar-2009 imp

Tweak comments.


# 181351 06-Aug-2008 imp

When the miibus for the AX88x90 or TC5299J cards fails to attach, we
would call ed_release_resources() when we should have called
ed_detach() to properly undo the effects of prior calls to
ed_attach(). This would leave a stray ed interface ifnet alive in the
system, which was, well, bad, since we called if_free() on the
underlying memory... Fix the ed_detach routine to cope being called
in this context now.

This should never come up because the miibus is always there. Except
for now when it seems to be failing for reasons unknown... That's a
different bug that hits at least ed, xl, dc and fxp...


# 167753 21-Mar-2007 nyan

Don't call bus_deactivate_resource() explicitly before calling
bus_release_resource(). This is needed for pc98 by upcoming nexus related
change.


# 159538 12-Jun-2006 imp

MFp4:
o Implement a bunch of sysctl's to report the information
that's now always reported. Mvoe reporting of that info
to bootverbose, but maybe it can go away entirely.
dev.ed.X.type: string name
dev.ed.X.TxMem: amount of memory used for tx side of the card
dev.ed.X.RxMem: amount of memory used for rx side of the card
dev.ed.X.Mem: Total amount of mem on card.
o Better comments about where NE-2000 (and clones) gets their MAC
address from.


# 154924 27-Jan-2006 imp

Have a function pointer to the routine to call for writing an mbuf
into the card's memory.

# this eliminates a more of the ifdef soup in if_ed and if_edvar

# I've fixed the cbus drivers, but can't test them all easily.

If I've broken anything, please let me know.


# 154895 27-Jan-2006 imp

Create mediachg functions for the 3c503 and hpp cards. This is used
to properly configure the right interface to use.

Also call the mediachg function when we set flags UP and are already
running. If this were a pure ifmedia driver, we'd not need to do this
since we'd be ignoring the linkX flags.

This reduces the number of ifdefs to support sub-devices a little as a
nice side effect. It also reduces the number of hpp interfaces
exposed by 33%.


# 154892 27-Jan-2006 imp

Transition from ALTPHYS to LINK2. We already document in the ed(4)
man page that the ifconfig option link2 is used to disable the AUI
transceiver on the 3com boards (should also say HP PC Lan+). This
makes the connection clearer.

Add a note about why we set this flag prior to attaching the device.
We never set or clear the flag later, only test it. There can be no
races here, but this might be asthetically displeasing to some. Also
note that we may no longer need to have this knob at all as we may be
able to do it with the more sophisticated rc.d scripts we have today I
think the only reason it is there is because we didn't used to allow
its proper setting when configured to get the IP address via DHCP.

I'll note that this would be better handled by using ifmedia for all
ed cards, not just those with a miibus...


# 152315 11-Nov-2005 ru

- Store pointer to the link-level address right in "struct ifnet"
rather than in ifindex_table[]; all (except one) accesses are
through ifp anyway. IF_LLADDR() works faster, and all (except
one) ifaddr_byindex() users were converted to use ifp->if_addr.

- Stop storing a (pointer to) Ethernet address in "struct arpcom",
and drop the IFP2ENADDR() macro; all users have been converted
to use IF_LLADDR() instead.


# 150580 26-Sep-2005 imp

Go ahead and detach our children in our detach routine. I'm undecided
if we should delete them also or not, but have decided not to do so
for the moment.


# 150326 19-Sep-2005 imp

Remove duplicate if_free().

Submitted by: ru@


# 150306 19-Sep-2005 imp

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.


# 150300 18-Sep-2005 imp

MFp4:
o eliminate the ED_NO_MIIBUS option. Now, you need miibus to use ed with
pccard. If you have an old ISA or PCI card w/o a miibus, then you'll still
be able to use the ed driver w/o miibus in the kernel. If you have pccard
you'll need mii now. Most pccards these days have miibus, and many
cards have ISSUES if you don't attach miibus. issues I don't want to
constantly rediagnose.
- Add new media_ioctl, mediachg and tick function pointers. The core
driver will call these if they aren't NULL, or return an error if they
are.
- migrate remaining mii code into if_ed_pccard.
o include some notes from my datasheet fishing. this may allow us to
get media status from some pccards.
o Fix one bug that's common to many drivers. call if_free(ifp) after
we tear down the interrupt. ed_intr() depends on ifp being there and
freeing it while interrupts can still happen is, ummm, bad.


# 150215 16-Sep-2005 ru

Fix "struct ifnet" leaks when attach() fails in the middle.


# 150108 13-Sep-2005 imp

MFp4: Omnibus ed changes

o Attach AX88x90's MII bus to system, and require its presence.
o Reorg the mii code a little, and move more of it into pccard attachment.
o Eliminate ed_pccard_{read,write}_attrmem in favor of a more appropriate
function in the pccard layer.
o Update comments to reflect knowledge gained.
o Update how re recognize a NE-2000 ROM. I found a couple of different
datasheets that define the structure of the PROM data, so the code's
old heuristics have been removed, and comments updated to reflect the
structure.
o Eliminate work around for EC2T. It is no longer needed, and was wrong
headed since the EC2T has a Winbound 82C926C in it, not a AX88x90.
o Add copyright to if_ed_pccard.c, since I believe I've re-written more than
3/4 of it.

# With these changes, all of my 20-odd ed based cards work, except for the
# NetGear FA-410, and I'm pretty sure that's a MII/PHY problem.


# 149891 08-Sep-2005 imp

The ed driver lock is already held in the mii frobbing routines. Remove
locking from these routines.


# 149702 02-Sep-2005 imp

MFp4: kill bogus comment


# 149558 28-Aug-2005 imp

Finish conversion to bus space and make ed MP safe.

o Lock ed
o Fix extra newline in probe messages
o Eliminate gone.
o Make detach less-racy.
o Eliminate spl*
o Switch from timeout/untimeout to callout interface.
o Read/write card memory using bus_space calls.
o generalize readmem so that we don't need ifs in the code.
o Fix memory stuff to be consistant.
o Remove OLDCARD compat stuff.
o Mark interrupt as MPSAFE.

# sic, hpp not tested at all
# ISA and PCI attachments lightly tested


# 148887 09-Aug-2005 rwatson

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


# 148654 02-Aug-2005 rwatson

Modify device drivers supporting multicast addresses to lock if_addr_mtx
over iteration of their multicast address lists when synchronizing the
hardware address filter with the network stack-maintained list.

Problem reported by: Ed Maste (emaste at phaedrus dot sandvine dot ca>
MFC after: 1 week


# 147405 15-Jun-2005 brooks

Fix four casts of the softc to a struct ifnet.

Hopefully this fixes ed(4) under qemu. I'm shocked that real hardware
is apparently working with these bugs.

Approved by: re (ifnet blanket)
Pointy hat: brooks


# 147256 10-Jun-2005 brooks

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


# 142259 22-Feb-2005 imp

Add a stratigic newline


# 142202 22-Feb-2005 imp

MFp4: Optimize in/out macros. Cache the handle and tag in softc and
use them in the macros. Since the rman_get_bus{tag,handle} transitioned
from macros to function calls, this unpessimizes that conversion.


# 142162 21-Feb-2005 imp

Minor style(9)isms.


# 142134 20-Feb-2005 imp

Minor optimizations to compile out bits that aren't necessary when
certain options aren't enabled.

Submitted by: Chiharu Shibata-san (chi at bd mbn or jp)


# 141879 14-Feb-2005 imp

Add some comments in preparation for converting bcopy/bzero to busspace.
Minor style nits.


# 141684 11-Feb-2005 imp

Diff reduction with p4.


# 141673 10-Feb-2005 imp

Move enable/disable 16bit access routines into if_ed. Slightly
pessmize the error recover path through edintr by calling these
functions, rather than expanding it inline. This error path already
does a lot in it, so an extra function call will be lost in the noise.
It also happens rarely.


# 141672 10-Feb-2005 imp

use
while (complicated-expr)
continune;
in preference to
while (complicated-expr);

since the code generated is identical, and the former is easier to read,
especially for complicated-expr that reach to the end of the line...


# 141586 09-Feb-2005 imp

Break out obscure ISA cards into their own files, as well as ne2000
and wd80x3 support. Make the obscure ISA cards optional, and add
those options to NOTES on i386 (note: the ifdef around the whole code
is for module building). Tweak pc98 ed support to include wd80x3 too.
Add goo for alpha too.

The affected cards are the 3Com 3C503, HP LAN+ and SIC (whatever that
is). I couldn't find any of these for sale on ebay, so they are
untested. If you have one of these cards, and send it to me, I'll
ensure that you have no future problems with it...

Minor cleanups as well by using functions rather than cut and paste
code for some probing operations (where the function call overhead is
lost in the noise).

Remove use of kvtop, since they aren't required anymore. This driver
needs to get its memory mapped act together, however, and use bus
space. It doesn't right now.

This reduces the size of if_ed.ko from about 51k to 33k on my laptop.


# 141548 08-Feb-2005 imp

Convenience function to clear memory of the card, and then check to make
sure that it works by reading back as 0.


# 141496 08-Feb-2005 imp

Use ANSI function definitions, tweak a couple of prototypes to match (since
K&R prototypes needed to mismatch in the way that they were mismatched),
rename ds_getmcaf to ed_ds_getmcaf. Remove a few register keywords.


# 141495 08-Feb-2005 imp

use fixed types for the calls to ed_pio_readmem, ed_pio_writemem.
Make the special hp versions match the general ones. Also use fixed
types in the WD80x3_generic probe, and change callers' arrays to
match. Fix a couple of minor style issues by using newstyle function
definitions in a couple places.


# 141494 08-Feb-2005 imp

Make it possible to unload ed. Move the ed_pccard_detach routine to
if_ed and rename it to ed_detach(). Tell other busses to use this
routine for detach.

Since I don't actually have any non-pccard ed hardware I can test
with, I've only tested with my pccards.

More improvements in this area likely are possible.

Prodded by: rwatson


# 140843 26-Jan-2005 imp

Repair probe messages a bit. Previously, we'd print the ethernet
address, and additional information. Then the printing of the
ethernet address was moved into ether_attach, and so we were printing
orphaned information about the card. Now the probe message is
prefixed by edX:. Prepare for it to move under bootverbose, but don't
move it there yet (the || 1 trick).


# 140468 19-Jan-2005 imp

MFp4: u_intXX_t to uintXX_t.


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 137958 21-Nov-2004 mlaier

Commit ALTQ-patch for ed(4).

Requested and tested by: pav
MFC after: 1 week


# 137531 10-Nov-2004 nyan

Fix build error with ED_DEBUG.

PR: kern/72753


# 134871 06-Sep-2004 glebius

Remove layer intermixing. Device driver should pass the frame should
pass frame to ether_input(), and do not play with bridge itself.

Reviewed by: sam, andre
Approved by: julian (mentor)
MFC after: 1 week


# 133683 13-Aug-2004 rwatson

Since if_ed doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.


# 130270 09-Jun-2004 naddy

Replace handrolled CRC calculation with ether_crc32_[lb]e().


# 129616 23-May-2004 mux

We don't need to initialize if_output, ether_ifattach() does it
for us.


# 128304 16-Apr-2004 obrien

Fix building on L64 machines.


# 128293 15-Apr-2004 luigi

Remove improper use of if_addrhead in device drivers to check
if the link-level address has been initialized already.

The majority of modern drivers never does this and works fine, which
makes me think that the check is totally unnecessary and a residue
of cut&paste from other drivers.

This change is done to simplify locking because now almost none of the
drivers uses this field. The exceptions are "ct" "ctau" and "cx"
where i am not sure if i can remove that part.


# 127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 126966 14-Mar-2004 mdodd

Announce ethernet MAC addresss in ether_ifattach().


# 126531 03-Mar-2004 obrien

Blah, s/newbus/busdma/ in the last commit.


# 126526 03-Mar-2004 obrien

Adjust ed(4) for 64-bit platforms should it get newbus'ified.


# 123289 08-Dec-2003 obrien

Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.

Requested by: bde,imp


# 122678 14-Nov-2003 obrien

Remove duplicate FBSDID's, move others to their right place.


# 122625 13-Nov-2003 obrien

Try to create some sort of consistency in how the routings to find the
multicast hash are written. There are still two distinct algorithms used,
and there actually isn't any reason each driver should have its own copy
of this function as they could all share one copy of it (if it grew an
additional argument).


# 121816 31-Oct-2003 brooks

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)


# 121752 30-Oct-2003 brooks

There is no way to enter the attach routine twice with the same softc
without a detach call in between so don't try to deal with that
possiability.

This is a diff-reduction commit for the upcoming if_xname conversion.


# 121118 15-Oct-2003 shiba

Add Allied Telesis SIC-AT boards support.
Discussed in from [FreeBSD-tech-jp 3396] to [FreeBSD-tech-jp 3407]
at FreeBSD-tech-jp@jp.freebsd.org.

NOTE: We must put ed_probe_SIC() function into if_ed_isa.c because
this is a bus dependent code. But the ed driver code is not
separated explicitly whether it is bus dependent or independent
now.

Refer to: http://plaza17.mbn.or.jp/~chi/myprog/FreeBSD/sicat.html
Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 118607 07-Aug-2003 jhb

Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort. In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by: bde (kern_ktrace.c)


# 113131 05-Apr-2003 cognet

Fix ed compilation with PAE by using %jx instead of %x.


# 112569 24-Mar-2003 jake

- Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
with PAE.
- Use this to represent physical addresses in the MI vm system and in the
i386 pmap code. This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by: DARPA, Network Associates Laboratories
Discussed with: re, phk (cdevsw change)


# 111119 19-Feb-2003 imp

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 109623 21-Jan-2003 alfred

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# 108533 01-Jan-2003 schweikh

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


# 106937 14-Nov-2002 sam

network interface driver changes:

o don't strip the Ethernet header from inbound packets; pass packets
up the stack intact (required significant changes to some drivers)
o reference common definitions in net/ethernet.h (e.g. ETHER_ALIGN)
o track ether_ifattach/ether_ifdetach API changes
o track bpf changes (use BPF_TAP and BPF_MTAP)
o track vlan changes (ifnet capabilities, revised processing scheme, etc.)
o use if_input to pass packets "up"
o call ether_ioctl for default handling of ioctls

Reviewed by: many
Approved by: re


# 104253 30-Sep-2002 brooks

Use if_printf() instead of printf() to print "ed#: blah".


# 104166 29-Sep-2002 imp

mbuf leak in the error case has been fixed. When we have
an error, go ahead and m_freem the buffer.

PR: 32666
Submitted by: Chi-Fung Fan


# 104094 28-Sep-2002 phk

Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by: FlexeLint warning #512


# 92739 20-Mar-2002 alfred

Remove __P.


# 86865 24-Nov-2001 imp

Patch to allow the ed driver interrupt routine to terminate if the
card is ejected while we're in this routine.

yamamoto-san's original patch had a small race window for AX88190
chips, which I corrected by limiting the number of iterations we'd try
to reset the bits to be about 15ms rather than forever. This seems to
work for me, but I don't have a large collections of cards based on
this chipset.

Submitted by: YAMAMOTO Shigeru


# 86047 04-Nov-2001 luigi

MFS: sync the ipfw/dummynet/bridge code with the one recently merged
into stable (mostly , but not only, formatting and comments changes).


# 85838 01-Nov-2001 luigi

Always compile in bridge hooks, or this code will not work (efficiently) with
the loadable bridge module.


# 85783 31-Oct-2001 asmodai

Fix obvious bug where return from probe was botched.
People with HP PCLAN+ NICs can now happily use the card again

PR: 21087
Submitted by: M. B. Buchanan <buchanan@orbitworld.net>


# 84601 06-Oct-2001 luigi

Make this compile again after the changes to make bridge kld'able


# 84151 29-Sep-2001 iedowse

Add an option ED_NO_MIIBUS, which causes the `ed' driver to be
built without support for miibus PHYs. Most ed cards don't need
miibus support, so it's useful to be able to avoid the bloat of
all the mii devices for small fixed-purpose kernels.


# 80166 22-Jul-2001 iedowse

Add a few missing spl calls in preparation for an MFC of the miibus
support.


# 73374 03-Mar-2001 imp

Add support for Dlink DL10022 to the ed driver. This is a mii part
bolted to a ne-2000 chip. This is necessary for the NetGear FA-410TX
and other cards.

This also requires you add mii to your kernel if you have an ed driver
configured.

This code will result in a couple of timeout messages for ed on the
impacted cards. Additional work will be needed, but this does work
right now, and many people need these cards.

Submitted by: Ian Dowse <iedowse@maths.tcd.ie>


# 72193 08-Feb-2001 luigi

Whoops... forgotten a few pieces in previous patch:
* a ">" is really ">=" ;
* do not try to fetch zero-sized blocks from the card;
* make sure that bpf gets the packets it wants even with
bridging active;


# 72190 08-Feb-2001 luigi

Make sure that we do not accept packets shorter than a full ethernet
header, or we would have a negative length passed to ether_input().


# 72084 06-Feb-2001 phk

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


# 72082 06-Feb-2001 asmodai

Fix typo: wierd -> weird.

There is no such thing as wierd in the english language.


# 72012 04-Feb-2001 phk

Another round of the <sys/queue.h> FOREACH transmogriffer.

Created with: sed(1)
Reviewed by: md5(1)


# 71999 04-Feb-2001 phk

Mechanical change to use <sys/queue.h> macro API instead of
fondling implementation details.

Created with: sed(1)
Reviewed by: md5(1)


# 70355 26-Dec-2000 imp

Minor newbus/style(9) cleanups.
o Move the ax88190 code to its own function.
o Move all device_method_t, driver_t and DRIVER_MODULE definitions to the
end of files.
o Wrap a few lines > 80 characters.
o Use the same devclass for all ed drivers. This allows machines with
multiple types of cards to have their cards numbered correctly. Before,
you could wind up with two ed0's.
o Protect if_edvar.h from multiple includes because I was there.


# 70154 18-Dec-2000 toshi

Linksys Fast Ethernet PCCARD cards supported by the ed driver now
require the addition of flag 0x80000 to their config line in
pccard.conf(5). This flag is not optional. These Linksys cards will
not be recognized without it.

Reviewed by: imp, iwasaki


# 69965 13-Dec-2000 imp

Remove unnecessary includes found by phk's script. I've been building
these locally for ages.


# 69137 25-Nov-2000 peter

Update the ed driver to probe and attach under a NEWCARD kernel (I was
using a cardbus based system with pccbb providing the pcic interface).
Something isn't quite right.. when the driver allocates and activates
its resources, the IO space that was requested reads as all zeros (versus
the original 0xff's as it normally is when there is no device responding).

Also, deactivate the resources before releasing them. OLDCARD doesn't
seem to care but NEWCARD/CARDBUS get rather unhappy if you release
a resource that hasn't been deactivated yet.

Make pcic_p.c only compile with oldcard kernels.


# 67164 15-Oct-2000 phk

Remove unneeded #include <machine/clock.h>


# 65771 12-Sep-2000 ps

Move the detection of Linksys PCMCIA cards from attach to probe.
This should solve the problems people were seeing with this driver.

Reported by: phk & others.


# 64777 17-Aug-2000 nyan

- Fixed the conversion to bus_space interface.
- Added PC-98 Cbus devices support.
The original patch is submitted by chi@bd.mbn.or.jp (Chiharu Shibata)
- Removed old ed driver.


# 64630 14-Aug-2000 tanimura

Newbusify ed driver.

Partly submitted by: alex


# 63775 23-Jul-2000 tanimura

MFPAO: Add support for AX88190, equipped in MELCO LPC3-TX.


# 63451 18-Jul-2000 phk

Fix the IRQ9/IRQ2 confusion.

Submitted by: Alan Clegg <abc@bsdi.com>


# 63090 13-Jul-2000 archie

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


# 62236 29-Jun-2000 ps

Only try to detect Linksys PCMCIA cards when we are in a pccard
environment. This fixes the breakage to ISA ethernet cards.

Reviewed by: peter


# 61792 18-Jun-2000 ps

Allow newer Linksys 10/100 PCMCIA cards to work.

Reviewed by: imp


# 61152 01-Jun-2000 phk

ed_ioctl() can be called from ifpromisc() after the card has been removed,
don't panic on a NULL pointer in that case.


# 60536 14-May-2000 archie

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


# 59760 29-Apr-2000 phk

Remove unneeded #include <sys/kernel.h>


# 59391 19-Apr-2000 phk

Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>


# 58409 20-Mar-2000 imp

Bogusly returned zero always. Return 1 if we pass the checksum.


# 58325 20-Mar-2000 imp

Noriyoshi Kawano-san reported in nomads another OUI for linksys. 4 is
too many, so I removed the checks for the valid OUIs. We already do a
checksum of the entire ethernet address, so extra checking against the
OUI shouldn't be needed.


# 57969 13-Mar-2000 imp

Add another Linksys OUI.

PR: 16922
Submitted by: takawata@shidahara1.planet.sci.kobe-u.ac.jp


# 54384 10-Dec-1999 imp

Fix pccard ed driver, I think.
o Expose ed_stop and call it early to shutdown the hardware.
o When releasing the interrupt, pass the cookie for the irq, not
a pointer to the cookie (this is the base problem).
o Release other resources used, just like the ep driver


# 53378 18-Nov-1999 nyan

Set port_used and mem_used to the resource size instead of 1.

Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 52783 02-Nov-1999 jmb

fix misordering of two lines in this file.


# 52725 31-Oct-1999 jmb

rearrange order of tests for NE1000, NE2000, and Linksys
cards. previous order caused computers with NE2000 cards
to hang during boot.


# 52714 31-Oct-1999 nyan

Change Linksys registers base/offset.
On NEC PC-98, asic_addr != nic_addr + 0x10.

Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 52584 28-Oct-1999 imp

Add comments to Linksys probe code.
Add another OUI to those acceptible to linksys (this check may need to
be removed).
A couple of style(9) nits.


# 52542 26-Oct-1999 jmb

add support for LinkSys 10/100 cards
new code is conditionalized by the vendor's ethernet OUI

Obtained from: PAO Project


# 52473 25-Oct-1999 imp

Add pccard attachment. This won't work with memory mapped ed devices
yet, but that should be resolved shortly. Non memory mapped ed
devices should work, but I cannot test this since my only ed card is
memory mapped.

Submitted by: Matt Dodd <mdodd@freebsd.org>


# 52375 18-Oct-1999 mdodd

This fixes the problem with SMC NE2000 cards hanging the box on
bootup. Somehow my backout of an abortaive attempt at shared
memory autoconfiguration included this line:

sc->mem_shared = 1;

Which is fairly important as it turns out.

Since I performed my pre-commit testing on a different box with a generic
NE2000 I didn't catch this. Pointy hat.


# 52247 15-Oct-1999 mdodd

- Remove the ISA, PCI, and PCCARD specific code from if_ed.c; it
now lives in the respective bus front end files.
- Add various function prototypes to if_edvar.h
- Clean up some debugging code that snuck into if_ed_isa.c
- Turn on the right bits in files.i386


# 52174 12-Oct-1999 dfr

* Add struct resource_list* argument to resource_list_alloc and
resource_list_release. This removes the dependancy on the
layout of ivars.

* Move set_resource, get_resource and delete_resource from
isa_if.m to bus_if.m.

* Simplify driver code by providing wrappers to those methods:

bus_set_resource(dev, type, rid, start, count);
bus_get_resource(dev, type, rid, startp, countp);
bus_get_resource_start(dev, type, rid);
bus_get_resource_count(dev, type, rid);
bus_delete_resource(dev, type, rid);

* Delete isa_get_rsrc and use bus_get_resource_start instead.

* Fix a stupid typo in isa_alloc_resource reported by Takahashi
Yoshihiro <nyan@FreeBSD.org>.

* Print a diagnostic message if we can't assign resources to a PnP
device.

* Change device_print_prettyname() so that it doesn't print
"(no driver assigned)-1" for anonymous devices.


# 51646 25-Sep-1999 phk

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.


# 51442 20-Sep-1999 peter

Make if_ed work again on pci, isa, isapnp. The hack to make it work on
PCCARD is pretty revolting but should buy us time while the pccard driver
angle is sorted out. A commit for the MCA ed attachment will follow
shortly.


# 51247 13-Sep-1999 peter

The sense of probes has inverted. They return an error, rather than
true/false. Fix ed_probe_HP_pclanp() so that it doesn't "succeed" on
non-existing hardware.

Submitted by: Mark Hittinger <bugs@freebsd.netcom.com>


# 51052 07-Sep-1999 dfr

Change isa_get/set_flags() to device_get/set_flags().


# 50857 03-Sep-1999 peter

Forced commit/correction: The previous commit message should have
referred to Matthew Dodd, not Warner. :-/ I should be asleep..


# 50852 03-Sep-1999 peter

Commit a checkpoint of an updated if_ed driver. This is pretty much
Doug Rabson's work, with a few tweaks from Warner Losh and I. There are
still some quirks to resolve, but the old driver is presently breaking
the build.


# 50808 02-Sep-1999 kato

- Added new macros ED_P1_MAR(i) and ED_P1_PAR(i) that replace
`ED_P1_MAR + i' and `ED_P1_PAR + i', respectively.
- convert ED_PC_RESET and ED_PC_MISC into relative offset from
ED_PC_ASIC_OFFSET (those macros are not used in current source).

Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 50807 02-Sep-1999 kato

The ed_probe_Novell should not clear id_maddr when it fails to probe.
This fixes potential panic by kvtop at addr == 0.

Submitted by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 50477 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48645 06-Jul-1999 des

Rename bpfilter to bpf.


# 46845 09-May-1999 peter

#ifdef BRIDGE around a goto label used by the bridge code to silcence a
warning.


# 45720 16-Apr-1999 peter

Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition. eisa, isapnp and pccard* are
not yet using the new resource manager. Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
ATA driver to the Alpha. Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by: core


# 44829 17-Mar-1999 luigi

MF22... add bridging support to the device drivers. Without this
bridging cannot work on -current/releng3!


# 43314 27-Jan-1999 dillon

Fix warnings in preparation for adding -Wall -Wcast-qual to the
kernel compile


# 42820 18-Jan-1999 peter

Update the pccard hooks to use a module style declaration instead.


# 41738 13-Dec-1998 eivind

Remove warning introduced by the last committer.


# 40565 22-Oct-1998 bde

Initialize isa_devtab entries for interrupt handlers in individual
device drivers, not in ioconf.c. Use a different hack in isa_device.h
so that a new config(8) is not required yet.

pc98 parts approved by: kato


# 39144 13-Sep-1998 eivind

Support PnP compatibility IDs. This allow e.g. the ed driver to pick
up any PnP NE2000 compatible card, instead of forcing us to always
update ID lists.

Submitted by: Ugo Paternostro <paterno@dsi.unifi.it>


# 38505 24-Aug-1998 bde

Fixed printf format errors. Only one left in LINT on i386's.


# 37101 21-Jun-1998 bde

Removed unused includes.


# 37032 17-Jun-1998 bde

Include <i386/isa/pnp.h> after including its prerequisite
<i386/isa/isa_device.h> - don't depend on pollution in <sys/conf.h>
including the prerequisite earlier.


# 36735 07-Jun-1998 dfr

This commit fixes various 64bit portability problems required for
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.

The prototype FreeBSD/alpha machdep will follow in a couple of days
time.


# 35256 17-Apr-1998 des

Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.


# 35210 15-Apr-1998 bde

Support compiling with `gcc -ansi'.


# 34936 29-Mar-1998 eivind

Don't use fast interrupts when initialized through PnP. if_ed does
not support fast interrupts.

Noticed by: bde


# 34928 28-Mar-1998 bde

Removed unused #includes.


# 33873 27-Feb-1998 hosokawa

Support for "MAC address in CIS" type cards.
For example, IBM Creditcard Ethernet's MAC address is ALWAYS
"0:2:4:6:8:a" :-) without this code.


# 33864 27-Feb-1998 msmith

PCCARD-code related style nits, as requested.
Submitted by: bde


# 33860 27-Feb-1998 msmith

Fix some style nits and remove an unused header.
Submitted by: bde


# 33134 06-Feb-1998 eivind

Back out DIAGNOSTIC changes.


# 33110 05-Feb-1998 eivind

Add PnP support to if_ed.c.


# 33108 04-Feb-1998 eivind

Turn DIAGNOSTIC into a new-style option.


# 32350 08-Jan-1998 eivind

Make INET a proper option.

This will not make any of object files that LINT create change; there
might be differences with INET disabled, but hardly anything compiled
before without INET anyway. Now the 'obvious' things will give a
proper error if compiled without inet - ipx_ip, ipfw, tcp_debug. The
only thing that _should_ work (but can't be made to compile reasonably
easily) is sppp :-(

This commit move struct arpcom from <netinet/if_ether.h> to
<net/if_arp.h>.


# 31311 20-Nov-1997 nate

- Renamed <pccard/card.h> -> <pccard/cardinfo.h>.

Forgotten by: me
Reminded by: Bruce


# 31016 07-Nov-1997 phk

Remove a bunch of variables which were unused both in GENERIC and LINT.

Found by: -Wunused


# 30892 02-Nov-1997 dg

Sigh, kill setting of 0WS...it breaks more machines than it fixes.


# 30824 28-Oct-1997 jdp

The previous change added a use of the DATA_SET macro, but forgot
to define it by including <sys/kernel.h>. That broke PC-CARD
support for this driver, producing the dreaded "device allocation
failed" message. Surprisingly, the missing include caused only
two compiler warnings. The compilation still "succeeded" anyway.


# 30747 26-Oct-1997 nate

- Instead of relying on a functional call to register PCARD-capable drivers,
use a Linker Set. Note, if a driver is loaded as an LKM if will have
to use the function call, but since none of the existing drivers
are loadable, this made things cleaner and boot messages nicer.

Obtained from: PAO-970616


# 30721 26-Oct-1997 nate

- Functional changes to PCCARD support.
* Kill individual drivers 'suspend' routines, since there's no simple/safe
way to suspend/resume a card w/out going through the complete probe
at initialization time.
* Default to using the apm_pccard_resume sysctl code, which basically
pretends the card was removed, and then re-inserted. Suspend/resume
is now 'emulated' with a fake insert/removal. (Hence we no longer
need the driver-specific suspend routines.)


# 30720 26-Oct-1997 nate

- Do a bunch of gratuitous changes intended to make the code easier to
follow.
* Rename/reorder all of the pccard structures, change many of the member
names to be descriptive, and follow more closely other 'bus' drivers
naming schemes.
* Rename a bunch of parameter and local variable names to be more
consistant in the code.
* Renamed the PCCARD 'crd' device to be the 'card' device
* KNF and make the code consistant where it was obvious.
* ifdef'd out some unused code


# 30084 03-Oct-1997 dg

Backed out part of a previous change: don't set ZWS on '790 chips; it has
shown to be harmful in that it results in the card not being detected
properly on warmboot due to the station address failing to be read
correctly from the NVRAM.


# 29261 09-Sep-1997 dg

Change the address for the low end of what we permit from c0000 down
to a0000 so that people can put their cards in the middle of their
video memory if they want. :-)


# 29226 08-Sep-1997 dg

Added a check for the ISA memory address range being valid. Fixes PR#835.


# 29221 08-Sep-1997 dg

Turn on the 0WS option for 16bit cards. Newer machines insert enough
delay that without this the performance is unacceptable. The 83C690,
83C790, and 83C795 chips which this affects are all designed to work
with 0 waitstates in 16bit mode.
Also cleaned up the toggling of 16bit access mode that occurs during
normal operation; the previous code may not have done the right thing
in all cases.


# 29024 01-Sep-1997 bde

Added used #include - don't depend on <sys/mbuf.h> including
<sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).


# 27555 20-Jul-1997 bde

Removed unused #includes.


# 24204 24-Mar-1997 bde

Don't include <sys/ioctl.h> in the kernel. Stage 2: include
<sys/sockio.h> instead of <sys/ioctl.h> in network files.


# 22975 22-Feb-1997 peter

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 22557 11-Feb-1997 julian

really minor cleanup

sc is set to ifp->if_softc so use it..


# 21673 14-Jan-1997 jkh

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 21666 13-Jan-1997 wollman

Use the new if_multiaddrs list for multicast addresses rather than the
previous hackery involving struct in_ifaddr and arpcom. Get rid of the
abominable multi_kludge. Update all network interfaces to use the
new machanism. Distressingly few Ethernet drivers program the multicast
filter properly (assuming the hardware has one, which it usually does).


# 20407 13-Dec-1996 wollman

Convert the interface address and IP interface address structures
to TAILQs. Fix places which referenced these for no good reason
that I can see (the references remain, but were fixed to compile
again; they are still questionable).


# 20276 10-Dec-1996 dg

1) Implement SIOCSIFMTU in ether_ioctl(), and change ether_ioctl's return
type to be int so that errors can be returned.
2) Use the new SIOCSIFMTU ether_ioctl support in the few drivers that are
using ether_ioctl().
3) In if_fxp.c: treat if_bpf as a token, not as a pointer. Don't bother
testing for FXP_NTXSEG being reached in fxp_start()...just check for
non-NULL 'm'. Change fxp_ioctl() to use ether_ioctl().


# 20116 03-Dec-1996 phk

PR kern/2141:

function ed_attach_NE2000_pci() in if_ed.c passes
an uninitialized block of memory (got with malloc())
to ed_attach. This prevents a proper initialization
of the device descriptor and in my case causes a panic
during the probe, while printing out device info.

Reviewed by: phk
Submitted by: Luigi Rizzo <luigi@iet.unipi.it>


# 19780 15-Nov-1996 wollman

Fix RFC 1650 stats... should have read the doco more carefully.
Fixes PR#2011

Submitted by: seki@sysrap.cs.fujitsu.co.jp


# 18979 17-Oct-1996 nate

This patch attempts to make the pccard probe in if_ed.c work with
non-memory-mapped cards.

Submitted by: Michael Smith <msmith@atrad.adelaide.edu.au>
Reviewed by: phk,dg


# 18869 11-Oct-1996 wollman

Implement the RFC 1650 MIB.


# 18084 06-Sep-1996 phk

Remove devconf, it never grew up to be of any use.


# 17465 07-Aug-1996 dg

This diff adds support for the HP PC Lan+ cards (model numbers: 27247B
and 27252A) in FreeBSD's `ed' driver.

Submitted by: A JOSEPH KOSHY <koshy@india.hp.com>


# 17455 06-Aug-1996 phk

Megacommit to straigthen out ETHER_ mess.

I'm pretty convinced after looking at this that the majority of our
drivers are confused about the in/exclusion of ETHER_CRC_LEN :-(


# 17416 04-Aug-1996 phk

Replace about 60 lines of code with a call to ether_ioctl().
This can be done for most of our ethernet drivers.


# 16733 25-Jun-1996 bde

Added #include of <machine/md_var.h>. This will be needed when
some declarations are moved from <machine/cpufunc.h> to better
places.


# 16471 17-Jun-1996 bde

Removed unused #includes of <i386/isa/icu.h> and <i386/isa/icu.h>. icu.h
is only used by the icu support modules and by a few drivers that know
too much about the icu (most only use it to convert `n' to `IRQn'). isa.h
is only used by ioconf.c and by a few drivers that know too much about
isa addresses (a few have to, because config is deficient).


# 15943 27-May-1996 gpalmer

Clean up the warnings produced by the recent PCI code. Requested by
SE since he doesn't have good access right now


# 15813 18-May-1996 se

Add support for NE2000 compatible PCI Ethernet cards. The PCI probe
is enabled by having an "device ed0 at isa? [...]" config line.
The first PCI card will get a unit number one higher than the highest
defined for any ISA card of the ED type, e.g. if ed0 and ed1 are
configured, then the PCI cards will be ed2, ed3, ...

BEWARE: If you have configured your kernel as ed0 with the port address
as assigned by the PCI BIOS, then your card will be found by both the
PCI and ISA probes, and bad things may happen. Make sure to restore
the original port address form the GENERIC kernel for the ed0 device!

Reviewed by: davidg


# 15363 23-Apr-1996 nate

Format the already applied PCCARD additions to use KNF form. No
functional changes.


# 15130 07-Apr-1996 dg

Killed sections 3 and 4 of my copyright as I think it is unnecessarily
restrictive.


# 14950 31-Mar-1996 joerg

Fix a bogus message:
ed0: Invalid irq configuration (2) must be 2-5 for 3c503
^ ^


# 13937 06-Feb-1996 wollman

Clean up Ethernet drivers:
- fill in and use ifp->if_softc
- use if_bpf rather than private cookie variables
- change bpf interface to take advantage of this
- call ether_ifattach() directly from Ethernet drivers
- delete kludge in if_attach() that did this indirectly


# 13619 24-Jan-1996 phk

Use new printf features rather than local kludges.


# 12868 15-Dec-1995 dg

Changed arg type for pio functions.
Cast a few things appropriately to shut up the compiler.


# 12854 14-Dec-1995 bde

Completed function declarations and/or added prototypes and/or added
#includes to get prototypes.


# 12724 10-Dec-1995 phk

Staticize and cleanup.


# 12634 05-Dec-1995 dg

Updated my copyright.
Fixed two cases of "=" that should have been "==" in card type comparison.
Simplified expression that checks for interface up/down.
Moved ed_ring_copy to before its first use so that it's inlined as intended.
Change mbuf allocation policy so that a received packet is stored in just
an mbuf header (no cluster) if it will fit in one.


# 12628 05-Dec-1995 dg

all:
Removed ifnet.if_init and ifnet.if_reset as they are generally unused.
Change the parameter passed to if_watchdog to be a ifnet * rather than
a unit number. All of this is an attempt to move toward not needing an
array of softc pointers (which is usually static in size) to point to
the driver softc.

if_ed.c:
Changed some of the argument passing to some functions to make a little
more sense.

if_ep.c, if_vx.c:
Killed completely bogus use of if_timer. It was being set in such a way
that the interface was being reset once per second (blech!).


# 12362 18-Nov-1995 bde

Fixed staticization - use `static' in function headers, not just in
prototypes.


# 12326 16-Nov-1995 bde

Included <sys/conf.h>. It used to be included as a side effect of
including <sys/devconf.h>.


# 12309 15-Nov-1995 dg

Correct the bogus probe for 8216/8416 cards...it was broken.

Submitted by: Steve Piette <steve@simon.chi.il.US>


# 12080 04-Nov-1995 bde

Added `#include "ioconf.h"' to <machine/conf.h> and cleaned up the
misplaced extern declarations (mostly prototypes of interrupt handlers)
that this exposed. The prototypes should be moved back to the driver
sources when the functions are staticalized.

Added idempotency guards to <machine/conf.h>. "ioconf.h" can't be
included when building LKMs so define a wart in bsd.kmod.mk to help
guard against including it.


# 11961 31-Oct-1995 phk

Cleanup, make things static.


# 11896 28-Oct-1995 pst

Close out kern/46.

Remove confusing backwards compatibility code that allowed driver to be
used in pre-4.4 releases. The 3COM card's use -link2 to switch tranceivers.
(no functional changes here)


# 11872 28-Oct-1995 phk

Remove unused functions and variables, make things static, and other cleanups.


# 11819 26-Oct-1995 julian

Reviewed by: julian and jhay@mikom.csir.co.za
Submitted by: Mike Mitchell, supervisor@alb.asctmd.com

This is a bulk mport of Mike's IPX/SPX protocol stacks and all the
related gunf that goes with it..
it is not guaranteed to work 100% correctly at this time
but as we had several people trying to work on it
I figured it would be better to get it checked in so
they could all get teh same thing to work on..

Mikes been using it for a year or so
but on 2.0

more changes and stuff will be merged in from other developers now that this is in.

Mike Mitchell, Network Engineer
AMTECH Systems Corporation, Technology and Manufacturing
8600 Jefferson Street, Albuquerque, New Mexico 87113 (505) 856-8000
supervisor@alb.asctmd.com


# 11602 20-Oct-1995 phk

A mixed bag of changes, relating to getting the state in "lsdev" right,
and pccard support to work sensibly. Better by far, but still not good.


# 11460 13-Oct-1995 wollman

Say goodbye to IFF_NOTRAILERS. Support for trailers was officially
dropped for 4.4, but for some reason this flag lived on. (Until
today, that is.)


# 11409 10-Oct-1995 phk

PCCARD support.


# 10270 25-Aug-1995 bde

Remove extra arg from the call to ds_crc().


# 9745 28-Jul-1995 dg

Fixed bug where a bogus packet length could cause a panic if the length
was less than sizeof(struct ed_ring).


# 9717 25-Jul-1995 bde

Change memcmp() to bcmp(). memcmp() isn't declared or implemented
for the kernel, but gcc provides an inline version of it if the
kernel is compiled with -O.


# 8876 30-May-1995 rgrimes

Remove trailing whitespace.


# 8511 14-May-1995 dg

After carefully reading three reference documents, and analyzing
the 802.3 frames generated by the DC21040 (which does automatic padding
of less-than-minimum frames) and the frames generated by the 'ed'
driver, I've found that there is indeed a bug in the size of "ETHER_MIN_LEN"
as reported by several people, John Hay being the most recent. The driver
was actually setting the length to 6+6+2+50 (64 bytes), which when adding
in the CRC (which is automatically appended to the frame and not included
in the length), the minimum frame is 4 bytes larger than it is supposed to
be. All of this is confirmed by tcpdump showing 50 bytes of data for
minimum frames from the 'ed' cards and 46 bytes from 'de' cards. This
analysis has also revealed that there is garbage in the un-filled in
portion at the end of the minimum frames from the 'ed' driver; I don't
plan to fix this.


# 8486 12-May-1995 dg

Only use card's soft-configured irq if no irq was specified in the kernel
config file. This should fix a number of complaints regarding the auto
detection behavior.


# 8266 04-May-1995 dg

Kill bogus duplicated code that resulted in an editing screwup of mine
that happend about 4 months ago.


# 7780 12-Apr-1995 wollman

Add a class field to devconf and mst drivers.
For those where it was easy, drivers were also fixed to call
dev_attach() during probe rather than attach (in keeping with the
new design articulated in a mail message five months ago). For
a few that were really easy, correct state tracking was added as well.
The `fd' driver was fixed to correctly fill in the description.
The CPU identify code was fixed to attach a `cpu' device. The code
was also massively reordered to fill in cpu_model with somethingremotely
resembling what identifycpu() prints out. A few bytes saved by using
%b to format the features list rather than lots of ifs.


# 7090 16-Mar-1995 bde

Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'. Fix all the bugs found. There were no serious
ones.


# 6742 26-Feb-1995 dg

Doubled 'maxwait' to 200 (240us).

Submitted by: brian@mediacity.com (Brian Litzinger)


# 6698 25-Feb-1995 dg

Spell "guaranteed" correctly.

Submitted by: frank@fwi.uva.nl (Frank van der Linden)


# 5807 23-Jan-1995 dg

Much better fix/support for the 83c795 based cards (the new SMC EtherEZ)
by steve@simon.chi.il.us (Steven E. Piette). Minor changes by me.


# 5629 14-Jan-1995 wollman

Some fixes to device configuration, now that I've had a chance to do it
properly from the beginning:

1) The `kern_devconf' struct should be a part of the driver's
`softc' structure (now it is).
2) The `description' should say what the device actually is,
rather than just giving a model number (now it does).
3) The device should be registered even if the probe fails, so
that it can be reconfigured later.
4) For netifs, the device state should follow the IFF_UP flag.

Other network interfaces should follow this example. (Please?) Eventually
there should be a rundown routine doing the equivalent of setting IFF_UP
off, and perhaps more if warranted.


# 5379 04-Jan-1995 dg

Made a few cosmetic changes, and fixed a bug in handling the case of the
remote DMA not completing correctly (the packet was still queued for xmit).


# 5333 01-Jan-1995 dg

Possible fix for NE2000 problems...the remote byte count wasn't word
aligned even though the transfers are 16bit.


# 5332 01-Jan-1995 dg

Get rid of unused variable.


# 5320 31-Dec-1994 jkh

Miscellaneous changes from Bill Paul:

- /sys/i386/isa/if_ed.c doesn't quite know how to deal with SMC EtherEZ
ethernet cards. The EtherEZ looks just like the Elite Ultra, except it
has only 8K of shared memory. The only way to have it properly detected
is to zero and test a few bytes of memory just about the first 8K region.
If it clears properly, it's an Elite Ultra, otherwise it's an EtherEZ.

I've also got an EtherEZ patch for netboot (Makefile, ether.c and ether.h).

- /sys/i386/isa/syscons.c wraps at the next to the last column rather than
the last column, like it should. You don't really notice this unless you
use certain programs that write all the way out to, say, the 80th column,
like VMSmail. Along with a one-line fix for this are some changes to
implement a non-blinking cursor. Put 'options "NOBLINK_CURSOR"' in your
config file and give it a try. :)

Submitted by: wpaul


# 5195 22-Dec-1994 wollman

Move ARP interface initialization into if_ether.c:arp_ifinit().


# 4820 26-Nov-1994 dg

Always put received packets in an mbuf cluster. This simplifies the code
considerably and is measurably faster. Various comment fixes.


# 4796 24-Nov-1994 dg

Moved conversion of ether_type to host byte order out of ethernet drivers
and into ether_input(). It was silly to have bpf want this one way and
ether_input want it another way. Ripped out trailer support from the few
remaining drivers that still had it.


# 4558 17-Nov-1994 dg

Fixed rather serious bug where the interface wasn't started after it was
stopped in ed_setrcr(). I'm amazed that the driver worked at all. Thanks to
John Hay for pointing this out.


# 4429 13-Nov-1994 dg

In cases where it is possible, use the card's configured irq rather than
the one compiled into the kernel. Left in some commented-out shared memory
performance test code.


# 3816 23-Oct-1994 wollman

Finished device configuration database work for all ISA devices (except `ze')
and all SCSI devices (except that it's not done quite the way I want). New
information added includes:

- A text description of the device
- A ``state''---unknown, unconfigured, idle, or busy
- A generic parent device (with support in the m.i. code)
- An interrupt mask type field (which will hopefully go away) so that
. ``doconfig'' can be written

This requires a new version of the `lsdev' program as well (next commit).


# 3796 22-Oct-1994 phk

While I debugged this, I quenched the compile warnings from if_ed. no other
changes.


# 3713 18-Oct-1994 wollman

Add support for devconf to a large number of device drivers, and do
the right thing in dev_goawayall() when kdc_goaway is null.


# 3670 17-Oct-1994 phk

isa_device.h: Added flag for sensitive HW. ed# seems to break if anything
else has been probed. This feature could go away again, if we can curb the
problem another way.

if_ed.c, syscons.c: Set the above flag. ed# because it needs it, syscons
because it looks stupid to "detect" the display you have already filled up
with text :-)

bt742a.c: Check bt_cmd() return-val during probe, thus failing on adaptec's.
Also silenced various printf's during the probe.

isa.c: Probe devices with the above flag set before the rest. Reduce the
number of "conflict" messages per device to one.

***
Please test the GENERIC-kernel now, if nobody can make it fail, GENERICAH
and GENERICBT has a finite and short life-expectancy...
***


# 3590 14-Oct-1994 dg

The code I wrote to write mbufs out using PIO had a bug in the handling
of mb_offset given the right sequence of 1 and 0 byte mbufs. This bug
was discovered by John Hood who also provided this fix - which is a
rewrite of the routine (and is easier to understand than the code I wrote).

Submitted by: John Hood <cgull@smoke.marlboro.vt.us>


# 3428 08-Oct-1994 dg

Completely removed trailer support. The only reason I wrote that code in
the first place was so that BPF could grok trailer packets. I've since
decided that this is a job for tcpdump to decipher (if at all). Also
fixed up checks for received packet length to better cope with ancient
starlan boards.


# 2826 16-Sep-1994 dg

Removed inclusion of pio.h and cpufunc.h (cpufunc.h is included from
systm.h). Merged functionality of pio.h into cpufunc.h. Cleaned up some
related code.


# 2534 07-Sep-1994 dg

Removed MULTICAST ifdef's; it's no longer optional. Cleaned up code a
little.


# 2200 22-Aug-1994 dg

Fixed minor typo in diagnostic message.


# 2112 18-Aug-1994 wollman

Fix up some sloppy coding practices:

- Delete redundant declarations.
- Add -Wredundant-declarations to Makefile.i386 so they don't come back.
- Delete sloppy COMMON-style declarations of uninitialized data in
header files.
- Add a few prototypes.
- Clean up warnings resulting from the above.

NB: ioconf.c will still generate a redundant-declaration warning, which
is unavoidable unless somebody volunteers to make `config' smarter.


# 2056 13-Aug-1994 wollman

Change all #includes to follow the current Berkeley style. Some of these
``changes'' are actually not changes at all, but CVS sometimes has trouble
telling the difference.

This also includes support for second-directory compiles. This is not
quite complete yet, as `config' doesn't yet do the right thing. You can
still make it work trivially, however, by doing the following:

rm /sys/compile
mkdir /usr/obj/sys/compile
ln -s M-. /sys/compile
cd /sys/i386/conf
config MYKERNEL
cd ../../compile/MYKERNEL
ln -s /sys @
rm machine
ln -s @/i386/include machine
make depend
make


# 2037 12-Aug-1994 dg

Removed some unnecessary code that sets the link layer address. This should
be removed from the other drivers, too, as it is already done at a higher level
in the kernel.


# 1954 08-Aug-1994 jkh

Fix a compilation-stopping typo; whoops, David - more sleep! :-)
Submitted by: jkh


# 1944 08-Aug-1994 dg

Added ioctl support for SIOCSIFMTU.


# 1831 04-Aug-1994 dg

Updated to include improvements from FreeBSD 1.1.5. Fixed brokeness
with multicast support and BPF.


# 1817 02-Aug-1994 dg

Added $Id$


# 1549 25-May-1994 rgrimes

The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by: Rodney W. Grimes
Submitted by: John Dyson and David Greenman


# 1358 13-Apr-1994 dg

Add delays after changing from 8/16 - 16/8 bit mode and after enabling/
disabling the shared memory. The 83C790 needs these or it does bad things.


# 1349 10-Apr-1994 dg

Fixed brokeness in the support of the 83C790/Elite Ultra (now that I
finally have the f**king documentation!):

1) Changed all the numeric register offsets to symbolic ones (it should
have been this way originally).
2) If 16 bit, disable the shared memory when not using it. Apparantly
switching between 8/16bit mode makes the Ultra unhappy unless
this is done (i.e. it trashes the bus).


# 1230 02-Mar-1994 dg

Minor comment change.


# 1226 01-Mar-1994 dg

Fix from Christoph Robitschko: the '790 interrupt table was wrong.


# 1080 03-Feb-1994 dg

if_ep.c: removed netisr.h, fixed unconverted ep_ac, changed <> into ""
for include files.
if_ed, if_ie, if_is: don't include netisr.h.


# 1075 02-Feb-1994 dg

Added 8003EB board type. Clue from Gerard J van der Grinten (gvdg@cdc.com)


# 1073 02-Feb-1994 dg

Added type code for 8003W.


# 1049 31-Jan-1994 dg

Patch from dcjm@cs.ed.ac.uk (Dave Matthews)...
Yes, I know that IFADDR ioctl is supposed to be deprecated... Note
that the patch was modified by me to fit better into the driver. -DG

...

While porting CAP to 386bsd/pk0.2.4 and now to FreeBSD Release 1.0
I found a couple of bugs associated with the packet filter. Here
are the fixes. I'm posting them here because they apply to
FreeBSD and 386bsd/pk0.2.4 and possibly to other *BSD.

The first occurs when using the packet filter to write raw
ethernet packets. The header consisting of the sender and
destination addresses and the protocol is removed and later
added back on, but with the byte order of the protocol reversed.
The fix ensures that the byte order in the protocol field is
swapped when it is removed.

The second fix ensures that SIOCGIFADDR works for BPF as claimed
in the man pages, by adding it to the ed driver. Similar fixes
will be needed for other ethernet drivers.
Dave Matthews.


# 1015 25-Jan-1994 ats

Put some more info about the toshiba ethernet cards into if_edreg.h.
Changed some numeric constants to defines in if_ed.c for the toshiba
cards.


# 969 11-Jan-1994 ats

Added the support for the Toshiba ethernet cards. It is only
ifdef and not default, because, i don't know if anyone else
is using this card.


# 927 03-Jan-1994 dg

Yanked out history section as it is unlikely there will be any further
changes for some time. Also changed the indentation style a little.


# 879 18-Dec-1993 wollman

Make everything compile with -Wtraditional. Make it easier to distribute
a binary link-kit. Make all non-optional options (pagers, procfs) standard,
and update LINT to reflect new symtab requirements.

NB: -Wtraditional will henceforth be forgotten. This editing pass was
primarily intended to detect any constructions where the old code might
have been relying on traditional C semantics or syntax. These were all
fixed, and the result of fixing some of them means that -Wall is now a
realistic possibility within a few weeks.


# 808 29-Nov-1993 dg

* Revision 2.16 1993/11/29 16:55:56 davidg
* merged in Garrett Wollman's strict prototype changes
*
* Revision 2.15 1993/11/29 16:32:58 davidg
* From Thomas Sandford <t.d.g.sandford@comp.brad.ac.uk>
* Add support for the 8013W board type


# 798 24-Nov-1993 wollman

Make the LINT kernel compile with -W -Wreturn-type -Wcomment -Werror, and
add same (sans -Werror) to Makefile for future compilations.


# 791 22-Nov-1993 dg

* Revision 2.14 1993/11/22 10:55:30 davidg
* change all splnet's to splimp's
*
* Revision 2.13 1993/11/22 10:53:52 davidg
* patch to add support for SMC8216 (Elite-Ultra) boards
* from Glen H. Lowe
*
* Revision 2.12 1993/11/07 18:04:13 davidg
* fix from Garrett Wollman:
* add a return(0) at the end of ed_probe so that if the various device
* specific probes fail that we just don't fall of the end of the function.


# 720 07-Nov-1993 wollman

Made all header files idempotent and moved incorrect common data from
headers into a related source file. Also fixed a bug in ed_probe() where
it was possible to fall off the end of the function


# 647 23-Oct-1993 dg

* Revision 2.11 1993/10/23 04:21:03 davidg
* Novell probe changed to be invasive because of too many complaints
* about some clone boards not being reset properly and thus not
* found on a warmboot. Yuck.
*
* Revision 2.10 1993/10/23 04:07:12 davidg
* increment output errors if the device times out (done via watchdog)
*
* Revision 2.9 1993/10/23 04:01:45 davidg
* increment input error counter if a packet with a bad length is
* detected.


# 609 15-Oct-1993 dg

* Revision 2.8 1993/10/15 10:59:56 davidg
* increase maximum time to wait for transmit DMA to complete to 120us.
* call ed_reset() if the time limit is reached instead of trying
* to abort the remote DMA.
*
* Revision 2.7 1993/10/15 10:49:10 davidg
* minor change to way the mbuf pointer temp variable is assigned in
* ed_start (slightly improves code readability)
*
* Revision 2.6 93/10/02 01:12:20 davidg
* use ETHER_ADDR_LEN in NE probe rather than '6'.


# 532 30-Sep-1993 dg

* Revision 2.5 93/09/30 17:44:14 davidg
* patch from vak@zebub.msk.su (Serge V.Vakulenko) to work around
* a hardware bug in cheap WD clone boards where the PROM checksum
* byte is always zero


# 522 30-Sep-1993 dg

* Revision 2.4 93/09/29 21:24:30 davidg
* Added software NIC reset in NE probe to work around a problem
* with some NE boards where the 8390 doesn't reset properly on
* power-up. Remove initialization of IMR/ISR in the NE probe
* because this is inherent in the reset.


# 521 29-Sep-1993 dg

* Revision 2.3 93/09/29 15:10:16 davidg
* credit Charles Hannum


# 520 29-Sep-1993 dg

* Revision 2.2 93/09/29 13:23:25 davidg
* added no multi-buffer override for 3c503
*
* Revision 2.1 93/09/29 12:32:12 davidg
* changed multi-buffer count for 16bit 3c503's from 5 to 2 after
* noticing that the transmitter becomes idle because of so many
* packets to load.
*
* Revision 2.0 93/09/29 00:00:19 davidg
* many changes, rewrites, additions, etc. Now supports the
* NE1000, NE2000, WD8003, WD8013, 3C503, 16bit 3C503, and
* a variety of similar clones. 16bit 3c503 now does multi
* transmit buffers. Nearly every part of the driver has
* changed in some way since rev 1.30.


# 506 24-Sep-1993 dg

* Revision 1.30 93/09/24 18:43:31 davidg
* fix bug where Compex boards ident themselves as 8003E's and the
* 16bit override wasn't working


# 498 22-Sep-1993 dg

rewrote interrupt code to be cleaner, fixed up some other parts
to make it easier to add future board types.


# 426 09-Sep-1993 dg

As of this revision, all known bugs have been fixed. Some of the fixes include:

1) fixed 3c503 lock-up if the thinwire cable was disconnected at boot time
2) 8013EBT boards now work (quite well!) in 16bit/16k mode
3) ED_NO_DOUBLE_BUFFERING flag now works
4) slightly higer performance (about 3%) with 16bit WD/SMC boards
5) support for WD8013WC (10BaseT) boards

Additionally, the probe code has been reorganized to be much cleaner. This
revision of the driver is 1.25. The release notes have been updated as well.


# 226 02-Aug-1993 dg

* Fixed problem where some rev 8013EBT boards want the DCR_LS flag
* set in order to work in 16bit mode.

Seems also to improve performance by 15%! (?!) I think there might
be more to this flag than the manual says.


# 200 27-Jul-1993 dg

* Applied fixes from Bruce Evans to fix COW bugs, >1MB kernel loading,
profiling, and various protection checks that cause security holes
and system crashes.
* Changed min/max/bcmp/ffs/strlen to be static inline functions
- included from cpufunc.h in via systm.h. This change
improves performance in many parts of the kernel - up to 5% in the
networking layer alone. Note that this requires systm.h to be included
in any file that uses these functions otherwise it won't be able to
find them during the load.
* Fixed incorrect call to splx() in if_is.c
* Fixed bogus variable assignment to splx() in if_ed.c


# 198 27-Jul-1993 dg

* Added include of systm.h to pick up inlined min/max/bcmp if you have
* them in cpufunc.h. Modified wait loop in reset to look a little better.
* Added read for talley counters to prevent an infinite loop on old
* 8003E's if they (the counters) overflow.


# 189 25-Jul-1993 dg

Fixed logic problem which caused a bogus value to be written to the 3c503
asic register even if the board isn't a 3c503. This caused old 8003E's not
to work because they ignore IO address bits >10bits and the 3c503 asic is
located at +0x400....the offset was ignored by the 8003E and so the
value was written to one of the NIC registers. The bug was discovered by
Wolfgang Solfrank.


# 172 20-Jul-1993 dg

Added config file override for memory size and added flags to force
8bit or 16bit operation, and a flag to disable transmitter double buffering.
See the updated "ed.relnotes" file for information about how to set
the flags.
This should be considered the first "production" release. It still
needs a manual page, though.


# 165 20-Jul-1993 jkh

Changed comment relating to memsize to be a little less misleading.


# 164 19-Jul-1993 jkh

Fixed to allow iosiz config parameter to override what was (for me,
incorrectly) probed. This allows you more flexibility in getting weird
WD 80x3 clones to work.


# 50 27-Jun-1993 dg

fixed bugs in the probe routine uncovered by the previous fix.


# 48 26-Jun-1993 dg

fixed bug in probe that causes it to complain about 'Invalid irq configuration'
if the interface isn't present in the system.


# 43 23-Jun-1993 dg

Second beta release of device driver for SMC/WD 80x3 ethernet boards +
some additional comments.


# 42 22-Jun-1993 dg

Second beta release of device driver for WD/SMC 80x3 and 3c503 ethernet boards


# 6 14-Jun-1993 dg

Beta release of device driver for SMC/WD80x3 and 3C503 ethernet boards.