Commit Graph

252 Commits

Author SHA1 Message Date
Brooks Davis
c3f967ce8d 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
2005-06-15 20:23:40 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

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

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

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Warner Losh
f5e40295aa Add a stratigic newline 2005-02-22 22:03:52 +00:00
Warner Losh
b2948b72e9 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.
2005-02-22 05:12:25 +00:00
Warner Losh
040cba413a Minor style(9)isms. 2005-02-21 07:22:50 +00:00
Warner Losh
b38c5039bd 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)
2005-02-20 18:44:45 +00:00
Warner Losh
f8d201b879 Add some comments in preparation for converting bcopy/bzero to busspace.
Minor style nits.
2005-02-14 06:27:23 +00:00
Warner Losh
d74c567254 Diff reduction with p4. 2005-02-11 07:50:03 +00:00
Warner Losh
f7167d3e91 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.
2005-02-10 23:48:13 +00:00
Warner Losh
0cfebadeb9 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...
2005-02-10 23:31:27 +00:00
Warner Losh
969eaf2179 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.
2005-02-09 20:03:40 +00:00
Warner Losh
851a243f68 Convenience function to clear memory of the card, and then check to make
sure that it works by reading back as 0.
2005-02-08 23:57:43 +00:00
Warner Losh
ad6da8a0fc 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.
2005-02-08 06:12:44 +00:00
Warner Losh
c1ed2c9eb2 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.
2005-02-08 05:59:43 +00:00
Warner Losh
9d512034e3 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
2005-02-08 05:45:35 +00:00
Warner Losh
4550f56d6f 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).
2005-01-26 05:12:16 +00:00
Warner Losh
33481e9d67 MFp4: u_intXX_t to uintXX_t. 2005-01-19 07:37:32 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Max Laier
ed0cf68945 Commit ALTQ-patch for ed(4).
Requested and tested by:	pav
MFC after:			1 week
2004-11-21 02:42:09 +00:00
Yoshihiro Takahashi
fea82a173b Fix build error with ED_DEBUG.
PR:		kern/72753
2004-11-10 13:16:12 +00:00
Gleb Smirnoff
1fb025d58a 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
2004-09-06 21:14:32 +00:00
Robert Watson
463d14faf8 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.
2004-08-13 23:04:23 +00:00
Christian Weisgerber
0e939c0cea Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
Maxime Henrion
866a788cc2 We don't need to initialize if_output, ether_ifattach() does it
for us.
2004-05-23 16:11:53 +00:00
David E. O'Brien
a1f60844da Fix building on L64 machines. 2004-04-16 05:34:14 +00:00
Luigi Rizzo
0318355d0e 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.
2004-04-15 20:31:10 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Matthew N. Dodd
e3bbbec2ca Announce ethernet MAC addresss in ether_ifattach(). 2004-03-14 07:12:25 +00:00
David E. O'Brien
a9653b1cc3 Adjust ed(4) for 64-bit platforms should it get newbus'ified. 2004-03-03 06:48:42 +00:00
David E. O'Brien
a55a017f42 Don't use caddr_t in mchash(). Also use C99 spellings over BSD ones.
Requested by:	bde,imp
2003-12-08 07:54:15 +00:00
David E. O'Brien
4dc52c32bf Remove duplicate FBSDID's, move others to their right place. 2003-11-14 17:16:58 +00:00
David E. O'Brien
aa8255025a 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).
2003-11-13 20:55:53 +00:00
Brooks Davis
9bf40ede4a Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.

This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.

Approved By:	re (in principle)
Reviewed By:	njl, imp
Tested On:	i386, amd64, sparc64
Obtained From:	NetBSD (if_xname)
2003-10-31 18:32:15 +00:00
Brooks Davis
c020a92f9f 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.
2003-10-30 19:45:58 +00:00
Takeshi Shibagaki
5141386c7b 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)
2003-10-15 17:22:15 +00:00
John Baldwin
8b149b5131 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)
2003-08-07 15:04:27 +00:00
Olivier Houchard
0a65bc0775 Fix ed compilation with PAE by using %jx instead of %x. 2003-04-05 18:12:36 +00:00
Jake Burkholder
227f9a1c58 - 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)
2003-03-25 00:07:06 +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
673d91916d 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
2002-11-14 23:54:55 +00:00
Brooks Davis
38d8969122 Use if_printf() instead of printf() to print "ed#: blah". 2002-10-01 00:49:28 +00:00
Warner Losh
0d9ad27e7e 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
2002-09-30 00:18:12 +00:00
Poul-Henning Kamp
37c841831f 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
2002-09-28 17:15:38 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Warner Losh
5c8fcbc866 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
2001-11-24 16:15:18 +00:00
Luigi Rizzo
7b109fa404 MFS: sync the ipfw/dummynet/bridge code with the one recently merged
into stable (mostly , but not only, formatting and comments changes).
2001-11-04 22:56:25 +00:00
Luigi Rizzo
5c514284de Always compile in bridge hooks, or this code will not work (efficiently) with
the loadable bridge module.
2001-11-01 17:10:52 +00:00
Jeroen Ruigrok van der Werven
2a01978a07 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>
2001-10-31 19:43:33 +00:00