Commit graph

512 commits

Author SHA1 Message Date
Ishai Rabinovitz 59f174faff IB/mthca: Fix memory leak of multicast group structures
Convert "/ (1 << lg)" to ">> lg" for a slight code size reduction.

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-24 (-24)
function                                     old     new   delta
mthca_map_cmd                                613     589     -24

Signed-off-by: Ishai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-12 15:24:51 -08:00
Eli Cohen 988bd50300 IPoIB: Fix memory leak of multicast group structures
The current handling of multicast groups in IPoIB ends up never
freeing send-only multicast groups.  It turns out the logic was much
more complicated than it needed to be; we can fix this bug and
completely kill ipoib_mcast_dev_down() at the same time.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-12 14:32:20 -08:00
Michael S. Tsirkin 78bfe0b5b6 IPoIB: Take dev->xmit_lock around mc_list accesses
dev->mc_list accesses must be protected by dev->xmit_lock.
Found by Eli Cohen <eli@mellanox.co.il>.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-11 11:47:34 -08:00
Eli Cohen 97460df37e IPoIB: Fix address handle refcounting for multicast groups
Multiple ipoib_neigh structures on mcast->neigh_list may point to the
same ah.  This means that ipoib_mcast_free() can't just make a list of
ah structs to free, since this might end up trying to add the same ah
to the list more than once.  Handle this in ipoib_multicast.c in the
same way as it is handled in ipoib_main.c for struct ipoib_path.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-10 07:43:02 -08:00
Eli Cohen 70b4c8cdc1 IPoIB: Fix error path in ipoib_mcast_dev_flush()
Don't leak memory on allocation failure for broadcast mcast group.
Also, print a warning to match handling for other mcast groups.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-10 07:42:14 -08:00
Sean Hefty cf311cd49a IB: Add node_guid to struct ib_device
Add a node_guid field to struct ib_device.  It is the responsibility
of the low-level driver to initialize this field before registering a
device with the midlayer.  Convert everyone to looking at this field
instead of calling ib_query_device() when all they want is the node
GUID, and remove the node_guid field from struct ib_device_attr.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-10 07:39:34 -08:00
Roland Dreier 87635b71b5 IB/mthca: Factor common MAD initialization code
Factor out common code for initializing MAD packets, which is shared
by many query routines in mthca_provider.c, into init_query_mad().

add/remove: 1/0 grow/shrink: 0/4 up/down: 16/-44 (-28)
function                                     old     new   delta
init_query_mad                                 -      16     +16
mthca_query_port                             521     518      -3
mthca_query_pkey                             301     294      -7
mthca_query_device                           648     641      -7
mthca_query_gid                              453     426     -27

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-09 15:29:53 -08:00
Roland Dreier 105e50a5e8 IB/mthca: kzalloc conversions
Convert kmalloc()/memset(,0,) pairs to kzalloc().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-09 15:21:21 -08:00
Michael S. Tsirkin 92898522e3 IB/mthca: prevent event queue overrun
I am seeing EQ overruns in SDP stress tests: if the CQ completion
handler arms a CQ, this could generate more EQEs, so that EQ will
never get empty and consumer index will never get updated.

This is similiar to what we have with command interface:
		/*
		 * cmd_event() may add more commands.
		 * The card will think the queue has overflowed if
		 * we don't tell it we've been processing events.
		 */
However, for completion events, we *don't* want to update the consumer
index on each event. So, perform EQ doorbell coalescing: allocate EQs
with some spare EQEs, and update once we run out of them.

The value 0x80 was selected to avoid any performance impact.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-09 14:04:40 -08:00
Michael S. Tsirkin 6627fa662e IB/mthca: fix page shift calculation in mthca_reg_phys_mr()
For all pages except possibly the last one, the byte beyond the buffer
end must be page aligned.  Therefore, when computing the page shift to
use, OR the end addresses of the buffers as well as the start
addresses into the mask we check.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-09 13:50:57 -08:00
Linus Torvalds 5367f2d67c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband 2006-01-08 20:18:44 -08:00
Tim Schmielau de25968cc8 [PATCH] fix more missing includes
Include fixes for 2.6.14-git11.  Should allow to remove sched.h from
module.h on i386, x86_64, arm, ia64, ppc, ppc64, and s390.  Probably more
to come since I haven't yet checked the other archs.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-08 20:13:45 -08:00
Ralph Campbell 4f8448dfe8 IB: Set GIDs correctly in ib_create_ah_from_wc()
ib_create_ah_from_wc() doesn't create the correct return address (AH)
when there is a GRH present (source & dest GIDs need to be swapped).

Signed-off-by: Ralph Campbell <ralphc@pathscale.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 16:43:47 -08:00
Jack Morgenstein ac4e7b3557 IB/uverbs: Release event file reference on ib_uverbs_create_cq() error
ib_uverbs_create_cq() should release the completion channel event file
if an error occurs after it looks it up.  Also, if userspace asks for
a completion channel and we don't find it, an error should be returned
instead of silently creating a CQ without a completion channel.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 16:43:14 -08:00
Ralph Campbell ea5d4a6ad2 IB/uverbs: set ah_flags when creating address handle
AH attribute's ah_flags need to be set according to the is_global flag
passed in from userspace.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 16:24:45 -08:00
Jack Morgenstein b4ca1a3f8c IB/uverbs: Fix reference counting on error paths
If an operation fails after incrementing an object's reference count,
then it should decrement the reference count on the error path.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 16:21:19 -08:00
Dotan Barak 4de144bf72 IB/mthca: Add support for automatic path migration (APM)
Add code to modify QP operation to handle setting alternate paths for
connected QPs.

Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 13:23:58 -08:00
Michael S. Tsirkin 0f8e8f9607 IB/mthca: Fill in vendor_err field in completion with error
Fill vendor_err field in completion with error.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 13:13:32 -08:00
Jack Morgenstein 5ceb74557c IB/mthca: multiple fixes for multicast group handling
Multicast group management fixes:
. Fix leak of mailbox memory in error handling on multicast group operations.
. Free AMGM indices at detach and in attach error handling.
. Fix amount to shift for aligning next_gid_index in mailbox: it
  starts at bit 6, not bit 5.
. Allocate AMGM index after end of MGM table, in the range num_mgms to
  multicast table size - 1. Add some BUG_ON checks to catch cases
  where the index falls in the MGM hash area.
. Initialize the list of QPs in a newly-allocated group from AMGM to 0
  This is necessary since when a group is moved from AMGM to MGM (in the
  case where the MGM entry has been emptied of QPs), the AMGM entry is
  not reset to 0 (and we don't want an extra command to do that).

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 13:11:07 -08:00
Jack Morgenstein 0d3b525fff IB/mthca: fix for RTR-to-RTS transition in modify QP
PKEY_INDEX is not a legal parameter in the RTR->RTS transition.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 13:03:43 -08:00
Jack Morgenstein 0364ffc3e8 IB/mthca: fix for SQEr-to-RTS transition in modify QP
Fixes to SQEr->RTS transition in modify_qp:
1. The flag IB_QP_ACCESS_FLAGS is optional for UC qps
2. The SQEr state is not supported for RC qps

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 13:01:27 -08:00
Jack Morgenstein 5b3bc7a681 IB/mthca: max_inline_data handling tweaks
Fix a case where copying max_inline_data from a successful create_qp
capabilities output to create_qp input could cause EINVAL error:

mthca_set_qp_size must check max_inline_data directly against
max_desc_sz; checking qp->sq.max_gs is wrong since max_inline_data
depends on the qp type and does not involve max_sg.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-06 12:57:30 -08:00
Michael S. Tsirkin 466200562c IB/mthca: create_eq with size not a power of 2
Fix mthca_create_eq for when the EQ size is not a power of 2.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-05 16:17:38 -08:00
Jack Morgenstein 38d1e79347 IB/mthca: check port validity in modify_qp
Modify_qp should check that the physical port number provided
is a legal value.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-05 16:13:46 -08:00
Jack Morgenstein aa2f936779 IB/mthca: check return value in mthca_dev_lim call
Check error return on call to mthca_dev_lim for Tavor
(as is done for memfree).

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-05 16:12:01 -08:00
Linus Torvalds db9edfd7e3 Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
Trivial manual merge fixup for usb_find_interface clashes.
2006-01-04 18:44:12 -08:00
Kay Sievers 312c004d36 [PATCH] driver core: replace "hotplug" by "uevent"
Leave the overloaded "hotplug" word to susbsystems which are handling
real devices. The driver core does not "plug" anything, it just exports
the state to userspace and generates events.

Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-01-04 16:18:08 -08:00
Jack Morgenstein 1d7d2f6f47 IB/mthca: fix WQE size calculation in create-srq
Thinko: 64 bytes is the minimum SRQ WQE size (not the maximum).

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2006-01-04 14:42:39 -08:00
Arnaldo Carvalho de Melo 14c850212e [INET_SOCK]: Move struct inet_sock & helper functions to net/inet_sock.h
To help in reducing the number of include dependencies, several files were
touched as they were getting needed headers indirectly for stuff they use.

Thanks also to Alan Menegotto for pointing out that net/dccp/proto.c had
linux/dccp.h include twice.

Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-01-03 13:11:21 -08:00
Jack Morgenstein c4342d8a4d IB/mthca: Fix corner cases in max_rd_atomic value handling in modify QP
sae and sre bits should only be set when setting sra_max.  Further, in
the old code, if the caller specifies max_rd_atomic = 0, the sre and
sae bits are still set, with the result that the QP ends up with
max_rd_atomic = 1 in effect.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-15 19:59:01 -08:00
Jack Morgenstein d1646f86a2 IB/mthca: Fix IB_QP_ACCESS_FLAGS handling.
This patch corrects some corner cases in managing the RAE/RRE bits in
the mthca qp context.  These bits need to be zero if the user requests
max_dest_rd_atomic of zero.  The bits need to be restored to the value
implied by the qp access flags attribute in a previous (or the
current) modify-qp command if the dest_rd_atomic variable is changed
to non-zero.

In the current implementation, the following scenario will not work:
RESET-to-INIT 	set QP access flags to all disabled (zeroes)
INIT-to-RTR     set max_dest_rd_atomic=10, AND
		set qp_access_flags = IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_ATOMIC

The current code will incorrectly take the access-flags value set in
the RESET-to-INIT transition.

We can simplify, and correct, this IB_QP_ACCESS_FLAGS handling: it is
always safe to set qp access flags in the firmware command if either
of IB_QP_MAX_DEST_RD_ATOMIC or IB_QP_ACCESS_FLAGS is set, so let's
just set it to the correct value, always.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-15 14:36:24 -08:00
Jack Morgenstein 576d2e4e40 IB/mthca: Fix SRQ cleanup during QP destroy
When cleaning up a CQ for a QP attached to SRQ, need to free an SRQ
WQE only if the CQE is a receive completion.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-15 14:20:23 -08:00
Michael S. Tsirkin 6c7d2a75b5 IB/mthca: Fix thinko in mthca_table_find()
break only escapes from the innermost loop, and we want to escape both
loops and return an answer.  Noticed by Ishai Rabinovitch.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-15 13:55:50 -08:00
Jack Morgenstein 44b5b03033 IB/mthca: don't change driver's copy of attributes if modify QP fails
Only change the driver's copy of the QP attributes in modify QP after
checking the modify QP command completed successfully.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-09 16:40:14 -08:00
Jack Morgenstein 6aa2e4e806 IB/mthca: correct log2 calculation
Fix thinko in rd_atomic calculation: ffs(x) - 1 does not find the next
power of 2 -- it should be fls(x - 1).

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-09 16:38:04 -08:00
Jack Morgenstein 94361cf74a IB/mthca: check RDMA limits
Add limit checking on rd_atomic and dest_rd_atomic attributes:
especially for max_dest_rd_atomic, a value that is larger than HCA
capability can cause RDB overflow and corruption of another QP.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-09 16:32:21 -08:00
Jack Morgenstein 52d0df153c IB/mthca: fix memory user DB table leak
Free the memory allocated in mthca_init_user_db_tab() when releasing
the db_tab in mthca_cleanup_user_db_tab().

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-09 13:48:50 -08:00
Jack Morgenstein 0efc4883a6 IB/umad: fix memory leaks
Don't leak packet if it had a timeout, and don't leak timeout struct
if queue_packet() fails.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-12-09 13:46:32 -08:00
Sean Hefty de1bb1a64c IB/cm: avoid reusing local ID
Use an increasing local ID to avoid re-using identifiers while
messages may still be outstanding on the old ID.  Without this, a
quick connect-disconnect-connect sequence can fail by matching
messages for the new connection with the old connection.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-30 10:01:13 -08:00
Sean Hefty 227eca8369 IB/cm: correct reported reject code
Change reject code from TIMEOUT to CONSUMER_REJECT when destroying a
cm_id in the process of connecting.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-30 10:00:25 -08:00
Jack Morgenstein a3c8ab4fe8 IB/mthca: fix QP size limits for mem-free HCAs
Unlike tavor, the max work queue size is an exact power of 2 for arbel
mode, despite what the documentation (of the QUERY_DEV_LIM firmware
command) says.  Without this patch, on Arbel, we can start with a QP
of a valid size and get above the reported limit after rounding to the
next power of two.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-30 09:55:22 -08:00
Jack Morgenstein f4e401562c IB/uverbs: track multicast group membership for userspace QPs
uverbs needs to track which multicast groups is each qp
attached to, in order to properly detach when cleanup
is performed on device file close.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 16:57:01 -08:00
Michael S. Tsirkin e0ae9ecf46 IB/mthca: fix posting of send lists of length >= 255 on mem-free HCAs
On mem-free HCAs, when posting a long list of send requests, a
doorbell must be rung every 255 requests.  Add code to handle this.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 11:33:46 -08:00
Roland Dreier 267ee88ed3 IPoIB: fix error handling in ipoib_open
If ipoib_ib_dev_up() fails after ipoib_ib_dev_open() is called, then
ipoib_ib_dev_stop() needs to be called to clean up.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 10:55:58 -08:00
Michael S. Tsirkin 4f71055a45 IPoIB: protect child list in ipoib_ib_dev_flush
race condition: ipoib_ib_dev_flush is accessing child list without locks.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 10:53:30 -08:00
Roland Dreier 2e86541ec8 IPoIB: don't zero members after we allocate with kzalloc
ipoib_mcast_alloc() uses kzalloc(), so there's no need to zero out
members of the mcast struct after it's allocated.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 10:25:23 -08:00
Michael S. Tsirkin de92248789 IPoIB: reinitialize mcast structs' completions for every query
Make sure mcast->done is initialized to uncompleted value before we
submit a new query, so that it's safe to wait on.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 10:18:45 -08:00
Roland Dreier 5872a9fc28 IPoIB: always set path->query to NULL when query finishes
Always set path->query to NULL when the SA path record query
completes, rather than only when we don't have an address handle.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-29 10:13:54 -08:00
Roland Dreier 65c7eddaba IPoIB: reinitialize path struct's completion for every query
It's possible that IPoIB will issue multiple SA queries for the same
path struct.  Therefore the struct's completion needs to be
initialized for each query rather than only once when the struct is
allocated, or else we might not wait long enough for later queries to
finish and free the path struct too soon.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-28 21:20:34 -08:00
Michael S. Tsirkin bf6d9e23a3 IB/umad: fix RMPP handling
ib_umad_write in user_mad.c is looking at rmpp_hdr field in MAD before
checking that the MAD actually has the RMPP header.  So for a MAD
without RMPP header it looks like we are actually checking a bit
inside M_Key, or something.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-28 13:07:20 -08:00
Michael S. Tsirkin 187a25863f IB/mthca: reset QP's last pointers when transitioning to reset state
last pointer is not updated when QP is modified to reset state.  This
causes data corruption if WQEs are already posted on the queue.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-28 11:19:43 -08:00
Adrian Bunk 2012a116d9 [PATCH] drivers/infiniband/core/mad.c: fix use-after-release case
The Coverity checker spotted this obvious use-after-release bug caused
by a wrong order of the cleanups.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-27 20:23:13 -08:00
Linus Torvalds 9b152d53b7 Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2005-11-18 14:33:03 -08:00
Roland Dreier eabc77935d IB/umad: make sure write()s have sufficient data
Make sure that userspace passes in enough data when sending a MAD.  We
always copy at least sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR
bytes from userspace, so anything less is definitely invalid.  Also,
if the length is less than this limit, it's possible for the second
copy_from_user() to get a negative length and trigger a BUG().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-18 14:18:26 -08:00
Michael S. Tsirkin 48fd0d1fdd IB/mthca: Safer max_send_sge/max_recv_sge calculation
Calculation of QP capabilities still isn't exactly right in mthca:
max_send_sge/max_recv_sge fields returned in create_qp can exceed the
handware supported limits.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-18 14:11:17 -08:00
Roland Dreier cbc5b2bb9e [IB] mthca: don't disable RDMA writes if no responder resources
Responder resources are only required to handle RDMA reads and atomic
operations, not RDMA writes.  So the driver should allow RDMA writes
even if responder resources are set to 0.  This is especially
important for the UC transport -- with the old code, it was impossible
to enable RDMA writes for UC QPs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-15 00:24:23 -08:00
Roland Dreier 47f2bce902 [IB] srp: don't post receive if no send buf available
Have __srp_get_tx_iu() fail if the target port's request limit will
not allow the initiator to post a send.  This avoids continuing on and
posting a receive, and then failing to post a corresponding send.  If
that happens, then the initiator will end up with an extra receive
posted, and if this happens to much, the receive queue will overflow.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-15 00:19:21 -08:00
Roland Dreier 5f068992a1 [IB] srp: increase max_luns
Increase SRP max_luns to 512 to match the kernel's default, since SRP
storage targets can have lots of LUNs and the SRP initiator itself
doesn't have any particular limit.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-11 14:06:01 -08:00
Greg Kroah-Hartman 249bb070f5 [PATCH] PCI: removed unneeded .owner field from struct pci_driver
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-10 16:09:17 -08:00
Linus Torvalds 78b9c0f91c Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2005-11-10 13:27:06 -08:00
Roland Dreier 94382f3562 [IB] umad: further ib_unregister_mad_agent() deadlock fixes
The previous umad deadlock fix left ib_umad_kill_port() still
vulnerable to deadlocking.  This patch fixes that by downgrading our
lock to a read lock when we might end up trying to reacquire the lock
for reading.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:51 -08:00
Michael S. Tsirkin ae57e24a40 [IB] mthca: fix posting long lists of receive work requests
In Tavor mode, when posting a long list of receive work requests, a
doorbell must be rung every 256 requests.  Add code to do this when
required.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:51 -08:00
Roland Dreier 64044bcf75 [IB] mthca: fix wraparound handling in mthca_cq_clean()
Handle case where prod_index has wrapped around and become less than
cq->cons_index by checking that their difference as a signed int is
positive rather than comparing directly.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:51 -08:00
Michael S. Tsirkin 62abb8416f [IB] mthca: fix posting of atomic operations
The size of work requests for atomic operations was computed
incorrectly in mthca: all sizeofs need to be divided by 16.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Jack Morgenstein 77369ed31d [IB] uverbs: have kernel return QP capabilities
Move the computation of QP capabilities (max scatter/gather entries,
max inline data, etc) into the kernel, and have the uverbs module
return the values as part of the create QP response.  This keeps
precise knowledge of device limits in the low-level kernel driver.

This requires an ABI bump, so while we're making changes, get rid of
the max_sge parameter for the modify SRQ command -- it's not used and
shouldn't be there.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier ec914c52d6 [IB] umad: get rid of unused mr array
Now that ib_umad uses the new MAD sending interface, it no longer
needs its own L_Key.  So just delete the array of MRs that it keeps.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier 40de2e548c [IB] Have cq_resize() method take an int, not int*
Change the struct ib_device.resize_cq() method to take a plain integer
that holds the new CQ size, rather than a pointer to an integer that
it uses to return the new size.  This makes the interface match the
exported ib_resize_cq() signature, and allows the low-level driver to
update the CQ size with proper locking if necessary.

No in-tree drivers are exporting this method yet.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier 0b4ff2c0e6 [IB] mthca: fix typo in catastrophic error polling
Fix a typo in the rearming of the catastrophic error polling timer: we
should rearm the timer as long as the stop flag is _not_ set.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier 8c608a32e3 [IPoIB] no need to set skb->dev right before freeing skb
For cut-and-paste reasons, the IPoIB driver was setting skb->dev right
before calling dev_kfree_skb_any().  Get rid of this.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier 2f76e82947 [IB] umad: avoid potential deadlock when unregistering MAD agents
ib_unregister_mad_agent() completes all pending MAD sends and waits
for the agent's send_handler routine to return.  umad's send_handler()
calls queue_packet(), which does down_read() on the port mutex to look
up the agent ID.  This means that the port mutex cannot be held for
writing while calling ib_unregister_mad_agent(), or else it will
deadlock.  This patch fixes all the calls to ib_unregister_mad_agent()
in the umad module to avoid this deadlock.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:50 -08:00
Roland Dreier 1732b0ef3b [IPoIB] add path record information in debugfs
Add ibX_path files to debugfs that contain information about the IPoIB
path cache.  IPoIB ARP only gives GIDs, which the IPoIB driver must
resolve to real IB paths through the ib_sa module.  For debugging,
when the ARP table looks OK but traffic isn't flowing, it's useful to
be able to see if the resolution from GID to path worked.

Also clean up the formatting of the existing _mcg debugfs files.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-10 10:22:49 -08:00
Olaf Hering 733482e445 [PATCH] changing CONFIG_LOCALVERSION rebuilds too much, for no good reason
This patch removes almost all inclusions of linux/version.h.  The 3
#defines are unused in most of the touched files.

A few drivers use the simple KERNEL_VERSION(a,b,c) macro, which is
unfortunatly in linux/version.h.

There are also lots of #ifdef for long obsolete kernels, this was not
touched.  In a few places, the linux/version.h include was move to where
the LINUX_VERSION_CODE was used.

quilt vi `find * -type f -name "*.[ch]"|xargs grep -El '(UTS_RELEASE|LINUX_VERSION_CODE|KERNEL_VERSION|linux/version.h)'|grep -Ev '(/(boot|coda|drm)/|~$)'`

search pattern:
/UTS_RELEASE\|LINUX_VERSION_CODE\|KERNEL_VERSION\|linux\/\(utsname\|version\).h

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-09 07:55:57 -08:00
Jesper Juhl 6044ec8882 [PATCH] kfree cleanup: misc remaining drivers
This is the remaining misc drivers/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in misc files in
drivers/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Acked-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Len Brown <len.brown@intel.com>
Acked-by: "Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:54:05 -08:00
Tim Schmielau 8c65b4a604 [PATCH] fix remaining missing includes
Fix more include file problems that surfaced since I submitted the previous
fix-missing-includes.patch.  This should now allow not to include sched.h
from module.h, which is done by a followup patch.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:41 -08:00
Michael S. Tsirkin 8b37b94721 [IB] umad: two small fixes
Two small fixes for the umad module:
 - set kobject name for issm device properly
 - in ib_umad_add_one(), s is subtracted from the index i when
   initializing ports, so s should be subtracted from the index when
   freeing ports in the error path as well.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-06 15:47:02 -08:00
Jack Morgenstein 0f69ce1e44 [IB] mthca: report page size capability
Report the device's real page size capability in mthca_query_device().

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-04 21:28:21 -08:00
Linus Torvalds 127f2fa31a Merge branch 'srp' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2005-11-04 16:32:36 -08:00
Linus Torvalds ba77df570c Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2005-11-04 16:31:54 -08:00
Jack Morgenstein d09e327641 [IB] mthca: check P_Key index in modify QP
Make sure that the P_Key index passed into mthca_modify_qp() is
within the device's P_Key table.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-03 14:58:33 -08:00
Roland Dreier 0c99cb6d5f [IB] umad: fix hot remove of IB devices
Fix hotplug of devices for ib_umad module: when a device goes away,
kill off all MAD agents for open files associated with that device,
and make sure that the device is not touched again after ib_umad
returns from its remove_one function.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-03 12:01:18 -08:00
Roland Dreier 87cfe32375 [IB] mthca: fix format of FW version
Mellanox has decided that the components of the firmware version are
really meant to be displayed in decimal, e.g. 0x000400070190 is
version 4.7.400.  Change the format we use from "%x.%x.%x" to
"%d.%d.%d" to match this convention.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-02 22:59:37 -08:00
Roland Dreier 8ae5a8a24f [IPoIB] don't compile debug code if debugging isn't enabled
Don't build ipoib_mcast_iter_ functions if CONFIG_INFINIBAND_IPOIB_DEBUG
is not enabled -- their only callers will not be built either.

Also move the prototype for ipoib_open() to ipoib.h to fix a sparse warning.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-02 20:51:01 -08:00
Roland Dreier aef9ec39c4 IB: Add SCSI RDMA Protocol (SRP) initiator
Add an InfiniBand SCSI RDMA Protocol (SRP) initiator.  This driver is
used to talk talk to InfiniBand SRP targets (storage devices).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-02 14:07:13 -08:00
Roland Dreier 21a384897d [IPoIB] remove unneeded initializations to 0
Shrink our source and .text a little by removing a few assignments of
NULL and 0 to memory that is already cleared as part of the allocation.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-02 10:07:59 -08:00
Roland Dreier de6eb66b56 [IB] kzalloc() conversions
Replace kmalloc()+memset(,0,) with kzalloc(), for a net savings of 35
source lines and about 500 bytes of text.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-11-02 07:23:14 -08:00
Roland Dreier 3bc12e75b2 [IPoIB] cleanups: fix comment, remove useless variables
Minor cleanups: fix a misleading comment, and get rid of attr_mask
variables that are only used to hold constants (just use the constants
directly).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-31 07:10:33 -08:00
Roland Dreier e5b251a24a [IB] mthca: Avoid SRQ free WQE list corruption
Fix wqe_to_link() to use a structure field that we know is definitely
always unused for receive work requests, so that it really avoids the
free list corruption bug that the comment claims it does.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-31 07:10:32 -08:00
Roland Dreier 7162a3e0db [IB] uverbs: Avoid NULL pointer deref on CQ async event
Userspace CQs that have no completion event channel attached end up
with their cq_context set to NULL.  However, asynchronous events like
"CQ overrun" can still occur on such CQs, so add a uverbs_file member
to struct ib_ucq_object that we can follow to deliver these events.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-31 07:10:32 -08:00
Tim Schmielau 4e57b68178 [PATCH] fix missing includes
I recently picked up my older work to remove unnecessary #includes of
sched.h, starting from a patch by Dave Jones to not include sched.h
from module.h. This reduces the number of indirect includes of sched.h
by ~300. Another ~400 pointless direct includes can be removed after
this disentangling (patch to follow later).
However, quite a few indirect includes need to be fixed up for this.

In order to feed the patches through -mm with as little disturbance as
possible, I've split out the fixes I accumulated up to now (complete for
i386 and x86_64, more archs to follow later) and post them before the real
patch.  This way this large part of the patch is kept simple with only
adding #includes, and all hunks are independent of each other.  So if any
hunk rejects or gets in the way of other patches, just drop it.  My scripts
will pick it up again in the next round.

Signed-off-by: Tim Schmielau <tim@physik3.uni-rostock.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-30 17:37:32 -08:00
Roland Dreier a20583a7c2 [IPoIB] use spin_trylock_irqsave()
Use spin_trylock_irqsave() in ipoib_start_xmit() instead of
reinventing it out of local_irq_save(), spin_trylock() and
local_irq_restore().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-29 13:54:40 -07:00
Al Viro 2d3c0b7bed [PATCH] missing include in infiniband
use of IS_ERR/PTR_ERR in infiniband/core/agent.c, without a portable
chain of includes pulling err.h (breaks on a bunch of platforms).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-29 10:35:07 -07:00
Michael S. Tsirkin affcd50546 [IB] mthca: report asynchronous CQ events
Implement reporting asynchronous CQ events in Mellanox HCA driver.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-29 07:39:42 -07:00
Roland Dreier 4cce3390c9 [IB] fix up class_device_create() calls
Fix class_device_create() calls to match the new prototype which
takes a parent device pointer.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-28 16:38:15 -07:00
Roland Dreier a4da0628ef Merge master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6 2005-10-28 15:50:51 -07:00
Roland Dreier 70a30e16a8 [IB] uverbs: Fix device lifetime problems
Move ib_uverbs module to using cdev_alloc() and class_device_create()
so that we can handle device lifetime properly.  Now we can make sure
we keep all of our data structures around until the last way to reach
them is gone.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-28 15:38:26 -07:00
Roland Dreier a74968f8c3 [IB] umad: Fix device lifetime problems
Move ib_umad module to using cdev_alloc() and class_device_create() so
that we can handle device lifetime properly.  Now we can make sure we
keep all of our data structures around until the last way to reach
them is gone.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-28 15:37:23 -07:00
Roland Dreier 1993d683f3 [IPoIB] Drop RX packets when out of memory
Change the way IPoIB handles RX packets when it can't allocate a new
receive skbuff.  If the allocation of a new receive skb fails, we now
drop the packet we just received and repost the original receive skb.
This means that the receive ring always stays full and we don't have
to monkey around with trying to schedule a refill task for later.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-28 15:30:34 -07:00
Greg KH 6fbfddcb52 Merge ../bleed-2.6 2005-10-28 10:13:16 -07:00
Greg Kroah-Hartman 53f4654272 [PATCH] Driver Core: fix up all callers of class_device_create()
The previous patch adding the ability to nest struct class_device
changed the paramaters to the call class_device_create().  This patch
fixes up all in-kernel users of the function.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-28 09:52:52 -07:00
Al Viro 87b750dc4b [PATCH] gfp_t: drivers/infiniband
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-28 08:16:50 -07:00
Sean Hefty cb0f0910f4 [IB] ib_umad: various cleanups
Simplify user_mad.c code in a few places, and convert from kmalloc() +
memset() to kzalloc().  This also fixes a theoretical race window by
not accessing packet->length after posting the send buffer (the send
could complete and packet could be freed before we get to the return
statement at the end of ib_umad_write()).

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-27 20:48:11 -07:00
Roland Dreier 089a1bedd8 [IB] ib_umad: fix crash when freeing send buffers
The conversion of user_mad.c to the new MAD send API was slightly off:
in a few places, we used packet->msg instead of packet->msg->mad when
referring to the actual data buffer, which ended up corrupting the
underlying data structure and crashing when we free an invalid pointer.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-27 20:33:43 -07:00
Roland Dreier 3d155f8cd0 [IB] mthca: first pass at catastrophic error reporting
Add some initial support for detecting and reporting catastrophic
errors reported by Mellanox HCAs.  We start a periodic timer which
polls the catastrophic error reporting buffer in device memory.  If an
error is detected, we dump the contents of the buffer for port-mortem
debugging, and report a fatal asynchronous error to higher levels.

In the future we can try to recover from these errors by resetting the
device, but this will require some work in higher-level code as well.
Let's get this in now, so that we at least get catastrophic errors
reported in logs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-27 11:03:38 -07:00
Roland Dreier 7cc656efb5 [IB] simplify mad_rmpp.c:alloc_response_msg()
Change alloc_response_msg() in mad_rmpp.c to return the struct
it allocates directly (or an error code a la ERR_PTR), rather than
returning a status and passing the struct back in a pointer param.
This simplifies the code and gets rid of warnings like

    drivers/infiniband/core/mad_rmpp.c: In function nack_recv:
    drivers/infiniband/core/mad_rmpp.c:192: warning: msg may be used uninitialized in this function

with newer versions of gcc.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-25 15:13:54 -07:00
Roland Dreier 547e309073 [IB] mthca: correct modify QP attribute masks for UC
The UC transport does not support RDMA reads or atomic operations, so
we shouldn't require or even allow the consumer to set attributes
relating to these operations for UC QPs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-25 10:57:32 -07:00
Sean Hefty 34816ad98e [IB] Fix MAD layer DMA mappings to avoid touching data buffer once mapped
The MAD layer was violating the DMA API by touching data buffers used
for sends after the DMA mapping was done.  This causes problems on
non-cache-coherent architectures, because the device doing DMA won't
see updates to the payload buffers that exist only in the CPU cache.

Fix this by having all MAD consumers use ib_create_send_mad() to
allocate their send buffers, and moving the DMA mapping into the MAD
layer so it can be done just before calling send (and after any
modifications of the send buffer by the MAD layer).

Tested on a non-cache-coherent PowerPC 440SPe system.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-25 10:51:39 -07:00
Sean Hefty ae7971a770 [IB] CM: Fix initialization of QP attributes for UC QPs.
Fix cm_init_qp_init_attr(), cm_init_qp_rtr_attr() and cm_init_qp_rts_attr()
so that they correctly handle the differences between UC and RC QPs.  This
fixes problems with setting up UC QPs through the CM.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-24 12:33:56 -07:00
Roland Dreier ec329a1359 Manual merge of for-linus to upstream (fix conflicts in drivers/infiniband/core/ucm.c) 2005-10-24 10:55:29 -07:00
Roland Dreier 5d7edb3c1a [IB] Add idr_destroy() calls on module unload
Add idr_destroy() calls to the module_exit() functions of the four IB
driver modules that use idrs, so we don't leak idr_layer_cache objects
when these modules are unloaded.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-24 10:53:25 -07:00
Roland Dreier 75eeec2f3f [PATCH] ib: mthca: Always re-arm EQs in mthca_tavor_interrupt()
We should always re-arm an event queue's interrupt in
mthca_tavor_interrupt() if the corresponding bit is set in the event cause
register (ECR), even if we didn't find any entries in the EQ.  If we don't,
then there's a window where we miss an EQ entry and then get stuck because
we don't get another EQ event.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-23 16:38:39 -07:00
Roland Dreier c8e0ca683d [IB] mthca: Always re-arm EQs in mthca_tavor_interrupt()
We should always re-arm an event queue's interrupt in
mthca_tavor_interrupt() if the corresponding bit is set in the event
cause register (ECR), even if we didn't find any entries in the EQ.
If we don't, then there's a window where we miss an EQ entry and then
get stuck because we don't get another EQ event.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-22 09:43:29 -07:00
Roland Dreier bbf2078609 [IB] user_mad: Use class_device.devt
Use devt member of struct class_device so that we don't have to create
our own "dev" file in sysfs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-20 12:54:01 -07:00
Roland Dreier 2e0c512aff [IB] user_mad: trivial coding style fixes
Add spaces after "sizeof" operator to match the rest of file.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-20 12:30:16 -07:00
Roland Dreier 3910f44d79 [IB] cm: Add missing break in switch
Add missing "break" in switch statement.  Without the break, the
CM ended up always falling through and setting every connection
request to use RC transport, which meant that UC connections
didn't work.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-20 12:29:36 -07:00
Jack Morgenstein 7150bf8a98 [IB] mthca: Don't enter QP into MCG more than once.
Avoid entering a QP as member of a multicast group multiple times.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-18 14:46:38 -07:00
Roland Dreier ba8e931024 [IB] Fail sysfs queries after device is unregistered
We keep IB device structures around until the last sysfs reference is
gone, but we shouldn't ask the low-level driver to do anything after
the LLD unregisters the device.  To handle this, check the reg_state
field and just fail sysfs show() requests if the device has already
been unregistered.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-18 14:14:56 -07:00
Roland Dreier d476306f1c [IB] mthca: Add struct pci_driver.owner field
Set mthca_driver.owner to THIS_MODULE.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-18 14:07:07 -07:00
Roland Dreier c6f5cb7be0 [IB] mthca: Use enum in mthca_alloc_db() prototype
Make the type parameter of mthca_alloc_db() be an enum mthca_db_type
instead of an int.  This doesn't have any practical effect but
documents the functions a little better.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-18 13:22:16 -07:00
Roland Dreier 4b2d319b53 [IPoIB] Improve ipoib_timeout() output
Use jiffies_to_msecs() so we print a human-readable time so
we don't have to worry about what HZ is configured to, and
print out a few values to make post-mortem analysis easier.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-18 12:20:06 -07:00
Roland Dreier 762a03e21e [IB] ucm: quiet sparse warnings
Make ctx_id_mutex and ctx_id_table static to quiet sparse warnings.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:38:50 -07:00
Sean Hefty 07d357d0cb [IB] CM: bind IDs to a specific device
Bind communication identifiers to a device to support device removal.
Export per HCA CM devices to userspace.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
2005-10-17 15:37:43 -07:00
Sean Hefty 595e726a1f [IB] merge ucm.h into ucm.c
Eliminate ucm.h.  Replace ucm_dbg with direct call to printk KERN_ERR.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
2005-10-17 15:33:47 -07:00
Roland Dreier 67cdb40ca4 [IB] uverbs: Implement more commands
Add kernel support for userspace calling poll CQ, request CQ
notification, post send, post receive, post SRQ receive, create AH and
destroy AH commands.  These commands allow us to support userspace
verbs for devices that can't perform these operations directly from
userspace (eg the PathScale HCA).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:31 -07:00
Roland Dreier 883a99c702 [IB] uverbs: Add a mask of device methods allowed for userspace
Give each device a uverbs_cmd_mask, so that a low-level driver can
control which methods may be called on behalf of userspace.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:30 -07:00
Roland Dreier 56c202d6e4 [IB] fail SA queries if device initialization failed
If the SA query module's initialization fails for a device, then that
device won't have a struct ib_sa_device associated.  We should fail SA
queries in that case, rather than blindly dereferencing the NULL
pointer we get back from ib_get_client_data().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:29 -07:00
Roland Dreier 305a7e8705 [IB] uverbs: unlock correctly in error paths
A couple of functions were missing spin_unlock calls in error paths.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:29 -07:00
Roland Dreier 5b6810e048 [IPoIB] Rename ipoib_create_qp() -> ipoib_init_qp() and fix error cleanup
ipoib_create_qp() no longer creates IPoIB's QP, so it shouldn't
destroy the QP on failure -- that unwinding happens elsewhere, so the
current code can cause a double free.  While we're at it, the
function's name should match what it actually does, so rename it to
ipoib_init_qp().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:29 -07:00
Jack Morgenstein efaae8f71f [IB] mthca: Better limit checking and reporting
Check the sizes of CQs, QPs and SRQs when creating objects, and fail
instead of creating too-big queues.  Also return real limits instead
of just plausible-sounding values from mthca_query_device().

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:29 -07:00
Roland Dreier 4ab6fb7e5b [IB] Fix leak on MAD initialization failure
There is a bug in ib_mad_init_device(): if ib_agent_port_open() fails
for a given port, then the current code doesn't call ib_mad_port_close()
for that port.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:28 -07:00
Roland Dreier e23d6d2b09 [IB] mthca: detect SRQ overflow
The hardware relies on us keeping one extra work request that never
gets used in SRQs.  Add checks to the SRQ work request posting
functions so that they fail when someone is about to use up that extra
work request, rather than when someone uses the very last work request.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:28 -07:00
Roland Dreier 90f104da22 [IB] mthca: SRQ limit reached events
Our hardware supports generating an event when the number of receives
posted to a shared receive queue (SRQ) falls below a user-specified
limit.  Implement mthca_modify_srq() to arm the limit, and add code to
handle dispatching SRQ events when they occur.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:28 -07:00
Roland Dreier 116c0074ec [IB] Check port number in ib_query_port()/ib_modify_port()
Check port number before passing query_port or modify_port operations
on to device driver.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:27 -07:00
Roland Dreier f575394f1d [IB] uverbs: reject invalid memory registration permission flags
Reject userspace memory registrations with invalid permission flags:
"local write" is required if "remote write" or "remote atomic" is also
requested.

Pointed out by Jack Morgenstein <jackm@mellanox.co.il>

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:27 -07:00
Jack Morgenstein 9825051e8c [IB] mthca: Fill in more fields in query_port method
Add code to fill in the bad_pkey_cntr, max_mtu, active_mtu and
subnet_timeout fields in mthca_query_port().

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:26 -07:00
Roland Dreier 274c089163 [IB] uverbs: Add device-specific ABI version attribute
Add abi_version attribute to uverbs class devices to allow for
ABI versioning of device-specific interfaces.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:26 -07:00
Roland Dreier eb9d3cd5ce [IB] uverbs: Fix up resource creation error paths
By waiting to add resources to our lists until after the last
operation that can fail, we don't have to remove them from their lists
in the error path.  Also, we should hold the idr mutex until we know
whether resource creation has succeed or failed, to avoid someone
finding a resource in our table before we're ready.

Loosely based on work by Robert Walsh <rjwalsh@pathscale.com>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:25 -07:00
Roland Dreier 6b73597e70 [IB] uverbs: ABI-breaking fixes for userspace verbs
Introduce new userspace verbs ABI version 3.  This eliminates some
unneeded commands, and adds support for user-created completion
channels.  This cleans up problems with file leaks on error paths, and
also makes sure that file descriptors are always installed into the
correct process.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:25 -07:00
Jack Morgenstein 33033b7972 [IB] mthca: Report correct atomic capability
Return correct atomic capability flag from mthca query function.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:24 -07:00
Jack Morgenstein 0c33aeedb2 [IB] Add checks to multicast attach and detach
Add checks so that we only allow multicast attach/detach with
a valid multicast GID and the correct QP type.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-10-17 15:20:24 -07:00
Al Viro dd0fc66fb3 [PATCH] gfp flags annotations - part 1
- added typedef unsigned int __nocast gfp_t;

 - replaced __nocast uses for gfp flags with gfp_t - it gives exactly
   the same warnings as far as sparse is concerned, doesn't change
   generated code (from gcc point of view we replaced unsigned int with
   typedef) and documents what's going on far better.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-08 15:00:57 -07:00
Michael S. Tsirkin aba7a22f29 [IB] mthca: Fix memory leak on device close
Remember to free the multicast group context memory table.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-30 13:55:50 -07:00
Roland Dreier d70ed6075f [IPoIB] Rename IPoIB's path_lookup() to avoid name clashes
Rename IPoIB driver's path_lookup() to ipoib_path_lookup() to avoid a
clashes with the kernel global path_lookup().  We don't hit this with
the current kernel source, but some external patches seem to trigger
this, and it's cleaner to avoid clashing with global names anyway.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
refs/heads/for-linus
2005-09-28 19:56:57 -07:00
Jack Morgenstein a1c337afaf [IB] mthca: fix hw_ver value returned from mthca_query_device
The IB spec defines the field to be 32 bits, not 16 bits.

Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-27 13:54:44 -07:00
Michael S. Tsirkin f02b16bea2 [IB] mthca: Round up number of slots in HCA context memory table
When allocating a table for mem-free HCA context, don't assume that
obj_size * nobj is an even multiple of MTHCA_TABLE_CHUNK_SIZE.  In
particular, make sure we allocate at least one slot even if the table
is smaller than MTHCA_TABLE_CHUNK_SIZE.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-26 21:12:26 -07:00
Roland Dreier 63c47c286d [IB] uverbs: Close some exploitable races
Al Viro pointed out that the current IB userspace verbs interface
allows userspace to cause mischief by closing file descriptors before
we're ready, or issuing the same command twice at the same time.  This
patch closes those races, and fixes other obvious problems such as a
module reference leak.

Some other interface bogosities will require an ABI change to fix
properly, so I'm deferring those fixes until 2.6.15.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-26 13:01:03 -07:00
Michael S. Tsirkin 44dd823b00 [IB] mthca: Fix off by one bug in mthca_map_cmd
The loop in mthca_map_cmd() would fill one entry past the end of the
mailbox buffer before calling the firmware command.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-26 09:42:09 -07:00
Michael S. Tsirkin f7ed3a5971 [IB] mthca: fix off by one in clr_int calculation
We should use the first word of the clear interrupt register if
the bit we're after is < 32, not < 31.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-26 09:38:34 -07:00
Roland Dreier 018771f435 [IB] mthca: Fix doorbell record resource leak
If we allocate a bunch of doorbell records and then free them, we'll
end up with completely empty pages, which we then free.  However, when
we come back to allocate more doorbell pages, we have to reallocate
those empty pages rather than always trying to take a slot that we've
never used.  If we don't, we eventually use up every slot and fail to
allocate a doorbell record, even though we have plenty of free space.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-26 09:38:26 -07:00
Hal Rosenstock f2065e4242 [IB] Fix RMPP receive length calculation
Based on simplification idea from Sean Hefty <sean.hefty@intel.com>

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-21 12:33:09 -07:00
Sean Hefty 972d512a17 [IB] Add MAD data field size definitions
Clean up code by using enums instead of hard-coded magic numbers.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-21 12:31:26 -07:00
Michael S. Tsirkin 71eea47d85 [PATCH] IB/mthca: Fix device removal memory leak
Clean up QP table array on device removal.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-20 10:54:48 -07:00
Roland Dreier 8d2cae0651 [PATCH] IPoIB: Don't flush workqueue from within workqueue
ipoib_mcast_restart_task() is always called from within the
single-threaded IPoIB workqueue, so flushing the workqueue from within
the function can lead to a recursion overflow.  But since we're
running in a single-threaded workqueue, we're already synchronized
against other items in the workqueue, so just get rid of the flush in
ipoib_mcast_restart_task().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-20 10:52:04 -07:00
Hal Rosenstock eff4c654b1 [PATCH] IB: Fix data length for RMPP SA sends
We need to subtract off the header length from our payload
length when sending multi-packet SA messages.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-19 13:51:01 -07:00
Roland Dreier 6577ae51cf [PATCH] IB/mthca: Don't try to set srq->last for userspace SRQs
Userspace SRQs don't have a buffer allocated for them in the kernel, so
it doesn't make sense to set srq->last during initialization.  In fact,
this can crash trying to follow a nonexistent buffer pointer.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-19 09:17:56 -07:00
Roland Dreier 3853194c2e [PATCH] IB/mthca: Fix posting work requests to shared receive queues
The error handling paths in mthca_tavor_post_srq_recv() and
mthca_arbel_post_srq_recv() are quite bogus, the result of a
screwed up merge.  Fix them so they work as intended.

Pointed out by Michael S. Tsirkin <mst@mellanox.co.il>

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:38 -07:00
Roland Dreier c915033fc6 [PATCH] IB/mthca: Initialize eq->nent before we use it
In mthca_create_eq(), we call get_eqe() before setting eq->nent.  This
is wrong, because get_eqe() uses eq->nent.  Fix this, and clean up the
code a little while we're at it.  (We got lucky with the current code,
because eq->nent was cleared to 0, which get_eqe() made happen to do
the right thing)

Pointed out by Michael S. Tsirkin <mst@mellanox.co.il>

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:38 -07:00
Hal Rosenstock ce5b65cc96 [PATCH] IPoIB: Fix SA client retransmission strategy
We got a little mixed up with what the backoff member holds in the
IPoIB multicast group structure: sometimes it was used as a number of
seconds, and sometimes it was used as a number of jiffies.  Fix the
code so that backoff is always in seconds.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:38 -07:00
Roland Dreier d6cff021e2 [PATCH] IB/mthca: fix posting of first work request
Fix posting first WQE for mem-free HCAs: we need to link to previous
WQE even in that case.  While we're at it, simplify code for
Tavor-mode HCAs.  We don't really need the conditional test there
either; we can similarly always link to the previous WQE.

Based on Michael S. Tsirkin's analogous fix for userspace libmthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:37 -07:00
Roland Dreier bb4a7f0da7 [PATCH] IB/mthca: assign ACK timeout field correctly
The hardware reads the ACK timeout field from the most significant 5
bits of struct mthca_qp_path's ackto field, not the least significant
bits.  This fix has the driver put the timeout in the right place.
Without this, we get a timeout that is 2^8 times too small.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:37 -07:00
Michael S. Tsirkin 51574e0398 [PATCH] IPoIB: fix module removal race
Since ipoib uses queue_delayed_work to run flush task on port state events,
it must flush scheduled work after unregistering the event handler.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-18 22:02:37 -07:00
Linus Torvalds 9fe66dfd88 Merge master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband 2005-09-11 10:16:07 -07:00
Roland Dreier 1b205c2d24 [PATCH] IB: fix CM use-after-free
If the CM REQ handling function gets to error2, then it frees
cm_id_priv->timewait_info.  But the next line goes through
ib_destroy_cm_id() -> ib_send_cm_rej() -> cm_reset_to_idle(),
which ends up calling cm_cleanup_timewait(), which dereferences the
pointer we just freed.  Make sure we clear cm_id_priv->timewait_info
after freeing it, so that doesn't happen.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-09 20:52:00 -07:00
John Kingman 354ba39cf9 [PATCH] IB CM: support CM redir
Changes to CM to support CM and port redirection (REJ reason 24).

Signed-off-by: John Kingman <kingman <at> storagegear.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-09 18:23:32 -07:00
Roland Dreier 63aaf64752 Make sure that userspace does not retrieve stale asynchronous or
completion events after destroying a CQ, QP or SRQ.  We do this by
sweeping the event lists before returning from a destroy calls, and
then return the number of events already reported before the destroy
call.  This allows userspace wait until it has processed all events
for an object returned from the kernel before it frees its context for
the object.

The ABI of the destroy CQ, destroy QP and destroy SRQ commands has to
change to return the event count, so bump the ABI version from 1 to 2.
The userspace libibverbs library has already been updated to handle
both the old and new ABI versions.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-09 15:55:08 -07:00
Hal Rosenstock fbed8eee70 [PATCH] IB: Move SA attributes to ib_sa.h
SA: Move SA attributes to ib_sa.h so are accessible to more than
sa_query.c. Also, remove deprecated attributes and add one missing one.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-09 15:24:04 -07:00
Adrian Bunk 982245f017 [PATCH] PCI: remove CONFIG_PCI_NAMES
This patch removes CONFIG_PCI_NAMES.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 14:57:23 -07:00
Pekka Enberg 82ca76b6b1 [PATCH] drivers: convert kcalloc to kzalloc
This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:46 -07:00
James Lentini 17781cd618 [PATCH] IB: clean up user access config options
Add a new config option INFINIBAND_USER_MAD to control whether we
build ib_umad.  Change INFINIBAND_USER_VERBS to INFINIBAND_USER_ACCESS,
and have it control ib_ucm and ib_uat as well as ib_uverbs.

Signed-off-by: James Lentini <jlentini@netapp.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 12:43:08 -07:00
Hal Rosenstock b5dcbf47e1 [PATCH] IB: RMPP fixes
- Fix payload length of middle RMPP sent segments. Middle payload
  lengths should be 0 on the send side.

  (This is perhaps a compliance and should not be an interop issue as
  middle payload lengths are supposed to be ignored on receive).

- Fix length in first segment of multipacket sends

  (This is a compliance issue but does not affect at least OpenIB to
  OpenIB RMPP transfers).

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 11:03:41 -07:00
Michael S. Tsirkin 30a7e8ef13 [PATCH] IB: Initialize qp->wait
Add missing call to init_waitqueue_head().

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 09:48:53 -07:00
Roland Dreier c9fe2b3287 [PATCH] IB: really reset QPs
When we modify a QP to the RESET state, completely clean up the QP
so that it is really and truly reset.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 09:48:52 -07:00
Sean Hefty 0b2b35f681 [PATCH] IB: Add user-supplied context to userspace CM ABI
- Add user specified context to all uCM events.  Users will not retrieve
  any events associated with the context after destroying the corresponding
  cm_id.
- Provide the ib_cm_init_qp_attr() call to userspace clients of the CM.
  This call may be used to set QP attributes properly before modifying the QP.
- Fixes some error handling synchonization and cleanup issues.
- Performs some minor code cleanup.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 09:48:52 -07:00
Michael S. Tsirkin 1d6801f9dd [PATCH] IB/sa_query: avoid unnecessary list scan
Using ib_get_client_data in SA event handler performs a list scan.
It's better to use container_of to get the sa device directly.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 09:48:52 -07:00
Michael S. Tsirkin 06c56e44f3 [PATCH] IPoIB: fix memory leak
Fix IPoIB memory leak on device removal.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-09-07 09:48:52 -07:00
Roland Dreier a4d61e8480 [PATCH] IB: move include files to include/rdma
Move the InfiniBand headers from drivers/infiniband/include to include/rdma.
This allows InfiniBand-using code to live elsewhere, and lets us remove the
ugly EXTRA_CFLAGS include path from the InfiniBand Makefiles.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:38 -07:00
Michael S. Tsirkin 1ad62a19f1 [PATCH] IPoIB: Fix device removal race
Currently we may have work scheduled in default kernel workqueue when
the device is going down.  The device could get freed before this
workqueue gets serviced.  I am actually seeing this causing system
hangs.

The following patch fixes this by using ipoib_workqueue which gets
flushed when the device is going down.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:38 -07:00
Sean Hefty fe9e08e17a [PATCH] IB: Add handling for ABORT and STOP RMPP MADs.
Add handling for ABORT / STOP RMPP MADs.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:38 -07:00
Sean Hefty b9ef520f9c [PATCH] IB: fix userspace CM deadlock
Fix deadlock condition resulting from trying to destroy a cm_id
from the context of a CM thread.  The synchronization around the
ucm context structure is simplified as a result, and some simple
code cleanup is included.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:38 -07:00
Roland Dreier 4ce059378c [PATCH] IPoIB: Set full membership bit in P_Keys
Always make sure that the full membership bit is set in the P_Keys
that IPoIB uses.  This makes sure that all hosts join the correct
multicast groups so that hosts that are partial partition members
can talk to the rest of the network.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier ec34a922d2 [PATCH] IB/mthca: Add SRQ implementation
Add mthca support for shared receive queues (SRQs),
including userspace SRQs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier d20a401928 [PATCH] IB/mthca: Handle context tables smaller than our chunk size
When creating a table in context memory where the table is smaller
than our chunk size, we don't want to allocate and map a full chunk.
Instead, allocate just enough memory to cover the table.

This can be pretty simple because all tables are a power-of-2 size, so
either the table is a multiple of the chunk size, or it's smaller than
one chunk.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier c04bc3d1f4 [PATCH] IB/mthca: Move WQE structures into their own header
Move the definitions of the WQE structures from mthca_qp.c into
mthca_wqe.h, so that we'll be able to share them when we add the
SRQ code in mthca_srq.c.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier 288bdeb4bc [PATCH] IB/mthca: Simplify handling of completions with error
Mem-free HCAs never generate error CQEs that complete multiple WQEs,
so just skip the call to mthca_free_err_wqe() for them rather than
having logic to handle the mem-free case in mthca_free_err_wqe().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier 87b816706b [PATCH] IB/mthca: Factor out common queue alloc code
Clean up the allocation of memory for queues by factoring out the
common code into mthca_buf_alloc() and mthca_buf_free().  Now CQs and
QPs share the same queue allocation code, which we'll also use for SRQs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier f520ba5aa4 [PATCH] IB: userspace SRQ support
Add SRQ support to userspace verbs module.  This adds several commands
and associated structures, but it's OK to do this without bumping the
ABI version because the commands are added at the end of the list so
they don't change the existing numbering.  There are two cases to
worry about:

1. New kernel, old userspace.  This is OK because old userspace simply
   won't try to use the new SRQ commands.  None of the old commands are
   changed.

2. Old kernel, new userspace.  This works perfectly as long as
   userspace doesn't try to use SRQ commands.  If userspace tries to
   use SRQ commands, it will get EINVAL, which is perfectly
   reasonable: the kernel doesn't support SRQs, so we couldn't do any
   better.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:37 -07:00
Roland Dreier d41fcc6705 [PATCH] IB: Add SRQ support to midlayer
Make the required core API additions and changes for
shared receive queues (SRQs).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Roland Dreier d1887ec212 [PATCH] IB/mthca: Report correct max_msg_sz
Set the max_msg_sz port property correctly in mthca's port_query
function.  Also zero out the attr struct so that we don't leave
any other members uninitialized.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Roland Dreier da6561c285 [PATCH] IB/mthca: Use correct port width capability value
When we call the INIT_IB firmware command to bring up a port, use
the actual port width capability returned by the QUERY_DEV_LIM
command instead of always trying to enable both 1X and 4X.  This
fixes breakage seen when the firmware is build to allow 4X only.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Olaf Hering 2aeba9a03b [PATCH] IB: Remove unnecessary includes of <linux/version.h>
changing CONFIG_LOCALVERSION rebuilds too much, for no appearent reason.
Remove unneeded includes of <linux/version.h>.

Signed-off-by: Olaf Hering <olh@suse.de>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Hal Rosenstock 5dd2ce1200 [PATCH] IB: Fix ib_mad_thread_completion_handler declaration
Change ib_mad_thread_completion_handler to conform to ib_comp_handler
declaration.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Guy German 7f9f2dba72 [PATCH] IB/mthca: use generic function instead of arbel_ version in mthca_free_region()
Use the generic key_to_hw_index() function instead of the Arbel-specific
version in mthca_free_region().

Signed-off-by: Guy German <guyg@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Roland Dreier ffbf4c34f1 [PATCH] IB: unmap FMRs when destroying FMR pool
Make sure that all FMRs are unmapped before we deallocate them so that
we don't leak references to our protection domain when destroying an
FMR pool.  (Bug reported by Guy German <guyg@voltaire.com>)

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:36 -07:00
Michael S. Tsirkin 2e8b981c5d [PATCH] IB/mthca: add HCA board ID to sysfs info
Add support for reporting HCA board ID returned from QUERY_ADAPTER
firmware command through sysfs.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:35 -07:00
Sean Hefty 97f52eb438 [PATCH] IB: sparse endianness cleanup
Fix sparse warnings.  Use __be* where appropriate.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:35 -07:00
Hal Rosenstock 92a6b34bf4 [PATCH] IB: Eliminate redundant NULL checks
IPoIB: Eliminate NULL checks prior to calling kfree

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:35 -07:00
Roland Dreier 2a1d9b7f09 [PATCH] IB: Add copyright notices
Make some lawyers happy and add copyright notices for people who
forgot to include them when they actually touched the code.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:35 -07:00
Tziporet Koren 49f6a7fbe1 [PATCH] IB: Update current firmware versions in mthca driver
Update FW versions in mthca according to July 05 Mellanox release

Signed-off-by: Tziporet Koren <tziporet@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-08-26 20:37:34 -07:00
Roland Dreier e1bcfcaa0b [PATCH] IB: fix use-after-free in user verbs cleanup
Fix a use-after-free bug in userspace verbs cleanup: we can't touch
mr->device after we free mr by calling ib_dereg_mr().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-26 19:37:12 -07:00
Al Viro a2b2f45be7 [PATCH] Kconfig fix (infiniband and PCI)
infiniband uses PCI helpers all over the place (including the core parts) and
won't build without PCI.

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-08-23 18:43:41 -07:00
Hal Rosenstock 0dca0f7bf8 [PATCH] [IPoIB] Handle sending of unicast RARP responses
RARP replies are another valid case where IPoIB may need to send a
unicast packet with no neighbour structure.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-28 13:17:26 -07:00
Roland Dreier 4e38d36d88 [PATCH] [IB/cm]: Correct CM port redirect reject codes
Reject code 24 is port and CM redirection, not just port redirection.
Port redirection alone is code 25.

Therefore we should rename code 24 to IB_CM_REJ_PORT_CM_REDIRECT and
use IB_CM_REJ_PORT_REDIRECT for code 25.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-28 13:16:30 -07:00
Hal Rosenstock 79d8190759 [IB/ucm]: Clean up userspace CM
Only print debug messages when debug_level is set.
Eliminate NULL checks prior to calling kfree.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Libor Michalek <libor@topspin.com>
2005-07-27 20:38:56 -07:00
Roland Dreier 2868bd281f Merge /scratch/Ksrc/linux-git/ 2005-07-27 19:12:56 -07:00
Hal Rosenstock f13f9f501a [PATCH] IB: Eliminate sparse warnings in SA client
Eliminate sparse warnings in SA client

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:15 -07:00
Hal Rosenstock 8fd65b096a [PATCH] IB: Hook up userspace CM to the make system
Hook up userspace CM to the make system

Signed-off-by: Libor Michalek <libor@topspin.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:15 -07:00
Tom Duffy 2d0d099f19 [PATCH] Add kernel portion of user CM implementation (fix)
Include the patch openib-general changing class_simple to class.

Signed-off-by: Tom Duffy <tduffy@sun.com>
Cc: Hal Rosenstock <halr@voltaire.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:15 -07:00
Hal Rosenstock a5b7454077 [PATCH] IB: Add kernel portion of user CM implementation
Add kernel portion of user CM implementation

Signed-off-by: Libor Michalek <libor@topspin.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:14 -07:00
Hal Rosenstock 8aa009191d [PATCH] IB: Add the header file for user space CM
Add the header file for user space CM.  This file defines the ABI used by the
CM for kernel/user communication.

Signed-off-by: Libor Michalek <libor@topspin.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:14 -07:00
Hal Rosenstock cb183a06b3 [PATCH] IB: Implementation for RMPP support in user MAD
Implementation for RMPP support in user MAD

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:14 -07:00
Hal Rosenstock 3f75daddb4 [PATCH] IB: User MAD ABI changes to support RMPP
User MAD ABI changes to support RMPP

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:14 -07:00
Hal Rosenstock a977049dac [PATCH] IB: Add the kernel CM implementation
Add the kernel CM implementation

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:14 -07:00
Hal Rosenstock c3e0164758 [PATCH] IB: Add the header file for kernel CM (Communications Manager)
Add the header file for kernel CM (Communications Manager)

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:13 -07:00
Hal Rosenstock cbae32c563 [PATCH] IB: Add Service Record support to SA client
Add Service Record support to SA client

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:13 -07:00
Hal Rosenstock fa619a7704 [PATCH] IB: Add RMPP implementation
Add RMPP implementation.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:13 -07:00
Hal Rosenstock d2082ee516 [PATCH] IB: Introduce RMPP APIs
Introduce RMPP APIs

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:12 -07:00
Hal Rosenstock 497677ab94 [PATCH] IB: A couple of IB core bug fixes
Replace be32_to_cpup with be32_to_cpu and fix bug referencing pointer rather
than value in ib_create_ah_from_wc().

Signed-off-by: Tom Duffy <tduffy@sun.com>
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:12 -07:00
Hal Rosenstock 513789ed99 [PATCH] IB: Add ib_create_ah_from_wc to IB verbs
Added new call: ib_create_ah_from_wc.  Call will allocate an address handle
given work completion information, including any received GRH.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:12 -07:00
Hal Rosenstock cabe3cbcbb [PATCH] IB: Fix a couple of MAD code paths
Fixed locking to handle error posting MAD send work requests.  Fixed handling
canceling a MAD with an active work request.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:12 -07:00
Hal Rosenstock 29bb33dd87 [PATCH] IB: Optimize canceling a MAD
Optimize canceling a MAD.
- Eliminate searching timeout list in cancel case.
- Remove duplicate calls to queue work item.
- Eliminate resending a MAD before MAD is completed.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:11 -07:00
Hal Rosenstock 03b61ad2f2 [PATCH] IB: Add ib_modify_mad API to MAD
Add new MAD layer call to modify (ib_modify_mad) the timeout of a sent MAD,
and simplify cancel code.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:11 -07:00
Hal Rosenstock 2c153b934d [PATCH] IB: Eliminate MAD cache leak associated with local completions
Eliminate MAD cache leak associated with local completions.  Also, when
canceling MAD, empty local completion list as well.

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:11 -07:00
Hal Rosenstock dbf9227bd3 [PATCH] IB: Simplify calling of list_del in MAD
Simplify calling of list_del.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:11 -07:00
Hal Rosenstock f75b7a5294 [PATCH] IB: Add automatic retries to MAD layer
Add automatic retries to MAD layer.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock df9f9ead74 [PATCH] IB: Add ib_coalesce_recv_mad to MAD
Add implementation for ib_coalesce_recv_mad.  Also, clear allocated MAD data
buffer in ib_create_send_mad.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock f68bcc2df8 [PATCH] IB: Minor cleanup during MAD startup and shutdown
Minor cleanup during startup and shutdown

Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock 6a0c435ef9 [PATCH] IB: Fix timeout/cancelled MAD handling
Fixes an issue processing a sent MAD after it has timed out or been canceled.
The race occurs when a response MAD matches with the send request.  The
request could time out or be canceled after the response MAD matches with the
request, but before the request completion can be processed.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock d760ce8f71 [PATCH] IB: Change ib_mad_send_wr_private struct
Have ib_mad_send_wr_private reference the private agent structure directly,
rather than the exposed agent definition.  Remove unneeded parameters to
functions and simplify code were possible from this change.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock f8197a4ed1 [PATCH] IB: Change saving of user's send wr_id in MAD
Move saving of user's send wr_id to better match layering of received response
handling.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:10 -07:00
Hal Rosenstock 4a0754fae8 [PATCH] IB: Combine some MAD routines
Combine response_mad() and solicited_mad() routines into a single function and
simplify/encapsulate its usage.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:09 -07:00
Hal Rosenstock 824c8ae7d0 [PATCH] IB: Add MAD helper functions
Add new helper routines for allocating MADs for sending and formatting a send
WR.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:09 -07:00
Hal Rosenstock b82cab6b33 [PATCH] IB: Update MAD client API
Automatically allocate a MR when registering a MAD agent.
MAD clients are modified to use this updated API.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:09 -07:00
Hal Rosenstock c183a4c335 [PATCH] IB: Update FMR functions
Change some functions to return void rather than an int since they are always
returning 0, thus making checking return values rather pointless.

Signed-off-by: Tom Duffy <tduffy@sun.com>
Signed-off-by: Libor Michalek <libor@topspin.com>
Signed-off-by: Hal Rosenstock <halr@voltaire.com>
Cc: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-27 16:26:09 -07:00
Michael S. Tsirkin 6d376756f2 [IB/mthca]: Use io_remap_pfn_range for PCI space
Use io_remap_pfn_range to remap IO pages (remap_pfn_range is for memory).

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-27 14:42:45 -07:00
Roland Dreier 2181858bb8 [IB/ipoib]: Fix unsigned comparisons to handle wraparound
Fix handling of tx_head/tx_tail comparisons to handle wraparound.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-27 14:41:32 -07:00
Gleb Natapov abdf119b4d [IB/uverbs]: Add O_ASYNC support
Add support for O_ASYNC notifications on userspace verbs
completion and asynchronous event file descriptors.

Signed-off-by: Gleb Natapov <glebn@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-27 14:40:00 -07:00
Roland Dreier 42b1806d5c [IB/mthca]: Fix error CQ entry handling on mem-free HCAs
Fix handling of error CQ entries on mem-free HCAs: the doorbell count
is never valid so we shouldn't look at it.  This fixes problems exposed
by new HCA firmware.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2005-07-27 14:38:49 -07:00
Roland Dreier 80c8ec2c04 [PATCH] IB uverbs: add mthca user QP support
Add support for userspace queue pairs (QPs) to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:50 -07:00
Roland Dreier 74c2174e7b [PATCH] IB uverbs: add mthca user CQ support
Add support for userspace completion queues (CQs) to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:50 -07:00
Roland Dreier 24d4281be0 [PATCH] IB uverbs: add mthca user MR support
Add support for userspace memory regions (MRs) to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier 99264c1ee2 [PATCH] IB uverbs: add mthca user PD support
Add support for userspace protection domains (PDs) to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier 53b8b3ffd5 [PATCH] IB uverbs: add mthca mmap support
Add support for mmap() method to mthca, so that userspace can get access to
doorbell registers.  This allows userspace to get direct access to the HCA for
data path operations.

Each userspace context gets its own copy of the doorbell registers and is only
allowed to use resources that the kernel has given it access to.  In other
words, this is safe.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier 5e0b537c7d [PATCH] IB uverbs: add mthca user context support
Add support for managing userspace contexts to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier 56483ec1b7 [PATCH] IB uverbs: add mthca user doorbell record support
Add support for userspace doorbell records to mthca.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier e95975e8b8 [PATCH] IB uverbs: add mthca ABI header
Add the mthca_user.h header file, which defines the device-specific ABI used
by the mthca low-level driver for kernel/user communication.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:49 -07:00
Roland Dreier 2d927d696c [PATCH] IB uverbs: hook up Kconfig/Makefile
Hook up InfiniBand userspace verbs to Kconfig and the make system.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00
Roland Dreier eb8ffbfed5 [PATCH] IB uverbs: memory pinning implementation
Add support for pinning userspace memory regions and returning a list of pages
in the region.  This includes tracking pinned memory against vm_locked and
preventing unprivileged users from exceeding RLIMIT_MEMLOCK.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00
Roland Dreier bc38a6abdd [PATCH] IB uverbs: core implementation
Add the core of the InfiniBand userspace verbs implementation, including
creating character device nodes, dispatching requests from userspace, and
passing event notifications back up to userspace.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00
Roland Dreier 8a96b3f9af [PATCH] IB uverbs: add user verbs ABI header
Add the ib_user_verbs.h header file, which defines the ABI used by InfiniBand
userspace verbs for kernel/user communication.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00
Roland Dreier 1cf296b66a [PATCH] IB uverbs: update mthca for new API
Update mthca to compile against the updated API for low-level drivers.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00
Roland Dreier b5e81bf5e7 [PATCH] IB uverbs: update kernel midlayer for new API
Update kernel InfiniBand midlayer to compile against the updated API for
low-level drivers.  This just amounts to passing NULL for all
userspace-related parameters, and setting userspace-related structure members
to NULL.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-07-07 18:23:48 -07:00