Commit Graph

17002 Commits

Author SHA1 Message Date
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
Remko Lodder
03206b569c Add support for the VIA USB2IDE bridge [1].
PR:		usb/95173
Submitted by:	Goegele Hannes <diazepam@gmx.net>
		Ben Kelly <bkelly at vadev dot org>
Tested by:	blackend
Approved by:	imp (mentor, blanket for simple patches)
X-MFC-After:	1 week
2008-02-21 19:07:08 +00:00
Remko Lodder
f17edc7494 Set the baudrate for if_ti.
PR:		kern/40516
Submitted by:	"Jin Guojun[VFF]" <jin at adsl-63-198-35-122 dot dsl dot snfc21 dot pacbell dot net>
Approved by:	imp (mentor, implicit for minor changes)
MFC After:	1 week
2008-02-19 20:54:42 +00:00
Justin T. Gibbs
2e9878a7c5 Only print sense data diagnostics if debugging is enabled with the
AHD_SHOW_SENSE flag.
2008-02-17 16:00:36 +00:00
Justin T. Gibbs
d950018dc2 Remove superfluous setting of the transport_version field of our
path inquiry response - a likely holdover from the port of this code
from the aic7xxx driver.
2008-02-17 15:22:26 +00:00
Justin T. Gibbs
accbb18a61 Advertise to CAM the ability of 790X controllers to negotiate information
unit transfers (packetized/U320 protocol) and QAS.
2008-02-17 06:14:59 +00:00
Hajimu UMEMOTO
d1c0178bfe Create a thread to handle passive cooling for 1st zone which has _PSV,
_TSP, _TC1 and _TC2.

Contirmed by:	"Alexandre \"Sunny\" Kovalenko" <alex.kovalenko_at_verizon.net>
Reviewed by:	njl
MFC after:	1 week
2008-02-16 07:15:34 +00:00
Rui Paulo
9e684e54fe Allow the user to override the current active cooling state if state
is currently TZ_ACTIVE_NONE.

Submitted by:   Andriy Gapon <avg at icyb.net.ua>
Reviewed by:    njl (mentor)
Approved by:    njl (mentor)
Requested by:   njl (mentor)
MFC after:      3 days
2008-02-16 02:09:05 +00:00
Rui Paulo
6e1de64dca Skip validation of the C3 state if we disabled C3 by software (i.e.,
via quirk).

Submitted by:	Andriy Gapon <avg at icyb.net.ua>
Reviewed by:	njl (mentor)
Approved by:	njl (mentor)
Requested by:	njl (mentor)
MFC after:	3 days
2008-02-16 02:00:25 +00:00
Andrew Gallatin
91ed89132c Now that mxge supports MSI-X interrupts, reverse the logic and flag
legacy interrupts rather than MSI as a special case.  Prior to this
commit, the interrupt handler was doing the slow handshaking with
the device to ensure the legacy interrupt was lowered in both
the legacy and MSI-X case.  This handshaking was not
required for MSI-X.
2008-02-14 16:24:14 +00:00
Rui Paulo
18d6902161 Don't attach to non Core CPUs. This is needed because on the PIII,
querying the number of sensors returns > 0.

PR:		120541
Approved by:	njl (mentor)
2008-02-14 14:14:59 +00:00
Pyun YongHyeon
9fb59f5567 Prefer NULL over integer 0 for pointer type. 2008-02-14 01:25:01 +00:00
Pyun YongHyeon
cdca0fe8be Nuke local jumbo allocator and switch to use of UMA backed page
allocator for jumbo frame.
 o Removed unneeded jlist lock which was used to manage jumbo
   buffers.
 o Don't reinitialize hardware if MTU was not changed.
 o Added additional check for minimal MTU size.
 o Added a new tunable hw.skc.jumbo_disable to disable jumbo frame
   support for the driver. The tunable could be set for systems that
   do not need to use jumbo frames and it would save
   (9K * number of Rx descriptors) bytes kernel memory.
 o Jumbo buffer allocation failure is no longer critical error for
   the operation of sk(4). If sk(4) encounter the allocation failure
   it just disables jumbo frame support and continues to work without
   user intervention.

With these changes jumbo frame performance of sk(4) was slightly
increased and users should not encounter jumbo buffer allocation
failure. Previously sk(4) tried to allocate physically contiguous
memory, 3388KB for 256 Rx descriptors. Sometimes that amount of
contiguous memory region could not be available for running systems
which in turn resulted in failure of loading the driver.

Tested by:	Cy Schubert < Cy.Schubert () komquats dot com >
2008-02-14 01:10:48 +00:00
Andrew Gallatin
37d89b0c5e Add minimally invasive shims to ease MFCs of mxge back as far
as RELENG_6

Sponsored by: Myricom, Inc.
2008-02-14 00:09:59 +00:00
John Baldwin
1d9c3ad3ef Mark the syscons video spin mutex as recursable since it is currently
recursed in a few places.

MFC after:	1 week
2008-02-13 23:38:08 +00:00
Andrew Gallatin
615fc0983c Make the type of the firmware arrays match those
in the other eth*_z8e.h files.
2008-02-13 21:58:46 +00:00
John Baldwin
7a31072193 Fix a typo when testing for the NO_C3 quirk.
MFC after:	3 days
2008-02-12 15:26:59 +00:00
Rafal Jaworowski
5713ef0ced Eliminate BUS_DMA <-> cache incoherencies in USB transfers.
With write-allocate cache we get into the following scenario:

1. data has been updated in the memory by the USB HC, but
2. D-cache holds an un-flushed value of it
3. when affected cache line is being replaced, the old (un-flushed) value is
flushed and overwrites the newly arrived

This is possible due to how write-allocate works with virtual caches (ARM for
example).

In case of USB transfers it leads to fatal tags discrepancies in umass(4)
operation, which look like the following:

umass0: Invalid CSW: tag 1 should be 2
(probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR
(probe0:umass-sim0:0:0:0): Retrying Command
umass0: Invalid CSW: tag 1 should be 3
(probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR
(probe0:umass-sim0:0:0:0): Retrying Command
umass0: Invalid CSW: tag 1 should be 4
(probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR
(probe0:umass-sim0:0:0:0): Retrying Command
umass0: Invalid CSW: tag 1 should be 5
(probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR
(probe0:umass-sim0:0:0:0): Retrying Command
umass0: Invalid CSW: tag 1 should be 6
(probe0:umass-sim0:0:0:0): Request completed with CAM_REQ_CMP_ERR
(probe0:umass-sim0:0:0:0): error 5
(probe0:umass-sim0:0:0:0): Retries Exausted

To eliminate this, a BUS_DMASYNC_PREREAD sync operation is required in
usbd_start_transfer().

Credits for nailing this down go to Grzegorz Bernacki gjb AT semihalf DOT com.

Reviewed by:	imp
Approved by:	cognet (mentor)
2008-02-12 11:03:29 +00:00
Christian Brueffer
a02b3966fc Add missing \n.
PR:		120341
Submitted by:	CyberLeo <cyberleo@cyberleo.net>
Approved by:	rwatson (mentor), aradford@amcc.com
MFC after:	3 days
2008-02-12 08:58:26 +00:00
Attilio Rao
5b56116548 - Revert last ehci.c change
- Include lock.h in lockmgr.h as nested header in order to safely use
  LOCK_FILE and LOCK_LINE.  As long as this code will be replaced soon
  we can tollerate for a while this namespace pollution even if the real
  fix would be to let lockmgr() depend by lock.h as a separate header.
2008-02-10 15:50:21 +00:00
Konstantin Belousov
2db08dbb82 After rev. 1.60 of sys/lockmgr.h, the header requires inclusion of the
sys/lock.h.
2008-02-10 07:34:16 +00:00
Mitsuru IWASAKI
5a3c4d694e Add `hw.ciss.nop_message_heartbeat' tunable (default disabled) for
NOP-message polling in ciss_periodic().
Note that setting the tunable to non-zero can be workaround only for
`ADAPTER HEARTBEAT FAILED' problem, and may freeze the system w/o
the problem.

Reviewed by:	scottl
Reported by:	Attila Nagy
MFC after:	3 days
2008-02-10 06:21:52 +00:00
Scott Long
1a6b516979 Remove an errant definition for AMR_CONFIG_ENQ3_SOLICITED NOTIFY that was
accidently reverted in the previous commit.
2008-02-06 14:26:31 +00:00
Scott Long
b204a4e7a1 Fix a symbol conflict between hptrr and hptmv 2008-02-06 05:33:17 +00:00
Scott Long
4fdb276a88 Update the hptrr driver to version 1.2. This adds port multiplier support
for several cards.  See the Highpoint website for more information.  Again,
many thanks to Highpoint for their continued support of FreeBSD.
2008-02-06 01:02:20 +00:00
Scott Long
2f6cdcc8f5 Update the hptiop driver to version 1.3. This adds support for the 4xxx
series of adapters.  Thanks again to Highpoint for their continued support
of FreeBSD.

Submitted by: Highpoint Technologies
2008-02-03 16:07:12 +00:00
Sepherosa Ziehau
4d494753eb Various bug fixes for 2560 parts of ral(4):
- Rename rt2560_read_eeprom to rt2560_read_config, we already have
  rt2560_eeprom_read
- If hardware gives us wrong encryption done index, shout out loudly and
  terminate the processing loop
- Process encryption done if RX done bit is set in interrupt status register
  (according to Ralink Linux driver)
- Turn VALID/BUSY bits in TX descriptor only after TX descriptor is fully setup
- Fix BBP read: RT2560_BBPCSR can't be written until its RT2560_BBP_BUSY bit is
  off (according to Ralink Linux driver)
- Skip invalid (0 of 0xffff) BBP register/value entries stored in EEPROM
- Fix channel TX power location in EEPROM, if channel TX power is above 31 set
  it to 24 (TX power only has 5bits in RF register, "24" is according to Ralink
  Linux driver)
- Configure BBP according to the BBP register/value stored in EEPROM, restore
  BBP17 (RX sensitivity tuning) to default value after this.
- Set TX/RX antenna after BBP is initialized; these two operation will try to
  set BBP registers
- Reconfigure ACK TX time registers according to 802.11g standard (TX @36Mb,
  other side's ACK should be sent @24Mb).
- 2560 parts have two TX ring: one for management/control packets, one for data
  packets.  Add private OACTIVE flag for each of them.  Turn on IFF_DRV_OACTIVE
  if one of private OACTIVE is on; turn off IFF_DRV_OACTIVE iff all of them are
  off.
- Rework watchdog to mimic old if_watchdog action.  Process TX done/encryption
  done in watchdog function (according to Ralink Linux driver)

Obtained from: DragonFly
Approved by: sam (mentor)
Tested by: sam
Related to PR: kern/117655

# Forcing long slot time setting is not included in this commit, comment and
# related code is in place, so if problem pops up, quick tests could be done.
2008-02-03 11:47:38 +00:00
Scott Long
593c873471 Remove the rr232x driver. It has been superceded by the hptrr driver. 2008-02-03 07:07:30 +00:00
Doug Ambrisko
04697de95a Fix some bugs in dealing with DCMD'd without data. MegaCli was sending
down some DCMD's without any data.  Thanks to Dell and LSI for helping
to provide clues to figure out this problem.  Now MegaCli can upgrade
the firmware and should work identical when run on Linux.

Reviewed by:	scottl, LSI
MFC after:	1 day
2008-02-02 17:29:28 +00:00
John Baldwin
138e8d08b0 Relax the check for a PCI-express chipset by assuming the system is a
PCI-express chipset (and thus has functional MSI) if there are any
PCI-express devices in the system, not requiring a root port device.

With PCI-X the chipset detection has to be very conservative because there
are known systems with PCI-X devices that do not appear to have PCI-X
chipsets.  However, with PCI-express I'm not sure it is possible to have
a PCI-express device in a system with a non-PCI-express chipset.  If we
assume that is the case then this change is valid.  It is also required
for at least some PCI-express systems that don't have any devices with
a root port capability (some ICH9 systems).

MFC after:	1 week
Reported by:	jfv
2008-02-01 20:31:09 +00:00
Poul-Henning Kamp
cf827063a9 Give MEXTADD() another argument to make both void pointers to the
free function controlable, instead of passing the KVA of the buffer
storage as the first argument.

Fix all conventional users of the API to pass the KVA of the buffer
as the first argument, to make this a no-op commit.

Likely break the only non-convetional user of the API, after informing
the relevant committer.

Update the mbuf(9) manual page, which was already out of sync on
this point.

Bump __FreeBSD_version to 800016 as there is no way to tell how
many arguments a CPP macro needs any other way.

This paves the way for giving sendfile(9) a way to wait for the
passed storage to have been accessed before returning.

This does not affect the memory layout or size of mbufs.

Parental oversight by:	sam and rwatson.

No MFC is anticipated.
2008-02-01 19:36:27 +00:00
Pyun YongHyeon
6ceb40baa9 Fix link state handling in bfe(4).
o conversion to callout(9) API.
 o add a missing driver lock in bfe_ifmedia_sts().
 o use our callout to drive watchdog timer.
 o restart Tx routine if pending queued packets are present in
   watchdog handler.
 o unarm watchdog timer only if there are no queued packets.
 o don't blindly reset phy and let phy driver handle link change
   request in bfe_init_locked().
 o return the status of mii_mediachg() to caller in
   bfe_ifmedia_upd(). Previously it always returned 0 to caller.
 o add check for IFF_DRV_RUNNING flag as well as IFF_DRV_OACTIVE
   in bfe_start_locked().
 o implement miibus_statchg method that keeps track of current
   link state changes as well as negotiated speed/duplex/
   flow-control configuration.
   Reprogram MAC to appropriate duplex state. Flow-control
   configuration was also implemented but commented out at the
   moment. The flow-control configuration will be enabled again
   after we have general flow-control framework in mii layer.

Reported by:	Yousif Hassan < yousif () alumni ! jmu ! edu >
Tesdted by:	Yousif Hassan < yousif () alumni ! jmu ! edu >
2008-01-29 02:15:11 +00:00
Mitsuru IWASAKI
0aeee4bd8a Don't repeat error logging about NOP message sending if
ciss_report_request() return an error (which is most likely data
underrun).

Noticed by:	Mark Atkinson
MFC after:	1 week
2008-01-28 16:21:34 +00:00
Andrew Gallatin
10882804c9 Only reset driver state when a hardware error is detected.
Preserve warning but do not reset if we enter the routine
without seeing a hardware error.
2008-01-28 13:20:51 +00:00
Mitsuru IWASAKI
7572a9c749 Return errno value rather than boolean in this context.
MFC after:	1 week
2008-01-28 01:57:48 +00:00
Mitsuru IWASAKI
0c26519e5a Enter the sleep state immediately without waiting for timeout if
devd(8) is not running such as the system in single user mode.

MFC after:	1 week
2008-01-27 16:11:04 +00:00
Kip Macy
6edc218ea1 Fix loading for case where we don't overload tcp_usrreqs by calling tcp_drop directly 2008-01-27 04:39:38 +00:00
Kip Macy
a57927a1e6 fix DISABLE_MBUF_IOVEC case by initializing mbuf header completely 2008-01-27 04:37:02 +00:00
Marius Strobl
82f358ff2a - Fix a typo in a comment.
- Fix whitespace according to style(9).
- Sync the comment describing why we have to wait in nsphy_reset()
  with nsphyter_reset(). It's true that the manual tells to not do a
  reset within 500us of applying power but that's unlikely the cause
  of problems seen here. Generally having to wait 500us after a reset
  however is.
2008-01-27 01:30:02 +00:00
Marius Strobl
4f3b854461 Fix a typo in a comment. 2008-01-27 01:11:57 +00:00
Marius Strobl
d47d37af9b Add a driver for the National Semiconductor DP83815, DP83843 and
DP83847 PHYs. The main reason for using a specific driver for these
PHYs are reset quirks similar to the nsphy(4) driven DP83840A.

PR:		112654
Obtained from:	NetBSD
MFC after:	2 weeks
Thanks to:	mlaier for testing w/ DP83815
2008-01-27 01:10:41 +00:00
Sam Leffler
650bd88c74 rx mbufs must have a pkthdr; use m_gethdr to populate the rx ring
(and while here correct the mbuf type)

Submitted by:	Sam Banks <w0lfie@clear.net.nz>
MFC after:	1 week
2008-01-26 22:35:57 +00:00
Ed Maste
5cc204ee18 Allow arbitrary baud rates, not just the standard ones. 2008-01-26 04:30:48 +00:00
Ed Maste
27e05557a5 Calculate baud rate divisor instead of allowing only a fixed set of
standard rates.

Obtained from OpenBSD
  src/sys/dev/usb/uftdi.c 1.29
  src/sys/dev/usb/uftdireg.h 1.11

OpenBSD revisions noted by: ticso, on hackers
2008-01-25 02:41:44 +00:00
Konstantin Belousov
eee74fe05d Do not dereference NULL scp in the case the screen is not opened.
Instead, return ENXIO to the ioctl caller.

Reported and tested by:	Pawel Worach <pawel.worach gmail com>
Discussed with:	markus
MFC after:	3 days
2008-01-24 15:37:48 +00:00
Attilio Rao
0e9eb108f0 Cleanup lockmgr interface and exported KPI:
- Remove the "thread" argument from the lockmgr() function as it is
  always curthread now
- Axe lockcount() function as it is no longer used
- Axe LOCKMGR_ASSERT() as it is bogus really and no currently used.
  Hopefully this will be soonly replaced by something suitable for it.
- Remove the prototype for dumplockinfo() as the function is no longer
  present

Addictionally:
- Introduce a KASSERT() in lockstatus() in order to let it accept only
  curthread or NULL as they should only be passed
- Do a little bit of style(9) cleanup on lockmgr.h

KPI results heavilly broken by this change, so manpages and
FreeBSD_version will be modified accordingly by further commits.

Tested by: matteo
2008-01-24 12:34:30 +00:00
Scott Long
74018414bf Many improvements that have been collected over time:
- Improve error handling for load operations.
- Fix a memory corruption bug when using certain linux management apps.
- Allocate all commands up front to avoid OOM deadlocks later on.
2008-01-24 07:26:53 +00:00
Andrew Gallatin
b0f7b92207 Take advantage of the new physically contiguous 9K jumbos in 8. 2008-01-22 22:04:31 +00:00
Pyun YongHyeon
9a508b89dc Fix build. 2008-01-21 09:51:28 +00:00
Pyun YongHyeon
f2ff94851b Overhaul sf(4) to make it run on all architectures and implement
checksum offoload by downloading AIC-6915 firmware. Changes are
 o Header file cleanup.
 o Simplified probe logic.
 o s/u_int{8,16,32}_t/uint{8,16,32}_t/g
 o K&R -> ANSI C.
 o In register access function, added support both memory mapped and
   IO space register acccess. The function will dynamically detect
   which method would be choosed.
 o sf_setperf() was modified to support strict-alignment
   architectures.
 o Use SF_MII_DATAPORT instead of hardcoded value 0xffff.
 o Added link state/speed, duplex changes handling task q. The task q
   is also responsible for flow control settings.
 o Always hornor link up/down state reported by mii layers. The link
   state information is used in sf_start() to determine whether we
   got a valid link.
 o Added experimental flow-control setup. It was commented out but
   will be activated once we have flow-cotrol infrastructure in mii
   layer.
 o Simplify IFF_UP/IFCAP_POLLING and IFF_PROMISC handling logic. Rx
   filter always honors promiscuous mode.
 o Implemented suspend/resume methods.
 o Reorganized Rx filter routine so promiscuous mode changes doesn't
   require interface re-initialization.
 o Reimplemnted driver probe routine such that it looks for matching
   device from supported hardware list table. This change will help to
   add newer hardware revision to the driver.
 o Use ETHER_ADDR_LEN instead of hardcoded value.
 o Prefer memory space register mapping over I/O space as the hardware
   requires lots of register access to get various consumer/producer
   index. Failing to get memory space mapping, sf(4) falls back to I/O
   space mapping. Use of memory space register mapping requires
   somewhat large memory space(512K), though.
 o Switch to simpler bus_{read,write}_{1,2,4}.
 o Use PCIR_BAR macro to get BARs.
 o Program PCI cache line size if the cache line size was set to 0
   and enable PCI MWI.
 o Add a new sysctl node 'dev.sf.N.stats' that shows various MAC
   counters for Rx/Tx statistics.
 o Add a sysctl node to configure interrupt moderation timer. The
   timer defers interrupts generation until time specified in timer
   control register is expired. The value in the timer register is in
   units of 102.4us. The allowable range for the timer is 0 - 31
   (0 ~ 3.276ms).
   The default value is 1(102.4us). Users can change the timer value
   with dev.sf.N.int_mod sysctl(8) variable/loader(8) tunable.
 o bus_dma(9) conversion
    - Enable 64bit DMA addressing.
    - Enable 64bit descriptor format support.
    - Apply descriptor ring alignment requirements(256 bytes alignment).
    - Apply Rx buffer address alignment requirements(4 bytes alignment).
    - Apply 4GB boundary restrictions(Tx/Rx ring and its completion ring
      should live in the same 4GB address space.)
    - Set number of allowable number of DMA segments to 16. In fact,
      AIC-6915 doesn't have a limit for number of DMA segments but it
      would be waste of Tx descriptor resource if we allow more than 16.
    - Rx/Tx side bus_dmamap_load_mbuf_sg(9) support.
    - Added alignment fixup code for strict-alignment architectures.
    - Added endianness support code in Tx/Rx descriptor access.
    With these changes sf(4) should work on all platforms.
 o Don't set if_mtu in device attach, it's handled in ether_ifattach.
 o Use our own callout to drive watchdog timer.
 o Enable VLAN oversized frames and announce sf(4)'s VLAN capability
   to upper layer.
 o In sf_detach(), remove mtx_initialized KASSERT as it's not possible
   to get there without initialzing the mutex. Also mark that we're
   about to detaching so active bpf listeners do not panic the system.
 o To reduce PCI register access cycles, Rx completion ring is
   directly scanned instead of reading consumer/producer index
   registers. In theory, Tx completion ring also can be directly
   scanned. However the completion ring is composed of two types
   completion(1 for Tx done and 1 and DMA done). So reading producer
   index via register access would be more safer way to detect the
   ring wrap-around.
 o In sf_rxeof(), don't use m_devget(9) to align recevied frames. The
   alignment is required only for strict-alignment architectures and
   now the alignment is handled by sf_fixup_rx() if required. The
   removal of the copy operation in fast path should increase Rx
   performance a lot on non-strict-alignemnt architectures such as
   i386 and amd64.
 o In sf_newbuf(), don't set descriptor valid bit as sf(4) is
   programmed to run with normal mode. In normal mode, the valid bit
   have no meaning. The valid bit should be used only when the
   hardware uses polling(prefetch) mode. The end of descriptor queue
   bit could be used if needed, but sf(4) relys on auto-wrapping of
   hardware on 256 descriptor queue entries so both valid and
   descriptor end bit are not used anymore.
 o Don't disable generation of Tx DMA completion as said in datasheet
   and use the Tx DMA completion entry instead of relying on Tx done
   completion entry. Also added additional Tx completion entry type
   check in Tx completion handler.
 o Don't blindly reset watchdog timer in sf_txeof(). sf(4) now unarm
   the the watchdog only if there are no active Tx descriptors in Tx
   queue.
 o Don't manually update various counters in driver, instead, use
   built-in MAC statistic registers to update them. The statistic
   registers are updated in every second.
 o Modified Tx underrun handlers to increase the threshold value
   in units of 256 bytes. Previously it used to increase 16 bytes
   at a time which seems to take too long to stabalize whenever Tx
   underrun occurrs.
 o In interrupt handler, additional check for the interrupt is
   performed such that interrupts only for this device is allowed to
   process descriptor rings. Because reading SF_ISR register clears
   all interrtups, nuke writing to a SF_ISR register.
 o Tx underrun is abonormal condition and SF_ISR_ABNORMALINTR includes
   the interrupt. So there is no need to inspect the Tx underrun again
   in main interrupt loop.
 o Don't blindly reinitialize hardware for abnormal interrupt
   condition. sf(4) reintializes the hardware only when it encounters
   DMA error which requires an explicit hardware reinitialization.
 o Fix a long standing bug that incorrectly clears MAC statistic
   registers in sf_init_locked.
 o Added strict-alignment safe way of ethernet address reprogramming
   as IF_LLADDR may return unaligned address.
 o Move sf_reset() to sf_init_locked in order to always reset the
   hardware to a known state prior to configuring hardware.
 o Set default Rx DMA, Tx DMA paramters as shown in datasheet.
 o Enable PCI busmaster logic and autopadding for VLAN frames.
 o Rework sf_encap.
     - Previously sf(4) used to type 0 of Tx descriptor with padding
       enabled to store driver private data. Emebedding private data
       structures into descriptors is bad idea as the structure size
       would be different between 64bit and 32bit architectures. The
       type 0 descriptor allows fixed number of DMA segments in
       a descriptor format and provides relatively simple interface to
       manage multi-fragmented frames.
       However, it wastes lots of Tx descriptors as not all frames are
       fragmented as the number of allowable segments in a descriptor.
     - To overcome the limitation of type 0 descriptor, switch to type
       2 descriptor which allows 64bit DMA addressing and can handle
       unliumited number of fragmented DMA segments. The drawback of
       type 2 descriptor is in its complexity in managing descriptors
       as driver should handle the end of Tx ring manually.
    -  Manually set Tx desciptor queue end mark and record number of
       used descriptors to reclaim used descriptors in sf_txeof().
 o Rework sf_start.
     - Honor link up/down state before attempting transmission.
     - Because sf(4) uses only one of two Tx queues, use low priority
       queue instead of high one. This will remove one shift operation
       in each Tx kick command.
     - Cache last produder index into softc such that subsequenet Tx
       operation doesn't need to access producer index register.
 o Rewrote sf_stats_update to include all available MAC statistic
   counters.
 o Employ AIC-6915 firmware from Adaptec and implement firmware
   download routine and TCP/UDP checksum offload.
   Partial checksum offload support was commented out due to the
   possibility of firmware bug in RxGFP.
   The firmware can strip VLAN tag in Rx path but the lack of firmware
   assistance of VLAN tag insertion in transmit side made it useless
   on FreeBSD. Unlike checksum offload, FreeBSD requires both Tx/Rx
   hardware VLAN assistance capability. The firmware may also detect
   wakeup frame and can wake system up from states other than D0.
   However, the lack of wakeup support form D3cold state keep me from
   adding WOL capability. Also detecting WOL frame requires firmware
   support but it's not yet known to me whether the firmware can
   process the WOL frame.
 o Changed *_ADDR_HIADDR to *_ADDR_HI to match other definitions of
   registers.
 o Added definitioan to interrupt moderation related constants.
 o Redefined SF_INTRS to include Tx DMA done and DMA errors. Removed
   Tx done as it's not needed anymore.
 o Added definition for Rx/Tx DMA high priority threshold.
 o Nuked unused marco SF_IDX_LO, SF_IDX_HI.
 o Added complete MAC statistic register definition.
 o Modified sf_stats structure to hold all MAC statistic regiters.
 o Nuke various driver private padding data in Tx/Rx descriptor
   definition. sf(4) no longer requires private padding. Also remove
   unused padding related definitions. This greatly simplifies
   descriptor manipulation on 64bit architectures.
 o Becase we no longer pad driver private data into descriptor,
   remove deprecated/not-applicable comments for padding.
 o Redefine Rx/Tx desciptor status. sf(4) doesn't use bit fileds
   anymore to support endianness.

Tested by:	bruffer (initial version)
2008-01-21 06:38:23 +00:00
Pyun YongHyeon
0e24813a2e It seems that the firmware for TxGFP does not work at all. I could
be wrong but I couldn't find a way to make it work. In addition, the
number of TxGFP instruction does not match the firmware image size,
so I guess something was wrong when Adaptec generated the TxGFP
firmware from their DDK.

According to datasheet, normally, the first GFP instruction would be
opcode C, WaitForStartOfFrame, to synchronize checksumming with
incoming frame. But the first instruction in TxGFP firmware was
opcode 1, BrToImmIfTrue, so it could not process checksum correctly,
I guess. Checking for RxGFP firmware also indicates the first
instruction should be opcode C. Since the number of instructions in
TxGFP firmware lacks exactly one instruction, I prepended the opcode
C to TxGFP firmware image. With this change, the resulting image size
perfectly matches with the nummber of instructions and Tx checksum
offload seems to work without problems.
2008-01-21 05:09:07 +00:00
Pyun YongHyeon
c5d7502930 Import AIC-6915 firmware for GFP from Adaptec.
Special thanks to bruffer to send the firmware image to me.

Submitted by:	gibbs via bruffer
2008-01-21 05:02:44 +00:00
Pyun YongHyeon
1dede5975a Forced commit to note that sf(4) was repocopied from sys/pci
and modified for its new location.
2008-01-21 04:23:47 +00:00
Kip Macy
9619451708 Re-enable pcpu caching by default make sysctl R/W 2008-01-19 22:47:43 +00:00
Jung-uk Kim
86543395c1 Add a flag for Ethernet@WireSpeed capability and correct chip revisions.
The idea was taken from OpenBSD and cross-referenced with Linux driver.
2008-01-18 22:09:50 +00:00
Jung-uk Kim
e4be3198af Fix mbuf pool watermark configuration (mismerged from OpenBSD in 1.132).
Submitted by:	sephe
MFC after:	3 days
2008-01-18 20:33:21 +00:00
Doug Ambrisko
ecefd670f5 Style changes from avatar.
Submitted by:	avatar
2008-01-18 16:34:18 +00:00
Doug Ambrisko
f0e1e8d9fb First real attempt at proper locking. The locking is a little complicated
since the the command and data that is being built to be sent to or read
from the HW lives in the softc.  Commands are later run via an_setdef etc.
In the ioctl path various references are kept to the data stored in
the softc so it needs to be protected.  Almost think of the command
in the softc a global variable since it essentially is.  Since locking
wasn't done in this type of context the commands would get corrupted.

Thanks to avatar@ for catching some lock issues and dhw@ for testing.

Things are a lot more stable except for the MPI-350 cards.  My an(4)
remote laptop stays on the network now.

The driver should be changed so that it uses private memory that is passed
to the functions that talk to the card.  Then only those functions would
really need to grab locks.

Reviewed by:	avatar@
2008-01-18 16:31:24 +00:00
Pyun YongHyeon
7eb12306d6 Use m_collapse(9) to collapse mbuf chains instead of relying on
shortest possible chain of mbufs of m_defrag(9). What we want is
chains of mbufs that can be safely stored to a Tx descriptor which
can have up to STGE_MAXTXSEGS mbufs. The ethernet controller does
not need to align Tx buffers on 32bit boundary. So the use of
m_defrag(9) was waste of time.
2008-01-18 08:32:08 +00:00
John Baldwin
304a4c6fb1 - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and
re_defrag() and use m_collapse() instead.
- Replace a reference to ath_defrag() in a comment in if_wpi.c with
  m_collapse().
2008-01-17 23:37:47 +00:00
Kip Macy
8ec3680eb5 - remove bogus_imm counter
- disable pcpu cluster cache by default until reference counting is handled
  correctly for held clusters - can be re-enable by sysctl
2008-01-17 21:25:58 +00:00
Sam Leffler
eeb76a1889 promote ath_defrag to m_collapse (and retire private+unused
m_collapse from cxgb)

Reviewed by:	pyun, jhb, kmacy
MFC after:	2 weeks
2008-01-17 21:25:09 +00:00
John Baldwin
9a57f6280c Use pause(9) instead of a tsleep() on a stack variable.
MFC after:	1 week
2008-01-17 20:11:58 +00:00
Kip Macy
4f6a96ae5b Fix lock ordering panic by not calling ether_ioctl with port lock held
Reported by: rrs
2008-01-16 21:33:34 +00:00
John Baldwin
f831d6e073 Add a header containing constants for the various HPET registers and their
fields and update the code to match.  The PR served more as an inspiration
than providing the actual diffs.

MFC after:	1 week
PR:		kern/112544
2008-01-16 18:47:07 +00:00
Remko Lodder
149e9017bd Dont accidentally remove a filesocket which is still in use. This gives
problems when the DRM driver is loaded and the AIXGL extension is loaded
, the AIXGL driver requests a drm_close and this will cause the radeon
driver to fail while starting X windows.

PR:		kern/114688
Submitted by:	vehemens <vehemens at verizon dot net>
Prodded by:	Robert Noland
Approved by:	imp (mentor, a while ago already), anholt
MFC After:	1 week
2008-01-16 13:54:40 +00:00
Kip Macy
8030c630da remove superfluous debug printfs 2008-01-16 02:39:33 +00:00
Kip Macy
c833fdd83f Fix mbuf leak caused by freeing packet zone clusters but not their associated mbufs
- Track packet zone mbufs separately from other mbufs
- free packet zone buffers via m_free rather than trying to manage the refcount
  as with clusters - its refcount and management seems to be "special"
2008-01-16 00:28:30 +00:00
Kip Macy
2fd79ec2de put tx queue size back to 1024 2008-01-16 00:26:04 +00:00
John Baldwin
16670d1bd1 Use '%zd' to print PIO_LEN since it involves a size_t (via sizeof()) to
appease the tinderbox on 32-bit platforms.

Tested on:	amd64, i386
2008-01-15 22:01:26 +00:00
John Baldwin
0678f786c4 Don't cache the new-bus name of a PCI device in the PCI conf structure,
but reread it from the device_t every time the device list is fetched.
Previously the device name in pciconf -l would not be updated when a driver
was unloaded or if a device was detached and attached to a different
driver.

MFC after:	1 week
PR:		kern/104777
Submitted by:	"Iasen Kostoff"  tbyte | otel net
2008-01-15 21:40:46 +00:00
Andrew Gallatin
1e413cf932 Add optional support to mxge for MSI-X interrupts and multiple receive
queues (which we call slices).  The NIC will steer traffic into up to
hw.mxge.max_slices different receive rings based on a configurable
hash type (hw.mxge.rss_hash_type).

Currently the driver defaults to using a single slice, so the default
behavior is unchanged.  Also, transmit from non-zero slices is
disabled currently.
2008-01-15 20:34:49 +00:00
Maxim Sobolev
9e2211fd05 Hide common prints under bootverbose.
Obtained from:	src/sys/dev/rr232x/osm_bsd.c, rev.1.2-1.3
MFC after:	2 weeks
2008-01-15 19:21:08 +00:00
John Baldwin
572f347d9f Fix a few minor issues based on a bug report and reading over the HPET
spec:
- Use read/modify/write cycles to enable and disable the HPET instead of
  writing 0 to reserved bits.
- Shutdown the HPET during suspend as encouraged by the spec.
- Fail to attach to an HPET with a period of zero.

MFC after:	1 week
PR:		kern/119675 [3]
Reported by:	Leo Bicknell | bicknell ufp.org
2008-01-15 18:50:47 +00:00
Andrew Gallatin
93143d572a Fix accidental swap of "const" for "static" in mxge firmware byte arrays
caused by running my import script with the wrong args.
2008-01-15 15:04:40 +00:00
Andrew Gallatin
7e8305464a Update to firmware version 1.4.29 from 1.4.25. Relevant changes include:
- Fix a bug introduced in 1.4.20 where speculative read by the processor in the
   write-only doorbell region would cause a target-abort (as opposed to simply
   returning random data). This could manifest itself as NMI or machine freeze
   depending on how the BIOS/OS/chipset configuration handles target-abort.

- Add support for new revisions of -R cards (with AEL1002/AEL1010 xaui->xfi)

- Increase an internal timing (dispatch engine): fix possible spurious reset
  (seen on very few cards).
2008-01-15 13:29:32 +00:00
Kip Macy
139edb19d9 - Simplify mb_free_ext_fast
- increase asserts for mbuf accounting
- track outstanding mbufs (maps very closely to leaked)
- actually only create one thread per port if !multiq
    Oddly enough this fixes the use after free

- move txq_segs to stack in t3_encap
- add checks that pidx doesn't move pass cidx
- simplify mbuf free logic in collapse mbufs routine
2008-01-15 08:08:09 +00:00
Pyun YongHyeon
738489d1c1 Fix build. 2008-01-15 03:47:24 +00:00
Kip Macy
60f1e27625 - move WR_LEN in to cxgb_adapter.h add PIO_LEN to make intent clearer
- move cxgb_tx_common in to cxgb_multiq.c and rename to cxgb_tx
- move cxgb_tx_common dependencies
- further simplify cxgb_dequeue_packet for the non-multiqueue case
- only launch one service thread per port in the non-multiq case
- remove dead cleaning code from cxgb_sge.c
- simplify PIO case substantially in by returning directly from mbuf collapse
  and just using m_copydata
- remove gratuitous m_gethdr in the rx path
- clarify freeing of mbufs in collapse
2008-01-15 03:27:42 +00:00
Kip Macy
74aba11713 remove superfluous locking from dequeue 2008-01-15 03:21:02 +00:00
Pyun YongHyeon
d65abd6663 Overhaul re(4).
o Increased number of Rx/Tx descriptors to 256 for 8169 GigEs
  because it's hard to push the hardware to the limit with default
  64 descriptors.
  TSO requires large number of Tx descriptors to pass a full sized
  TCP segment(65535 bytes IP packet) to hardware. Previously it
  consumed 32 Tx descriptors, assuming MCLBYTES DMA segment size,
  to send the TCP segment which means re(4) couldn't queue more
  than two full sized IP packets.
  For 8139C+ it still uses 64 Rx/Tx descriptors due to its hardware
  limitations. With this changes there are (very) small waste of
  memory for 8139C+ users but I don't think it would affect 8139C+
  users for most cases.
o Various bus_dma(9) fixes.
   - The hardware supports DAC so allow 64bit DMA operations.
   - Removed BUS_DMA_ALLOC_NOW flag.
   - Increased DMA segment size to 4096 from MCLBYTES because TSO
     consumes too many descriptors with MCLBYTES DMA segment size.
   - Tx/Rx side bus_dmamap_load_mbuf_sg(9) support. With these
     changes the code is more readable than previous one and got a
     (slightly) better performance as it doesn't need to pass/
     decode arguments to/from callback function.
   - Removed unnecessary callback function re_dmamap_desc() and
     nuked rl_dmaload_arg structure which was used in the callback.
   - Additional protection for DMA map load failure. In case of
     failure reuse current map instead of returning a bogus DMA
     map.
  -  Deferred DMA map unloading/sync operation for maximum
     performance until we really need to load new DMA map. If we
     happen to reuse current map(e.g. input error) there is no need
     to sync/unload/load again.
  -  The number of allowable Tx DMA segments for a mbuf chains are
     now 32 instead of magic nseg value. If the number of available
     Tx descriptors are short enough to send highly fragmented mbuf
     chains an optimized re_defrag() is called to collapse mbuf
     chains which is supposed to be much faster than m_defrag(9).
     re_defrag() was borrowed from ath(4).
   - Separated Rx/Tx DMA tag from a common DMA tag such that Rx DMA
     tag correctly uses DMA maps that were created with DMA alignment
     restriction(8bytes alignments). Tx DMA tag does not have such
     alignment limitation.
   - Added additional sanity checks for DMA ring map load failure.
   - Added additional spare Rx DMA map for graceful handling of Rx
     DMA map load failure.
   - Fixed misused bus_dmamap_sync(9) and added missing
     bus_dmamap_sync(9) in re_encap()/re_txeof()/re_rxeof().
o Enabled TSO again as re(4) have reasonable number of Tx
  descriptors.
o Don't touch DMA address of a Tx descriptor in re_txeof(). It's
  not needed.
o Fix incorrect update of if_ierrors counter. For Rx buffer
  shortage it should update if_qdrops as the buffer is reused.
o Added checks for unsupported H/W revisions and return ENXIO for
  these hardwares. This is required to remove resource allocation
  code in re_probe as other drivers do in device probe routine.
o Modified descriptor index manipulation macros as it's now possible
  to have different number of descriptors for Rx/Tx.
o In re_start, to save a lock operation, use IFQ_DRV_IS_EMPTY before
  trying to invoke IFQ_DRV_DEQUEUE. Also don't blindly call re_encap
  since we already know the number of available Tx descriptors in
  advance.
o Removed RL_TX_DESC_THLD which was used to reserve RL_TX_DESC_THLD
  descriptors in Tx path. There is no such a limitation mentioned in
  8139C+/8169/8110/8168/8101/8111 datasheet and it seems to work ok
  without reserving RL_TX_DESC_THLD descriptors.
o Fix a comment for RL_GTXSTART. The register is 8bits register.
o Added comments for 8169/8139C+ hardware restrictions on descriptors.
o Removed forward declaration for "struct rl_softc", it's not needed.
o Added a new structure rl_txdesc for Tx descriptor managements and
  a structure rl_rxdesc for Rx descriptor managements.
o Removed unused member variable rl_intlock in driver softc. There are
  still several unused member variables which are supposed to be used
  to access hardware statistics counters. But it seems that accessing
  hardware counters were not implemented yet.
2008-01-15 01:10:31 +00:00
Kip Macy
8b7399ad30 - Assert that immpkt is not set
- convert %lx to 32-bit safe %jx
2008-01-14 07:55:56 +00:00
Pyun YongHyeon
346de09f2a Implement WOL capability.
- Turn on WOL bits in suspend/shutdown method.
 - WOL is disabled in resume routine as WOL can interfere normal
   Rx operation.
 - Move stge_reset() to stge_init_locked() as resetting hardware
   clears configured Rx information which in turn results in
   non-working Rx module after suspend/shutdown operation.
2008-01-14 07:16:48 +00:00
Kip Macy
efe7dfb26c - Add more extensive sanity checks
- remove initial dequeue from cxgb_start as it was causing an mbuf to be referenced twice
2008-01-14 06:00:41 +00:00
Kip Macy
9346e5197a Make back pressure visible more quickly, particularly now that we maintain a queue internally 2008-01-14 05:59:06 +00:00
Kip Macy
6481d641b5 Add extensive sanity checking to buf_ring 2008-01-14 05:56:03 +00:00
Kip Macy
5ef02c0223 Convert over to using the multiqueue infrastructure although all calls going
through cxgb_start still end up using queue 0
2008-01-13 22:38:17 +00:00
Kip Macy
0d57d78ca0 Add buf_ring_full utility function, make sure dequeue/enqueue see the latest
indexes
2008-01-13 22:37:09 +00:00
Kip Macy
1f36fc8a84 remove unused code 2008-01-13 22:35:12 +00:00
Kip Macy
9b063e763d style nit 2008-01-13 22:33:49 +00:00
Attilio Rao
22db15c06f VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in
conjuction with 'thread' argument passing which is always curthread.
Remove the unuseful extra-argument and pass explicitly curthread to lower
layer functions, when necessary.

KPI results broken by this change, which should affect several ports, so
version bumping and manpage update will be further committed.

Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
2008-01-13 14:44:15 +00:00
Nate Lawson
4c12fb6750 Fix GPE livelock that occurs on HP/Compaq laptops, mostly in the thermal
zone code.  The GPE handler method (i.e. _L00) generates various Notify
events that need to be run to completion before the GPE is re-enabled.
In ACPI-CA, we queue an asynch callback at the same priority as a Notify
so that it will only run after all Notify handlers have completed.  The
callback re-enables the GPE afterwards.  We also changed the priority of
Notifies to be the same as GPEs, given the possibility that another GPE
could arrive before the Notifies have completed and we don't want it to
get queued ahead of the rest.

The ACPI-CA change was submitted by Alexey Starikovskiy (SUSE) and will
appear in a later release.  Special thanks to him for helping track this
bug down.

MFC after:	1 week
Tested by:	jhb, Yousif Hassan <yousif / alumni.jmu.edu>
2008-01-12 22:13:12 +00:00
Kip Macy
9b74c87f1f MFp4 multiple queue support 2008-01-12 20:34:56 +00:00
Maxim Konovalov
f6a60feb6c o Add Moxa Technologies CP-104EL PCI Express 4 port Serial card.
PR:		kern/119515
Submitted by:	Gavin Stone-Tolcher
MFC after:	1 month
2008-01-12 19:14:29 +00:00
Konstantin Belousov
89a828fde9 The wakeup() line from the rev. 1.319 is wrong and reintroduces
a panic race on module unload. The wakeup() is internal to
kproc_exit/kthread_exit. The correct fix is to fix the msleep() in
detach to sleep on fdc->fdc_thread instead of &fdc->fdc_thread.

Noted and reviewed by:	jhb
Pointy hat to:	kib
MFC after:	1 week
2008-01-11 16:50:52 +00:00
Konstantin Belousov
fc9f8bcf4f Fix unload of the fdc.ko:
Wakeup the thread doing the fdc_detach() when the fdc worker thread exits [1].
Write access to the write-protected floppy shall call device_unbusy() to
pair the device_busy() in the fd_access() [2].

PR:	116537 [1], 116539 [2]
MFC after:	1 week
2008-01-11 11:53:04 +00:00
Kip Macy
9330dbc3a1 Be more aggressive about tx cleaning - when multiples streams were running the tx
queue could fill up and stop getting cleaned.
2008-01-11 02:26:54 +00:00
Kip Macy
9cce003858 If we're not running with multiqueue enabled we need to wait to acquire the
rspq lock. Not doing so was causing us to skip re-enabling the interrupt.

- remove duplicate credits sysctl
- add support for dumping hardware context of the txq
- decrement budget_left when we break out of the process_responses loop
2008-01-10 23:51:34 +00:00
John Baldwin
618f2b4d55 Work around problems with the ppbus(4)'s interesting way of managing
interrupt handlers for child devices by adding a dummy handler that is
always present so that the underlying interrupt thread is always around
avoiding panics from stray interrupts.

MFC after:	3 days
2008-01-10 23:43:47 +00:00
Rui Paulo
ab0b125777 Disable the check for errata AE18. On MacBooks (1,1 version) there's
no problem with coretemp and C3 state.

Approved by:	njl (mentor)
2008-01-10 16:09:22 +00:00