Commit Graph

86 Commits

Author SHA1 Message Date
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
tron 71c703ffaa Add support for Broadcom BCM5788 GbE. Patches supplied by FUKAUMI Naoki
in PR kern/25166.
2004-05-12 07:07:34 +00:00
thorpej 4c019a313e Add 802.3x flow control support. From HITOSHI Osada. 2004-04-10 19:23:49 +00:00
keihan fef14e4cd8 s/netbsd.org/NetBSD.org/g 2004-04-06 08:48:55 +00:00
jonathan e05bba34d6 Fix mistaken arguments to bge_set_thresh(); the prior revision would
pass the bge_softc * to a function expecting the struct ifnet*,
triggering a panic every time the Rx-mitigation value is changed via sysctl.
(Testing via kernel debugger before Andrew's recent sysctl(9) changes
was done with the exact same mistaken argument.)
2004-04-04 00:43:25 +00:00
atatat b233127eb3 GC ath_node_root as well, but modify to work around the single
(tightly scoped) reason for recording the node address by recording
the assigned number.  Dink pci/if_bge.c to match, since ic/ath.c was
used as the archetype.
2004-03-27 04:37:59 +00:00
atatat de94728620 GC bge_node_root, since it's not needed and probably wrong. 2004-03-27 04:25:12 +00:00
jonathan c13c949dac Update yesterday's if_bge sysctl hooks for hw.bge.* (based on
yesterday's sys/dev/ic/ath.c) to match today's ath.c driver.
Commit now in the hope that Andrew Brown will pick up this file for
any more pending changes.
2004-03-27 01:17:49 +00:00
jonathan b9aa680ef2 Add a table of Rx interrupt-threshold register values for mitigating
Rx interrupts, functions to post a request for new table entries, and
code to apply pending Rx-interrupt control values at the next hardware
interrupt.

As used in a third-party proprietary tree since at least March 2003.
As discussed on tech-kern/tech-net in January 2004 (in the context of
NetBSD for packet capture, bpf, and FreeBSD-sylte IFF_POLL), and as
posted to tech-net for comments in mid-March 2004.

Still missing sysctl or other knobs to acutally change the config-time
values, due to my ignorance of any accepted per-device sysctl namespace.
2004-03-20 02:04:07 +00:00
jonathan 73e79089ee Possibloe fix for some bge chip revisions taking a long time to reset
(e.g., polling for a half-second or more at splnet(), blocking most
interrupts, durin an ifconfig down/ifconfig up).

Appears to help for a 5704C rev A3, which is the only chip I've
ever seen that had even a mild version of the reported problem.
2004-03-20 01:58:51 +00:00
jonathan 426b3e3a08 Check for BGE_PCI_PCISTATE register failing to revert on reset.
if it occurs, print a message indicating why the reset took so long.
2004-03-20 01:42:21 +00:00
drochner 529666a2a8 use "=" instead of "|=" on first assignment to mbuf.csum_flags
(probably unnecessary because zero-initialized on mget, but
cheaper anyway)
2004-03-10 18:46:10 +00:00
martin bddc2b94bb Set BGE_JUMBO_RXRING_VALID in bge_flags when allocating jumbo ring buffers,
so it can be freed later. From HITOSHI Osada in PR kern/24686.
2004-03-06 17:42:43 +00:00
jonathan ca71058195 Add hooks to dynamically change the bge Rx interrupt thresholds. I
found empiricaly that (at least on bcm5700s) the Rx coalesce and bd
counts cannot be updated on-the-fly; attempting to do so (even at
splhigh()) causes weird behaviour.

Instead, add a softc flag to record that the desired softc values for
Rx-interrupt thresholds have changed; check that boolean in the interrupt
routine. If set, apply the new values there and clear the flag.
2004-01-22 02:29:46 +00:00
jonathan c4e9405150 Do 5704-specific setup of DMA control register for all 5704 variants,
including chips that matched only the asic-revision  fallback table.

When dong DMA setup for 5703 and 5704, use the new BGE_ASICREV() macro
to extract the ASIC revision.
2003-12-14 03:08:12 +00:00
pooka 34f5b5e378 The highest 16 bits of chipid identify the ASIC, so print only them. 2003-12-09 15:19:33 +00:00
pooka 3c0925818d Match 5703 ASIC A3.
Also, when printing the ASIC ID, print the revision in hex in all
cases to avoid extra confusion if only the "superclass" of the ASIC
is recognized.
2003-12-08 17:09:39 +00:00
fvdl 9d4e217e09 From FreeBSD:
* erratum: disable the nocrc RX bit, as it may cause problems on the 570{1-4}.
  adjust the length of the incoming packet accordingly to trim it.
* the 5704 has a smaller MBUF_POOL, so set a smaller value

Local change:
* Pass the autoneg force flag to mii_attach. Some PHYs need to be kicked
  out of their falsely autoneged 10baseT state with this.
2003-11-11 22:28:58 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
fvdl d85a7f8656 Need the NOCRC bit, or my 5704B5 will start acting up. 2003-10-23 20:36:36 +00:00
fvdl 4df6c69646 * match more cards (from FreeBSD)
* don't set the NOCRC bit in the mode control register, it can cause
  problems on some chips (from the broadcom errata via FreeBSD)
* implement a fallback quirktable that is searched only using the
  major asic revision, so that the driver has a shot at supporting
  newer versions properly without modification
* rename asicrev -> chipid, like the FreeBSD driver
2003-10-23 17:41:59 +00:00
tron 90ef1d5718 From FreeBSD as suggested by Nicolas Joly in PR kern/22682:
Do not initalize the LED's to 0x00.  The default configuration
the chip comes up in should yeild proper operation of the LED's.
2003-09-05 08:53:23 +00:00
fvdl 7674ed5fa0 Support the BCM5704C rev 3. From Nicolas Joly, PR 22620 2003-08-27 23:13:50 +00:00
hannken 26d8cfe506 Finish last commit (Make this compile with options DEBUG).
NetBSD has no M_WRITABLE().
2003-08-26 10:17:02 +00:00
cjep a94f967897 Make this compile with options DEBUG (part of PR#22582 from Frank Kardel). 2003-08-23 20:37:18 +00:00
jonathan 215937cb45 Check in hooks to fix checksum offload on bge devices. Empirical
observation is that some 570x devices can get themselves into a state
where they miscompute off-loaded TCP or UDP checksums on packets so
small that Ethernet padding is required.  Further obsevation suggests
that the bge checksum-offload hardware is adding those padding bytes
into its TCP checksum computation. (Once a 5700 gets in this state,
even a warm boot won't fix it: it needs a hard powerdown.)

Work around the problem by padding such runts with zeros: even if the
checksum-offload adds in extra zeros, the resulting sum will be correct.

Also, dont trust the checksum-offload on received packets smaller than
the minimum ethernet frame, in case the Rx-side has a similar bug.

Finally, on packets where we do trust the outboard Rx-side TCP or UDP
checksum, the bge did not include the pseudo-header. Set the
M_CSUM_NO_PSEUDOHDR bit as well as M_CSUM_DATA, and rely on
udp_input() or tcp_input() adding in the sum via in_cksum_phdr().
2003-08-22 03:32:35 +00:00
jonathan 25eeb02c06 Fix a bug in compaction of `DMA runt' fragmented packet chains:
if we m_dup() a packet to compactify it, and later run out of DMA
descriptors, bge_encap() will return ENOBUFS, hoping the driver will
try again later.  But we have just m_freem()'d the original chain
which was m_dup()'d, leaving a pointer to the just-freed packet header
in the tx queue.

Fix by always walking the chain, shuffling data towards the head;
except if we find a runt in the very last mbuf, we must borrow data
from its predecessor.

(Patch is verbatim from a third-party tree, apologies for any style woes.)
2003-08-22 03:03:20 +00:00
hannken 7b247f3812 Add support for the BCM5705:
- Only BCM5705M asic rev A1 was tested.

Thanks to Bill Paul (wpaul@freebsd.org) for help and support.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-07-17 11:44:26 +00:00
lukem 365cbd9428 add missing __KERNEL_RCSID() 2003-07-14 15:47:00 +00:00
ragge b027f1fffd Set the send queue to max(BGE_TX_RING_CNT - 1, IFQ_MAXLEN); sometimes
IFQ_MAXLEN may be choosen to a larger value than number of descriptors.
Why this setting from the beginning???
2003-06-30 13:20:21 +00:00
fvdl 7dd7f8baa2 Handle 64bit DMA addresses on PCI for platforms that can (currently only
enabled on amd64). Add a dmat64 field to various PCI attach structures,
and pass it down where needed. Implement a simple new function called
pci_dma64_available(pa) to test if 64bit DMA addresses may be used.
This returns 1 iff _PCI_HAVE_DMA64 is defined in <machine/pci_machdep.h>,
and there is more than 4G of memory.
2003-06-15 23:08:53 +00:00
fvdl 370167ec16 Add newer 5704 asic revs, and add them to the table, with the
BGE_QUIRK_ONLY_PHY_1 quirk in their entry.
2003-06-01 20:26:14 +00:00
wiz 1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
tron ea710d8119 Don't print a kernel message like "bge0: gigabit link up" when a Gigabit
link is detected. No other ethernet driver does this and this driver
doesn't do it for other modes.
2003-03-24 12:06:05 +00:00
jonathan cd38c4da5c Commit workaround for hardware bug: 5701 chips running in PCI-X mode
require that the DMA receive buffers be aligned. The driver was
deliberately mis-aligning by 2 bytes, to force the layer-2/3
headers to 32-bit alignment.

Workaround: if chip is a 5701, and is in PCI-X mode, leave the DMA
buffers aligned.  If the host CPU requires alignment, copy the buffer
after reception to force aligment.

Tested  on an i386 in  PCI-X bus, with __NO_STRICT_ALIGNMENT forced off.

Patch and comments reworked  to minimize drift from
	FreeBSD if_bge.c rev 1.14.
2003-03-07 18:57:53 +00:00