Commit Graph

120 Commits

Author SHA1 Message Date
tsutsui
3267e61df1 Add and fix some BGE_CHIPIDs. From FreeBSD and OpenBSD. 2006-11-26 04:00:45 +00:00
tsutsui
5a3995e0ab Add support for BCM5752M. from Matt Kolb on tech-kern and OpenBSD. 2006-11-26 03:02:04 +00:00
tsutsui
fc28f9749e Pull some bge_encap() fixes from OpenBSD:
> - Move TX ring full sanity check further up and check the number of DMA
> segments from the DMA map, instead of counting the DMA segments in the
> for loop and breaking out later.
> - Unload the DMA map if encountering an error condition.
2006-11-26 02:40:10 +00:00
tsutsui
b7a2205885 BCM5701 B2 requires BGE_QUIRK_ONLY_PHY_1 quirk. From Brian Baird
in PR kern/23778.
2006-11-25 13:31:00 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
tsutsui
6ed1365e7f - bcopy -> strcpy (in debug message)
- bcopy -> memcpy
2006-10-28 18:45:57 +00:00
tsutsui
40c87dddb4 - use continue for an empty statement in for() loop
- remove an empty statement in if() clause by inverting logic
- use KDASSERT(9) rather than #ifdef DEBUG + KASSERT(9)
- replace commented out M_WRITABLE() with !M_READONLY(9)
2006-10-28 18:26:15 +00:00
tsutsui
b62bfc53fd M_TRALINGSPACE(m) returns 0 if M_READONLY(m) is true,
so no need to call both.  Pointed out by Pavel Cahyna.
2006-10-28 18:00:53 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos
13528a299f Coverity CID 3666: Remove debug to expose KASSERT's (from Arnaud Lacombe) 2006-09-29 14:33:52 +00:00
jmcneill
f135e0d607 Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
2006-09-24 03:53:07 +00:00
jonathan
6e42605bf4 Rework bge_reset() to more closely follow the Broadcom-supplied Linux driver:
1. Instead of enabling the buffer manager hardware-FSM only on
pre-5705 devices, initialize the buffer manager on all bge devices.
Modelled on the Broadcom-authored Linux driver.

2. Instead of enabling the memory arbiter hardware-FSM only on
pre-5705 devices, initialize the memory arbiter on all bge devices.
Modelled on the Broadcom-authored Linux driver.

3. Ditto the second copy of code which enables the memory arbiter.
Also, add an XXX asking, why taunt the chip this way a second time?
(The most plausible explanatoin is that enabling the memory arbiter
twice is my own darn fault, likely a cut-and-paste glitch I made many
moons ago, when re-ordering hardware enables to match the Linux drivers.)
2006-06-01 02:20:54 +00:00
jonathan
e8c37e204d Fix a minor thinko in ascertaining whether or not a bge(4) device is
attached via PCI-Express:

The previous code first checked that the bge ASIC-revision matched the
5750 ASIC-revisoin (the bcm5721 has the same ASIC revision). However, the
bcm5752 is also a PCI-Express device, but has a different ASIC revision.
Thus, we were setting sc->bge_pcie to zero for bcm5752s, which in turn
causes bge_reset() to not perform required PCI-Express setup.

The test for a 5750 ASIC revision may (or may not) have been carried
across from the FreeBSD bge(4) driver. FreeBSD's bge(4) does not
properly detect or handle post-5750 bge devices. Instead, FreeBSD's
bge(4) keeps a sofc copy of the ASIC revision, and for post-5750
devices (5752, 5714, ...) overwrites that softc copy of the
ASIC-revision with the 5750 ASIC revision.  Thus, the test (mutatis
mutandis, using FreeBDS's softc asic-revision field), was correct for
FreeBSD; but manifestly incorrect for NetBSD.

Mark Davies (mark at mcs.vuw.ac..nz) has confirmed via private email
that this change fixes PR kern/kern/33509: his bcm5752 now works.
2006-06-01 01:46:41 +00:00
blymn
8582430c8c Clean up bogus whitespace 2006-05-28 13:01:46 +00:00
jonathan
faecb6a29c Add an default entry to bge_majorrevs[] for bge chips with the 5780
ASIC revision.

Add (accidentally omitted) PCI product-ID entries for the BCM5780 and
BCM5780 (Serverworks HT-2000 to bge_products[], so that bge_probe()
will attach bcm5780 variants.  Tested on a bcm5780.

Handling for the bcm5780S with 1000base-X PHY  almost certainly has the
wrong quirks; our quirk entries are driven off ASIC ID. However, the
5780 (usually integral copper) and 5780S (TBI?)  have the same ASIC ID.
The Linux drivers ascertain whether to use integral copper phy or external
PHY via EEPROM bits.

I suspect the only way we're going to handle the 5780 vs. 5780S
properly is to add exact chip-id matches for all 5780/5780S variants
to bge_revisions[]. However, I don't know those ids until other users
with bcm5780s hardware can get this revision, try it, and report the output.
So, here  goes.
2006-04-27 18:09:54 +00:00
christos
1736325575 PR/33828: Pawel Chwalowski: Add support for Broadcom BCM5789 chip 2006-04-18 14:53:43 +00:00
thorpej
e49323e509 Static'ify. 2006-03-04 19:20:50 +00:00
rpaulo
be393d0ce0 In bge_ioctl(), don't call bge_init() if the interface is already up.
Makes ifwatchd work on this interface.
2006-02-22 15:18:55 +00:00
perry
93124077ae Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:27:29 +00:00
skrll
6a270f002d Typo in comment. 2005-12-19 12:35:19 +00:00
jonathan
e66e62e9be Fix silly cut-and-paste typo (CSR_READ(sc, BGE_MARBMODE_ENABLE),
should obviously have been CSR_READ(sc, BGE_MARB_MODE) incurred during
my backport of 5714/5715 support from my netbsd-3 development branch,
back into -current.
2005-12-12 19:58:11 +00:00
jonathan
cc474061e1 Add support for bcm5714 and (possibly incorrect) support for the
bcm5715 PCI-Express dual-port NICs. Taken from the Broadcom-supplied
Linux driver, bcm-8.3.13a.

Add nascent support for the bcm5780, but (since I have no bcm5780 to
test), don't yet add an entry which allows us to match or attach to a
5780.

Change 5752 support: Follow the lead of the Broadcom-supplied Linux
driver (bcm) and the Linux tg3 driver, and treat the 5752 like a 5750.
2005-12-12 00:40:44 +00:00
jonathan
cf16a10aad Add PCI device-ids to sys/dev/pci/pcidevs for newer Broadcom gigabit
ethernet devices: bcm5714, bcm5752 (previously the 5789, but fvdl
committed that whilst I was musing).

Add definitions to sys/dev/pci/if_bgereg.h for the Broadcom 57xx-family
ASIC revisions on these newer chips.

Add entries to the PCI-device-version and bge-internal-asic-revision
tables in sys/dev/pci/if_bge.c to use these new devices. Pending
further information, follow the lead of FreeBSD's if_bge.c driver and,
pending further info, treat these new chips as we do the 5750.
2005-12-07 04:43:05 +00:00
fvdl
a085182504 Match the 5789. 2005-12-06 20:56:42 +00:00
martin
328b263349 Use %zd for size_t. Noticed by Kurt Schreiner on current-users. 2005-11-24 13:47:46 +00:00
jonathan
43255e3f4e Add TSO support to bge(4) for PCI-Express bge devices, which are
shipped from the factory with TSO-capable firmware.  The TSO support
here may also work on 5705 chips, but that is (so far) untested.

TSO support written after careful reading of the Linux tg3 driver,
and (after attempting to deconstruct the cut-and-paste mess therein)
very close reading of the Broadcom-supplied Linux driver, particularly
the building of Tx-DMA buffer descriptors (bds). The TSO code herein was
then rewritten from scratch, circa 4am local time, October 27 2005.
(In other words: this is 4am software; caveat emptor.)

Other magic register settings in this patch are required; without
them, attepmting to use TSO locks up the chip. The required register
settings were extracted from the cited Linux drivers.

Note that TSO-capable firmware for the 5703/5704 is distributed in
non-GPL form with the aforementioned Linux drivers. Once the 5705 case
is debugged, (particularly the pseudo-header checksum precalculation
flagged with an XXX) downloading that TSO-capable firmware to the
5703/5704 should, in principle, enable TSO support on all but the
original bcm5700 (I forget if the 5701 can support TSO, or not).

Note also that the ``hard case '' of IP/TCP headers spanning more than
one mbuf is not handled; I haven't been able to trigger it.  In any
case, since TSO applies only to packets generated by the local TCP,
and our TCP always leaves space for TCP headers and a normal IP
header, TSO on an IP/TCP header spanning multiple headers can only
arise due to insertion of IP options. I beleive that we are clearly
better off outlawing that case, and requiring ip_insertoptions()
to  pull-up TCP headers on any packets with M_CSUM_TSOv4 set.

As far as I know, bge hardwar does not support TSO for IPv6.
2005-11-24 03:27:59 +00:00
jonathan
de85711ee1 Correct a performance bug from Bill Paul's original FreeBSD bge(4) driver:
Each call to the FreeBSD bge_start() routine the transmit producer
pointer index from the chip mailbox register BGE_MBX_TX_HOST_PROD0_LO.
The local copy of that value is then updated by bge_encap() as
bge_encap() encapsulates packets in the Tx ring. If bge_encap()
succeds in encpuslating one or more packets, bge_start() tells the
chip to start sending the newly-encinitiates writes the new value back
to the chip mailbox register.

However, comparison of the Linux drivers (Broadcom-supplied and
open-source tg3.c) and to the OpenSolaris driver confirms that
register BGE_MBX_TX_HOST_PROD0_LO is write-only to software.
Thus, we can just keep a copy in the softc, and eliminate the
(expensive) PCI register write on each call to bge_start().

``Make it so''.
2005-11-15 06:05:44 +00:00
tsarna
da085b10b3 Allow reception of VLAN sized frames. From FreeBSD.
Reviewed by cube.
2005-09-06 15:42:21 +00:00
gavan
84c672e259 Add quirk for BGE_CHIPID_BCM5751_A1. From Kurt Schreiner <ks at ub.uni-mainz
dot de> via PR kern/31028.
2005-08-22 18:18:25 +00:00
gavan
0216bccfb3 Recognise Broadcom 5751M Gigabit Ethernet, as found on ThinkPad T43p. 2005-08-21 21:32:26 +00:00
atatat
df13e3579e Change the rest of the sysctl subsystem to use const consistently.
The __UNCONST macro is now used only where necessary and the RW macros
are gone.  Most of the changes here are consumers of the
sysctl_createv(9) interface that now takes a pair of const pointers
which used not to be.
2005-06-20 02:49:18 +00:00
christos
7cdea212c0 No 0x in front of %p... 2005-05-22 15:54:45 +00:00
yamt
330cc0a11e split IFCAP_CSUM_xxx to IFCAP_CSUM_xxx_Rx and IFCAP_CSUM_xxx_Tx. 2005-05-02 15:34:31 +00:00
perry
f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
thorpej
2f8e8079d1 Define M_CSUM_DATA_IPv4_IPHL() and M_CSUM_DATA_IPv4_OFFSET() macros
to extract data from csum_data, rather than just open-coding it.
2005-02-21 02:12:48 +00:00
jdolecek
dc8941eb32 use VLAN_* macros for VLAN tag extraction/addition
also restructure and simplify input VLAN ID code handling somewhat, to not use
local have_vlan/vlan_tag variables, and use the appropriate cur_rx condition
on the one place where it's needed
2005-02-20 15:48:35 +00:00
heas
d6e174eefd Adjust csum_data usage; mask off the high 16 bits. 2005-02-18 01:10:44 +00:00
jmcneill
6a3e1ea6a4 Missed a break in the powerhook (shouldn't matter functionally, but
fix anyway for correctness).
2005-01-26 22:15:26 +00:00
jmcneill
0c537484ca Add powerhook to bge(4) 2005-01-26 21:52:47 +00:00
matt
027c11539b Add IFNET_FOREACH and IFADDR_FOREACH macros and start using them. 2005-01-24 21:25:09 +00:00
fredb
99ad984e37 Recognize the Broadcom 5721 Gigabit Ethernet, as found on SuperMicro P8SCi
motherboards.
2005-01-08 16:00:03 +00:00
jmmv
dcfa2c4905 Fix typo in previous commit that was breaking the build (hi, tacha@!). 2004-11-19 17:59:09 +00:00
tacha
f2ffe49e42 Add support for Broadcom BCM5705K. 2004-11-19 10:17:17 +00:00
thorpej
e9818f5b5e When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
2004-10-30 18:08:34 +00:00
cube
cce3c2a9eb Add support for the BCM575x variants. They're close to the 5705 one, with
some special cases for the PCI-Express versions.  As there is no
documentation available, all of this is inspired from Linux or taken from
FreeBSD (itself inspired from Linux).  There are a lot of magic numbers.

Tested on two BCM5751 devices as found in newer Dell computers.
2004-10-28 07:36:05 +00:00
yamt
81378f8ab8 - mbuf external storage is of (caddr_t), not (caddr_t *).
- remove a needless cast.
2004-09-29 11:22:03 +00:00
yamt
52f0c217f7 introduce M_EXT_RW to allow mbuf external storage R/W.
discussed on tech-net@.
2004-09-21 21:57:30 +00:00
atatat
16122fe06c Remaining sysctl descriptions under hw subtree (ath and bge) 2004-05-25 04:38:36 +00:00
thorpej
b7d5c113dd Add PAUSE-related event counters. Slightly modified from patch supplied by
HITOSHI Osada.
2004-05-15 22:19:27 +00:00
thorpej
34b8c2c481 Patches from HITOSHI Osada:
* Set buffer management high water marks for MTU > 1514.
* Set BGE_MAX_RX_FRAME_LOWAT (from Linux driver).
2004-05-15 21:58:40 +00:00