History log of /drivers/infiniband/hw/mlx4/qp.c
Revision Date Author Comments
4ba6b8eaa9d67d03fb653cb8a13afca3236d4d70 09-Feb-2012 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Set bad_wr for invalid send opcode

If the opcode of a work request exceeds the range of valid opcodes,
return the pointer to the offending work request.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
9106c410697427363517ca6b4f463698aebc5f25 11-Dec-2011 Or Gerlitz <ogerlitz@mellanox.com> IB/mlx4: Fix SL to 802.1Q priority-bits mapping for IBoE

For IBoE, SLs 0-7 are mapped to Ethernet 802.1Q user priority bits
(pbits) which are part of the VLAN tag, SLs 8-15 are reserved.

Under Ethernet, the ConnectX firmware treats (decode/encode) the four
bit SL field in various constructs such as QPC / UD WQE / CQE as PPP0
and not as 0PPP. This correlates well to the fact that within the
vlan tag the pbits are located in bits 15-13 and not 12-14.

The current code wasn't consistent around that area - the
encoding was correct for the IBoE QPC.path.schedule_queue field,
but was wrong for IBoE CQEs and when MLX header was built.

These inconsistencies resulted in wrong SL <--> wire 802.1Q pbits
mapping, which is fixed by using SL <--> PPP0 all around the place.

Signed-off-by: Oren Duer <oren@mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
80a2dcd8d05c11d42f4e606d7a5f3eaa2794ab34 10-Oct-2011 Or Gerlitz <ogerlitz@mellanox.com> IB/mlx4: Don't set VLAN in IBoE WQEs' control segment

There's no need to set the vlan-related fields in an IBoE send WQE
control segment:

- the vlan to be used by a UD QP is set in the datagram segment.
- for GSI (CM) QP, all the headers down to 8021q and MAC are built by
the software anyway.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
0a1405da9952a72dd587829a3321695adde7dca1 02-Jun-2011 Sean Hefty <sean.hefty@intel.com> IB/mlx4: Add support for XRC QPs

Support the creation of XRC INI and TGT QPs. To handle the case where
a CQ or PD is not provided, we allocate them internally with the xrcd.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
cfcde11c3d7ae175f49280bb6f913478c2f1bd8c 15-Jun-2011 Or Gerlitz <ogerlitz@mellanox.com> IB/mlx4: Use flow counters on IBoE ports

Allocate flow counter per Ethernet/IBoE port, and attach this counter
to all the QPs created on that port. Based on patch by Eli Cohen
<eli@mellanox.co.il>.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.co.il>
Signed-off-by: Roland Dreier <roland@purestorage.com>
e27535b9c6e071d461be33b75a33047c9bb4c0ce 17-Nov-2010 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Fix memory ordering of VLAN insertion control bits

We must fully update the control segment before marking it as valid,
so that hardware doesn't start executing it before we're ready.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>

[ Move VLAN control bit setting to before wmb(). - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
4c3eb3ca13966508bcb64f39dcdef48be22f1731 26-Aug-2010 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Add VLAN support for IBoE

This patch allows IBoE traffic to be encapsulated in 802.1Q tagged
VLAN frames. The VLAN tag is encoded in the GID and derived from it
by a simple computation.

The netdev notifier callback is modified to catch VLAN device
addition/removal and the port's GID table is updated to reflect the
change, so that for each netdevice there is an entry in the GID table.
When the port's GID table is exhausted, GID entries will not be added.
Only children of the main interfaces can add to the GID table; if a
VLAN interface is added on another VLAN interface (e.g. "vconfig add
eth2.6 8"), then that interfaces will not add an entry to the GID
table.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
af7bd463761c6abd8ca8d831f9cc0ac19f3b7d4b 26-Aug-2010 Eli Cohen <eli@dev.mellanox.co.il> IB/core: Add VLAN support for IBoE

Add 802.1q VLAN support to IBoE. The VLAN tag is encoded within the
GID derived from a link local address in the following way:

GID[11] GID[12] contain the VLAN ID when the GID contains a VLAN.

The 3 bits user priority field of the packets are identical to the 3
bits of the SL.

In case of rdma_cm apps, the TOS field is used to generate the SL
field by doing a shift right of 5 bits effectively taking to 3 MS bits
of the TOS field.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
fa417f7b520ee60b39f7e23528d2030af30a07d1 25-Oct-2010 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Add support for IBoE

Add support for IBoE to mlx4_ib. The bulk of the code is handling the
new address vector fields; mlx4 needs the MAC address of a remote node
to include it in a WQE (for datagrams) or in the QP context (for
connected QPs). Address resolution is done by assuming all unicast
GIDs are either link-local IPv6 addresses.

Multicast group attach/detach needs to update the NIC's multicast
filters; but since attaching a QP to a multicast group can be done
before the QP is bound to a port, for IBoE we need to keep track of
all multicast groups that a QP is attached too before it transitions
from INIT to RTR (since it does not have a port in the INIT state).

Signed-off-by: Eli Cohen <eli@mellanox.co.il>

[ Many things cleaned up and otherwise monkeyed with; hope I didn't
introduce too many bugs. - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
ff7f5aab354dee01f29c9c00933f6d4aa590eadb 26-Aug-2010 Eli Cohen <eli@dev.mellanox.co.il> IB/pack: IBoE UD packet packing support

Add support for packing IBoE packet headers.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>

[ Clean up and fix ib_ud_header_init() a bit. - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
6fa8f719844b8455033e295f720e739c1dc3804a 14-Apr-2010 Vladimir Sokolovsky <vlad@mellanox.co.il> IB/mlx4: Add support for masked atomic operations

Add support for masked atomic operations (masked compare and swap,
masked fetch and add).

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
920d706c892e8f8cfff95f46aeb95fc6344f0bd5 08-Feb-2010 Eli Cohen <eli@mellanox.co.il> IB/core: Fix and clean up ib_ud_header_init()

ib_ud_header_init() first clears header and then fills up the various
fields. Later on, it tests header->immediate_present, which it has
already cleared, so the condition is always false. Fix this by adding
an immediate_present parameter and setting header->immediate_present
as is done with grh_present. Also remove unused calculation of
header_len.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
a478868a1b891da8f3c67c1b933e870df89dca80 27-Jan-2010 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Simplify retrieval of ib_device

struct ib_qp already holds a pointer to the ib device. No need to dive to the
hw device object to retrieve it.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2b946077423270f065013c45d78522a5fb9542ca 06-Jan-2010 Or Gerlitz <ogerlitz@voltaire.com> IB/mlx4: Fix queue overflow check in post_recv

In mlx4_ib_post_recv(), we should check the queue for overflow using
recv_cq instead of send_cq (current code looks like a copy-and-paste
mistake).

Signed-off-by: Or Gerlitz <ogerlitz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
af901ca181d92aac3a7dc265144a9081a86d8f39 14-Nov-2009 André Goddard Rosa <andre.goddard@gmail.com> tree-wide: fix assorted typos all over the place

That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
417608c20a4c8397bc5307d949ec01ea0a0dd8e5 12-Nov-2009 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Remove limitation on LSO header size

Current code has a limitation: an LSO header is not allowed to cross a
64 byte boundary. This patch removes this limitation by setting the
WQE RR for large headers thus allowing LSO headers of any size. The
extra buffer reserved for MLX4_IB_QP_LSO QPs has been doubled, from 64
to 128 bytes, assuming this is reasonable upper limit for header
length. Also, this patch will cause IB_DEVICE_UD_TSO to be set only
for HCA FW versions that set MLX4_DEV_CAP_FLAG_BLH; e.g. FW version
2.6.000 and higher.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
ecdc428e4c5d821a07baf4f8b1718faf67b9026f 12-Nov-2009 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Remove unneeded code

There is no such flag DE - the field is reserved and should be zero.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
338a8fad27908f64a0d249cc9f5c7d4ddb7e5684 06-Sep-2009 Roland Dreier <rolandd@cisco.com> IB/mlx4: Annotate CQ locking

mlx4_ib_lock_cqs()/mlx4_ib_unlock_cqs() are helper functions that
lock/unlock both CQs attached to a QP in the proper order to avoid
AB-BA deadlocks. Annotate this so sparse can understand what's going
on (and warn us if we misuse these functions).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2ac6bf4ddc87c3b6b609f8fa82f6ebbffeac12f4 05-Jun-2009 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Add strong ordering to local inval and fast reg work requests

The ConnectX Programmer's Reference Manual states that the "SO" bit
must be set when posting Fast Register and Local Invalidate send work
requests. When this bit is set, the work request will be executed
only after all previous work requests on the send queue have been
executed. (If the bit is not set, Fast Register and Local Invalidate
WQEs may begin execution too early, which violates the defined
semantics for these operations)

This fixes the issue with NFS/RDMA reported in
<http://lists.openfabrics.org/pipermail/general/2009-April/059253.html>

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Cc: <stable@kernel.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2b6b7d4be487bada8c727df829c25068c7b5e5a3 08-May-2009 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Don't overwrite fast registration page list when posting work request

The low-level mlx4 driver modified the page-list addresses for fast
register work requests post send to big-endian, and set a "present"
bit. This caused problems later when the consumer attempted to unmap
the pages using the page-list (using the list addresses which were
assumed to be still in CPU-endian order). Fix the mlx4 driver to
allocate two buffers and use a private buffer for the hardware-format
bus addresses.

This patch fixes <https://bugs.openfabrics.org/show_bug.cgi?id=1571>,
an NFS/RDMA server crash. The cause of the crash was found by Vu Pham
of Mellanox. The fix is along the lines suggested by Steve Wise in
comment #21 in bug 1571.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9c3da0991754d480328eeaa2b90cb231a1cea9b6 18-Jan-2009 Harvey Harrison <harvey.harrison@gmail.com> IB: Remove __constant_{endian} uses

The base versions handle constant folding just fine, use them
directly. The replacements are OK in the include/ files as they are
not exported to userspace so we don't need the __ prefixed versions.

This patch does not affect code generation at all.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0fd7e1d8559f45a6838cee93ea49adc0c5bda8f0 16-Jan-2009 Roland Dreier <rolandd@cisco.com> IB/mlx4: Fix memory ordering problem when posting LSO sends

The current work request posting code writes the LSO segment before
writing any data segments. This leaves a window where the LSO segment
overwrites the stamping in one cacheline that the HCA prefetches
before the rest of the cacheline is filled with the correct data
segments. When the HCA processes this work request, a local
protection error may result.

Fix this by saving the LSO header size field off and writing it only
after all data segments are written. This fix is a cleaned-up version
of a patch from Jack Morgenstein <jackm@dev.mellanox.co.il>.

This fixes <https://bugs.openfabrics.org/show_bug.cgi?id=1383>.

Reported-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
a3cdcbfa8fb1fccfe48d359da86e99546610c562 10-Oct-2008 Yevgeny Petrilin <yevgenyp@mellanox.co.il> mlx4_core: Add QP range reservation support

To allow allocating an aligned range of consecutive QP numbers, add an
interface to reserve an aligned range of QP numbers and have the QP
allocation function always take a QP number.

This will be used for RSS support in the mlx4_en Ethernet driver and
also potentially by IPoIB RSS support.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
d57f5f72df1b0da501c4b55e56a1040b1631c1f3 09-Oct-2008 Vladimir Sokolovsky <vlad@mellanox.co.il> IB/mlx4: Set RLKEY bit for kernel QPs

Set RLKEY bit in the HW context for kernel QPs so that kernel QPs can
use the reserved L_Key for memory reference.

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
29bdc88384c2b24e37e5760df0dc898546083d6b 15-Sep-2008 Vladimir Sokolovsky <vlad@mellanox.co.il> IB/mlx4: Fix up fast register page list format

Byte swap the addresses in the page list for fast register work requests
to big endian to match what the HCA expectx. Also, the addresses must
have the "present" bit set so that the HCA knows it can access them.
Otherwise the HCA will fault the first time it accesses the memory
region.

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
6e0d733d921526e628107fb8b1aff5f7de870d6f 07-Aug-2008 Alex Naslednikov <xalex@mellanox.co.il> IB/mlx4: Allow 4K messages for UD QPs

Current code limits the max message size to 2K for UD QPs, while MTU
might be as big as 4K. This patch sets the maximum message size to
4K, which is needed for UD to work correctly on fabrics with a 4K MTU.

Signed-off-by: Alex Naslednikov <xalex@mellanox.co.il>
Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
51a379d0c8f7a6db7c9e3c9c770d90a6d2d1ef9b 25-Jul-2008 Jack Morgenstein <jackm@dev.mellanox.co.il> mlx4: Update/add Mellanox Technologies copyright lines to mlx4 driver files

Update existing Mellanox copyright lines to 2008, and add such lines
to files where they are missing.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
95d04f0735b4fc837bff9aedcc3f3efb20ddc3d1 23-Jul-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Add support for memory management extensions and local DMA L_Key

Add support for the following operations to mlx4 when device firmware
supports them:

- Send with invalidate and local invalidate send queue work requests;
- Allocate/free fast register MRs;
- Allocate/free fast register MR page lists;
- Fast register MR send queue work requests;
- Local DMA L_Key.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
47b374752aed1c029f995473c7c463ee3ae5fbaa 22-Jul-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Rename struct mlx4_lso_seg to mlx4_wqe_lso_seg

Make the struct name consistent with other WQE segment struct types
defined in <linux/mlx4/qp.h>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
f507d28bff0601f1a8a96b7939fa3855c50d25b6 15-Jul-2008 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Use kzalloc() for new QPs so flags are initialized to 0

Current code uses kmalloc() and then just does a bitwise OR operation on
qp->flags in create_qp_common(), which means that qp->flags may
potentially have some unintended bits set. This patch uses kzalloc()
and avoids further explicit clearing of structure members, which also
shrinks the code:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-65 (-65)
function old new delta
create_qp_common 2024 1959 -65

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
521e575b9a7324a0bca762622139f69582a042bf 15-Jul-2008 Ron Livne <ronli@voltaire.com> IB/mlx4: Add support for blocking multicast loopback packets

Add support for handling the IB_QP_CREATE_MULTICAST_BLOCK_LOOPBACK
flag by using the per-multicast group loopback blocking feature of
mlx4 hardware.

Signed-off-by: Ron Livne <ronli@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
7c27f358209a8ce7c57b584346d7b611e823f1b1 15-Jul-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Remove extra code for RESET->ERR QP state transition

Commit 65adfa91 ("IB/mlx4: Fix RESET to RESET and RESET to ERROR
transitions") added some extra code to handle a QP state transition
from RESET to ERROR. However, the latest 1.2.1 version of the IB spec
has clarified that this transition is actually not allowed, so we can
remove this extra code again.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
d1f2cd895f8733faa9d79d09d825a2ed80002ac7 15-Jul-2008 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Configure QPs' max message size based on real device capability

ConnectX returns the max message size it supports through the
QUERY_DEV_CAP firmware command. When modifying a QP to RTR, the max
message size for the QP must be specified. This value must not exceed
the value declared through QUERY_DEV_CAP. The current code ignores
the max allowed size and unconditionally sets the value to 2^31. This
patch sets all QPs to the max value allowed as returned from firmware.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
9670e553915e67fb68f13258644342c68dc26b84 15-Jul-2008 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Optimize QP stamping

The idea is that for QPs with fixed size work requests (eg selective
signaling QPs), before stamping the WQE, we read the value of the DS
field, which gives the effective size of the descriptor as used in the
previous post. Then we stamp only that area, since the rest of the
descriptor is already stamped.

When initializing the send queue buffer, make sure the DS field is
initialized to the max descriptor size so that the subsequent stamping
will be done on the entire descriptor area.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
cd155c1c7c9e64df6afb5504d292fef7cb783a4f 20-May-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Fix creation of kernel QP with max number of send s/g entries

When creating a kernel QP where the consumer asked for a send queue
with lots of scatter/gater entries, set_kernel_sq_size() incorrectly
returned an error if the send queue stride is larger than the
hardware's maximum send work request descriptor size. This is not a
problem; the only issue is to make sure that the actual descriptors
used do not overflow the maximum descriptor size, so check this instead.

Clamp the returned max_send_sge value to be no bigger than what
query_device returns for the max_sge to avoid confusing hapless users,
even if the hardware is capable of handling a few more s/g entries.

This bug caused NFS/RDMA mounts to fail when the server adapter used
the mlx4 driver.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
a3d8e1591dc90d359d444c759dfda2c6fc605251 16-May-2008 Andrew Morton <akpm@linux-foundation.org> IB/mlx4: Fix uninitialized-var warning in mlx4_ib_post_send()

drivers/infiniband/hw/mlx4/qp.c: In function 'mlx4_ib_post_send':
drivers/infiniband/hw/mlx4/qp.c:1460: warning: 'seglen' may be used uninitialized in this function

This is the dopey gcc-doesn't-know-that-foo(&var)-writes-to-var problem.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
cb9fbc5c37b69ac584e61d449cfd590f5ae1f90d 29-Apr-2008 Arthur Kepner <akepner@sgi.com> IB: expand ib_umem_get() prototype

Add a new parameter, dmasync, to the ib_umem_get() prototype. Use dmasync = 1
when mapping user-allocated CQs with ib_umem_get().

Signed-off-by: Arthur Kepner <akepner@sgi.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Jes Sorensen <jes@sgi.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: David Miller <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6296883ca4cd52dafb45f191d24102e28ded38f2 23-Apr-2008 Yevgeny Petrilin <yevgenyp@mellanox.co.il> mlx4_core: Move kernel doorbell management into core

In addition to mlx4_ib, there will be ethernet and FC consumers of
mlx4_core, so move the code for managing kernel doorbells into the
core module to avoid having to duplicate this multiple times.

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0df67030958bad07c3f82f392e3ffb785c56e48d 17-Apr-2008 Dotan Barak <dotanb@dev.mellanox.co.il> IB/mlx4: Update QP state if query QP succeeds

If the QP was moved to another state (such as SQE) by the hardware,
then after this change the user won't have to set the IBV_QP_CUR_STATE
mask in order to execute modify QP in order to recover from this state.

Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0f39cf3d54e67a705773fd0ec56ca3dcd3e9272f 17-Apr-2008 Roland Dreier <rolandd@cisco.com> IB/core: Add support for "send with invalidate" work requests

Add a new IB_WR_SEND_WITH_INV send opcode that can be used to mark a
"send with invalidate" work request as defined in the iWARP verbs and
the InfiniBand base memory management extensions. Also put "imm_data"
and a new "invalidate_rkey" member in a new "ex" union in struct
ib_send_wr. The invalidate_rkey member can be used to pass in an
R_Key/STag to be invalidated. Add this new union to struct
ib_uverbs_send_wr. Add code to copy the invalidate_rkey field in
ib_uverbs_post_send().

Fix up low-level drivers to deal with the change to struct ib_send_wr,
and just remove the imm_data initialization from net/sunrpc/xprtrdma/,
since that code never does any send with immediate operations.

Also, move the existing IB_DEVICE_SEND_W_INV flag to a new bit, since
the iWARP drivers currently in the tree set the bit. The amso1100
driver at least will silently fail to honor the IB_SEND_INVALIDATE bit
if passed in as part of userspace send requests (since it does not
implement kernel bypass work request queueing). Remove the flag from
all existing drivers that set it until we know which ones are OK.

The values chosen for the new flag is not consecutive to avoid clashing
with flags defined in the XRC patches, which are not merged yet but
which are already in use and are likely to be merged soon.

This resurrects a patch sent long ago by Mikkel Hagen <mhagen@iol.unh.edu>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
f438000f7a31fad7cfd27f33ad324a250f4cd2df 17-Apr-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Micro-optimize mlx4_ib_post_send()

Rather than have build_mlx_header() return a negative value on failure
and the length of the segments it builds on success, add a pointer
parameter to return the length and return 0 on success. This matches
the calling convention used for build_lso_seg() and generates slightly
smaller code -- eg, on 64-bit x86:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-22 (-22)
function old new delta
mlx4_ib_post_send 2023 2001 -22

Signed-off-by: Roland Dreier <rolandd@cisco.com>
b832be1e4007f4a54954ec68bd865ff05d6babca 17-Apr-2008 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Add IPoIB LSO support

Add TSO support to the mlx4_ib driver.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
b846f25aa2a353355aec5202fe4dbdc6674dfc64 17-Apr-2008 Eli Cohen <eli@dev.mellanox.co.il> IB/core: Add creation flags to struct ib_qp_init_attr

Add a create_flags member to struct ib_qp_init_attr that will allow a
kernel verbs consumer to create a pass special flags when creating a QP.
Add a flag value for telling low-level drivers that a QP will be used
for IPoIB UD LSO. The create_flags member will also be useful for XRC
and ehca low-latency QP support.

Since no create_flags handling is implemented yet, add code to all
low-level drivers to return -EINVAL if create_flags is non-zero.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
8ff095ec4bce7be943beff3b330562e2f0e42167 17-Apr-2008 Eli Cohen <eli@dev.mellanox.co.il> IB/mlx4: Add IPoIB checksum offload support

ConnectX devices support checksum generation and verification of TCP
and UDP packets for UD IPoIB messages. This patch checks if the HCA
supports this and sets the IB_DEVICE_UD_IP_CSUM capability flag if it
does. It implements support for handling the IB_SEND_IP_CSUM send
flag and setting the csum_ok field in receive work completions.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Ali Ayub <ali@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
d2ae16d576086bd3e539f4e94f95df4e37ea2419 17-Apr-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Endianness annotations

Trivial fixes to stamp_send_wqe().

Signed-off-by: Roland Dreier <rolandd@cisco.com>
ea54b10c7773007e173da31fe7adcc049da33331 28-Jan-2008 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Use multiple WQ blocks to post smaller send WQEs

ConnectX HCA supports shrinking WQEs, so that a single work request
can be made of multiple units of wqe_shift. This way, WRs can differ
in size, and do not have to be a power of 2 in size, saving memory and
speeding up send WR posting. Unfortunately, if we do this then the
wqe_index field in CQEs can't be used to look up the WR ID anymore, so
our implementation does this only if selective signaling is off.

Further, on 32-bit platforms, we can't use vmap() to make the QP
buffer virtually contigious. Thus we have to use constant-sized WRs to
make sure a WR is always fully within a single page-sized chunk.

Finally, we use WRs with the NOP opcode to avoid wrapping around the
queue buffer in the middle of posting a WR, and we set the
NoErrorCompletion bit to avoid getting completions with error for NOP
WRs. However, NEC is only supported starting with firmware 2.2.232,
so we use constant-sized WRs for older firmware. And, since MLX QPs
only support SEND, we use constant-sized WRs in this case.

When stamping during NOP posting, do stamping following setting of the
NOP WQE valid bit.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
1c69fc2a9012e160c8d459f63df74a6b01db8322 07-Feb-2008 Roland Dreier <rolandd@cisco.com> IB/mlx4: Consolidate code to get an entry from a struct mlx4_buf

We use struct mlx4_buf for kernel QP, CQ and SRQ buffers, and the code
to look up an entry is duplicated in get_cqe_from_buf() and the QP and
SRQ versions of get_wqe(). Factor this out into mlx4_buf_offset().

This will also make it easier to switch over to using vmap() for buffers.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
96db0e0335c7981911bd7efc5c79e82d2358c0fc 30-Oct-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Lock SQ lock in mlx4_ib_post_send()

Because of a typo, mlx4_ib_post_send() takes the same lock rq.lock as
mlx4_ib_post_recv(). Correct the code so the intended sq.lock is
taken when posting a send.

Noticed by Yossi Leybovitch and pointed out by Jack Morgenstein from
Mellanox.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
839041329fd3410e07d614f81e75bb43367d8f89 18-Oct-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Sanity check userspace send queue sizes

Add sanity checks to send queue sizes passed in from userspace. The
minimum sq stride value below is taken from the MT25408 PRM (section
11.10, Table 306, log_sq_stride definition).

Without this check, userspace can submit arbitrarily large/small
values for the number of WQEs and the stride, which can crash the
kernel.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
2242fa4f04d670f02efb43ec537d677edc220880 10-Oct-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Use __set_data_seg() in mlx4_ib_post_recv()

Use a __set_data_seg() helper in mlx4_ib_post_recv() too; in addition
to making the code easier to read, this also allows gcc to generate
better code -- on x86_64:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8 (-8)
function old new delta
mlx4_ib_post_recv 359 351 -8

Signed-off-by: Roland Dreier <rolandd@cisco.com>
6e694ea33e7a7fad908d188c46f441f04fb633d4 19-Sep-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Fix data corruption triggered by wrong headroom marking order

This is an addendum to commit 0e6e7416 ("IB/mlx4: Handle new FW
requirement for send request prefetching"). We also need to handle
prefetch marking properly for S/G segments, or else the HCA may end up
processing S/G segments that are not fully written and end up sending
the wrong data. This can actually cause data corruption in practice,
especially on systems with relatively slow CPUs (where the HCA is more
likely to prefetch while the CPU is in the middle of writing a work
request into memory).

We write S/G segments in reverse order into the WQE, in order to
guarantee that the first dword of all cachelines containing S/G
segments is written last (overwriting the headroom invalidation
pattern). The entire cacheline will thus contain valid data when the
invalidation pattern is overwritten.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e0f5d99e8dec3f157d3fff96c1e6a8b4abd24050 29-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Whitespace fix

Remove extra dumb-looking blank line that snuck in somehow.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
23f1b38481596ad77e5f51562977b12c8418eee3 21-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Fix error path in create_qp_common()

The error handling code at err_wrid in create_qp_common() does not
handle a userspace QP attached to an SRQ correctly, since it ends up
in the else clause of the if statement. This means it tries to
kfree() the uninitialized qp->sq.wrid and qp->rq.wrid pointers. Fix
this so we only free the wrid arrays for kernel QPs.

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

Signed-off-by: Roland Dreier <rolandd@cisco.com>
f5b404317b79823ec643dfbb71d62f65a48cc178 19-Jul-2007 Florin Malita <fmalita@gmail.com> IB/mlx4: Fix leaks in __mlx4_ib_modify_qp

Temporarily allocated struct mlx4_qp_context *context is leaked by
several error paths. The patch takes advantage of the return value
'err' being preinitialized to -EINVAL.

Spotted by Coverity (CID 1768).

Signed-off-by: Florin Malita <fmalita@gmail.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
0fbfa6a9062c71b62ec216c0294b676b76e41661 18-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Factor out setting other WQE segments

Factor code to set remote address, atomic and datagram segments out of
mlx4_ib_post_send() into small helper functions. This doesn't change
the generated code in any significant way, and makes the source easier
on the eyes.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
d420d9e32f4bd741b2f0b7227a91941107f96b47 18-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Factor out setting WQE data segment entries

Factor code to set data segment entries out of mlx4_ib_post_send()
into set_data_seg(). This cleans up the code and lets the compiler do
a better job -- on x86_64:

add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16)
function old new delta
mlx4_ib_post_send 1598 1582 -16

Signed-off-by: Roland Dreier <rolandd@cisco.com>
7f5eb9bb8c7fb3bd411674b856872d7ab4a7b1a3 18-Jul-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Return receive queue sizes for userspace QPs from query QP

Return the receive queue sizes for both userspace QPs and kernel Qps
(not just kernel QPs) from mlx4_ib_query_qp(). Also zero the send
queue sizes for userspace QPs to avoid a possible information leak,
and set the max_inline_data for kernel QPs to 0 since inline sends are
not supported for kernel QPs.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
8fcea95a2a15444d5cc4bee174bb12233aa0a2aa 15-Jul-2007 Dotan Barak <dotanb@dev.mellanox.co.il> IB/mlx4: Take sizeof the correct pointer in call to memset()

When clearing the ib_ah_attr parameter in to_ib_ah_attr(), use sizeof
*ib_ah_attr instead of sizeof *path. This is the same bug as was
fixed for mthca in 99d4f22e ("IB/mthca: Use correct structure size in
call to memset()"), but the code was cut and pasted into mlx4 before the
fix was merged.

Signed-off-by: Dotan Barak <dotanb@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
1c27cb71aa7d86df0271caadfcc196a0518f5e33 18-Jul-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Fix port returned from query QP for QPs in INIT state

When a QP is in the INIT state, the sched_queue field hasn't been given
to the firmware yet, so the firmware cannot return the value when the QP
is queried. To handle this, use the port number that is saved in the
driver's QP data structure.

Found by Dotan Barak and Yaron Gepstein of Mellanox.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
586bb586ae59c473393c09291e86042d263c3ddd 18-Jul-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Fix flow label returned from query QP

Correct the mask used to get the flow label, since the field is 20 bits,
not 24 bits.

Found by Dotan Barak and Yaron Gepstein of Mellanox.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
6a775e2ba4f7635849ade628e64723ab2beef0bc 20-Jun-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Implement query QP

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
e61ef2416b0b92828512b6cfcd0104a02b6431fe 18-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Make sure inline data segments don't cross a 64 byte boundary

Inline data segments in send WQEs are not allowed to cross a 64 byte
boundary. We use inline data segments to hold the UD headers for MLX
QPs (QP0 and QP1). A send with GRH on QP1 will have a UD header that
is too big to fit in a single inline data segment without crossing a
64 byte boundary, so split the header into two inline data segments.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
5ae2a7a836be660ff1621cce1c46930f19200589 18-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Handle FW command interface rev 3

Upcoming firmware introduces command interface revision 3, which
changes the way port capabilities are queried and set. Update the
driver to handle both the new and old command interfaces by adding a
new MLX4_FLAG_OLD_PORT_CMDS that it is set after querying the firmware
interface revision and then using the correct interface based on the
setting of the flag.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
54e95f8dcbd7d86f79b423e8d11053ec9a2d9946 18-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Get rid of max_inline_data calculation

The calculation of max_inline_data in set_kernel_sq_size() is bogus,
since it doesn't take into account the fact that inline segments may
not cross a 64-byte boundary, and hence multiple inline segments will
probably need to be used to post large inline sends.

We don't support inline sends for kernel QPs anyway, so there's no
point in doing this calculation anyway, since the field is just zeroed
out a little later. So just delete the bogus calculation.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
0e6e74162164d908edf7889ac66dca09e7505745 18-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Handle new FW requirement for send request prefetching

New ConnectX firmware introduces FW command interface revision 2,
which requires that for each QP, a chunk of send queue entries (the
"headroom") is kept marked as invalid, so that the HCA doesn't get
confused if it prefetches entries that haven't been posted yet. Add
code to the driver to do this, and also update the user ABI so that
userspace can request that the prefetcher be turned off for userspace
QPs (we just leave the prefetcher on for all kernel QPs).

Unfortunately, marking send queue entries this way is confuses older
firmware, so we change the driver to allow only FW command interface
revisions 2. This means that users will have to update their firmware
to work with the new driver, but the firmware is changing quickly and
the old firmware has lots of other bugs anyway, so this shouldn't be too
big a deal.

Based on a patch from Jack Morgenstein <jackm@dev.mellanox.co.il>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
42c059ea2b0aac5f961253ba81c1b464d181a600 12-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Fix warning in rounding up queue sizes

Doing max(1, foo) where foo is u32 generates a warning, because 1 is a
signed constant. Fix this by using 1U instead.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
a4cd7ed86ff511aebcc97675937039f2321d6987 08-Jun-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Make sure RQ allocation is always valid

QPs attached to an SRQ must never have their own RQ, and QPs not
attached to SRQs must have an RQ with at least 1 entry. Enforce all
of this in set_rq_size().

Based on a patch by Eli Cohen <eli@mellanox.co.il>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
57f01b53398baebd809e7efd49fc10c10174b46d 06-Jun-2007 Jack Morgenstein <jackm@dev.mellanox.co.il> IB/mlx4: Fix zeroing of rnr_retry value in ib_modify_qp()

The code in __mlx4_ib_modify_qp() overwrites context->params1 after
the RNR retry parameter is ORed in, which results in the RNR retry
parameter always being set to 0. Fix this by moving where we OR in
the value to later in the function, after the initial assignment of
context->params1.

Found by the Mellanox firmware group.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
c0be5fb5f835110652911ea8b88ad78f841e5b45 24-May-2007 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Initialize send queue entry ownership bits

We need to initialize the owner bit of send queue WQEs to hardware
ownership whenever the QP is modified from reset to init, not just
when the QP is first allocated. This avoids having the hardware
process stale WQEs when the QP is moved to reset but not destroyed and
then modified to init again.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
02d89b87081f516ad3993637f9b75db0d9786554 24-May-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Don't allocate RQ doorbell if using SRQ

If a QP is attached to a shared receive queue (SRQ), then it doesn't
have a receive queue (RQ). So don't allocate an RQ doorbell (or map a
doorbell from userspace for userspace QPs) for that QP.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
2446304dd687488c054d0437f2aeef1ef2bfbd02 17-May-2007 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Pass send queue sizes from userspace to kernel

Pass the number of WQEs for the send queue and their size from userspace
to the kernel to avoid having to keep the QP size calculations in sync
between the kernel driver and libmlx4. This fixes a bug seen with the
current mlx4_ib driver and current libmlx4 caused by a difference in the
calculated sizes for SQ WQEs. Also, this gives more flexibility for
userspace to experiment with using multiple WQE BBs for a single SQ WQE.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
59b0ed121297b57abb2352bdc8313959e7cb5635 19-May-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Fix check of opcode in mlx4_ib_post_send()

wr->opcode is invalid if it's >= ARRAY_SIZE(mlx4_ib_opcode), not just
strictly >.

This was spotted by the Coverity checker (CID 1643).

Signed-off-by: Roland Dreier <rolandd@cisco.com>
65adfa911a3522c1e40e55afd472dd571dc2431b 14-May-2007 Michael S. Tsirkin <mst@dev.mellanox.co.il> IB/mlx4: Fix RESET to RESET and RESET to ERROR transitions

According to the IB spec, a QP can be moved from RESET back to RESET
or to the ERROR state, but mlx4 firmware does not support this and
returns an error if we try. Fix the RESET to RESET transition by
just returning 0 without doing anything, and fix RESET to ERROR by
moving the QP from RESET to INIT with dummy parameters and then
transitioning from INIT to ERROR.

Signed-off-by: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
1526130351b31c792ced90c6c5ee08df955696c1 19-May-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Set GRH:HopLimit when sending globally routed MADs

This is the same issue discovered in mthca by Rolf Manderscheid
<rvm@obsidianresearch.com>.

Signed-off-by: Roland Dreier <rolandd@cisco.com>
1f8f7b7a7b885a0041a21b3d93c507269baf57c8 17-May-2007 Eli Cohen <eli@mellanox.co.il> IB/mlx4: Fix check of max_qp_dest_rdma in modify QP

max_qp_dest_rdma is already in natural units - no need to shift. This
was discovered by a test that deliberately requests more outstanding
atomic operation than the device supports.

Found by Sagi Rotem at Mellanox.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
225c7b1feef1b41170f7037a5b10a65cd8a42c54 09-May-2007 Roland Dreier <rolandd@cisco.com> IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters

Add an InfiniBand driver for Mellanox ConnectX adapters. Because
these adapters can also be used as ethernet NICs and Fibre Channel
HBAs, the driver is split into two modules:

mlx4_core: Handles low-level things like device initialization and
processing firmware commands. Also controls resource allocation
so that the InfiniBand, ethernet and FC functions can share a
device without stepping on each other.

mlx4_ib: Handles InfiniBand-specific things; plugs into the
InfiniBand midlayer.

Signed-off-by: Roland Dreier <rolandd@cisco.com>