platform/kernel/linux-rpi.git
16 years agoselinux: fix labeling of /proc/net inodes
Stephen Smalley [Fri, 25 Jan 2008 18:03:42 +0000 (13:03 -0500)]
selinux: fix labeling of /proc/net inodes

The proc net rewrite had a side effect on selinux, leading it to mislabel
the /proc/net inodes, thereby leading to incorrect denials.  Fix
security_genfs_sid to ignore extra leading / characters in the path supplied
by selinux_proc_get_sid since we now get "//net/..." rather than "/net/...".

Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
Signed-off-by: James Morris <jmorris@namei.org>
16 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
Linus Torvalds [Fri, 25 Jan 2008 22:41:24 +0000 (14:41 -0800)]
Merge branch 'for-linus' of git://git./linux/kernel/git/roland/infiniband

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: (81 commits)
  RDMA/cxgb3: Fix the T3A workaround checks
  IB/ipath: Remove unnecessary cast
  IPoIB: Constify seq_operations function pointer tables
  RDMA/cxgb3: Mark QP as privileged based on user capabilities
  RDMA/cxgb3: Fix page shift calculation in build_phys_page_list()
  RDMA/cxgb3: Flush the receive queue when closing
  IB/ipath: Trivial simplification of ipath_make_ud_req()
  IB/mthca: Update latest "native Arbel" firmware revision
  IPoIB: Remove redundant check of netif_queue_stopped() in xmit handler
  IB/ipath: Add mappings from HW register to PortInfo port physical state
  IB/ipath: Changes to support PIO bandwidth check on IBA7220
  IB/ipath: Minor cleanup of unused fields and chip-specific errors
  IB/ipath: New sysfs entries to control 7220 features
  IB/ipath: Add new chip-specific functions to older chips, consistent init
  IB/ipath: Remove unused MDIO interface code
  IB/ehca: Prevent RDMA-related connection failures on some eHCA2 hardware
  IB/ehca: Add "port connection autodetect mode"
  IB/ehca: Define array to store SMI/GSI QPs
  IB/ehca: Remove CQ-QP-link before destroying QP in error path of create_qp()
  IB/iser: Add change_queue_depth method
  ...

16 years agoRDMA/cxgb3: Fix the T3A workaround checks
Steve Wise [Thu, 24 Jan 2008 22:30:16 +0000 (16:30 -0600)]
RDMA/cxgb3: Fix the T3A workaround checks

Correctly work around T3A issues by checking "hwtype != T3A" instead of
"hwtype == T3B".  This will be needed for new hardware types.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Remove unnecessary cast
Jan Engelhardt [Tue, 22 Jan 2008 19:45:30 +0000 (20:45 +0100)]
IB/ipath: Remove unnecessary cast

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB: Constify seq_operations function pointer tables
Jan Engelhardt [Tue, 22 Jan 2008 19:45:30 +0000 (20:45 +0100)]
IPoIB: Constify seq_operations function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cxgb3: Mark QP as privileged based on user capabilities
Steve Wise [Mon, 21 Jan 2008 20:42:13 +0000 (14:42 -0600)]
RDMA/cxgb3: Mark QP as privileged based on user capabilities

This is needed to support zero-stag properly.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cxgb3: Fix page shift calculation in build_phys_page_list()
Steve Wise [Mon, 21 Jan 2008 20:42:11 +0000 (14:42 -0600)]
RDMA/cxgb3: Fix page shift calculation in build_phys_page_list()

The existing logic incorrectly maps this buffer list:

    0: addr 0x10001000, size 0x1000
    1: addr 0x10002000, size 0x1000

To this bogus page list:

    0: 0x10000000
    1: 0x10002000

The shift calculation must also take into account the address of the
first entry masked by the page_mask as well as the last address+size
rounded up to the next page size.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cxgb3: Flush the receive queue when closing
Steve Wise [Mon, 21 Jan 2008 20:42:09 +0000 (14:42 -0600)]
RDMA/cxgb3: Flush the receive queue when closing

- for kernel mode cqs, call event notification handler when flushing.
- flush QP when moving from RTS -> CLOSING.
- fix logic to identify a kernel mode qp.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Trivial simplification of ipath_make_ud_req()
Ralph Campbell [Fri, 25 Jan 2008 22:17:44 +0000 (14:17 -0800)]
IB/ipath: Trivial simplification of ipath_make_ud_req()

Move the increment of s_hdrwords into the existing if block that tests
if we're doing a send with immediate, to save one test of the opcode.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mthca: Update latest "native Arbel" firmware revision
Roland Dreier [Fri, 25 Jan 2008 22:17:44 +0000 (14:17 -0800)]
IB/mthca: Update latest "native Arbel" firmware revision

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB: Remove redundant check of netif_queue_stopped() in xmit handler
Krishna Kumar [Thu, 15 Nov 2007 05:05:37 +0000 (10:35 +0530)]
IPoIB: Remove redundant check of netif_queue_stopped() in xmit handler

qdisc_run() now tests for queue_stopped() before calling
__qdisc_run(), and the same check is done in every iteration of
__qdisc_run(), so another check is not required in the driver xmit.
This means that ipoib_start_xmit() no longer needs to test
netif_queue_stopped(); the test was added to fix earlier kernels,
where the networking stack did not guarantee that the xmit method of
an LLTX driver would not be called after the queue was stopped, but
current kernels do provide this guarantee.

To validate, I put a debug in the TX_BUSY path which never hit with 64
threads running overnight exercising this code a few 100 million
times.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Add mappings from HW register to PortInfo port physical state
Ralph Campbell [Thu, 10 Jan 2008 08:50:41 +0000 (00:50 -0800)]
IB/ipath: Add mappings from HW register to PortInfo port physical state

Add new mappings from port physical state (a HW register value) to the
IB SubnGet(PortInfo) port physical state.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Changes to support PIO bandwidth check on IBA7220
Dave Olson [Thu, 9 Aug 2007 10:11:38 +0000 (03:11 -0700)]
IB/ipath: Changes to support PIO bandwidth check on IBA7220

The IBA7220 uses a count-based triggering mechanism, and therefore
can't use the same bandwidth verification mechanism as older chips.

To support the 7220, allow enabling and disabling armlaunch errors on
application request.  Minor robustness improvements as well.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Minor cleanup of unused fields and chip-specific errors
Dave Olson [Tue, 8 Jan 2008 09:51:46 +0000 (01:51 -0800)]
IB/ipath: Minor cleanup of unused fields and chip-specific errors

Clean up some unused header fields, minor related cleanup.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: New sysfs entries to control 7220 features
Michael Albaugh [Tue, 8 Jan 2008 08:37:34 +0000 (00:37 -0800)]
IB/ipath: New sysfs entries to control 7220 features

IBA7220 includes many more configurable IB settings. Getting/setting
these is now grouped into a pair of chip specific functions accessed via
function pointers.  Provide sysfs access to these settings.

Signed-off-by: Michael Albaugh <michael.albaugh@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Add new chip-specific functions to older chips, consistent init
Dave Olson [Tue, 8 Jan 2008 10:36:46 +0000 (02:36 -0800)]
IB/ipath: Add new chip-specific functions to older chips, consistent init

This adds the new (sometimes empty) chip-specific functions to the older
chips, and makes the initialization and related functions consistent across
all 3 chips.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Remove unused MDIO interface code
Dave Olson [Wed, 9 Jan 2008 07:16:17 +0000 (23:16 -0800)]
IB/ipath: Remove unused MDIO interface code

This code has been unused for some time, but still had leftovers
from when it was used.

Signed-off-by: Dave Olson <dave.olson@qlogic.com
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Prevent RDMA-related connection failures on some eHCA2 hardware
Joachim Fenkes [Thu, 17 Jan 2008 14:07:24 +0000 (15:07 +0100)]
IB/ehca: Prevent RDMA-related connection failures on some eHCA2 hardware

Some HW revisions of eHCA2 may cause an RC connection to break if they
received RDMA Reads over that connection before.  This can be
prevented by assuring that, after the first RDMA Read, the QP receives
a new RDMA Read every few million link packets.

Include code into the driver that inserts an empty (size 0) RDMA Read
into the message stream every now and then if the consumer doesn't
post them frequently enough.

Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Add "port connection autodetect mode"
Hoang-Nam Nguyen [Thu, 17 Jan 2008 14:05:45 +0000 (15:05 +0100)]
IB/ehca: Add "port connection autodetect mode"

This patch enhances ehca with a capability to "autodetect" the ports
being connected physically. In order to utilize that function the
module option nr_ports must be set to -1 (default is 2 - two
ports). This feature is experimental and will made the default later.

More detail:

If the user connects only one port to the switch, current code requires
  1) port one to be connected and
  2) module option nr_ports=1 to be given.

If autodetect is enabled, ehca will not wait at creation of the GSI QP
for the respective port to become active. Since firmware does not
accept modify_qp() while the port is down at initialization, we need
to cache all calls to modify_qp() for the SMI/GSI QP and just return a
good return code.

When a port is activated and we get a PORT_ACTIVE event, we replay the
cached modify-qp() parms and re-trigger any posted recv WRs. Only then
do we forward the PORT_ACTIVE event to registered clients.

The result of this autodetect patch is that all ports will be
accessible by the users. Depending on their respective cabling only
those ports that are connected properly will become operable. If a
user tries to modify a regular QP of a non-connected port, modify_qp()
will fail. Furthermore, ibv_devinfo should show the port state
accordingly.

Note that this patch primarily improves the loading behaviour of
ehca. If the cable is removed while the driver is operating and
plugged in again, firmware will handle that properly by sending an
appropriate async event.

Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Define array to store SMI/GSI QPs
Hoang-Nam Nguyen [Thu, 17 Jan 2008 14:04:32 +0000 (15:04 +0100)]
IB/ehca: Define array to store SMI/GSI QPs

Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Remove CQ-QP-link before destroying QP in error path of create_qp()
Hoang-Nam Nguyen [Thu, 17 Jan 2008 14:03:55 +0000 (15:03 +0100)]
IB/ehca: Remove CQ-QP-link before destroying QP in error path of create_qp()

Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/iser: Add change_queue_depth method
Erez Zilber [Thu, 17 Jan 2008 09:53:17 +0000 (11:53 +0200)]
IB/iser: Add change_queue_depth method

Add a .change_queue_depth handler to the scsi_host_template in the
iSER driver.  iscsi_change_queue_depth was added to iscsi_tcp in order
to solve the problem of queue depth which was too high for some
targets.  It is also applicable for iSER.

Signed-off-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/iser: Print information about unhandled RDMA CM events
Erez Zilber [Thu, 17 Jan 2008 09:51:58 +0000 (11:51 +0200)]
IB/iser: Print information about unhandled RDMA CM events

Some RDMA CM events are not supported or not handled in iSER.
This patch adds some info (printk) for the user about them.

Signed-off-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/fmr_pool: ib_fmr_pool_flush() should flush all dirty FMRs
Olaf Kirch [Wed, 16 Jan 2008 17:37:16 +0000 (18:37 +0100)]
IB/fmr_pool: ib_fmr_pool_flush() should flush all dirty FMRs

When a FMR is released via ib_fmr_pool_unmap(), the FMR usually ends
up on the free_list rather than the dirty_list (because we allow a
certain number of remappings before actually requiring a flush).

However, ib_fmr_batch_release() only looks at dirty_list when flushing
out old mappings.  This means that when ib_fmr_pool_flush() is used to
force a flush of the FMR pool, some dirty FMRs that have not reached
their maximum remap count will not actually be flushed.

Fix this by flushing all FMRs that have been used at least once in
ib_fmr_batch_release().

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/fmr_pool: Flush serial numbers can get out of sync
Olaf Kirch [Wed, 16 Jan 2008 17:36:27 +0000 (18:36 +0100)]
IB/fmr_pool: Flush serial numbers can get out of sync

Normally, the serial numbers for flush requests and flushes executed
for an FMR pool should be in sync.

However, if the FMR pool flushes dirty FMRs because the
dirty_watermark was reached, we wake up the cleanup thread and let it
do its stuff.  As a side effect, the cleanup thread increments
pool->flush_ser, which leaves it one higher than pool->req_ser.  The
next time the user calls ib_flush_fmr_pool(), the cleanup thread will
be woken up, but ib_flush_fmr_pool() won't wait for the flush to
complete because flush_ser is already past req_ser.  This means the
FMRs that the user expects to be flushed may not have all been flushed
when the function returns.

Fix this by telling the cleanup thread to do work exclusively by
incrementing req_ser, and by moving the comparison of dirty_len and
dirty_watermark into ib_fmr_pool_unmap().

Signed-off-by: Olaf Kirch <olaf.kirch@oracle.com>
16 years agoIB/umad: Simplify and fix locking
Roland Dreier [Fri, 25 Jan 2008 22:15:42 +0000 (14:15 -0800)]
IB/umad: Simplify and fix locking

In addition to being overly complex, the locking in user_mad.c is
broken: there were multiple reports of deadlocks and lockdep warnings.
In particular it seems that a single thread may end up trying to take
the same rwsem for reading more than once, which is explicitly
forbidden in the comments in <linux/rwsem.h>.

To solve this, we change the locking to use plain mutexes instead of
rwsems.  There is one mutex per open file, which protects the contents
of the struct ib_umad_file, including the array of agents and list of
queued packets; and there is one mutex per struct ib_umad_port, which
protects the contents, including the list of open files.  We never
hold the file mutex across calls to functions like ib_unregister_mad_agent(),
which can call back into other ib_umad code to queue a packet, and we
always hold the port mutex as long as we need to make sure that a
device is not hot-unplugged from under us.

This even makes things nicer for users of the -rt patch, since we
remove calls to downgrade_write() (which is not implemented in -rt).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Fix some sparse warnings about shadowed symbols
Roland Dreier [Fri, 25 Jan 2008 22:15:42 +0000 (14:15 -0800)]
IB/ipath: Fix some sparse warnings about shadowed symbols

There are a few places in the ipath driver where a variable is
re-declared within a block where it is already in scope.  Most of these
extra declarations can simply be removed, since the variable from the
outer scope is used in a way so that it does not need to keep its
variable across the block with the re-declaration.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cxgb3: Endianness annotation for irs field
Roland Dreier [Fri, 25 Jan 2008 22:15:42 +0000 (14:15 -0800)]
RDMA/cxgb3: Endianness annotation for irs field

t3_rdma_init_wr.irs is a big-endian field, so declare it as __be32.
This fixes one sparse warning.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Use round_jiffies() for EQ polling timer
Anton Blanchard [Mon, 15 Oct 2007 05:49:07 +0000 (00:49 -0500)]
IB/ehca: Use round_jiffies() for EQ polling timer

Use round_jiffies() to align ehca's 1-second timer with other timers
and potentially save power by sleeping cores for longer.

Signed-off-by: Anton Blanchard <anton@samba.org>
Acked-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cma: Override default responder_resources with user value
Sean Hefty [Fri, 4 Jan 2008 18:47:12 +0000 (10:47 -0800)]
RDMA/cma: Override default responder_resources with user value

By default, the responder_resources parameter is set to that received
in a connection request.  The passive side may override this value
when accepting the connection.  Use the value provided by the passive
side when transitioning the QP to RTR state, rather than the value
given in the connect request.  Without this change, the RTR transition
may fail if the passive side supports fewer responder_resources than
that in the request.

For code consistency and to protect against QP destruction, restructure
overriding initiator_depth to match how responder_resources is set.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Drop support for the original QHT7040 board
Dave Olson [Mon, 7 Jan 2008 05:12:38 +0000 (21:12 -0800)]
IB/ipath: Drop support for the original QHT7040 board

The original QHT7040 had significant performance issues so there was an
additional check in the driver for a newer serial number.  Support for
the small quantities of that board shipped has been dropped, so this
patch removes the special checks to simplify the code.

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Add ipath_read_ireg() abstraction
Arthur Jones [Mon, 7 Jan 2008 05:12:38 +0000 (21:12 -0800)]
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>
16 years agoIB/ipath: Add flag and handling for chips with swapped register bug
Ralph Campbell [Mon, 7 Jan 2008 05:12:38 +0000 (21:12 -0800)]
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>
16 years agoIB/ipath: Port config has on-chip effects for 7220
Ralph Campbell [Mon, 7 Jan 2008 05:02:34 +0000 (21:02 -0800)]
IB/ipath: Port config has on-chip effects for 7220

The number of configured ports for the 7220 changes the number of eager
TIDs available per port, for all but port 0 (kernel port) which remains
constant, so add a field to give port0 count separate from the portdata
structure.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Allow more flexible user register alignments
Ralph Campbell [Mon, 7 Jan 2008 05:02:34 +0000 (21:02 -0800)]
IB/ipath: Allow more flexible user register alignments

User registers have different alignments on different chips (4KB on
older, 64KB on 7220).  Allow mapping the user registers on kernels with
page sizes up to 64K.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Clean up some comments
Dave Olson [Mon, 7 Jan 2008 05:02:34 +0000 (21:02 -0800)]
IB/ipath: Clean up some comments

Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Export hardware counters more consistently
Ralph Campbell [Mon, 7 Jan 2008 05:02:34 +0000 (21:02 -0800)]
IB/ipath: Export hardware counters more consistently

Various hardware counters are exported via the ipath file system (since
it is binary data).  The old file format was very dependent on the HW
offsets for these registers.  Newer HCA chips can have different
counters at different offsets.  This patch adds a level of indirection
to make the file format consistent across HCAs.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: MAD performance sampling registers support
Ralph Campbell [Mon, 7 Jan 2008 05:02:33 +0000 (21:02 -0800)]
IB/ipath: MAD performance sampling registers support

Add support for QLogic HCAs which have hardware performance sampling
registers for PortSamplesControl and PortSamplesResult MADs.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/srp: Add identifying information to log messages
David Dillow [Mon, 7 Jan 2008 23:23:41 +0000 (18:23 -0500)]
IB/srp: Add identifying information to log messages

When you have multiple targets, it gets really confusing when you try
to track down who did a reset when there is no identifying information
in the log message, especially when the same extension ID is mapped
through two different local IB ports.  So, add an identifier that can
be used to track back to which local IB port/remote target pair is the
one having problems.

Signed-off-by: David Dillow <dillowda@ornl.gov>
Acked-by: Pete Wyckoff <pw@osc.edu>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB/CM: Enable SRQ support on HCAs that support fewer than 16 SG entries
Pradeep Satyanarayana [Fri, 21 Dec 2007 21:08:23 +0000 (13:08 -0800)]
IPoIB/CM: Enable SRQ support on HCAs that support fewer than 16 SG entries

Some HCAs (such as ehca2) support SRQ, but only support fewer than 16 SG
entries for SRQs.  Currently IPoIB/CM implicitly assumes all HCAs will
support 16 SG entries for SRQs (to handle a 64K MTU with 4K pages). This
patch removes that restriction by limiting the maximum MTU in connected
mode to what the maximum number of SRQ SG entries allows.

This patch addresses <https://bugs.openfabrics.org/show_bug.cgi?id=728>

Signed-off-by: Pradeep Satyanarayana <pradeeps@linux.vnet.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/srp: Enable SG list chaining
David Dillow [Wed, 19 Dec 2007 22:09:15 +0000 (17:09 -0500)]
IB/srp: Enable SG list chaining

By default, the SCSI mid-layer seems to send down 512KB requests
(sg_tablesize = 256), with some requests occasionally combined. By
allowing the mid-layer to chain requests, we can easily grow to 1024KB
or larger -- I've tested 4096KB I/O requests with no problems.

I looked through the DMA paths on the hardware drivers to ensure they
could take advantage of the SG chaining, and it seems that every one
except ipath uses the system's DMA routines, which have been converted
to handle chaining.  ipath looks like it should be OK, but I have no
way to test it.

Signed-off-by: David Dillow <dillowda@ornl.gov>
[ Tested on ipath.  - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/srp: Respect target credit limit
David Dillow [Wed, 19 Dec 2007 22:08:43 +0000 (17:08 -0500)]
IB/srp: Respect target credit limit

The current SRP initiator will send requests even if it has no credits
available.  The results of sending extra requests are vendor specific,
but on some devices, overrunning credits will cost 85% of peak
performance -- e.g. 100 MB/s vs 720 MB/s.  Other devices may just drop
the requests.

This patch will tell the SCSI midlayer to queue requests if there are
fewer than two credits remaining, and will not issue a task management
request if there are no credits remaining.  The mid-layer will retry
the queued command once an outstanding command completes.

The patch also removes the unlikely() in __srp_get_tx_iu(), as it is
not at all unlikely to hit this limit under heavy load.

Signed-off-by: David Dillow <dillowda@ornl.gov>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB: improve IPv4/IPv6 to IB mcast mapping functions
Rolf Manderscheid [Mon, 10 Dec 2007 20:38:41 +0000 (13:38 -0700)]
IPoIB: improve IPv4/IPv6 to IB mcast mapping functions

An IPoIB subnet on an IB fabric that spans multiple IB subnets can't
use link-local scope in multicast GIDs.  The existing routines that
map IP/IPv6 multicast addresses into IB link-level addresses hard-code
the scope to link-local, and they also leave the partition key field
uninitialised.  This patch adds a parameter (the link-level broadcast
address) to the mapping routines, allowing them to initialise both the
scope and the P_Key appropriately, and fixes up the call sites.

The next step will be to add a way to configure the scope for an IPoIB
interface.

Signed-off-by: Rolf Manderscheid <rvm@obsidianresearch.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Changes for fields moving from devdata to portdata
Dave Olson [Thu, 6 Dec 2007 08:28:02 +0000 (00:28 -0800)]
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>
16 years agoIB/ipath: Generalize some xxx_SHIFT macros
Dave Olson [Fri, 21 Dec 2007 09:50:59 +0000 (01:50 -0800)]
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>
16 years agoIB/ipath: kreceive uses portdata rather than devdata
Ralph Campbell [Thu, 20 Dec 2007 10:43:23 +0000 (02:43 -0800)]
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>
16 years agoIB/ipath: Cleanup ipath_get_egrbuf()
Ralph Campbell [Sat, 22 Dec 2007 00:47:04 +0000 (16:47 -0800)]
IB/ipath: Cleanup ipath_get_egrbuf()

Remove an unused parameter and fix up the comment.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Fix RNR NAK handling
Ralph Campbell [Sat, 15 Dec 2007 03:22:34 +0000 (19:22 -0800)]
IB/ipath: Fix RNR NAK handling

This patch fixes a couple of minor problems with RNR NAK handling:
 - The insertion sort was causing extra delay when inserting ahead
   vs. behind an existing entry on the list.
 - A resend of a first packet of a message which is still not ready,
   needs another RNR NAK (i.e., it was suppressed when it shouldn't).
 - Also, the resend tasklet doesn't need to be woken up unless the
   ACK/NAK actually indicates progress has been made.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ehca: Forward event client-reregister-required to registered clients
Hoang-Nam Nguyen [Thu, 20 Dec 2007 14:06:33 +0000 (15:06 +0100)]
IB/ehca: Forward event client-reregister-required to registered clients

This patch allows ehca to forward event client-reregister-required to
registered clients.  One such event is generated by a switch eg. after
its reboot.

Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mlx4: Micro-optimize mlx4_ib_poll_one()
Roland Dreier [Fri, 25 Jan 2008 22:15:34 +0000 (14:15 -0800)]
IB/mlx4: Micro-optimize mlx4_ib_poll_one()

Rather than byte-swapping cqe->g_mlpath_rqpn each time we extract a
field from it, byte-swap it once into a temporary variable.  This
results in smaller, better code -- eg, on 32-bit x86:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-5 (-5)
function                                     old     new   delta
mlx4_ib_poll_cq                             1188    1183      -5

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mthca: Remove MSI support as scheduled
Adrian Bunk [Tue, 1 Jan 2008 13:47:10 +0000 (15:47 +0200)]
IB/mthca: Remove MSI support as scheduled

Remove MSI support from the mthca driver, as scheduled.  There is no
reason to use MSI instead of MSI-X, since MSI-X performs better.  No
one has spoken up since MSI support was deprecated in commit f6be6fbe
("IB/mthca: Schedule MSI support for removal"), so apparently the MSI
support is unused.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/iser: Typo fix (s/destory/destroy/)
Oliver Pinter [Fri, 25 Jan 2008 22:15:32 +0000 (14:15 -0800)]
IB/iser: Typo fix (s/destory/destroy/)

Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/iser: update URLs of iSER docs
Erez Zilber [Fri, 25 Jan 2008 22:15:32 +0000 (14:15 -0800)]
IB/iser: update URLs of iSER docs

Signed-off-by: Erez Zilber <erezz@voltaire.com>
16 years agoRDMA/cma: add support for rdma_migrate_id()
Sean Hefty [Wed, 14 Nov 2007 08:29:50 +0000 (00:29 -0800)]
RDMA/cma: add support for rdma_migrate_id()

This is based on user feedback from Doug Ledford at RedHat:

Events that occur on an rdma_cm_id are reported to userspace through an
event channel.  Connection request events are reported on the event
channel associated with the listen.  When the connection is accepted, a
new rdma_cm_id is created and automatically uses the listen event
channel.  This is suboptimal where the user only wants listen events on
that channel.

Additionally, it may be desirable to have events related to connection
establishment use a different event channel than those related to
already established connections.

Allow the user to migrate an rdma_cm_id between event channels. All
pending events associated with the rdma_cm_id are moved to the new event
channel.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cma: Reenable device removal on passive side
Vladimir Sokolovsky [Sat, 8 Dec 2007 04:32:03 +0000 (20:32 -0800)]
RDMA/cma: Reenable device removal on passive side

Enable conn_id remove on the passive side after connection
establishment.  This corrects an issue where the IB driver can't be
unloaded after running applications over RDS.  The 'dev_remove' counter
does not reach 0 for established connections on the passive side.

This problem is limited to device removal, and only occurs on the
passive side if there are established connections.

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.co.il>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mad: Fix incorrect access to items on local_list
Sean Hefty [Sat, 1 Dec 2007 01:30:18 +0000 (17:30 -0800)]
IB/mad: Fix incorrect access to items on local_list

In cancel_mads(), MADs are moved from the wait_list and local_list
to a cancel_list for processing.  However, the structures on these two
lists are not the same.  The wait_list references struct
ib_mad_send_wr_private, but local_list references struct
ib_mad_local_private.  Cancel_mads() treats all items moved to the
cancel_list as struct ib_mad_send_wr_private.  This leads to a system
crash when requests are moved from the local_list to the cancel_list.

Fix this by leaving local_list alone.  All requests on the local_list
have completed are just awaiting processing by a queued worker thread.

Bug (crash) reported by Dotan Barak <dotanb@dev.mellanox.co.il>.
Problem with local_list access reported by Robert Reynolds
<rreynolds@opengridcomputing.com>.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/cm: Add basic performance counters
Sean Hefty [Tue, 17 Jul 2007 04:49:35 +0000 (21:49 -0700)]
IB/cm: Add basic performance counters

Add performance/debug counters to track sent/received messages, retries,
and duplicates.  Counters are tracked per CM message type, per port.

The counters are always enabled, so intrusive state tracking is not done.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mad: Report number of times a mad was retried
Sean Hefty [Tue, 27 Nov 2007 08:11:04 +0000 (00:11 -0800)]
IB/mad: Report number of times a mad was retried

To allow ULPs to tune timeout values and capture retry statistics,
report the number of times that a mad send operation was retried.

For RMPP mads, report the total number of times that the any portion
(send window) of the send operation was retried.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/multicast: Report errors on multicast groups if P_key changes
Sean Hefty [Tue, 23 Oct 2007 04:52:54 +0000 (21:52 -0700)]
IB/multicast: Report errors on multicast groups if P_key changes

P_key changes can invalidate multicast groups.  Report errors on all
multicast groups affected by a pkey change.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB: Spelling fixes in comments
Joe Perches [Mon, 17 Dec 2007 19:30:36 +0000 (11:30 -0800)]
IB: Spelling fixes in comments

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agomlx4_core: Fix max_eqs masking in QUERY_DEV_CAP
Jack Morgenstein [Mon, 10 Dec 2007 03:25:23 +0000 (05:25 +0200)]
mlx4_core: Fix max_eqs masking in QUERY_DEV_CAP

log_max_eqs is a 4-bit field, not a 3-bit field in the response to the
QUERY_DEV_CAP FW command, so we should mask with 0xf instead of 0x7
when reading it.

Found by Yossi Leybovitch of Mellanox.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Convert from .nopage to .fault
Nick Piggin [Thu, 13 Dec 2007 23:58:57 +0000 (15:58 -0800)]
IB/ipath: Convert from .nopage to .fault

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Add the work completion error code to the QP error debug output
Ralph Campbell [Sat, 3 Nov 2007 00:40:36 +0000 (17:40 -0700)]
IB/ipath: Add the work completion error code to the QP error debug output

Add the work completion error code to the QP error debug output.
This makes it easier to determine the cause of the error.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Better comment for rmb() in ipath_intr()
Arthur Jones [Thu, 18 Oct 2007 01:18:29 +0000 (18:18 -0700)]
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>
16 years agoIB/ipath: Fix comments for ipath_create_srq()
Ralph Campbell [Tue, 27 Nov 2007 07:44:15 +0000 (23:44 -0800)]
IB/ipath: Fix comments for ipath_create_srq()

During a code review, someone noticed the comments didn't match the code.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Fix error returned from ib_resize_cq if new size smaller than # entries
Ralph Campbell [Fri, 9 Nov 2007 03:53:01 +0000 (19:53 -0800)]
IB/ipath: Fix error returned from ib_resize_cq if new size smaller than # entries

The gen2_basic tests check for the errno value when a CQ is resized
smaller than the number of outstanding completions queue on the CQ.
This patch changes ib_ipath to return EINVAL which is what ib_mthca
returns and what gen2_basic expects.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Fix sendctrl locking
John Gregor [Wed, 5 Sep 2007 08:57:14 +0000 (01:57 -0700)]
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>
16 years agoIB/ipath: Remove dead code for user process waiting for send buffer
Ralph Campbell [Sat, 13 Oct 2007 03:48:06 +0000 (20:48 -0700)]
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>
16 years agoRDMA/cxgb3: Support version 5.0 firmware
Steve Wise [Mon, 26 Nov 2007 17:28:46 +0000 (11:28 -0600)]
RDMA/cxgb3: Support version 5.0 firmware

The 5.0 firmware now supports translating sgls in recv work requests,
so remove the host driver logic currently doing the translation.

Note: this change requires 5.0 firmware.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/cxgb3: Hold rtnl_lock() around ethtool get_drvinfo call
Steve Wise [Mon, 26 Nov 2007 17:28:44 +0000 (11:28 -0600)]
RDMA/cxgb3: Hold rtnl_lock() around ethtool get_drvinfo call

Currently the call into cxgb3 to get the driver info is not serialized.
The iw_cxgb3 module needs to hold the rtnl_lock around the ethtool ops
call like dev_ioctl() does.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agodrivers/infiniband: Add missing "space"
Joe Perches [Tue, 20 Nov 2007 01:48:11 +0000 (17:48 -0800)]
drivers/infiniband: Add missing "space"

Add missing spaces in the middle of format strings.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Convert ipath_eep_sem semaphore to a mutex
Matthias Kaehlcke [Thu, 15 Nov 2007 23:23:25 +0000 (15:23 -0800)]
IB/ipath: Convert ipath_eep_sem semaphore to a mutex

Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Acked-by: Michael Albaugh <Michael.Albaugh@qlogic.com>
Tested-by: Arthur Jones <arthur.jones@qlogic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mad: Enable loopback of DR SMP responses from userspace
Steve Welch [Tue, 23 Oct 2007 22:06:10 +0000 (15:06 -0700)]
IB/mad: Enable loopback of DR SMP responses from userspace

The local loopback of an outgoing DR SMP response is limited to those
that originate at the driver specific SMA implementation during the
driver specific process_mad() function.  This patch enables a
returning DR SMP originating in userspace (or elsewhere) to be
delivered to the local managment stack.  In this specific case the
driver process_mad() function does not consume or process the MAD, so
a reponse mad has not be created and the original MAD must manually be
copied to the MAD buffer that is to be handed off to the local agent.

Signed-off-by: Steve Welch <swelch@systemfabricworks.com>
Acked-by: Hal Rosenstock <hal@xsigo.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Enable loopback of DR SMP responses from userspace
Ralph Campbell [Tue, 23 Oct 2007 22:07:41 +0000 (15:07 -0700)]
IB/ipath: Enable loopback of DR SMP responses from userspace

This patch is in response to reviewing a patch to the core MAD
processing which fixes loopback of directed route packets to/from user
level MAD agents.  This change enables the core code to work for
ib_ipath by fixing the return code from the ipath process_mad method.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/mad: Remove redundant NULL pointer check in ib_mad_recv_done_handler()
Ralph Campbell [Tue, 23 Oct 2007 22:04:15 +0000 (15:04 -0700)]
IB/mad: Remove redundant NULL pointer check in ib_mad_recv_done_handler()

In ib_mad_recv_done_handler(), the response pointer is checked for
NULL after allocating it.  It is then checked again in the local
process_mad() path but there is no possibility of it changing in
between.

Signed-off-by: Ralph Campbell <ralph.campbell@qlogic.com>
Acked-by: Hal Rosenstock <hal@xsigo.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoRDMA/iwcm: Set initiator depth and responder resources to device max values
Steve Wise [Mon, 29 Oct 2007 16:34:05 +0000 (11:34 -0500)]
RDMA/iwcm: Set initiator depth and responder resources to device max values

Set the initiator depth and responder resources to the device max
values for new connect request events in the iWARP connection manager.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Improve interrupt handler cache footprint
Dave Olson [Wed, 10 Oct 2007 12:10:35 +0000 (05:10 -0700)]
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>
16 years agoIPoIB/cm: Add connected mode support for devices without SRQs
Pradeep Satyanarayana [Fri, 25 Jan 2008 22:15:24 +0000 (14:15 -0800)]
IPoIB/cm: Add connected mode support for devices without SRQs

Some IB adapters (notably IBM's eHCA) do not implement SRQs (shared
receive queues).  The current IPoIB connected mode support only works
on devices that support SRQs.

Fix this by adding support for using the receive queue of each
connected mode receive QP.  The disadvantage of this compared to using
an SRQ is that it means a full queue of receives must be posted for
each remote connected mode peer, which means that total memory usage
is potentially much higher than when using SRQs.  To manage this, add
a new module parameter "max_nonsrq_conn_qp" that limits the number of
connections allowed per interface.

The rest of the changes are fairly straightforward: we use a table of
struct ipoib_cm_rx to hold all the active connections, and put the
table index of the connection in the high bits of receive WR IDs.
This is needed because we cannot rely on the struct ib_wc.qp field for
non-SRQ receive completions.  Most of the rest of the changes just
test whether or not an SRQ is available, and post receives or find
received packets in the right place depending on the answer.

Cleaning up dead connections actually becomes simpler, because we do
not have to do the "last WQE reached" dance that is required to
destroy QPs attached to an SRQ.  We just move the QP to the error
state and wait for all pending receives to be flushed.

Signed-off-by: Pradeep Satyanarayana <pradeeps@linux.vnet.ibm.com>
[ Completely rewritten and split up, based on Pradeep's work.  Several
  bugs fixed and no doubt several bugs introduced.  - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB/cm: Factor out ipoib_cm_free_rx_reap_list()
Roland Dreier [Fri, 25 Jan 2008 22:15:24 +0000 (14:15 -0800)]
IPoIB/cm: Factor out ipoib_cm_free_rx_reap_list()

Factor out the code for going through the rx_reap list of struct
ipoib_cm_rx and freeing each one.  This consolidates the code
duplicated between ipoib_cm_dev_stop() and ipoib_cm_rx_reap() and
reduces the risk of error when adding additional accounting.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB/cm: Factor out ipoib_cm_create_srq()
Roland Dreier [Fri, 25 Jan 2008 22:15:24 +0000 (14:15 -0800)]
IPoIB/cm: Factor out ipoib_cm_create_srq()

Factor out the code to create an SRQ and allocate the receive ring in
ipoib_cm_dev_init() into a new function ipoib_cm_create_srq().  This
will make the code neater when support for devices that don't implement
SRQs is added.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB/cm: Factor out ipoib_cm_free_rx_ring()
Roland Dreier [Fri, 25 Jan 2008 22:15:24 +0000 (14:15 -0800)]
IPoIB/cm: Factor out ipoib_cm_free_rx_ring()

Factor out the code to unmap/free skbs and free the receive ring in
ipoib_cm_dev_cleanup() into a new function ipoib_cm_free_rx_ring().
This function will be called from a couple of other places when
support for devices that don't implement SRQs is added.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIPoIB: Trivial formatting cleanups
Roland Dreier [Wed, 24 Oct 2007 02:57:54 +0000 (19:57 -0700)]
IPoIB: Trivial formatting cleanups

Fix whitespace blunders, convert "foo* bar" to "foo *bar", etc.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoIB/ipath: Fix crash on unload introduced by sysfs changes
Roland Dreier [Fri, 25 Jan 2008 22:15:21 +0000 (14:15 -0800)]
IB/ipath: Fix crash on unload introduced by sysfs changes

Commit 23b9c1ab ("Infiniband: make ipath driver use default driver
groups.") introduced a bug in the ipath driver where
ipath_device_create_group() fell through into the error path, even on
success, which meant that the sysfs groups it created would always get
removed right away.  This made ipath_device_remove_group() hit the
BUG_ON() in sysfs_remove_group() when it tried to remove those groups a
second time.

Correct the return path so that the groups stick around until they are
supposed to be cleaned up.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
Linus Torvalds [Fri, 25 Jan 2008 21:59:51 +0000 (13:59 -0800)]
Merge git://git./linux/kernel/git/mchehab/v4l-dvb

* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (509 commits)
  V4L/DVB (7078): radio: fix sf16fmi section mismatch
  V4L/DVB (7077): bt878: remove handcrafted PCI subsystem ID check
  V4L/DVB (7075): Make a local function static
  V4L/DVB (7074): DiB7000P: correct tuning problem for 7MHz channel
  V4L/DVB (7073): DiB7070: Reception quality improved
  V4L/DVB (7072): sets the MT2060 IF1 frequency according to EEPROM
  V4L/DVB (7071): DiB0700: Start streaming the right way
  V4L/DVB (7070): Fix some tuning problems
  V4L/DVB (7069):  Support for myTV.t
  V4L/DVB (7068): Add support for WinTV Nova-T-CE driver
  V4L/DVB (7067): fix autoserach in the Hauppauge NOVA-T 500
  V4L/DVB (7066):  ASUS My Cinema U3000 Mini DVBT Tuner
  V4L/DVB (7065): Artec T14BR patches
  V4L/DVB (7063): xc5000: Fix OOPS caused by missing firmware
  V4L/DVB (7062): radio-si570x: Some fixes and new USB ID addition
  V4L/DVB (7061): radio-si470x: Some cleanups
  V4L/DVB (7060): em28xx: remove has_tuner
  V4L/DVB (7059): cx88: Ensure the tuner is reset correctly
  V4L/DVB (7058): IR corrections for the Pinnacle 800i
  V4L/DVB (7056): tuner: suppress obsolete tuner i2c address warning for XC5000 tuners
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
Linus Torvalds [Fri, 25 Jan 2008 21:57:26 +0000 (13:57 -0800)]
Merge git://git./linux/kernel/git/bart/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (67 commits)
  ide: remove redundant DMA blacklist check from __ide_dma_on()
  ide: cleanup ide_set_dma()
  ide: remove redundant ->ide_dma_on call from set_using_dma()
  sc1200: move DMA timings to timing tables
  ide: add IDE_HFLAG_ABUSE_SET_DMA_MODE host flag
  sis5513: factor out UDMA programming code
  pdc202xx_new: move PIO programming code to pdcnew_set_pio_mode()
  ide: make 'extra' field in struct ide_port_info u8
  ide: kill duplicate code in ide_dump_{ata,atapi}_status()
  ide-disk: use ide_get_lba_addr()
  ide: printk fix
  ide: add ide_tf_read() helper
  ide: fix registers loading order in ide_dump_ata_status()
  ide-disk: use do_rw_taskfile() (take 2)
  ide-disk: add ide_tf_set_cmd() helper
  ide-disk: extend timeout for PIO-in commands
  ide: remove 'handler' field from ide_task_t (take 2)
  ide: use ->data_phase to set ->handler in do_rw_taskfile()
  ide: convert do_rw_taskfile() to use ->data_phase
  ide: merge flagged_taskfile() into do_rw_taskfile()
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
Linus Torvalds [Fri, 25 Jan 2008 21:42:32 +0000 (13:42 -0800)]
Merge git://git./linux/kernel/git/mingo/linux-2.6-sched

* git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched: (96 commits)
  sched: keep total / count stats in addition to the max for
  sched, futex: detach sched.h and futex.h
  sched: fix: don't take a mutex from interrupt context
  sched: print backtrace of running tasks too
  printk: use ktime_get()
  softlockup: fix signedness
  sched: latencytop support
  sched: fix goto retry in pick_next_task_rt()
  timers: don't #error on higher HZ values
  sched: monitor clock underflows in /proc/sched_debug
  sched: fix rq->clock warps on frequency changes
  sched: fix, always create kernel threads with normal priority
  debug: clean up kernel/profile.c
  sched: remove the !PREEMPT_BKL code
  sched: make PREEMPT_BKL the default
  debug: track and print last unloaded module in the oops trace
  debug: show being-loaded/being-unloaded indicator for modules
  sched: rt-watchdog: fix .rlim_max = RLIM_INFINITY
  sched: rt-group: reduce rescheduling
  hrtimer: unlock hrtimer_wakeup
  ...

16 years agoide: remove redundant DMA blacklist check from __ide_dma_on()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:19 +0000 (22:17 +0100)]
ide: remove redundant DMA blacklist check from __ide_dma_on()

->ide_dma_on method is called only after successful ide_dma_check() call
(ide_dma_check()->ide_tune_dma() checks DMA blacklist) or if drive->using_dma
has been previously enabled for a given device (->ide_dma_on is the only place
which sets drive->using_dma to '1').

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: cleanup ide_set_dma()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:19 +0000 (22:17 +0100)]
ide: cleanup ide_set_dma()

* ->dma_off_quietly is always called before ide_set_dma()
  so the call can be moved inside ide_set_dma().

* ide_dma_check() doesn't touch hardware so ->dma_off_quietly
  call for 'rc == -1' case is redundant, remove it.

* '0' and '-1' are the only values returned by ide_dma_check()
  so remove dead code for other cases.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove redundant ->ide_dma_on call from set_using_dma()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:19 +0000 (22:17 +0100)]
ide: remove redundant ->ide_dma_on call from set_using_dma()

ide_set_dma() calls ->ide_dma_on method itself and returns zero
only if ->ide_dma_on call succeeded.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosc1200: move DMA timings to timing tables
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:18 +0000 (22:17 +0100)]
sc1200: move DMA timings to timing tables

Based on pata_sc1200.c.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add IDE_HFLAG_ABUSE_SET_DMA_MODE host flag
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:18 +0000 (22:17 +0100)]
ide: add IDE_HFLAG_ABUSE_SET_DMA_MODE host flag

* Add IDE_HFLAG_ABUSE_SET_DMA_MODE host flag and use it to decide
  what to do with transfer modes < XFER_PIO_0 in ide_set_xfer_rate().

* Set IDE_HFLAG_ABUSE_SET_DMA_MODE in host drivers that need it
  (aec62xx, amd74xx, cs5520, cs5535, hpt34x, hpt366, pdc202xx_old,
  serverworks, tc86c001 and via82cxxx) and cleanup ->set_dma_mode
  methods in host drivers that don't (IDE core code guarantees that
  ->set_dma_mode will be called only for modes which are present
  in SWDMA/MWDMA/UDMA masks).

While at it:

* Add IDE_HFLAGS_HPT34X/HPT3XX/PDC202XX/SVWKS define in
  hpt34x/hpt366/pdc202xx_old/serverworks host driver.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agosis5513: factor out UDMA programming code
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:18 +0000 (22:17 +0100)]
sis5513: factor out UDMA programming code

* Factor out UDMA programming code from sis_set_dma_mode() to per
  chipset family helpers: sis_{ata33,ata133}_program_udma_timings().

* Add sis_program_udma_timings() helper.

* Remove unneeded casts to 'unsigned long'.

* Minor cleanups.

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agopdc202xx_new: move PIO programming code to pdcnew_set_pio_mode()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:18 +0000 (22:17 +0100)]
pdc202xx_new: move PIO programming code to pdcnew_set_pio_mode()

* Move PIO programming code from pdcnew_set_mode() to pdcnew_set_pio_mode().

* Rename pdcnew_set_mode() to pdcnew_set_dma_mode().

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: make 'extra' field in struct ide_port_info u8
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide: make 'extra' field in struct ide_port_info u8

The maximum value used currently for 'extra' field in struct ide_port_info
is 240.

Make 'extra' u8 so it packs nicely together with enablebits[] and 'chipset'
fields (ide_pci_enablebit_t is 3 bytes and hwif_chipset_t is 1 byte).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: kill duplicate code in ide_dump_{ata,atapi}_status()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide: kill duplicate code in ide_dump_{ata,atapi}_status()

* Move the common code from ide_dump_{ata,atapi}_status() to
  ide_dump_status().

* ide_dump_{ata,atapi}_status() -> ide_dump_{ata,atapi}_error().

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-disk: use ide_get_lba_addr()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide-disk: use ide_get_lba_addr()

* Export ide_get_lba_addr().

* Convert idedisk_{read_native,set}_max_address() to use ide_get_lba_addr().

* Remove incorrect comment from idedisk_read_native_max_address()
  (noticed by Sergei).

There should be no functionality changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: printk fix
Andrew Morton [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide: printk fix

power4:

drivers/ide/ide-lib.c: In function `ide_dump_sector':
drivers/ide/ide-lib.c:516: warning: long long unsigned int format, u64 arg (arg 2)

We don't know what type is used to implement u64 hence it must always be cast
when printed.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_tf_read() helper
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide: add ide_tf_read() helper

* Factor out code reading taskfile registers from ide_end_drive_cmd()
  to the new ide_tf_read() helper.

* Add IDE_TFLAG_IN_* taskfile flags to indicate the need to load
  particular IDE taskfile register in ide_tf_read().

* Update ide_end_drive_cmd() to set respective IDE_TFLAG_IN_* taksfile flags.

* Add ide_get_lba_addr() for getting LBA sector address from taskfile struct.

* Factor out code getting sector address from ide_dump_ata_status()
  to the new ide_dump_sector() function.

* Convert ide_dump_sector() to use ide_tf_read() and ide_get_lba_addr().

* Remove no longer needed ide_read_24().

The only change in functionality caused by this patch is that
ide_dump_ata_status() no longer prints "high"/"low" parts of LBA48
sector address (of course LBA48 sector address is still printed).

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix registers loading order in ide_dump_ata_status()
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:17 +0000 (22:17 +0100)]
ide: fix registers loading order in ide_dump_ata_status()

Fix registers loading order in ide_dump_ata_status()/ide_read_24().

Load registers in this order:
* IDE_SECTOR_REG
* IDE_LCYL_REG
* IDE_HCYL_REG
* IDE_SELECT_REG

It shouldn't affect anything (just a usual paranoia to separate changes
which change the way in which hardware is accessed from code cleanups).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-disk: use do_rw_taskfile() (take 2)
Bartlomiej Zolnierkiewicz [Fri, 25 Jan 2008 21:17:16 +0000 (22:17 +0100)]
ide-disk: use do_rw_taskfile() (take 2)

* Add IDE_TFLAG_DMA_PIO_FALLBACK taskfile flag to indicate the need
  to skip loading taskfile registers in do_rw_taskfile().

* Export do_rw_taskfile().

* Convert __ide_do_rw_disk() to use do_rw_taskfile().

* Unexport ide_tf_load().

* Unexport {pre_task_out,task_in}_intr() and make it static.

* Remove incorrect comment about do_rw_taskfile() from <linux/ide.h>.

There should be no functionality changes caused by this patch.

v2:
* Add missing blk_fs_request() check to task_dma_ok() (for VDMA).

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>