Commit Graph

65 Commits

Author SHA1 Message Date
Warner Losh
794950069f Remove the setting of the pci config variables on power state changes.
The bus does this now.
2004-06-28 20:26:21 +00:00
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
Yaroslav Tykhiy
25fbb2c38c A handler for ioctl(SIOCSIFCAP) should not alter a bit in
if_capenable unless the interface driver is actually able
to toggle the respective capability on and off.

Reviewed by:	ru
2004-05-23 21:05:08 +00:00
Yaroslav Tykhiy
a5820ecb77 According to the design of checksum offloading framework,
if_hwassist should be in accord with the IFCAP_TXCSUM bit
of if_capenable.
2004-05-23 20:22:40 +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
Ruslan Ermilov
37f5f2397d Implemented per-interface polling(4) control. 2004-04-11 19:25:56 +00:00
Ruslan Ermilov
1e73ec7d53 Fixed resetting of the watchdog timer and queue full flag. 2004-04-11 18:28:14 +00:00
Robert Watson
fa9336b832 Compare IFF_POLLING flag with ifp->if_flags rather than ifp->if_ipending,
which was almost certainly a bug since polling support was introduced
in this driver.

Found during discussion with:	mlaier
2004-04-11 16:26:39 +00:00
Ruslan Ermilov
53090724b0 The VLAN TCI field should be operated in network byte order.
This fixes the VLAN support for nge(4).

Reported by:	Jacob S. Barrett
MFC after:	3 days
2004-03-30 10:24:52 +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
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
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
38d8c9940b Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 06:42:59 +00:00
Warner Losh
fa4b32fa80 All current uses of pci_set_powerstate are bogus, at least in theory.
However, they are presently necessary due to bigger bogusness in the
pci bus layer not doing the right thing on suspend/resume or on
initial device probe.  This is exactly the sort of thing that the
BURN_BRIDGES option was invented for.  Mark all of them as
BURN_BRIDGES.  As soon as I have the powerstate stuff properly
integrated into the pci bus code, I intend to remove all these
workarounds.
2003-07-03 14:00:57 +00:00
Matthew N. Dodd
533294b956 - Don't call pci_enable_io() in drivers (unless needed for resume).
- Don't test memory/port status and emit an error message; the PCI
  bus code will do this now.
2003-04-16 03:16:57 +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
David E. O'Brien
8368cf8f75 Use __FBSDID rather than rcsid[]. 2003-04-03 21:36:33 +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
Martin Blapp
e808cf6260 When reading PHY regs over the i2c bus, the turnaround ACK bit
is read one clock edge too late. This bit is driven low by
slave (as any other input data bits from slave) when the clock
is LOW. The current code did read the bit after the clock was
driven high again.

Reviewed by:	luoqi
MFC after:	2 weeks
2003-01-10 08:09:58 +00:00
Jens Schweikhardt
d64ada501a Fix typos, mostly s/ an / a / where appropriate and a few s/an/and/
Add FreeBSD Id tag where missing.
2002-12-30 21:18:15 +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
Alfred Perlstein
29f194457c Fix instances of macros with improperly parenthasized arguments.
Verified by: md5
2002-11-09 12:55:07 +00:00
Hidetoshi Shimokawa
196c0df6ca Add support for DEVICE_POLLING.
PR: kern/44772
Submitted by: Takashi Oono <takashi@yha.att.ne.jp>
MFC after: 1 week
2002-11-06 15:50:32 +00:00
Doug Ambrisko
1f5488043d Add support for SX cards using TBI such as Netgear GA621.
Sponsored by:	Vernier Networks.
MFC after:	1 week
2002-08-08 18:33:28 +00:00
Alfred Perlstein
eaabec5530 Cleanup after my de-__P (remove leading whitespace before prototype args).
Add newlines after function return types in function declarations.

Approved by: wpaul (a long time ago)
2002-07-06 15:59:57 +00:00
Alfred Perlstein
914596ab53 catch up with ext_free prototype change. 2002-06-29 01:36:59 +00:00
Poul-Henning Kamp
d9fc2b816e Do not call nge_tick() if we get an PHY interrupt, nge_tick() calls
mii_tick() which should only be called once per second.

Our current MII/PHY state-engine is not able to deal with PHY
interrupts as far as I can tell, and most net drivers don't seem
to use the link/status change call-back mechanism.  It seems that
MII/PHY was orphaned before it grew up.
2002-05-04 11:15:33 +00:00
Poul-Henning Kamp
279fe8d156 Make one generic mii_phy_detach() to replace 19 slightly different ones.
Rename mii_phy_auto_stop() mii_phy_down().

Introduce mii_down(), use it from nge.  Do not indirect it to 19 identical
case's in 19 switchstatements like NetBSD did.
2002-04-29 13:07:38 +00:00
Poul-Henning Kamp
78c8c3db4b Move a lot closer to NetBSDs MII support for GigE.
Move fxp and nge drivers over to use the new stuff.
2002-04-29 11:57:30 +00:00
Poul-Henning Kamp
b418ad5c2e Follow NetBSD and s/IFM_1000_TX/IFM_1000_T/ 2002-04-28 20:34:20 +00:00
Poul-Henning Kamp
ff7ed9f76b If the receiver runs out of space for an received frame in the internal
FIFO or the in-RAM descriptors it will switch to RX_IDLE from where it
is not restarted.

We used to deal with RX_IDLE by doing a total reinit but this lost
our link and caused a potential 30sec autonegotiation against
switches.  This was changed to a less heavyhanded approach, but this
failed to restart the receiver it it were in the RX_IDLE state.

This change adds the RX_IDLE and the RX_FIFO_OFLOW conditions as
triggers for interrupts and receive side processing, and restarts
the receiver when it is RX_IDLE.

Remove the #ifdef notyet'ed nge_rxeoc() function.

Sponsored by:	Cybercity Internet, Denmark.
MFC after:	7 days
2002-04-13 21:33:33 +00:00
John Baldwin
6008862bc2 Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on:	i386, alpha, sparc64
2002-04-04 21:03:38 +00:00
Alfred Perlstein
e51a25f850 Remove __P. 2002-03-20 02:08:01 +00:00
Julian Elischer
3ffc8ab1ac Remove errors in LINT (now that they are fatal) 2002-02-27 02:21:43 +00:00
Brooks Davis
437e48e931 Don't pass an interface pointer to VLAN_INPUT{,_TAG}. Get it from the
mbuf instead.

Suggested by:	fenner
2001-12-03 17:28:27 +00:00
Jonathan Lemon
b256187110 Do not call mii_polltick() immediately after mii_tick().
Poiinted out by: wpaul
2001-09-29 19:31:29 +00:00
Bill Paul
8ce3678a09 Handle the RX FIFO overflow condition with the rxeof handler instead
of the rxeoc handler for now. The rxeoc handler will reset the link,
and the NatSemi chip's RX FIFO will overflow on a 32-bit bus once you
start hitting it with 500Mbps or more of traffic.

Also increase the size of the RX ring to 128 descriptors (was 64).
2001-09-19 21:39:26 +00:00
Jonathan Lemon
84e4de28cc Have the driver to announce what capabilitis it supports. 2001-09-18 18:53:41 +00:00
Brooks Davis
9d4fe4b2b0 Make vlan(4) loadable, unloadable, and clonable. As a side effect,
interfaces must now always enable VLAN support.

Reviewed by:	jlemon
MFC after:	3 weeks
2001-09-05 21:10:28 +00:00
Brooks Davis
bbce7eba7f IFT_8021_VLAN -> IFT_L2VLAN per if_vlan_var.h rev 1.9. With this change
LINT compiles, but doesn't link.
2001-07-25 00:19:59 +00:00
Bill Paul
248fa967ca Change the interrupt handler a bit so that we call the nge_rxeof() handler
when we get an RX_ERR interrupt rather than the nge_rxeoc() handler. The
rxeoc (end of channel) handler attempts to reinitialize the whole NIC,
which we don't want to do if we only received a bad packet.
2001-07-16 16:35:09 +00:00
Bill Paul
962315f66f Two optimizations:
1) Bite the bullet, and allow unaligned accesses without buffer copies
   on the i386 platform. According to some tests run by Andrew Gallatin,
   the buffer copy performance hit is greater than the unaligned access
   performance hit (especially with jumbo frames). We still need to copy
   everywhere else.

2) Enable interrupt moderation with a 100us timeout.

Submitted by: Andrew Gallatin <no longer at duke.edu>
MFC after: 1 week
2001-07-10 23:07:15 +00:00
Bill Paul
75ff968cd5 Apply patch supplied by Jonathan Chen: use the correct arguments to
pci_enable_io(). We need to use SYS_RES_IOPORT/SYS_RES_MEMORY instead
of PCIM_CMD_PORTEN/PCIM_CMD_MEMEN.
2001-07-09 17:58:42 +00:00
Bill Paul
2ce0498bd7 Do not set the MODE_1000 bit unless we actually have a gigabit link.
Previously, I had the MODE_1000 bit in the global config register set
unconditionally, which was wrong: we have to turn it off if we have
a 10/100 link. This is now handled in the nge_miibus_statchg() routine.

Discovered by: Nathan Binkert <binkertn@eecs.umich.edu>

(Note: this commit is being done from JFK airport. :P )
2001-07-08 16:24:01 +00:00