Commit Graph

58 Commits

Author SHA1 Message Date
Christian Weisgerber
0e939c0cea Replace handrolled CRC calculation with ether_crc32_[lb]e(). 2004-06-09 14:34:04 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Warner Losh
33de92af3f Include required machine/bus.h 2004-05-28 02:23:10 +00:00
Warner Losh
2e31e339d1 Fix disordering of pccarddevs.h noticed by bde. Also remove a few
redundant includes and fix some of the include disordering.

Submitted by: bde
2004-05-27 03:49:45 +00:00
Warner Losh
dba6dd177b Move to generating pccarddevs.h on the fly, both for the kernel and
the modules.

Also generate usbdevs.h automatically now, but a non-kernel file is
stopping that at the moment.
2004-05-26 00:53:10 +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
Warner Losh
fbfb97942e It turns out that the module dependency on pccard is in error. Since
there's not dependencies on pccard symboles, such a dependency is not
necessary.  This means that drivers that have multiple attachments can
not drag bogus devices into the kernel at load time.

We can't (yet) do this with pci and isa.  Drivers written for them
actually do seem to have symbols that depend on these busses'
implementation code.

ndis not touched until other things can be tested.
2004-05-08 06:04:06 +00:00
Luigi Rizzo
3c56e09895 Remove two variables that became unused because of last commit.
Reported by: tinderbox
2004-04-16 06:58:39 +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
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
Warner Losh
55e8a70c67 Reconst-poison crc routine that was renamed to mchash.
re-remove the _ in u_intXX_t
2003-11-14 05:37:36 +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
Warner Losh
9b41f0a787 Don't establish the ISR in the sn_activate routine. I've had two
crashes that had sn0 as the irq that's being serviced, when there was
no sn0 in the system.  This seems to prevent them.  Also, we want to
wait until after we've registered with the network layer before we
turn on the interrupt spigot to avoid races.
2003-11-10 16:04:11 +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
Warner Losh
400911ccdc Make sn MPSAFE. This has survived a couple of make buildworlds with
my Megahertz XJ10BT.
2003-10-26 22:35:44 +00:00
Warner Losh
03c1602aed Style changes:
o kill register
o minor function name tweaks.
2003-10-26 05:34:01 +00:00
Warner Losh
470de03fd0 Convert to bus_space.
Make the pccard attachment work with NEWCARD
Start locking of the driver, but only the macros are defined right now

Tested on: Megahertz CC10BT/2
# (These cards are very popular on ebay these days, and run < $10 including
#  shipping from some sellers).
2003-10-25 19:56:19 +00:00
David E. O'Brien
945ff31afa Use __FBSDID().
Also some minor style cleanups.
2003-08-24 18:03:45 +00:00
Warner Losh
9a28275ef5 DSP Solutions, Inc made the XJEM1144 and XJACK ethernet cards. Update
MEGAHERTZ2 to DSPSI.
2003-08-21 17:27:49 +00:00
Matthew N. Dodd
f246e4a17f - Express hard dependencies on bus (pci, isa, pccard) and
network layer (ether).
- Don't abuse module names to facilitate ifconfig module loading;
  such abuse isn't really needed.  (And if we do need type information
  associated with a module then we should make it explicit and not
  use hacks.)
2003-04-15 06:37:30 +00:00
Warner Losh
f5746231ff Make sure that pp_name is non-null before setting the device
description.  This allows us to rely entirely on the CIS entries if
necessary...
2003-04-10 04:36:02 +00:00
Peter Wemm
3c6b084e96 Finish driving a stake through the heart of netns and the associated
ifdefs scattered around the place - its dead Jim!

The SMB stuff had stolen AF_NS, make it official.
2003-03-05 19:24:24 +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
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
421f55825b Use if_printf(ifp, "blah") instead of printf("sn%d: blah", ifp->if_unit). 2002-10-01 00:56:39 +00:00
Warner Losh
fd78f7e0f3 Don't bogusly depend on pcic. pccard should be enough.
Noticed by: jhay
Forgotten  about for two years by: imp
2002-08-08 15:52:55 +00:00
Warner Losh
5c673b5765 Minor whitespace nits. remove #if 1 and #endif pair, but not code between. 2002-07-21 04:24:30 +00:00
Warner Losh
9de4df498c Migrate to PCMCIA_CARD() macros 2001-11-15 07:52:49 +00:00
Warner Losh
269b3a8211 s/PCCARD_/PCMCIA_/g in NEWCARD device tables to enable easier NetBSD sharing 2001-11-11 20:17:10 +00:00
Warner Losh
a253d9b47b Kill debug output for sn device. It is confusing the natives 2001-08-04 05:27:52 +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
Warner Losh
828e38343a Use PCCARD_CIS_xxx #defines for the table of oem ids. These usually
translate to all NULLs (as for all the ones in this commit).
2001-01-21 08:15:37 +00:00
Toshihiko ARAI
6fb806fdd1 Add support for SMC91C100FD chip of MELCO LPC-TX.
sn1 at port 0x240-0x24f irq 10 slot 0 on pccard0
sn1:  SMC91C100FD UTP MAC address 00:a0:dc:22:26:8c

Submitted by:	"KOMURO" <komujun@nifty.com>
2001-01-15 12:01:14 +00:00
Warner Losh
6763347475 Add isa support:
o write isa driver routines.
o factor detach routine in sn_detach.
2000-12-13 01:47:19 +00:00
Peter Wemm
f4e13f88b6 Make sn_pccard_products[] static 2000-11-25 07:25:45 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Warner Losh
109c00c9ee Implement sn_pccard_match. The match routines are the compromise
matching methods so that we can run the same driver on both NEWCARD
and OLDCARD.  Also set the device description to the card that we
found, if any.

The sn driver should be ready when the NEWCARD catches up.  There's a
config activation issue as well as a kernel thread issue to resolve
first.
2000-09-28 07:35:06 +00:00
Warner Losh
baebc9fa44 Remove 8 unnecessary includes from phk's script 2000-09-20 19:05:32 +00:00
Warner Losh
2276cee521 Implement indirection in the pccard probe/attach. This should make it
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.

Compatibility methods for OLDCARD drivers.  We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects.  For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines.  For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.

compat devices should use the following:

	/* Device interface */
	DEVMETHOD(device_probe),	pccard_compat_probe),
	DEVMETHOD(device_attach),	pccard_compat_attach),
	/* Card interface */
	DEVMETHOD(card_compat_match,	foo_match),	/* newly written */
	DEVMETHOD(card_compat_probe,	foo_probe),	/* old probe */
	DEVMETHOD(card_compat_attach,	foo_attach),	/* old attach */

This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.

Drivers wishing to not retain OLDCARD compatibility needn't do this.

ep driver minorly updated.

sn driver updated more than minorly.  Add module dependencies to allow
module to load.  Also change name to if_sn.  Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
2000-09-19 04:39:20 +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
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
Warner Losh
c927ee19a4 Don't claim devices that we fail to probe for. Reverse the sense of a test
so that we return failure when we've failed and succeed when we succeed.
Otherwise, users always get a sn device :-(.

PR:		18431
Submitted by:	<sanpei@sanpei.org> MIHIRA Yoshiro-san
2000-05-07 18:20:40 +00:00
Poul-Henning Kamp
eb95c536ad Remove unneeded #include <sys/kernel.h> 2000-04-29 15:36:14 +00:00
Poul-Henning Kamp
3389ae9350 Remove ~25 unneeded #include <sys/conf.h>
Remove ~60 unneeded #include <sys/malloc.h>
2000-04-19 14:58:28 +00:00