Commit Graph

16891 Commits

Author SHA1 Message Date
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
Kip Macy
10b16b260c Add support for selectively dumping the state of the hardware response queue.
Change ordering of a couple of types.
2008-01-10 06:54:20 +00:00
Kip Macy
4fa42a6fa6 should always free when refcount is 1 2008-01-10 06:52:48 +00:00
Attilio Rao
cb05b60a89 vn_lock() is currently only used with the 'curthread' passed as argument.
Remove this argument and pass curthread directly to underlying
VOP_LOCK1() VFS method. This modify makes the code cleaner and in
particular remove an annoying dependence helping next lockmgr() cleanup.
KPI results, obviously, changed.

Manpage and FreeBSD_version will be updated through further commits.

As a side note, would be valuable to say that next commits will address
a similar cleanup about VFS methods, in particular vop_lock1 and
vop_unlock.

Tested by:	Diego Sardina <siarodx at gmail dot com>,
		Andrea Di Pasquale <whyx dot it at gmail dot com>
2008-01-10 01:10:58 +00:00
Kip Macy
f001b63dcb - make 9k clusters the default unless a tunable is set
- return the error from cxgb_tx_common so that when an error is hit we dont
  spin forever in the taskq thread
- remove unused rxsd_ref
- simplify header_offset calculation for embedded mbuf headers
- fix memory leak by making sure that mbuf header initialization took place
- disable printf's for stalled queue, don't do offload/ctrl queue restart
  when tunnel queue is restarted
- add more diagnostic information about the txq state
- add facility to dump the actual contents of the hardware queue using sysctl
2008-01-10 00:55:42 +00:00
Scott Long
15d0222f66 Fix a buffer overflow in the processing of various SCSI commands. This likely
fixes a an great number of weird problems that have been reported with this
driver.

PR: 119114
Submitted by: Jens Rehsack
2008-01-09 20:02:56 +00:00
Kip Macy
8d5754afc5 make nqsets a uint32_t so that sysctl will work
add 2 fields for allowing queue dumping
2008-01-09 08:12:24 +00:00
Kip Macy
b3fa5e2f65 don't decrement ref count below 1 for EXT_PACKET 2008-01-09 08:01:42 +00:00
Kip Macy
5f78571d1c EXT_PACKET is one of the valid mbuf types 2008-01-09 08:01:08 +00:00
Attilio Rao
d7a7e17968 Remove explicit calling of lockmgr() with the NULL argument.
Now, lockmgr() function can only be called passing curthread and the
KASSERT() is upgraded according with this.

In order to support on-the-fly owner switching, the new function
lockmgr_disown() has been introduced and gets used in BUF_KERNPROC().
KPI, so, results changed and FreeBSD version will be bumped soon.
Differently from previous code, we assume idle thread cannot try to
acquire the lockmgr as it cannot sleep, so loose the relative check[1]
in BUF_KERNPROC().

Tested by: kris

[1] kib asked for a KASSERT in the lockmgr_disown() about this
condition, but after thinking at it, as this is a well known general
rule, I found it not really necessary.
2008-01-08 23:48:31 +00:00
John Baldwin
e46502943a Make ftruncate a 'struct file' operation rather than a vnode operation.
This makes it possible to support ftruncate() on non-vnode file types in
the future.
- 'struct fileops' grows a 'fo_truncate' method to handle an ftruncate() on
  a given file descriptor.
- ftruncate() moves to kern/sys_generic.c and now just fetches a file
  object and invokes fo_truncate().
- The vnode-specific portions of ftruncate() move to vn_truncate() in
  vfs_vnops.c which implements fo_truncate() for vnode file types.
- Non-vnode file types return EINVAL in their fo_truncate() method.

Submitted by:	rwatson
2008-01-07 20:05:19 +00:00
Weongyo Jeong
6be174137b Fix incorrect dependencies of zyd(4).
Approved by:	thompsa (mentor)
2008-01-07 11:31:55 +00:00