Commit Graph

93 Commits

Author SHA1 Message Date
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Yoshihiro Takahashi
d4fcf3cba5 Remove bus_{mem,p}io.h and related code for a micro-optimization on i386
and amd64.  The optimization is a trivial on recent machines.

Reviewed by:	-arch (imp, marcel, dfr)
2005-05-29 04:42:30 +00:00
Mike Silbersack
c3615d48b7 Add PCI ID for BCM5789.
Submitted by:	S. Aeschbacher
2005-05-22 03:16:45 +00:00
Paul Saab
419c028b36 Support the 5714C
Submitted by:	John Cagle <john dot cagle at hp dot com>
2005-05-19 21:08:59 +00:00
Doug White
2eb15b9375 Backout part of rev 1.71, which breaks the interfaces on IBM/Intel blade
servers.

PR:		kern/68445
MFC after:	7 days
2005-05-05 03:37:27 +00:00
Scott Long
2f28b97311 Fix the order of the lowaddr,highaddr arguments in the parent tag. This
coincidentally didn't cause any problems, but was definitely wrong.
2005-04-24 02:45:27 +00:00
Tai-hwa Liang
d2014b3079 Adding new device ID for BCM5751M support.
Submitted by:	FUJITA Kazutoshi <fujita at soum dot co dot jp>
Reviewed by:	sam (mentor)
2005-03-12 06:51:25 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Paul Saab
35ca8069a9 Add support for the 5721 which seems to be similar to the 5750/5751.
Tested by:	Vivek Khera vivek at khera dot org
2004-12-17 21:50:18 +00:00
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