Commit Graph

73 Commits

Author SHA1 Message Date
Pyun YongHyeon
6401cf0ccc Add TSO support on VLANs. bce(4) controllers require VLAN hardware
tagging to make TSO work on VLANs so explicitly disable TSO on VLAN
if VLAN hardware tagging is disabled.

Reviewed by:	davidch
2010-02-26 21:26:07 +00:00
Pyun YongHyeon
c3b399103c Move TSO setup to new function bce_tso_setup(). Also remove VLAN
parsing code in TSO path as the controller requires VLAN hardware
tagging to make TSO work over VLANs.
While parsing the mbuf in TSO patch, always perform check for
writable mbuf as bce(4) have to reset IP length and IP checksum
field of IP header and make sure to ensure contiguous buffer before
accessing IP/TCP headers. While I'm here replace magic number 40 to
more readable sizeof(struct ip) + sizeof(struct tcphdr).

Reviewed by:	davidch
2010-02-26 21:19:46 +00:00
Pyun YongHyeon
80a48895fc Prefer m_collapse(9) over m_defrag(9).
Reviewed by:	davidch
2010-02-26 20:41:28 +00:00
Pyun YongHyeon
b2ec4a73f5 Make toggling TSO, VLAN hardware checksum offloading work. Also fix
TX/RX checksum handler to set/clear relavant assist bits which was
used to cause unexpected results.
With this change, bce(4) can be bridged with other interfaces that
lack TSO, VLAN checksum offloading.

Reviewed by:	davidch
2010-02-26 20:39:07 +00:00
Pyun YongHyeon
03c28f4ef5 Make sure to stop controller first before changing MTU. And if
interface is not running don't initialize controller.
While here remove unnecessary update of error variable.

Reviewed by:	davidch
2010-02-26 20:26:17 +00:00
Pyun YongHyeon
e89abed364 Allow disabling VLAN hardware tag stripping with software work
around. Management firmware(ASF/IPMI/UMP) requires the VLAN
hardware tag stripping so don't actually disable VLAN hardware tag
stripping. If VLAN hardware tag stripping was disabled, bce(4)
manually reconstruct VLAN frame by appending stripped VLAN tag.
Also remove unnecessary IFCAP_VLAN_MTU message.

Reviewed by:	davidch
2010-02-26 20:17:17 +00:00
David Christensen
bff0eb4e5c - Added a workaround for NC-SI management firmware that would allow
frames to be accepted while the driver is resetting the hardware.
  This failure is generally observed when broadcast frames are received
  during driver load and will generate "Unable to write CTX memory"
  errors.
- Small changes to driver flags display.
2010-01-20 20:33:10 +00:00
Stanislav Sedov
a0d600845e - Introduce new option BCE_JUMBO_HDRSPLIT that allows user to enable header
splitting in bce(4) instead of (ab)using ZERO_COPY_SOCKETS that was not
  propagated into if_bce.c anyway.  It is disabled by default.

Approved by:	davidch
MFC after:	3 days
2009-10-21 12:47:09 +00:00
Poul-Henning Kamp
6778431478 Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
2009-09-08 13:19:05 +00:00
Poul-Henning Kamp
b34421bf9c Add necessary include. 2009-09-08 13:16:55 +00:00
Robert Watson
eb956cd041 Use if_maddr_rlock()/if_maddr_runlock() rather than IF_ADDR_LOCK()/
IF_ADDR_UNLOCK() across network device drivers when accessing the
per-interface multicast address list, if_multiaddrs.  This will
allow us to change the locking strategy without affecting our driver
programming interface or binary interface.

For two wireless drivers, remove unnecessary locking, since they
don't actually access the multicast address list.

Approved by:	re (kib)
MFC after:	6 weeks
2009-06-26 11:45:06 +00:00
David Christensen
d037d7aed6 - Added code to read bootcode firwmare version.
- Created dedicated shared memory access routines.

MFC after:	One week
2009-06-23 22:19:27 +00:00
Xin LI
ab7b2d927c DMA synchronization fixes:
- In bce_rx_intr(), use BUS_DMASYNC_POSTREAD instead of
   BUS_DMASYNC_POSTWRITE, as we want to "read" from the
   rx page chain pages.
 - Document why we need to do PREWRITE after we have updated
   the rx page chain pages.
 - In bce_intr(), use BUS_DMASYNC_POSTREAD and
   BUS_DMASYNC_PREREAD when before and after CPU "reading"
   the status block.
 - Adjust some nearby style mismatches/etc.

Pointed out by:	yongari
Approved by:	davidch (no objection) but bugs are mine :)
2009-05-18 01:51:52 +00:00
David Christensen
8ef3f835d2 - Fixed incorrect packet length problem caused be earlier change to
support ZERO_COPY_SOCKETS.
- Created #define for context initialization retry count.

MFC after:	1 week
2009-05-08 22:20:45 +00:00
David Christensen
725e9bc78c - Updated firmware to latest 4.6.X release.
- Added missing firmware for 5709 A1 controllers.
- Changed some debug statistic variable names to be more consistent.

Submitted by:	davidch
MFC after:	Two weeks
2009-03-04 00:05:40 +00:00
David Christensen
0e38e31f49 - Update copyright to 2009.
- Only enable split header operation when ZERO_COPY_SOCKETS is enabled in
  the kernel.

Submitted by:	davidch
MFC after:	1 week
2009-02-27 19:25:06 +00:00
Xin LI
bf55aadcb9 Changes to match "Marketing Description" from Broadcom for HP servers.
Submitted by:	davidch
MFC after:	2 months
2009-01-15 22:28:05 +00:00
Xin LI
d337638129 Remove intermediate variable busaddr and have bus_* operate directly on
softc members upon initialization.

Reviewed by:	davidch
MFC after:	1 month
2009-01-13 23:46:45 +00:00
Xin LI
c47f7fff79 Add several HP OEM parts' PCI IDs.
MFC after:	2 months
2009-01-13 07:12:32 +00:00
Xin LI
204cbef71b Don't count InFramesL2FilterDiscards into Ierr. This value does not represent
a real packet error but simply indicate that an unexpected unicast or multicast
error was received by the NIC, which was not counted in the past as well.

Reported by:	many (on -stable@)
Reviewed by:	davidch
MFC after:	3 days
2008-12-16 05:03:22 +00:00
Xin LI
6fca90a0f9 Test whether sc->tx_mbuf_map[i], not whether sc->tx_mbuf_map is NULL before
doing bus_dmamap_sync() since it operates on the former, not the latter.

Reviewed by:	davidch
2008-12-16 04:59:04 +00:00
Xin LI
2dd5c73163 Don't attempt to clear status updates if we did not do a link state
change.  As a side effect, this makes the excessive interrupts to
disappear which has been observed as a regression in recent stable/7.

Reported by:	many (on -stable@)
Reviewed by:	davidch
2008-12-03 23:00:00 +00:00
Kip Macy
db7f0b974f - bump __FreeBSD version to reflect added buf_ring, memory barriers,
and ifnet functions

- add memory barriers to <machine/atomic.h>
- update drivers to only conditionally define their own

- add lockless producer / consumer ring buffer
- remove ring buffer implementation from cxgb and update its callers

- add if_transmit(struct ifnet *ifp, struct mbuf *m) to ifnet to
  allow drivers to efficiently manage multiple hardware queues
  (i.e. not serialize all packets through one ifq)
- expose if_qflush to allow drivers to flush any driver managed queues

This work was supported by Bitgravity Inc. and Chelsio Inc.
2008-11-22 05:55:56 +00:00
Xin LI
202f306c24 Correct a logic error when testing BCE_PHY_SERDES_FLAG.
PR:		kern/128801
Pointed out by:	Adam Morrison
Ok'ed by:	davidch
MFC after:	3 days
2008-11-19 03:24:35 +00:00
David Christensen
b6d57579a2 - Updated support for 5716.
- Added some additional code for debug builds.
- Fixed a problem printing physical memory on 64bit system during debugging.
- Modified some of the context memory and mailbox register names to more
  clearly distinguish their use.
- Added memory barriers for Intel CPUs when accessing host memory data
  structures which are written by hardware.

MFC after:	Two weeks.
2008-08-27 18:47:24 +00:00
David Christensen
7752e34d05 - Added support for BCM5709 and BCM5716 controllers.
MFC after:	2 weeks
2008-06-13 01:16:37 +00:00
David Christensen
680ece5918 - Fixed kern/123696 by increasing firmware timeout value from 100 to 1000.
- Fixed a problem on i386 architecture when using split header/jumbo frame
  firmware caused by hardware alignment requirements.
- Added #define BCE_USE_SPLIT_HEADER to allow the feature to be enabled/
  disabled.  Enabled by default.

PR:		kern/123696
MFC after:	2 weeks
2008-06-10 02:19:11 +00:00
John Baldwin
f720694bc3 Trim an extra semi-colon. 2008-05-30 18:26:37 +00:00
Scott Long
9fc852229b The BCE chips appear to have an undocumented requirement that RX frames be
aligned on an 8 byte boundary.  Prior to rev 1.36 this wasn't a problem
because mbuf clusters tend be naturally aligned.  The switch to using
split buffers with the first buffer being the embedded data area of the
mbuf has broken this assumption, at least on i386, causing a complete
failure of RX functionality.  Fix this for now by using a full cluster for
the first RX buffer.  A more sophisticated approach could be done with the
old buffer scheme to realign the m_data pointer with m_adj(), but I'm also
not clear on performance benefits of this old scheme or the performance
implications of adding an m_adj() call to every allocation.
2008-05-08 15:05:38 +00:00
Marius Strobl
44f8f2fc05 Remove some remnant alpha hacks.
Approved by:	PCI-maintainers (imp, jhb)
2008-04-26 14:13:48 +00:00
David Christensen
46c3c836b6 - Fixed a problem with the send chain consumer index which would cause
TX traffic to sit in the send chain until a received packet kick
  started the interrupt handler.  This would cause extremely slow
  performance when used with NFS over UDP.
- Removed untested polling code.
- Updated copyright year in the file header.
- Removed inadvertent ^M's created by DOS text editor.

MFC after:	2 weeks
2008-04-11 23:10:40 +00:00
David Christensen
8ec2795f0d MFC after: 4 weeks
- Added loose RX MTU functionality to allow frames larger than 1500 bytes
  to be accepted even though the interface MTU is set to 1500.
- Implemented new TCP header splitting/jumbo frame support which uses
  two chains for receive traffic rather than the original single recevie
  chain.
- Added additional debug support code.
2008-02-22 00:46:22 +00:00
Pyun YongHyeon
6a087a8722 Fix function prototype for device_shutdown method. 2007-11-22 02:45:00 +00:00
David Christensen
990a2aa530 - Fixed a problem that would cause kernel panics and "bce0: discard frame .."
errors (especially when jumbo frames are enabled or in low memory systems)
  because the RX chain was corrupted when an mbuf was mapped to an unexpected
  number of buffers.
- Fixed a problem that would cause kernel panics when an excessively
  fragmented TX mbuf couldn't be defragmented and was released by
  bce_tx_encap().

Approved by:	re(hrs)
MFC after:	7 days
2007-07-31 00:06:04 +00:00
David Christensen
ca4c7b3b75 - Migrated IPMI fix from RELENG_6.
- Added additional debug code.
2007-06-16 02:27:03 +00:00
David Christensen
133ac1f5cc New Features:
- Added 2.5G support for BCM5708S.

MFC after:	4 weeks
2007-06-07 02:23:56 +00:00
David Christensen
567590460f - Added TSO support
- Updated firmware to latest release (v3.4.8) to fix TSO + jumbo frame lockup
- Added MSI (hw.bce.msi_enable) and TSO (hw.bce.tso_enable) sysctls
- Fixed kernel panic when MSI is used and module is unloaded
- Added several new debug routines
- Removed slack space for RX/TX chains since it only covers sloppy coding
- Fixed a potential problem when programming jumbo MTU size in hardware
- Various other comment changes

MFC after:	4 weeks
2007-05-16 23:34:11 +00:00
David Christensen
d2b9bc428c MFC after: 2 weeks
Updated copyright date to 2007.

Tested with BCM5706 A3.

Added ID for BCM5708 B2.

Removed unused driver version string.

Modified BCE_PRINTF macro to automatically fill-in the sc pointer.

Fixed a kernel panic when the driver was loaded as a module from the
command-line because the MII bus pointer was null (i.e. the MII bus
hadn't been enumerated yet).

Added fix proposed by Vladimir Ivanov <wawa@yandex-team.ru> to prevent
driver state corruption when releasing the lock during the ISR in
bce_rx_intr() to send packets up the stack.

Added new TX chain and register read sysctl interfaces for debugging.

Cleaned up formatting for various other debug routines.

Added a new statistic maintained by firmware which tracks the number
of received packets dropped because no receive buffers are available.
2007-05-04 23:14:19 +00:00
Christian S.J. Peron
59a0d28bac Catch up the rest of the drivers with the ether_vlan_mtap modifications.
If these drivers are setting M_VLANTAG because they are stripping the
layer 2 802.1Q headers, then they need to be re-inserting them so any
bpf(4) peers can properly decode them.

It should be noted that this is compiled tested only.

MFC after:	3 weeks
2007-03-04 03:38:08 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Doug White
4a5cd040cb Add support for SERDES PHY configurations. These are commonly found in
blade systems, such as the Dell 1955 and the Intel SBXD132.

Development hardware for this work was provided by Broadcom and iXsystems.
A SBXD132 blade for testing was provided by Iron Systems.
2007-01-26 17:03:51 +00:00
Scott Long
089292ab0b The multicast hash table has 8 slots in the BCE hardware, not 4 slots like
the BGE hardware.  Adapt the driver for this.

Submitted by: Mike Karels
MFC After: 3 days
2007-01-20 17:05:12 +00:00
John Baldwin
53a8becd31 - Add a locked variant of bce_ifmedia_upd() for use within the driver and
add missing locking to bce_ifmedia_upd().
- While I'm here, unexpand an instance of LIST_FOREACH().

MFC after:	2 weeks
Reviewed by:	scottl
2007-01-13 04:35:15 +00:00
Xin LI
f662c0c840 Space cleanup. 2007-01-11 03:18:31 +00:00
Xin LI
5411f54447 - Instead of if_watchdog/if_timer interface use our own timer
that piggybacks on bce_tick() callout.
 - Instead of unconditionally resetting the controller, try to
   skip the reset in case we got a pause frame, like em(4) did.
 - Lock bce_tick() using callout_init_mtx().

Discussed with/Reviewed by:	glebius, scottl, davidch
2007-01-11 03:17:28 +00:00
John Baldwin
5c356a4834 Fix compile with BCE_DEBUG. The last one tripped up gcc 2.95 on 4.x even
with BCE_DEBUG turned off.
2006-12-06 22:53:22 +00:00
Scott Long
46222d084a Due to an incorrect macro, it appears that this driver has always been
accidentally truncating off the VLAN tag field in the TX descriptor.  Fix
this by splitting up the vlan_tag and flags fields into separate fields,
and handling them appropriately.

Sponsored by: Ironport
MFC After: 3 days
2006-11-16 06:28:54 +00:00
John Polstra
6e7b2160a4 In bce_start_locked, check the used_tx_bd count rather than the
descriptor's mbuf pointer to see if the transmit ring is full.  The
mbuf pointer is set only in the last descriptor of a
multi-descriptor packet.  By relying on the mbuf pointers of the
earlier descriptors, the driver would sometimes overwrite a
descriptor belonging to a packet that wasn't completed yet.  Also,
tx_chain_prod wasn't updated inside the loop, causing the wrong
descriptor to be checked after the first iteration.  The upshot of
all this was the loss of some transmitted packets at medium to high
packet rates.

In bce_tx_encap, remove a couple of old statements that shuffled
around the tx_mbuf_map pointers.  These now correspond 1-to-1 with
the transmit descriptors, and they are not supposed to be changed.

Correct a couple of inaccurate comments.

MFC after:	1 month
2006-11-16 04:04:07 +00:00
John Baldwin
280388afe5 Add MSI support to em(4), bce(4), and mpt(4). For now, we only support
devices that support a maximum of 1 message, and we use that 1 message
instead of the INTx rid 0 IRQ with the same interrupt handler, etc.
2006-11-15 20:04:57 +00:00
Scott Long
9df92bda76 Fix a typo in the device ID table that prevented 5708S chips from being
detected.

Submitted by: pyun
2006-10-31 03:28:25 +00:00