Commit Graph

84 Commits

Author SHA1 Message Date
Scott Long
8a40c10eb9 Don't force busdma to pre-allocate bounce pages for the parent tag. 2004-11-21 04:02:36 +00:00
Poul-Henning Kamp
649ce479d4 Hide link up/down/media printfs behind bootverbose 2004-11-08 19:27:00 +00:00
Dag-Erling Smørgrav
303a718c5e With ALTQ, it is possible that although the queue was not empty when we
entered the interface start function, no packets were actually dequeued.
Therefore, keep a count of how many packets we really added onto the tx
chain, and initiate a transmit only if the count is non-zero.
2004-10-30 22:59:30 +00:00
Dag-Erling Smørgrav
4d665c4dde Add altq(4) support. 2004-10-30 21:21:10 +00:00
Dag-Erling Smørgrav
bc0afa22dd Whitespace cleanup. 2004-10-30 14:54:51 +00:00
Scott Long
8a2e22dec0 Use and alignment of 1 instead of ETHER_ALIGN for rx and tx buffers and jumbo
frames.  BGE hardware with the rx alignment bug will still be handled by the
calls to m_adj() that already exist.  m_adj() is probably better suited for
this task anyways.  Just as with if_em, this saves a malloc + several locks
per packet and prevents unneeded data copying within busdma.
2004-10-19 02:42:49 +00:00
Paul Saab
5dc9afc584 Fix the statements for checking if we're dealing with a 5705/5750.
Pointhat to:	me
2004-09-25 05:07:20 +00:00
Paul Saab
e53d81eee9 Add support for the BCM5750/5751. Unfortunately the documentation
I have from Broadcom does not give much information on these devices,
so the Broadcom Linux driver was used for clues to what these chips
support.  It turns out they are similar to the 5705 with the 5751
being the PCI-Express version and needing special work-arounds and
settings.
2004-09-24 22:24:33 +00:00
Bill Paul
dc961de0b4 Commit patch to supress spurious link change events. Apparently, with
copper NICs, a link change event is posted whenever MII autopolling is
toggled off and on, which happens whenever someone calls
bge_miibus_readreg() or bge_miibus_writereg() to access the PHY
registers. This means anytime someone called the SIOCGIFMEDIA ioctl
on a bge interface, the link would reset. Even a simple "ifconfig bge0"
would do it, though other apps like dhclient or the PPPoE daemon could
trigger it as well. An obvious symptom of this problem is lots of
"bgeX: gigabit link up" messages appearing on the console for no
apparent reason.

Through experimentation, I determined that when a real link change
event occurs, the BGE_MIMODE_AUTOPOLL in the BGE_MI_MODE register
is always set, so now if we have a copper NIC and an link change
event occurs and the BGE_MIMODE_AUTOPOLL bit is clear, we ignore
the event.

Note that this does not apply to the original BCM5700 chip since we
use a different method for sensing link changes with that chip (the
status block method was broken), nor to fiber optic NICs since they
don't use the GMII PHY access registers.
2004-09-17 04:58:17 +00:00
Yaroslav Tykhiy
b874fdd40d Bring the advertised interface capabilities into line with the reality
(in particular, bge(4) hasn't supported rxcsum since if_bge.c#1.5)

Clean up some aspects of capabilities usage, i.e. stop using
if_hwassist to see whether we are doing offload now because if_hwassist
is for TCP/IP layer and it is subordinate to if_capenable.

Thanks to:	Aled Morris for donating a nice bge(4) NIC to me
Reviewed by:	-net, -hackers (silence)
2004-07-24 13:45:38 +00:00
Bill Paul
da3003f09a Add some special case code to fix a problem with the BCM5704 in TBI (fiber)
mode. The 5704 apparently has some s00p3r s33kr1t registers for setting
the advertisement of pause frame ability (i.e flow control) when in
autoneg mode. If we don't set these registers correctly, we may not
be able to negotiate a proper link with some switches. (Symptom is that
the NIC reports the link as up (PCS synched) but no traffic can be
exchanged.)

PR:		kern/67598
2004-06-09 16:01:59 +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
Paul Saab
c001ccf2a3 Add support for BCM5705K
Submitted by:	candy@kgc.co.jp
PR:		kern/67110
2004-05-24 04:46:54 +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
Paul Saab
a7b0c31480 Enable the memory arbiter before turning off the PXE restart. This
prevents NMI's from happening when resetting the chip on some
hardware I have seen.

Mis-behaving box made available by:	John Cagle <john.cagle@hp.com>
2004-04-06 18:28:15 +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
Christian Brueffer
6034c7012c Fix typo in a comment 2004-01-13 11:31:09 +00:00
Bill Paul
2aae662479 Add the PCI ID for yet another bge chip: the Altima 1002.
Submitted by: Pavel Gubin <pg@rainbow.ie.tusur.ru>
2004-01-08 17:19:11 +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
Sam Leffler
0f9bd73b71 o add locking
o mark isr MPSAFE

Supported by:	FreeBSD Foundation
2003-11-11 17:57:03 +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
Bill Paul
9f71a4c2d8 Add support for the Broadcom BCM5788 (just another entry to the PCI
device ID list, probably a 5705 ASIC).

Submitted by: Marcel Prisi <marcel@virtua.ch>
2003-10-31 16:25:39 +00:00
Paul Saab
473851ba04 By not setting No_CRC in the Mode Control Register, we must also
reduce the size of the packet by 4 bytes to remove the ethernet crc.

Submitted by:	jdp
2003-09-23 19:54:32 +00:00
Paul Saab
e446dc8601 From the Broadcom Eratta:
Setting the No_CRC bit Can Cause Data Write Errors on BCM5701/03/04
The resolution is to not set the No_CRC bit in the Mode Control Register.
2003-09-23 00:37:07 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
4fbd232c86 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 05:54:52 +00:00
Doug Ambrisko
6d2a9bd669 On Dell boxes such as the PE2650 we need to disable 3 led mode for the
link LED to work.

Reviewed by:	wpaul
Obtained from:	Linux driver
2003-08-20 04:06:00 +00:00
Paul Saab
f53579cfaa Fix a typo. BGE_HCC_TX_MAX_COAL_BDS_INT is at offset 0x3C24, not 0x3C34 2003-08-17 19:14:02 +00:00
Bill Paul
5d99c6417d Add support for the Broadcom BCM5901 and BCM5901 rev A2 chips.
These are 10/100 only NICs found on the IBM Thinkpad R40E and
G40. These seem to be based on the BCM5705 MAC but with a PHY
that doesn't support 1000Mbps modes.

Submitted by:	Igor Sviridov <sia@nest.org>
2003-08-12 05:18:51 +00:00
Bill Paul
822f63fc94 The BCM5704 ASIC has a smaller mbuf space than the 5700/1/2/3. Failure
to configure this correctly yields many watchdog timeouts even on lightly
loaded machines. This is a common complaint from users with Dell 1750
servers with built-in dual 5704 NICs.
2003-08-10 18:04:35 +00:00
Bill Paul
ca3f4fd0a9 Silence unwanted 'gigabit link up' messages: do not treat the
BGE_MACSTAT_MI_COMPLETE bit in the MAC status register as a link
change indicator. We turn this bit on now because some of the newer
chips need it, but it usually just means that reading/writing
an MII/GMII register has completed, not that a link change has
occured.
2003-08-10 01:32:16 +00:00
Bill Paul
859c6c7d03 Set the BGE_RX_MTU register correctly so that we can receive slightly
larger than normal frames, to account for the case where a bge(4) NIC
is used with VLANs. Since we set the IFCAP_VLAN_MTU flag, we must allow
reception of frames up to 1522 bytes in size rather than 1518.

Note that it is possible to work around this bug by doing:

# ifconfig bge0 mtu 1504

prior to configuring any VLAN interfaces.
2003-08-04 05:50:53 +00:00
Bill Paul
0304f1c01e Remove alpha vtophys() hack from if_bgereg.h and clean up unneeded
#includes formerly required to pull in vtophys support, since we
don't need them anymore.
2003-07-25 20:33:43 +00:00
Bill Paul
f41ac2be93 Convert bge(4) to use busdma. I have not tested this on anything
besides x86 yet since I don't have access to a non-x86 FreeBSD
box at the moment. Volunteers welcome.
2003-07-25 19:42:44 +00:00
Bill Paul
0434d1b8d2 Add support for the BCM5705 and its ilk. Changes:
- 5705 doesn't support jumbo frames
- Statistics must be read from registers
- RX return ring must be capped at 512 entries
- Omit initialization of certain device blocks
- Acknowledge link change interrupts by setting the 'link changed'
  bit in the status register (used to have no effect)
- Remember to toggle the MI completion bit too
- Set the mbuf low watermark differently (on-chip memory buffers,
  not BSD mbufs)
- Don't enable Ethernet@WireSpeed feature for certain 5705 chip revs
- Add additional PCI IDs for 5705 and 5782 parts
- Add a forgotten 5704 PCI ID

Most changes ripped kicking and screaming from the Broadcom linux driver.
Thanks to Paul Saab for sanity testing. (My lack of sanity has been
confirmed.)
2003-07-16 00:09:56 +00:00
Bill Paul
22606b2001 Squelch spurious "gigabit link up" messages generated on some fiber NICs
(mainly the 3Com 3c996B/BCM5701).

For some reason that I don't fully understand, the 5701 signals PCS
encoding errors as though they were link change events, i.e. the 'link
state changed' bit in the status word of the status block is updated
and an interrupt is generated. This would cause the bge_tick() function
to be invoked and a "gigabit link up" message to be printed on the console.

To avoid this, the interrupt handler now checks the MAC status register
when a link change interrupt is triggered, and it will only call the
bge_tick() function if the 'PCS encoding error detected' bit is clear.
(This change should have no effect on copper NICs since this bit can
only ever be set in TBI mode. I do not know how it affects 5704 NICs
with a BCM8002 SERDES PHY.)

Special thanks to: Sherry Rogers at UCB for allowing me access to one
of their traffic monitor boxes so I could diagnose this problem.
2003-07-11 08:19:52 +00:00
Poul-Henning Kamp
bb0b8a23c0 Remove unused variable(s).
Found by:       FlexeLint
2003-05-31 20:42:24 +00:00
Paul Saab
487a8c7e61 - Make this work with PAE.
- atomically load and clear the status block so we dont miss an
  update.
  Submitted by: jdp

Approved by:	re (scottl)
2003-05-21 07:00:49 +00:00
Paul Saab
e0ced69666 - Change the full Asic revision defines to CHIPID to better since the
ASIC revision is really the major number of the CHIPID.  Also store
  the chipid, asic rev and chip revision in the softc for later use.

- The write twice to send producer index workaround only applies to
  the 5700_BX chips, so only do it there.
  Requested by: jdp

- Do not initalize the LED's to 0x00.  The default configuration
  the chip comes up in should yeild proper operation of the LED's.
  Confirmed by: John Cagle <john.cagle@hp.com>

Approved by:	re (blanket)
2003-05-07 21:51:13 +00:00
Paul Saab
3927098f93 Implement the write twice to send producer index workaround for
BCM5700 chips as described in the Broadcom Errata documents.

Obtained from:	NetBSD and Broadcom Errata documentation
2003-05-04 00:07:21 +00:00
Paul Saab
5cba12d3bc - Change the short hand representation of the various ASIC revisions
- Implement the ONEDMA_AT_ONCE workaround as described in the
  5703/5704 eratta documents.
  Obtained from: NetBSD & Broadcom documentation
2003-05-03 22:58:45 +00:00
Paul Saab
37ceeb4d9f - Move bge_phy_hack into the phy code and implement the various DSP
patch workarounds for each phy revision.
  Obtained from: NetBSD & Broadcom Linux driver

- Disable AUTOPOLL when accessing the PHY as it may cause PCI errors.
  Obtained from: NetBSD

- Check the UPDATED bit in the status block so the driver knows
  that the status block as indeed changed since the last access.
  Broadcom documentation states drivers should unset the UPDATED/CHANGED
  bits after reading them.

- When changing media types, first loop the phy then set the media.
  Broadcom documentation and Linux drivers do this and I observed
  much better handling of link after this change.

- Broadcom documentation states that for 1000BaseT operation,
  autonegotiation must be enabled.  Fix hard coding of media so that
  the driver only advertises 1000BaseT as the supported media type
  and enable autonegotition.

- Only set Master/Slave on the 5701.
  Obtained from Broadcom Linux driver.
2003-05-03 19:06:50 +00:00
Paul Saab
6ac6d2c895 Add untested support for the Broadcom 5704.
Obtained from:	NetBSD
2003-05-02 19:53:40 +00:00
Paul Saab
fa22802086 Update the mbuf watermark settings to match the latest documentation
from Broadcom.  These values are strongly encouraged for proper operation.

MFC after:	3 days
2003-04-26 18:26:29 +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