History log of /drivers/infiniband/hw/ipath/ipath_intr.c
Revision Date Author Comments
49410185c356b2767409de9220d5cf5c8db062e5 25-May-2014 Manuel Schölling <manuel.schoelling@gmx.de> IB/ipath: Use time_before()/_after()

Time comparisons must use time_after / time_before to avoid problems
when jiffies wraps.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: Roland Dreier <roland@purestorage.com>
6475f1df272fee35cb718acb5e55b51f23898e82 11-Apr-2012 Jim Cromie <jim.cromie@gmail.com> IB/ipath: Replace open-coded ARRAY_SIZE with macro

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
d43c36dc6b357fa1806800f18aa30123c747a6d1 07-Oct-2009 Alexey Dobriyan <adobriyan@gmail.com> headers: remove sched.h from interrupt.h

After m68k's task_thread_info() doesn't refer to current,
it's possible to remove sched.h from interrupt.h and not break m68k!
Many thanks to Heiko Carstens for allowing this.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
70117b9e866b1fdf7e4e84ffb6f38a7b3e9702f8 04-Aug-2008 Alexander Beregalov <a.beregalov@gmail.com> IB/ipath: Fix printk format warnings

ipath_driver.c:1260: warning: format '%Lx' expects type 'long long unsigned int', but argument 6 has type 'long unsigned int'
ipath_driver.c:1459: warning: format '%Lx' expects type 'long long unsigned int', but argument 4 has type 'u64'
ipath_intr.c:358: warning: format '%Lx' expects type 'long long unsigned int', but argument 3 has type 'u64'
ipath_intr.c:358: warning: format '%Lu' expects type 'long long unsigned int', but argument 6 has type 'u64'
ipath_intr.c:1119: warning: format '%Lx' expects type 'long long unsigned int', but argument 5 has type 'u64'
ipath_intr.c:1119: warning: format '%Lx' expects type 'long long unsigned int', but argument 3 has type 'u64'
ipath_intr.c:1123: warning: format '%Lx' expects type 'long long unsigned int', but argument 3 has type 'u64'
ipath_intr.c:1130: warning: format '%Lx' expects type 'long long unsigned int', but argument 4 has type 'u64'
ipath_iba7220.c:1032: warning: format '%llx' expects type 'long long unsigned int', but argument 4 has type 'u64'
ipath_iba7220.c:1045: warning: format '%llX' expects type 'long long unsigned int', but argument 3 has type 'u64'
ipath_iba7220.c:2506: warning: format '%Lu' expects type 'long long unsigned int', but argument 4 has type 'u64'

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e2ab41cae418108f376ad1634d7507f56379f7a2 07-May-2008 Dave Olson <dave.olson@qlogic.com> IB/ipath: Need to always request and handle PIO avail interrupts

Now that we always use PIO for vl15 on 7220, we could get stuck forever
if we happened to run out of PIO buffers from the verbs code, because
the setup code wouldn't run; the interrupt was also ignored if SDMA was
supported. We also have to reduce the pio update threshold if we have
fewer kernel buffers than the existing threshold.

Clean up the initialization a bit to get ordering safer and more
sensible, and use the existing ipath_chg_kernavail call to do init,
rather than doing it separately.

Drop unnecessary clearing of pio buffer on pio parity error.

Drop incorrect updating of pioavailshadow when exitting freeze mode
(software state may not match chip state if buffer has been allocated
and not yet written).

If we couldn't get a kernel buffer for a while, make sure we are
in sync with hardware, mainly to handle the exitting freeze case.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
b4d390d8d219452e5d4257c87134a6934d7fabeb 07-May-2008 Dave Olson <dave.olson@qlogic.com> IB/ipath: Fix bug that can leave sends disabled after freeze recovery

The semantics of cancel_sends changed, but the code using it was missed.
Don't leave sends and pioavail updates disabled, and add a comment as to
why the force update is needed.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e7eacd36865ae0707f5efae8e4dda421ffcd1b66 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Update copyright dates for files changed in 2008

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
124b4dcb1dd3a6fb80051f1785117a732d785f70 17-Apr-2008 Dave Olson <dave.olson@qlogic.com> IB/ipath: add calls to new 7220 code and enable in build

This patch adds the initialization calls into the new 7220 HCA files,
changes the Makefile to compile and link the new files, and code to
handle send DMA.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
bb9171448deb1f7ece27674e2e431e4f267fd453 17-Apr-2008 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Misc changes to prepare for IB7220 introduction

The patch adds a number of minor changes to support newer HCAs:
- New send buffer control bits
- New error condition bits
- Locking and initialization changes
- More send buffers

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
555b203e48faeacc0373eda7bc87db874db37136 17-Apr-2008 Dave Olson <dave.olson@qlogic.com> IB/ipath: Make link state transition code ignore (transient) link recovery

The hardware-based recovery doesn't need any intervention, and in a few
cases we can get a bit confused about state and skip steps such as
turning off the link state LED when we consider recovery to be "down".
So ignore this transition, and either we recover in hardware, or we
transition to down, and will handle it then.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9355fb6a064723c71e80e9c78de3140b43bfb52d 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Add support for 7220 receive queue changes

Newer HCAs have a HW option to write a sequence number to each receive
queue entry and avoid a separate DMA of the tail register to memory.
This patch adds support for these changes.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2ba3f56eb402672ff83601b5990b219d39577636 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Fix some white space and code style issues

This patch makes some white space changes and minor non-functional
changes to more closely match the code in OFED-1.3.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
c4b4d16e090e1b68d1d4d20a28757070982b9725 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Make send buffers available for kernel if not allocated to user

A fixed partitioning of send buffers is determined at driver load time
for user processes and kernel use. Since send buffers are a scarce
resource, it makes sense to allow the kernel to use the buffers if they
are not in use by a user process.

Also, eliminate code duplication for ipath_force_pio_avail_update().

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
4330e4dad780467d930b394b5119c0218a1e2dbe 17-Apr-2008 Michael Albaugh <Michael.Albaugh@Qlogic.com> IB/ipath: Prevent link-recovery code from negating admin disable

The link can be put in LINKDOWN_DISABLE state either locally or via a
MAD. However, the link-recovery code will take it out of that state as
a side-effect of attempts to clear SerDes/XGXS issues.

We add a flag to indicate "link is down on purpose, leave it alone."

Signed-off-by: Michael Albaugh <michael.albaugh@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
72708a0a2b60e83255631f2557a85ac7daf33fac 17-Apr-2008 Dave Olson <dave.olson@qlogic.com> IB/ipath: HW workaround for case where chip can send but not receive

Workaround a QLE7140 problem that in rare cases causes flow control
problems after link recovery by forcing a link retrain after recovery.
A module parameter is provided to control the behavior in case it causes
problems.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
58411d1c012dca53ec9107bd98acb63f648e2435 17-Apr-2008 John Gregor <john.gregor@qlogic.com> IB/ipath: Head of Line blocking vs forward progress of user apps

There's a conflict between our need to quiesce PSM-based applications
to avoid HoL blocking when the IB link goes down and the apps' desire
to remain running so that their quiescence timout mechanism can keep
running.

The compromise is to STOP the processes for a fixed period of time and
then alternate between CONT and STOP until the link is again active.

If there are poor interactions with subnet manager configuration at a
given site, the interval can be adjusted via a module paramter.

Signed-off-by: John Gregor <john.gregor@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
8bae0ff2590c0b709d217da4466c6dba0b6b885c 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Fix error recovery for send buffer status after chip freeze mode

The error recovery code for updating the driver's cached status information
for which send buffers are busy or free wasn't updated for IBA7220.
It should be similar to the initialization code in enable_chip().

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0349d1662027fee36e590640b3b05fd979ae26f8 17-Apr-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Fix byte order of pioavail in handle_errors()

Fix byte order of value assigned to pioavailshadow. This bug was
detected by sparse endianness warnings.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
3dd59e226e01ddb5b041eb0b2e7c7f28b1f730c9 17-Apr-2008 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Misc sparse warning cleanup

Recent sparse versions and kernel cleanups knock down the false positive
rate of the ipath driver code to a point where having it be sparse clean
is worthwhile. Here we fixup the sparse warnings. Some of these warnings
(and the impetus to run sparse again) are due to work by Roland Dreier.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
7da0498e7f0eb022107811b9d41697298329f6b4 07-Jan-2008 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Add ipath_read_ireg() abstraction

Different chips have different width interrupt status registers, so add
a flag and accessor function to decide which width register read to use.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
4ea61b548bc93fb87cec6f52059851076e2ff54d 07-Jan-2008 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Add flag and handling for chips with swapped register bug

The 6110 had a bug that caused some registers to be swapped; it was
fixed for the 7220 (and didn't affect the 6120 because it had fewer
registers). This adds a flag and related code to handle that, and
includes some minor cleanups in the same area.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
755807a296f77ca7c31dc000afdfe1e5172bbf72 06-Dec-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Changes for fields moving from devdata to portdata

This patch moves some arrays that were defined per-device to be
variables defined in the per context data structure, thus avoiding extra
kzalloc() calls.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
d8274869d742c3d8082e1428de47e54d12104928 21-Dec-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Generalize some xxx_SHIFT macros

In preparation for upcoming chips that have different values for
INFINIPATH_R_PORTENABLE_SHIFT, INFINIPATH_R_INTRAVAIL_SHIFT,
INFINIPATH_R_TAILUPD_SHIFT, and portcfg_shift, remove the shared
#defines and use device-specific variables instead.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
c59a80aca0bfc491d90534ed5606d5493eca24a3 20-Dec-2007 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: kreceive uses portdata rather than devdata

kreceive is now portdata * instead of devdata * and other kreceive
related cleanups....

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2f01a7001131bbf3ce1e39252bf72aea2da034df 18-Oct-2007 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Better comment for rmb() in ipath_intr()

An internal code review found the comment here lacking -- update it with
more specifics of how and why the rmb() is there.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e342c119172f87f2d812bccfd0283f62e1bc1c2a 05-Sep-2007 John Gregor <john.gregor@qlogic.com> IB/ipath: Fix sendctrl locking

Code review pointed out that the locking around uses of ipath_sendctrl
and kr_sendctrl were, in several places, incorrect and/or inconsistent.

Signed-off-by: John Gregor <john.gregor@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9ab4295d1d9ab10a249aea002060685f935a528c 13-Oct-2007 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Remove dead code for user process waiting for send buffer

At one point in time there was code to allow a user process to
wait for a send buffer if none were available. This feature was
never used and most of the code was removed. This removes
some missed unused code.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e193e3326c521eea6a0221e945627ae5e3274910 10-Oct-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Improve interrupt handler cache footprint

Improve interrupt handler cache footprint by noinline'ing error
functions that are rarely called.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
164ef7a25285bbc42d8177f454b31631ca4d3ec7 10-Oct-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Fix incorrect use of sizeof on msg buffer (function argument)

Inside a function declared as

void foo(char bar[512])

the value of sizeof bar is the size of a pointer, not 512. So avoid
constructions like this by passing the size explicitly.

Also reduce the size of the buffer to 128 bytes (512 was overly generous).

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
49739b3e24a10d819d3167a1c5b319d0b1186245 20-Sep-2007 Ralph Campbell <ralph.campbell@qlogic.com> IB/ipath: Fix IB_EVENT_PORT_ERR event

The link state event calls were being generated when the SM told the SMA
to change link states. This works for IB_EVENT_PORT_ACTIVE but not if
the link goes down and stays down. The fix is to generate event calls
from the interrupt handler when the HW link state changes.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
6a733cdc71b7aa8107caa57f2a16629aa731242a 03-Oct-2007 Michael Albaugh <Michael.Albaugh@Qlogic.com> IB/ipath: Better handling of unexpected GPIO interrupts

The General Purpose I/O pins can be configured to cause interrupts. At
the end of the interrupt code dealing with all known causes, a message
is output if any bits remain un-handled. Since this is a "can't happen"
scenario, it should only be triggered by bugs elsewhere. It is harmless,
and potentially beneficial, to limit the damage by masking any such
unexpected interrupts.

This patch adds disabling of interrupts from any pins that should
not have been allowed to interrupt, in addition to emitting a message.

Signed-off-by: Michael Albaugh <Michael.Albaugh@Qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
70c51da2c4f84317bb13a2b564600afdcebd686f 14-Sep-2007 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Use counters in ipath_poll and cleanup interrupts in ipath_close

ipath_poll() suffered from a couple subtle bugs. Under the right
conditions we could leave recv interrupts enabled on an ipath user
context on close, thereby taking potentially unwanted interrupts on the
next open -- this is fixed by unconditionally turning off recv
interrupts on close. Also, we now use counters rather than set/clear
bits which allows us to make sure we catch all interrupts at the cost of
changing the semantics slightly (it's now give me all events since the
last time I called poll() rather than give me all events since I called
_this_ poll routine). We also added some memory barriers which may help
ensure we get all notifications in a timely manner.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
327a338d4fd018d33e7cacde46c0d82622b4bda8 02-Aug-2007 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: iba6110 rev4 GPIO counters support

On iba6110 rev4, support for three more IB counters were added. The
LocalLinkIntegrityError counter, the ExcessiveBufferOverrunErrors
counter and support for error counting of flow control packets on an
invalid VL. These counters trigger GPIO interrupts and the sw keeps
track of the counts. Since we also use GPIO interrupts to signal packet
reception, we need to turn off the fast interrupts, or we risk losing a
GPIO interrupt.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
78d1e02fac0595a8aa8a5064d1bd0c0ea55b22b0 20-Jul-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Workaround problem of errormask register being overwritten

On some system hardware, we are seeing moderately common cases of the
chip errormask register being overwritten due to a chip bug in iba6120
that is triggered by a vendor-specific PCIe broadcast message. This
patch merely checks periodically, and corrects it if needed (the
overwrite can cause us to not get error and hardware error
interrupts). Also, make dd->ipath_errormask the one, true canonical
source for kr_errormask, and remove references to ipath_ignorederrs as
it is currently unused.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: John Gregor <john.gregor@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
3810f2a84e994e295e181eb9bd4b8007f611b5eb 20-Jul-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Fix some issues with buffer cancel and sendctrl register update

There was confused use of INFINIPATH_S_PIOBUFAVAILUPD (value) and
IPATH_S_PIOBUFAVAILUPD (bit position). Also, some callers of
ipath_cancel_sends() need kr_sendctrl restored, and some want to do it
later.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
f17fddc9e266281bbb4d384b031e1521e1f2510e 20-Jul-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Remove unsafe fastrcvint code from interrupt handler

The fastrcvint code's purpose was to avoid reading the interrupt
status if kernel packets were in the receive queue (to reduce
overhead). Because intstatus was not read, we could miss the error
interrupt bit indicating freeze mode, since it only delivers a single
interrupt, even if still pending after intclear is written.

This patch removes that unsafe optimization.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
da9aec7b627c0369b955f82e855508c6711929ac 18-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/ipath: Make a few functions static

Make some functions that are only used in a single .c file static. In
addition to being a cleanup, this shrinks the generated code. On x86_64:

add/remove: 1/3 grow/shrink: 2/1 up/down: 4777/-4956 (-179)
function old new delta
handle_errors - 3994 +3994
__verbs_timer 42 710 +668
ipath_do_ruc_send 2131 2246 +115
ipath_no_bufs_available 136 - -136
ipath_disarm_senderrbufs 639 - -639
ipath_ib_timer 658 - -658
ipath_intr 5878 2355 -3523

Signed-off-by: Roland Dreier <rolandd@cisco.com>
3588423fbab1cfaf839e67378897e232a054f317 06-Jul-2007 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Test interrupts at driver startup

All too often, interrupts do not get enabled for our card due to BIOS
misconfiguration and other issues. This patch checks for that
condition on startup and warns the user. This patch is based on work
(check LID availability) by Robert Walsh.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0f4fc5ebd9a68ede20ca365576a6df2df2fefc4c 06-Jul-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Be more cautious about coming out of freeze mode

We are more careful to be sure that we don't lose information about
changes that occurred while we were in freeze mode, when the chip will
not notify us, and try to avoid false error interrupts while doing
cleanup. Put all of this logic in a new function ipath_clear_freeze().

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
87427da55bc03dbce7906a5b09ed50279d654d28 11-Jun-2007 John Gregor <john.gregor@qlogic.com> IB/ipath: Update copyright dates

Now that it's June, it's about time to update
the copyright notices of files that have changed.

Signed-off-by: John Gregor <john.gregor@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
f2d042313e420002b06715675963cfab48ed2597 18-Jun-2007 Robert Walsh <robert.walsh@qlogic.com> IB/ipath: ipath_poll fixups and enhancements

Fix ipath_poll and enhance it so we can poll for urgent packets or
regular packets and receive notifications of when a header queue
overflows.

Signed-off-by: Robert Walsh <robert.walsh@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9380068fc2f230e7840ff87d3f1e6030ae2ee5e8 18-Jun-2007 Dave Olson <dave.olson@qlogic.com> IB/ipath: Use S_ABORT not cancel and abort on exit freeze mode after recovery

This centralizes the use of the abort functionality, removes the
unneeded buffer cancel (abort does the same thing), sets up to ignore
launch errors after abort, same as cancel. We need abort on exit from
freeze mode to avoid having buffers stuck in the busy state, if a user
process happened to complete the send while we were in freeze mode
doing the recovery.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
aecd3b5ab19624ca9644b9df9c61615282d8923f 17-May-2007 Michael Albaugh <michael.albaugh@qlogic.com> IB/ipath: Log "active" time and some errors to EEPROM

We currently track various errors, now we enhance that capability by
logging some of them to EEPROM. We also now log a cumulative "active"
time defined by traffic though the InfiniPath HCA beyond the normal SM
traffic.

Signed-off-by: Michael Albaugh <michael.albaugh@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
8f140b407f3be04e7202be9aa0cfef3006d14c9f 10-May-2007 Arthur Jones <arthur.jones@qlogic.com> IB/ipath: Shadow the gpio_mask register

Once upon a time, GPIO interrupts were rare. But then a chip bug in
the waldo series forced the use of a GPIO interrupt to signal packet
reception. This greatly increased the frequency of GPIO interrupts
which have the gpio_mask bits set on the waldo chips. Other bits in
the gpio_status register are used for I2C clock and data lines, these
bits are usually on. An "unlikely" annotation leftover from the old
days was improperly applied to these bits, and an unnecessary chip
mmio read was being accessed in the interrupt fast path on waldo.

Remove the stagnant unlikely annotation in the interrupt handler and
keep a shadow copy of the gpio_mask register to avoid the slow mmio
read when testing for interruptable GPIO bits.

Signed-off-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9783ab405844202b452ac673677e6c8f8c9a6a99 15-Mar-2007 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Improve handling and reporting of parity errors

Mostly cleanup.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
614d49a21e96737f84b13f644ac813f8eb6d297a 15-Mar-2007 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Fix bad argument to clear_bit()

Code was converted from a &= ~mask to clear_bit, but the bit was left
shifted instead of being used directly, so we were either trashing
memory several pages away, or sometimes taking a kernel page fault on
an invalid page.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
8ec1077b35359c973f4b1de7c516be570a6df495 15-Mar-2007 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Change packet problems vs chip errors handling and reporting

Some types of packet errors are moderately common with longer IB
cables and large clusters, and are not reported with prints by other
IB HCA drivers. This suppresses those messages unless the new
__IPATH_ERRPKTDBG bit is set in ipath_debug. Reporting of temporarily
disabled frequent error interrupts was also made clearer

We also distinguish between chip errors, and bad packets sent or
received in the wording of the messages.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
44f8e3f3f7d8e61b4aafced278403955fe18ad88 12-Dec-2006 Roland Dreier <rolandd@cisco.com> IB/ipath: Remove unused "write-only" variables

Remove variables that are set but then never looked at in the ipath
driver. These cleanups came from David Binderman's list of "set but
never used" warnings from icc.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
51f65ebccf55121832c265838f93949f898b12ff 09-Nov-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath - program intconfig register using new HT irq hook

Eric's changes to the htirq infrastructure require corresponding
modifications to the ipath HT driver code so that interrupts are still
delivered properly.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Roland Dreier <rdreier@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7d12e780e003f93433d49ce78cfedf4b4c52adc5 05-Oct-2006 David Howells <dhowells@redhat.com> IRQ: Maintain regs pointer globally rather than passing to IRQ handlers

Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.

(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.

(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
89d1e09b6a6d844ef327937f41658a426be42501 28-Sep-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Fix and recover TXE piobuf and PBC parity errors

We can sometimes trigger parity errors due to processor speculative
reads to our write-combined memory (mostly seen on Woodcrest). Add a
stats counter for these.

Factored out the sendbuffererror buffer cancellation code so it can be
used in the new handling; suppress likely subsequent error messages if
within two jiffies of the cancellation.

Also restore 2 dropped TXE lines on hwe_bitsextant noticed while
debugging.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
1fd3b40fde3bfacdf742cadfe99cfd47ffd05219 28-Sep-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Improved support for PowerPC

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
f62fe77ad26b9c89c2028d96709f0f28793fe6cd 28-Sep-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Support multiple simultaneous devices of different types

Prior to this change, the driver was not able to support a HT and PCIE
card simultaneously present in the same machine.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
8d588f8bb79c86a5826f66946c1ea026b6b07bd8 28-Sep-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Print more informative parity error messages

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2c9446a1d63f1ca570e92f89422595732efedf44 28-Sep-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: Support revision 2 InfiniPath PCIE devices

This also entailed a little GPIO-interrupt general cleanup.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0fd41363e0785247b7c19127318abc8b5eacc86b 25-Aug-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: remove stale references to userspace SMA

When we first submitted a userspace subnet management agent, it was
rejected, so we left it out of the final driver submission. This patch
removes a number of vestigial references to it.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
34b2aafea38efdf02cd8107a6e1057e2a297c447 25-Aug-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: simplify layering code

A lot of ipath layer code was only called in one place. Now that the
ipath_core and ib_ipath drivers are merged, it's more sensible to simply
inline the simple stuff that the layer code was doing.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
b1c1b6a30eac88665a35a207cc5e6233090b9d65 25-Aug-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: merge ipath_core and ib_ipath drivers

There is little point in keeping the two drivers separate, so we are
merging them.

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
27b678dd04a636f2c351816f4b3042c8815d4e9d 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: namespace cleanup: replace ips with ipath

Remove ips namespace from infinipath drivers. This renames ips_common.h to
ipath_common.h. Definitions, data structures, etc. that were not used by
kernel modules have moved to user-only headers. All names including ips have
been renamed to ipath. Some names have had an ipath prefix added.

Signed-off-by: Christian Bell <christian.bell@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fba75200ad92892bf32d8d6f1443c6f1e4f48676 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: fixes to performance get counters for IB compliance

This patch fixes some problems uncovered during IB compliance testing to
return the right values for error counters returned by the Performance Get
Counters packet.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7cd658cd2bca48d3a0e747b4525c72eb8855278e 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: removed redundant statements

The tail register read became redundant as the result of earlier receive
interrupt bug fixes.

Drop another unneeded register read.

And another line that got duplicated.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
57abad25f844e760082c0b1ab2b176dad682ea16 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: fix lost interrupts on HT-400

Do an extra check to see if in-memory tail changed while processing packets,
and if so, going back through the loop again (but only once per call to
ipath_kreceive()). In practice, this seems to be enough to guarantee that if
we crossed the clearing of an interrupt at start of ipath_intr with a
scheduled tail register update, that we'll process the "extra" packet that
lost the interrupt because we cleared it just as it was about to arrive.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f5f99929ac584126ef3f47d805dc619abc54768c 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: fixed bug 9776 for real

The problem was that I was updating the head register multiple times in the
rcvhdrq processing loop, and setting the counter on each update. Since that
meant that the tail register was ahead of head for all but the last update, we
would get extra interrupts. The fix was to not write the counter value except
on the last update.

I also changed to update rcvhdrhead and rcvegrindexhead at most every 16
packets, if there were lots of packets in the queue (and of course, on the
last packet, regardless).

I also made some small cleanups while debugging this.

With these changes, xeon/monty typically sees two openib packets per interrupt
on sdp and ipoib, opteron/monty is about 1.25 pkts/intr.

I'm seeing about 3800 Mbit/s monty/xeon, and 5000-5100 opteron/monty with
netperf sdp. Netpipe doesn't show as good as that, peaking at about 4400 on
opteron/monty sdp. Plain ipoib xeon is about 2100+ netperf, opteron 2900+, at
128KB

Signed-off-by: olson@eng-12.pathscale.com
Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
13aef4942c291742064c1d5ac71df6493c4a00a9 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: reduce overhead on receive interrupts

Also count the number of interrupts where that works (fastrcvint). On any
interrupt where the port0 head and tail registers are not equal, just call the
ipath_kreceive code without reading the interrupt status, thus saving the
approximately 0.25usec processor stall waiting for the read to return. If any
other interrupt bits are set, or head==tail, take the normal path, but that
has been reordered to handle read ahead of pioavail. Also no longer call
ipath_kreceive() from ipath_qcheck(), because that just seems to make things
worse, and isn't really buying us anything, these days.

Also no longer loop in ipath_kreceive(); better to not hold things off too
long (I saw many cases where we would loop 4-8 times, and handle thousands (up
to 3500) in a single call).

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f37bda92461313ad3bbfbf5660adc849c69718bf 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: memory management cleanups

Made in-memory rcvhdrq tail update be in dma_alloc'ed memory, not random user
or special kernel (needed for ppc, also "just the right thing to do").

Some cleanups to make unexpected link transitions less likely to produce
complaints about packet errors, and also to not leave SMA packets stuck and
unable to go out.

A few other random debug and comment cleanups.

Always init rcvhdrq head/tail registers to 0, to avoid race conditions (should
have been that way some time ago).

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
759d57686dab8169ca68bbf938ce8e965d1e107a 01-Jul-2006 Bryan O'Sullivan <bos@pathscale.com> [PATCH] IB/ipath: update copyrights and other strings to reflect new company name

Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com>
Cc: "Michael S. Tsirkin" <mst@mellanox.co.il>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
80f7228b59e4bbe9d840af3ff0f2fe480d6e7c79 30-Jun-2006 Adrian Bunk <bunk@stusta.de> typo fixes: occuring -> occurring

Signed-off-by: Adrian Bunk <bunk@stusta.de>
d562a5ae69bd5643d777788117d02acb22fab347 24-Apr-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: fix label name in interrupt handler

Names that are the opposite of their intended meanings are not so helpful.

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
c71c30dcba142f16bc5f651812b1bc0b9f70f02d 24-Apr-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: prevent hardware from being accessed during reset

The reset code now turns off the PRESENT flag during a reset, so that
other code won't attempt to access a device that's in mid-reset.

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
5494c22ba293a37534591d793f73e445a66196b5 19-Apr-2006 Roland Dreier <rolandd@cisco.com> IB/ipath: Fix whitespace

Signed-off-by: Roland Dreier <rolandd@cisco.com>
108ecf0d90655055d5a7db8d3a7239133b4d52b7 30-Mar-2006 Bryan O'Sullivan <bos@pathscale.com> IB/ipath: misc driver support code

EEPROM support, interrupt handling, statistics gathering, and write
combining management for x86_64.

A note regarding i2c: The Atmel EEPROM hardware we use looks like an
i2c device electrically, but is not i2c compliant at all from a
functional perspective. We tried using the kernel's i2c support to
talk to it, but failed.

Normal i2c devices have a single 7-bit or 10-bit i2c address that they
respond to. Valid 7-bit addresses range from 0x03 to 0x77. Addresses
0x00 to 0x02 and 0x78 to 0x7F are special reserved addresses
(e.g. 0x00 is the "general call" address.) The Atmel device, on the
other hand, responds to ALL addresses. It's designed to be the only
device on a given i2c bus. A given i2c device address corresponds to
the memory address within the i2c device itself.

At least one reason why the linux core i2c stuff won't work for this
is that it prohibits access to reserved addresses like 0x00, which are
really valid addresses on the Atmel devices.

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>