Commit Graph

205 Commits (ae7971a7706384ca373fb7e212fe195698e6c5a1)

Author SHA1 Message Date
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 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