]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
9 years agomlx4_core: Introduce restrictions for PD update
Ajaykumar Hotchandani [Wed, 14 Oct 2015 23:38:11 +0000 (16:38 -0700)]
mlx4_core: Introduce restrictions for PD update

From 2.31.5350 firmware onwards,
- RDS with RDMA data transfer stopped working.
- Mellanox has introduced limitations related to PD updates.
  These imposed limitations are inline with PRM.

This patch makes driver in sync with these imposed limitations.
Mellanox R&D has approved this patch.

It's been tested on both old firmware (2.11.1280) and new firmware.

Mellanox case number is 179121.
OraBug: 22022389

v2: Change subject as per suggestion from Yuval

Tested-by: Pierre Orzechowski <pierre.e.orzechowski@oracle.com>
Tested-by: Kushagra Misra <kushagra.misra@oracle.com>
Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Qing Huang <qing.huang@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib_sdp/cma: readd SDP support to cma_save_net_info
Qing Huang [Sat, 26 Sep 2015 00:47:19 +0000 (17:47 -0700)]
ib_sdp/cma: readd SDP support to cma_save_net_info

Upstream has removed SDP support from cma.c. Some applications may
not display addr/port information correctly without this change to
cma_save_net_info() function.

Signed-off-by: Qing Huang <qing.huang@oracle.com>
9 years agomlx4_ib: Memory leak on Dom0 with SRIOV.
Venkat Venkatsubra [Thu, 17 Sep 2015 20:16:12 +0000 (13:16 -0700)]
mlx4_ib: Memory leak on Dom0 with SRIOV.

There are many scenarios when (using SR-IOV) the connection setup
tunneled from the VM through Dom0 fails for reasons such as the peer
silently dropping the connection requests due to its listener queue being
full or sends back a reject because there is no listener, the id_map_entry
is not freed on the Dom0 causing memory leak.

During testing we encountered a softlockup with multiple CPUs stuck
waiting for sriov->id_map_lock while id_map_ent_timeout was holding it for
a long time. Changing spin_lock(&sriov->id_map_lock) in id_map_ent_timeout
to spin_lock_irqsave resolved this hang.

Orabug: 21675211

Acked-by: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Signed-off-by: Venkat Venkatsubra <venkat.x.venkatsubra@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib_core: Usermode FMR config params
Dotan Barak [Wed, 11 Jul 2012 12:14:40 +0000 (15:14 +0300)]
ib_core: Usermode FMR config params

Orabug: 21517998

Signed-off-by: Arun Kaimalettu <gotoarunk@gmail.com>
(Ported from UEK2/Mellanox OFED1.5.5R2)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib_core: User mode FMR fixes 2012-06-11
Dotan Barak [Wed, 11 Jul 2012 09:45:12 +0000 (03:45 -0600)]
ib_core: User mode FMR fixes 2012-06-11

Orabug: 21517998

Signed-off-by: Arun Kaimalettu <gotoarunk@gmail.com>
(Ported from UEK2/Mellanox OFED 1.5.5R2)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib/srp: Enable usermode FMR
Dotan Barak [Wed, 22 Feb 2012 13:00:21 +0000 (15:00 +0200)]
ib/srp: Enable usermode FMR

Orabug: 21517998

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
(Ported from UEK2/Mellanox OFED1.5.5R2)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib/iser: Enable usermode FMR
Dotan Barak [Wed, 22 Feb 2012 12:59:18 +0000 (14:59 +0200)]
ib/iser: Enable usermode FMR

Orabug: 21517998

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
(Ported from UEK2/Mellanox OFED 1.5.5R2)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib/mlx4: Enable usermode FMR
Dotan Barak [Wed, 22 Feb 2012 12:27:55 +0000 (14:27 +0200)]
ib/mlx4: Enable usermode FMR

Orabug: 21517998

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
(Ported from UEK2/Mellanox OFED 1.5.5R2)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib/core: Enable usermode FMR
Dotan Barak [Wed, 22 Feb 2012 12:23:21 +0000 (14:23 +0200)]
ib/core: Enable usermode FMR

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
(Ported from UEK2/OFED 1.5.5)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoib/core: init shared-pd ref count to 1, and add cleanup
Arun Kaimalettu [Mon, 18 Jul 2011 12:21:34 +0000 (15:21 +0300)]
ib/core: init shared-pd ref count to 1, and add cleanup

When shpd is created it is already referred to by parent 'pd',
so shpd->shared should be '1' initially (and not '0');
otherwise, the 'shpd' memory may get freed/reallocated
while it is still being referred to by one last pd.

Additionally, add shared-pd cleanup to ucontext cleanup flow.

Orabug: 21496696

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from UEK2/OFED 1.5.5)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agoIB/Shared PD support from Oracle
Eli Cohen [Sun, 5 Jun 2011 12:36:46 +0000 (15:36 +0300)]
IB/Shared PD support from Oracle

Orabug: 21496696

Signed-off-by: Arun Kaimalettu <arun.kaimalettu@oracle.com>
Signed-off-by: Eli Cohen <eli@mellanox.co.il>
(Ported from UEK2/OFED 1.5.5)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
9 years agonet/mlx4_vnic: Initialize new fields of mlx4_ib_qp
Yuval Shaia [Sun, 16 Aug 2015 04:00:45 +0000 (21:00 -0700)]
net/mlx4_vnic: Initialize new fields of mlx4_ib_qp

Initializing the three new mlx4_ib_qp's fields - qps_list, cq_recv_list
and cq_send_list.
w/o initializing these new fields, kernel crashed in destroy_qp_common
when trying to remove them from the list.
The functions get_cqs, mlx4_ib_lock_cqs and mlx4_ib_unlock_cqs moved as
inline functions to mlx4_ib.h so it can be called also from mlx4_vnic.

Orabug: 21530835

Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
9 years agomlx4_vnic: Skip fip discover restart if pkey index not changed
Yuval Shaia [Sun, 1 Feb 2015 00:53:26 +0000 (16:53 -0800)]
mlx4_vnic: Skip fip discover restart if pkey index not changed

Driver receives MAD on any change made to partition table.
This fix aim to cover the case where driver shouldn't restart net interface
when receiving PKEY_CHANGE event but pkey index was not changed.

Ported from UEK3 commit: 7f56a9b2252e732b0d9e2621303b0c2b781bddfc

Orabug: 21446728

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
10 years agoIB/ipoib: CSUM support in connected mode
Yuval Shaia [Tue, 16 Jun 2015 07:32:36 +0000 (00:32 -0700)]
IB/ipoib: CSUM support in connected mode

This enhancement suggest the usage of IB CRC instead of CSUM in IPoIB CM.
IPoIB CM uses RC (Reliable Connection) which guarantees the corruption free
delivery of the packet.

InfiniBand uses 32b CRC which provides stronger data integrity protection
compare to 16b IP Checksum. So, there is no added value that IP/TCP Checksum
provides in the IB world.

The proposal is to tell network stack that IPoIB-CM supports IP Checksum
offload. This enables the kernel to save the time of checksum calculation
of IPoIB CM packets. Network sends the IP packet without adding the IP
Checksum to the header. On the receive side, IPoIB driver again tells the
network stack that IP Checksum is good for the incoming packets and network
stack avoids the IP Checksum calculations.

During connection establishment the driver determine if peer supports
IB CRC as checksum. This is done so driver will be able to calculate
checksum before transmiting the packet in case the peer does not support
this feature.

Orabug: 20559068

Tested-Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Reviewed-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
10 years agoIB/ipoib: Scatter-Gather support in connected mode
Yuval Shaia [Wed, 29 Apr 2015 07:16:41 +0000 (00:16 -0700)]
IB/ipoib: Scatter-Gather support in connected mode

By default, IPoIB-CM driver uses 64k MTU. Larger MTU gives better performance.
This MTU plus overhead puts the memory allocation for IP based packets at 32
4k pages (order 5), which have to be contiguous.
When the system memory under pressure, it was observed that allocating 128k
contiguous physical memory is difficult and causes serious errors (such as
system becomes unusable).
This enhancement resolve the issue by removing the physically contiguous memory
requirement using Scatter/Gather feature that exists in Linux stack.

With this fix Scatter-Gather will be supported also in connected mode
This change also revert the change made in commit e112373
("IPoIB/cm: Reduce connected mode TX object size)".

Orabug: 20422840

Reviewed-by: John Sobecki <john.sobecki@oracle.com>
Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
10 years agoib_uverbs: Support for kernel implementation of XRC calls from user space
Knut Omang [Tue, 21 Apr 2015 10:20:08 +0000 (12:20 +0200)]
ib_uverbs: Support for kernel implementation of XRC calls from user space

Extends the kernel/user space interface for work requests to also provide
the XRC shared receive queue number. Necessary to support
kernel level implementation of user verbs for XRC.

Requires a corresponding libibverbs change to support XRC.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_{uverbs/core}: add new ib_create_qp_ex with udata arg
Knut Omang [Tue, 21 Apr 2015 10:20:07 +0000 (12:20 +0200)]
ib_{uverbs/core}: add new ib_create_qp_ex with udata arg

Necessary to get device specific arguments through to XRC QPs.
Added new local header file to serve as support interface
between ib_core and ib_uverbs.

Right now there is a lot of duplicate setup code in uverbs_cmd.c
on the ib_uverbs side and verbs.c on the ib_core side. This commit
is a quick fix to have XRC support working, but similar calls
can be added to consolidate the code for other parts of the API.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_uverbs: Avoid vendor specific masking of attributes in query_qp
Knut Omang [Tue, 21 Apr 2015 10:20:06 +0000 (12:20 +0200)]
ib_uverbs: Avoid vendor specific masking of attributes in query_qp

This commit removes the implementation and use of the modify_qp_mask
helper function from the generic OFED implementation and into individual
device drivers.

Like with use of the ib_modify_qp_is_ok function it should be up to
each device driver how to handle bits set in the attribute masks.

With the modify_qp_mask function applied in the generic code,
drivers would not see the bits that the user process actually sets.

The restrictions imposed by the filter are also beyond what
is imposed by the Infiniband standard, and would also limit
future drivers or hardware from checking for unsupported or
invalid settings.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_uverbs: Add padding to end align ib_uverbs_reg_mr_resp
Knut Omang [Tue, 21 Apr 2015 10:20:05 +0000 (12:20 +0200)]
ib_uverbs: Add padding to end align ib_uverbs_reg_mr_resp

The ib_uverbs_reg_mr_resp structure was not 64 bit end aligned
as required by the protocol. This causes alignment issues
if a device specific driver needs to transfer extra response
arguments.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib: Add udata argument to create_ah
Knut Omang [Tue, 21 Apr 2015 10:20:04 +0000 (12:20 +0200)]
ib: Add udata argument to create_ah

Most of the ib device driver entry points supports optional
device specific parameter transfer between user space and kernel space
via the udata argument - add a similar argument for ib_create_ah.

Update all infiniband drivers to include this agument
in their driver entry point implementation.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_umem: Add a new, more generic ib_umem_get_attrs
Knut Omang [Tue, 21 Apr 2015 10:20:03 +0000 (12:20 +0200)]
ib_umem: Add a new, more generic ib_umem_get_attrs

This call allows a full range of DMA attributes and also
DMA direction to be supplied and is just a refactor of the old ib_umem_get.
Reimplement ib_umem_get using the new generic call,
now a trivial implementation.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_mad: incoming sminfo SMPs gets discarded if no process_mad function is registered
Dag Moxnes [Tue, 21 Apr 2015 10:20:02 +0000 (12:20 +0200)]
ib_mad: incoming sminfo SMPs gets discarded if no process_mad function is registered

The process_mad function is an optional IB driver entry point
allows a driver to intercept or modify MAD traffic.

This fix allows MAD traffic to flow down to the device also
when MAD traffic is completely handled by the device and
no process_mad function is provided.

Orabug: 20930262

Signed-off-by: Knut Omang <knut.omang@oracle.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: More support for automatically scaling profile parameters
Mukesh Kacker [Tue, 17 Mar 2015 01:11:27 +0000 (18:11 -0700)]
mlx4_core: More support for automatically scaling profile parameters

Add a new module configuration variable "scale_profile" parameter
which allows dynamic scaling of parameters. When it is not set,
the Mellanox default behavior will prevail.

The dynamically configured parameters are typically set to 0 in
configuration - but if they are set to a specific value, a warning
is printed that they are not being dynamically scaled. (This allows
for make exceptions and experiments with different values).

The original dynamic scaling of profile parameter num_mtt_segs
(governed by log_num_mtt) is retained. In addition scaling is
also introduced for parameter num_qp (governed by log_num_qp).

This is not a direct port but similar in spirit to fixes done
in UEK2 with following commits:
52ac96 OFED: Automatically size MTT in mlx4_core
47678c mlx4_core: increase default number of qps in mlx4_core driver
218561 mlx_core: Change log_num_mtt scaling range
497dd4 mlx4_core: change default for mlx4_scale_profile

An error message improvement is borrowed from Mellanox OFED 2.4 commit
17465c net/mlx4: add explicit message if user ask too few QPs
(Code for this commit is already upstream but the error message is less
 explicit upstream!)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoipoib: rfe- enable pkey and device name decoupling
Mukesh Kacker [Thu, 22 Jan 2015 19:14:02 +0000 (11:14 -0800)]
ipoib: rfe- enable pkey and device name decoupling

The sysfs "create_child" interface creates
pkey based child interface but derives the
name from parent device name and pkey value.
This makes administration difficult where pkey
values can change but policies encoded with
device names do not.

We add ability to create a child interface with
a user specified name and a specified pkey
with a new sysfs "create_named_child" interface
(and also add a corresponding "delete_named_child"
interface).

We also add a new module api interface to query
pkey from a netdevice so any kernel users of
pkey based child interfaces can query it - since
with device name decoupled from pkey, it can no
longer be deduced from parsing the device name
by other kernel users.

Orabug: 19064704

Ported from UEK2 commits
 a101f6037e882b1c12143416d48345fe7ea62979 and
 916eb26c32082e241c22fcf8064959d697eabe2b

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Reviewed-by: Chien-Hua Yen <chien.yen@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
10 years agoib_sdp: adding sdp socket support to rdma_cm
Qing Huang [Mon, 26 Jan 2015 06:17:09 +0000 (22:17 -0800)]
ib_sdp: adding sdp socket support to rdma_cm

SDP related code was completely removed from upstream after
these two commits:

fbaa1a6, Sean Hefty, RDMA/cma: Merge cma_get/save_net_info
01602f1, Sean Hefty, RDMA/cma: Remove unused SDP related code

When adding the SDP support code back, to better organize
changes, we created the following separate new files for the
code: cma_priv.h, cma_sdp.c and cma_sdp_priv.h

Signed-off-by: Qing Huang <qing.huang@oracle.com>
10 years agomlx4_vnic: set mod param "lro_num" default value to 0 to disable LRO feature
Qing Huang [Wed, 18 Feb 2015 19:39:05 +0000 (11:39 -0800)]
mlx4_vnic: set mod param "lro_num" default value to 0 to disable LRO feature

Three reasons for us to disable Large Receive Offload in
uek4/vnic driver

1. Some of vnic required LRO related kernel code has been removed
   from upstream by commit# 24245a1b055df246dc94517c1a8b1fdfe7668da0

2. uek4/vnic has better performance on bare metal than uek3/vnic
   (with LRO support) when running iperf/tcp

3. LRO has potential performance impact on TCP in virtualized
   environment

Signed-off-by: Qing Huang <qing.huang@oracle.com>
10 years agomlx4_vnic: Add correct typecasting to pointers in vnic_get_frag_header()
Ashish Samant [Tue, 7 Oct 2014 18:21:35 +0000 (11:21 -0700)]
mlx4_vnic: Add correct typecasting to pointers in vnic_get_frag_header()

The *mac_hdr (Mac Header) pointer should be incremented ETH_HLEN
bytes to get the *ip_hdr (IP Header) pointer. Similarly, the IP
Header pointer should be incremented by (iph->ihl << 2) bytes
to get the *tcpudp_hdr (Transport Header) pointer.

Fix this by adding a u8* cast to the two pointers while doing
the pointer arithmetic.

Orabug: 19824501

Signed-off-by: Ashish Samant <ashish.samant@oracle.com>
Acked-by: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
10 years agordma_cm: CMA_QUERY_HANDLER: BAD STATUS -110 and -22
Chien-Hua Yen [Wed, 17 Jul 2013 22:54:52 +0000 (15:54 -0700)]
rdma_cm: CMA_QUERY_HANDLER: BAD STATUS -110 and -22

Orabug: 16708786

Signed-off-by: Chien-Hua Yen <chien.yen@oracle.com>
(cherry picked from commit 0d0e27b60592d65b15cdc2926fbb032eaaa9351c)

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
Conflicts:
drivers/infiniband/core/cma.c

10 years agoRDMA CM: Avoid possible SEGV during connection shutdown
Bang Nguyen [Mon, 17 Jun 2013 18:53:15 +0000 (11:53 -0700)]
RDMA CM: Avoid possible SEGV during connection shutdown

cma_release_port() may be called twice for the same rdma id during
connection shutdown, causing hlist_del() to SEGV.

Orabug: 16750726

Signed-off-by: Chien-Hua Yen <chien.yen@oracle.com>
(cherry picked from commit cfee888ccacc233d2045a26492ed92a25d468927)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agordma_cm: extend debug for remote mapping
Ajaykumar Hotchandani [Tue, 13 Jan 2015 02:01:44 +0000 (18:01 -0800)]
rdma_cm: extend debug for remote mapping

This fetches local_id, remote_id, and qpn
which helps to map corresponding remote cm_id

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
10 years agomlx4_core: supporting 64b counters
Vu Pham [Fri, 18 May 2012 22:01:29 +0000 (15:01 -0700)]
mlx4_core: supporting 64b counters

Support 64b counters using PMA_COUNTERS_EXT mad:
. Sending the mad to fw for IB transport using MAD_IFC
. Sending mailbox command QUERY_IF_STAT to fw for EN transport

Note: Ported from Mellanox OFED 2.4.
     64-bit counters can wrap around. 32-bit counters saturate at UINT_MAX
     (as in upstream code but unlike in Mellanox OFED 2.4 code where they
      can wrap around!)

Orabug: 21094165

Signed-off-by: Vu Pham <vu@mellanox.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
10 years agoib_core: supporting 64b counters using PMA_COUNTERS_EXT mad
Vu Pham [Fri, 18 May 2012 21:35:54 +0000 (14:35 -0700)]
ib_core: supporting 64b counters using PMA_COUNTERS_EXT mad

Support 64b counters using PMA_COUNTERS_EXT mad
. create "counters_ext" group in sysfs
. form mad management class IB_MGMT_CLASS_PERF_MGMT, attribute_id IB_PMA_PORT_COUNTERS_EXT

(Ported from Mellanox OFED 2.4)

Orabug: 21094165

Signed-off-by: Vu Pham <vu@mellanox.com>
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
Reviewed-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
10 years agonet/mlx4: When issuing commands use rwsem insteam of rw spinlocks
Matan Barak [Tue, 23 Sep 2014 08:56:50 +0000 (11:56 +0300)]
net/mlx4: When issuing commands use rwsem insteam of rw spinlocks

The mlx4 drivers use a read_lock while issuing commands, but
when a lot of commands are issued simultaneously, the mlx4
driver could sleep. In order to resolve this "sleep while holding
spin-lock" issue, we replace this spinlock with read-write
semaphore.

Fixes: 2393fac27a97 ('net/mlx4: Switching between sending
     commands via polling and events may results
     in hung tasks')
Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_ib: Make sure that PSN does not overflow.
Majd Dibbiny [Sun, 24 Aug 2014 10:50:03 +0000 (13:50 +0300)]
mlx4_ib: Make sure that PSN does not overflow.

The rq/sq->psn is 24 bits as defined in the IB spec,
therefore we mask out the 8 most significant bits to avoid
overflow in the modify qp.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: Make sure that PSN does not overflow.
Majd Dibbiny [Sun, 24 Aug 2014 10:48:53 +0000 (13:48 +0300)]
ib_core: Make sure that PSN does not overflow.

The rq/sq->psn is 24 bits as defined in the IB spec,
therefore we mask out the 8 most significant bits to
avoid overflow in the modify qp.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/CMA: Make sure that PSN is not over max allowed
Moni Shoua [Mon, 18 Aug 2014 11:30:20 +0000 (14:30 +0300)]
IB/CMA: Make sure that PSN is not over max allowed

This patch limits the initial value for PSN to 24 bits as
spec requires.

Related to commit 76eada4 IB/mlx5: Check that PSN does not overflow
Signed-off-by: Moni Shoua <monis@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Mark user mr as writable if actual virtual memory is writable
Moshe Lazer [Tue, 5 Aug 2014 15:16:46 +0000 (18:16 +0300)]
IB/mlx4: Mark user mr as writable if actual virtual memory is writable

To allow rereg mr (from read only mr to writablemr) without using
get_user_pages again, we need to define the initial mr as writable.
We shouldn't do this in case that user virtual memory is not
writable (e.g. const memory)

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_ib: Report proper BDF for IB MSI-X vectors
Yevgeny Petrilin [Tue, 5 Aug 2014 08:08:41 +0000 (11:08 +0300)]
mlx4_ib: Report proper BDF for IB MSI-X vectors

Using pci_name primitive for proper reporting

Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/core: Fix memory leak in cm_req_handler error flows
Matan Barak [Tue, 29 Jul 2014 13:42:37 +0000 (16:42 +0300)]
IB/core: Fix memory leak in cm_req_handler error flows

In cm_req_handler error flows, sometimes
cm_id_priv->timewait_info isn't free'd.

Thanks to Yohad Tor for this fix.

Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: enable msi_x module parameter for SRIOV VFs to limit number MSI-X interrup...
Tal Alon [Sun, 20 Jul 2014 17:59:40 +0000 (20:59 +0300)]
mlx4_core: enable msi_x module parameter for SRIOV VFs to limit number MSI-X interrupts per VF

Signed-off-by: Tal Alon <talal@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_ib: Fix endianness in blueflame post_send.
Jack Morgenstein [Thu, 10 Jul 2014 09:29:14 +0000 (12:29 +0300)]
mlx4_ib: Fix endianness in blueflame post_send.

qp object field doorbell_qpn was initialized using swab()
at qp creation.
swab() unconditionally swaps dword endianness. Thus, on
little-endian platforms the endianness of doorbell_qpn was
big endian; on big-endian platforms, doorbell_qpn is little-endian.

In post send blueflame, doorbell_qpn was taken as is (i.e., the
driver assumed that it was in big-endian format). This was OK
for little-endian hosts, but incorrect for big-endian hosts.

The fix is to use cpu_to_be32 when initializing doorbell_qpn (thus
guaranteeing that doorbell_qpn is in big-endian format on all
host types). This also requires modifying non-bf sends to
use __raw_writel (which does not do any endianness swapping)
instead of writel (which does endianness swapping on big-endian hosts).

The fix was developed by Shamir Rabinovitch of Oracle.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported by Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agonet/mlx4: Switching between sending commands via polling and events may results in...
Matan Barak [Wed, 9 Jul 2014 08:29:21 +0000 (11:29 +0300)]
net/mlx4: Switching between sending commands via polling and events may results in hung tasks

When switching between those methonds of sending commands, it's
possbile that a task will keep waiting for the polling sempahore,
but may never be able to acquire it.
This is due to mlx4_cmd_use_events which "down"s the
sempahore back to 0.

Reproducing it involves in sending commands while changing
between mlx4_cmd_use_polling and mlx4_cmd_use_events.

Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Put non zero value in max_ah
Eli Cohen [Thu, 3 Jul 2014 13:39:00 +0000 (16:39 +0300)]
IB/mlx4: Put non zero value in max_ah

We put INT_MAX since this is the max value the in can hold.
Though hardware capability is unlimited, this is practically
a large enough number so we can use it.

Signed-off-by: Eli Cohen <eli@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/core: Add debugging prints to ib_uverbs_write
Haggai Eran [Mon, 19 May 2014 06:48:35 +0000 (09:48 +0300)]
IB/core: Add debugging prints to ib_uverbs_write

These debug prints should help anyone attempting to understand
why -EINVAL was returned for a command.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/core: add debugging prints to explain -EINVAL in ib_uverbs_reg_mr
Majd Dibbiny [Mon, 16 Jun 2014 07:18:41 +0000 (10:18 +0300)]
IB/core: add debugging prints to explain -EINVAL in ib_uverbs_reg_mr

Understanding why -EINVAL is returned from uverbs is difficult
as there are multiple code paths that can cause the value to be
returned. This patch adds some explainations as pr_debug prints.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agofix warning about bitwise or between u32 and size_t
Haggai Eran [Thu, 1 May 2014 07:12:31 +0000 (10:12 +0300)]
fix warning about bitwise or between u32 and size_t

(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Don't update QP1 for native functions
Matan Barak [Mon, 28 Apr 2014 15:46:13 +0000 (18:46 +0300)]
IB/mlx4: Don't update QP1 for native functions

For native functions, there's no reason to update
the smac_index, as QP1 is a GSI QP.

Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/ipoib: Check gso size prior to ib_send
Erez Shitrit [Wed, 30 Apr 2014 07:45:20 +0000 (10:45 +0300)]
IB/ipoib: Check gso size prior to ib_send

We found that in some cases the kernel sends skb where the
gso field was damaged, and the size of that field was bigger
than the physical mtu, when the HW gets such size it flushes
the qp to error state and all traffic on that interface is
disabled.

In order to avoid such case, i added a check to that field
prior to the ib_send.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: fix may be used uninitialized compilation warnings
Saeed Mahameed [Tue, 22 Apr 2014 11:49:32 +0000 (14:49 +0300)]
mlx4_vnic: fix may be used uninitialized compilation warnings

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: fix potential data corruption in sprintf
Saeed Mahameed [Sun, 13 Apr 2014 08:58:36 +0000 (11:58 +0300)]
mlx4_vnic: fix potential data corruption in sprintf

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Fix resource tracker memory leak after Reset Flow
Hadar Hen Zion [Tue, 11 Mar 2014 15:44:51 +0000 (17:44 +0200)]
mlx4_core: Fix resource tracker memory leak after Reset Flow

In case of non-responsive device mlx4_ACCESS_MEM fails and the
driver can't read qp_detach mailbox, which includes all the
rule information.

Since the driver doesn't get the rules attributes form the
qp_detach mailbox the master fails to detach his rules form
the resource tracker during driver unload sequence when the
device in in internal_error state.

Calling rem_slave_qp will remove those rules and the qps they are
attached to unconditionally.

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Check port_num before using it in mlx4_ib_port_link_layer
Moshe Lazer [Tue, 25 Mar 2014 08:54:15 +0000 (10:54 +0200)]
IB/mlx4: Check port_num before using it in mlx4_ib_port_link_layer

In mlx4_ib_port_link_layer func port_num is used as table
index without checking its validity.

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Fix wrong calculation of link layer
Moni Shoua [Wed, 12 Mar 2014 16:00:06 +0000 (18:00 +0200)]
IB/mlx4: Fix wrong calculation of link layer

Use ah->port_num to find link layer before value was set to it.

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Copy SL from correct place in address path
Shani Michaelli [Wed, 12 Feb 2014 13:48:08 +0000 (15:48 +0200)]
IB/mlx4: Copy SL from correct place in address path

According to PRM, sl in address path is at offset 28 for
InfiniBand and 29 for Ethernet.

Signed-off-by: Shani Michaeli <shanim@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Check return status of rdma_resolve_ip
Shani Michaelli [Sun, 9 Mar 2014 16:36:50 +0000 (18:36 +0200)]
mlx4_core: Check return status of rdma_resolve_ip

Fix usage of rdma_resolve_ip() when return status was
not checked for success.

Signed-off-by: Shani Michaeli <shanim@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4: Clean IRQ affinity hint when freeing it
Ido Shamay [Sun, 9 Mar 2014 11:35:04 +0000 (13:35 +0200)]
mlx4: Clean IRQ affinity hint when freeing it

This is done to avoid kernel's warning when affinty hint
of IRQ is set, when free_irq is called.

WARNING: at kernel/irq/manage.c:1002 __free_irq+0x22d/0x250()
Call Trace:
 [<ffffffff81071e27>] ? warn_slowpath_common+0x87/0xc0
 [<ffffffff81071e7a>] ? warn_slowpath_null+0x1a/0x20
 [<ffffffff810e83fd>] ? __free_irq+0x22d/0x250
 [<ffffffff810e848e>] ? free_irq+0x4e/0xb0
 [<ffffffffa03d083d>] ? mlx4_release_eq+0x9d/0xc0 [mlx4_core]

Signed-off-by: Ido Shamay <idos@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/core: Fix QP attr mask when resolving smac
Moni Shoua [Mon, 3 Feb 2014 13:39:15 +0000 (15:39 +0200)]
IB/core: Fix QP attr mask when resolving smac

When rdma_accept() is called rdma_cm modifies the QP to RTR.
During this stage the source mac needs to be resolved and put
in the QP atrr. Before modifying the QP. This patch also adds
the flag IB_QP_SMAC to the atrr_mask which was missing.

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
10 years agomlx4_vnic: fix typo in log messages
Saeed Mahameed [Sun, 12 Jan 2014 11:46:20 +0000 (13:46 +0200)]
mlx4_vnic: fix typo in log messages

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: print vnic keep alive info in mlx4_vnic_info
Saeed Mahameed [Thu, 26 Dec 2013 10:45:22 +0000 (12:45 +0200)]
mlx4_vnic: print vnic keep alive info in mlx4_vnic_info

Print last keep alive timestamp and GW keep alive period.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: default gid should respect dev_id
Matan Barak [Wed, 18 Dec 2013 17:34:38 +0000 (19:34 +0200)]
IB/mlx4: default gid should respect dev_id

The default gid should match the true ipv6 link
local address which respects the dev_id.

Signed-off-by: Matan Barak <matanb@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Change the name of the num_mtt in mlx4_profile to be num_mtt_segs.
Majd Dibbiny [Mon, 23 Sep 2013 10:52:08 +0000 (13:52 +0300)]
mlx4_core: Change the name of the num_mtt in mlx4_profile to be num_mtt_segs.

The old name is misleading. The variable is the number of mtt
segments and not the number of mtts so it was changed to match
the actual meaning.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Print error messages when GID table update failed
Moni Shoua [Wed, 11 Dec 2013 11:29:29 +0000 (13:29 +0200)]
IB/mlx4: Print error messages when GID table update failed

When trying to add a GID to a full GID table or when trying
to delete a GID which is not in the GID table an error will
be printed to the kernel log.

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Remove unnecessary warning message
Moni Shoua [Mon, 9 Dec 2013 16:07:01 +0000 (18:07 +0200)]
IB/mlx4: Remove unnecessary warning message

Signed-off-by: Moni Shoua <monis@mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: Check that caches exist before accessing them
Jack Morgenstein [Thu, 12 Dec 2013 07:34:10 +0000 (09:34 +0200)]
ib_core: Check that caches exist before accessing them

Check that the gid/pkey cache exists before trying to access
them (ib_find_cached_xxx and ib_cache_update).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agordma_cm/cma: Cache broadcast domain record.
Erez Shitrit [Sun, 8 Dec 2013 11:39:35 +0000 (13:39 +0200)]
rdma_cm/cma: Cache broadcast domain record.

Currently, rdma_cm waits for the IPoIB driver to complete
its join to the broadcast domain record; after IPoIB gets its
multicast, rdma_cm tries to obtain its own multicast. After an
IB_CLIENT reregister event, IPoIB may not succeed in its first
effort to reregister its multicast groups. In this case, the
backoff mechanism is applied, and IPoIB retries after a
backoff which starts at 2 seconds and can increase up to
16 seconds.
Since rdma_cm waits for the IPoIB multicast join to succeed,
it too will be delayed at least 2 seconds.

The fix is to detach rdma_cm's multicast operation from IPoIB's
broadcast record re-join. When rdma_cm executes a new join
request, it now tries (via the cma) to take parameters from a
cached broadcast record. If the join fails using the cached
values, the cma deletes the cached record and tries to get a new
one.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoipoib: added an error message when trying to change mtu to 2K-4K
Noa Osherovich [Thu, 5 Dec 2013 08:24:55 +0000 (10:24 +0200)]
ipoib: added an error message when trying to change mtu to 2K-4K

Max mtu defined by IB is 4K, but mcast_mtu is limited to 2K,
so any request to change mtu to a value between 2K-4K didn't
change the mtu, but also didn't show an error message.
An error value (-EINVAL) is now returned and an ipoib_warn
is issued in such cases.

Signed-off-by: Noa Osherovich <noaos@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: Do not transition MC groups to error on SM_CHANGE event
Jack Morgenstein [Sun, 8 Dec 2013 08:41:07 +0000 (10:41 +0200)]
ib_core: Do not transition MC groups to error on SM_CHANGE event

Do not transition multicast groups to error on an SM_CHANGE
event. These events are not connected with mcast groups.
(When the SM wishes to have multicast groups reregistered,
it issues the CLIENT_REREG event).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoipoib: Do not flush mcast groups on SM_CHANGE event
Jack Morgenstein [Sun, 8 Dec 2013 08:32:13 +0000 (10:32 +0200)]
ipoib: Do not flush mcast groups on SM_CHANGE event

SM_CHANGE events have nothing to do with reregistering
multicast groups. Therefore, do not flush/rereg mcast
groups when receiving an SM_CHANGE event.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agordma_cm: add debug functions and module parameter
Saeed Mahameed [Wed, 4 Dec 2013 11:23:51 +0000 (13:23 +0200)]
rdma_cm: add debug functions and module parameter

added debug function and debug module parameter.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agordma_cm: garbage-collection thread for rdma_destroy_id()
Saeed Mahameed [Wed, 4 Dec 2013 11:14:50 +0000 (13:14 +0200)]
rdma_cm: garbage-collection thread for rdma_destroy_id()

garbage-collection thread for rdma_destroy_id,
so as not to paralyze ib_cm thread with wait_for_completion.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Extracted from following commit in Mellanox OFED-2.4
812c3972cf93e0d04f568ba353e87a1de7c9e006
(rdma_cm: race condition bug fixes)

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: always remove child macs in vnic_parent_update remove request
Saeed Mahameed [Wed, 27 Nov 2013 13:50:11 +0000 (15:50 +0200)]
mlx4_vnic: always remove child macs in vnic_parent_update remove request

Child macs are not removed in host admin vnics once the connection
is lost with BX. This caused a loss of connectivity for child vnics
in case of connection restored with the BX, since the BX is not
aware of the old child macs.

Solution is to always remove child macs when vnic_paren_update is
called with remove request.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: set default moderation values in vnic_alloc_netdev
Saeed Mahameed [Wed, 27 Nov 2013 09:55:07 +0000 (11:55 +0200)]
mlx4_vnic: set default moderation values in vnic_alloc_netdev

vnic_set_default_moder was called from _vnic_open, which caused
to reset all current moderation values to the default every time
the user opens/closes the vnic interface.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4: Handle memory region deregistration failure
Shani Michaeli [Sun, 3 Jun 2012 12:48:32 +0000 (15:48 +0300)]
mlx4: Handle memory region deregistration failure

Memory region deregistration can fail when memory windows
are bound to it. We handle such failures by propagating them
to the user, or by printing a serious warning.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Shani Michaeli <shanim@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: More fixes to ib_sa_add_one error flow
Jack Morgenstein [Thu, 14 Nov 2013 15:35:06 +0000 (17:35 +0200)]
ib_core: More fixes to ib_sa_add_one error flow

commit 0e7377eed fixed a resource leak of mad agents in
the ib_sa_add_one error flow.  However, the fix allowed
ib_mad_unregister_agent to be called in a case where the
ib_mad_register_agent request failed (resulting in an
illegal pointer in the agent field).  This caused a kernel
Oops in the error flow.

Fix this by calling ib_unregister_mad_agent only for cases where
ib_register_mad_agent succeeded.

In addition, separate the ib_register_event_handler() call error
flow from the loop error flow. If the call to
ib_register_event_handler fails, the client data must be reset
to NULL, (in case at some point ib_register_event_handler() is
modified so that it may return a non-zero (error) value).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/ipoib: Set mode only when needed.
Erez Shitrit [Wed, 6 Nov 2013 16:23:48 +0000 (18:23 +0200)]
IB/ipoib: Set mode only when needed.

Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Use div_u64 to avoid unresolved symbol on 32-bit OSes
Vladimir Sokolovsky [Sun, 27 Oct 2013 12:03:59 +0000 (14:03 +0200)]
mlx4_core: Use div_u64 to avoid unresolved symbol on 32-bit OSes

E.g.: On Xenserver6.1/2:
WARNING: "__udivdi3" [<path>/drivers/net/ethernet/mellanox/mlx4/mlx4_core.ko] undefined!

Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: Safely unregister mad agent when necessary.
Majd Dibbiny [Mon, 19 Aug 2013 15:19:23 +0000 (18:19 +0300)]
ib_core: Safely unregister mad agent when necessary.

When the allocation of the receive buffer fails the driver
needs to unregister the mad agent. The function
ib_unregister_mad_agent doesn't check if the pointer of the
mad agent is valid and doesn't contain an error and causes a
Kernel Panic. Therefore, we need to check if the pointer of
the mad agent is valid by calling PTR_ERR and only then
unregister the agent.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_vnic: use netif_set_real_num_tx_queues to dynamically change tx queue size
Saeed Mahameed [Mon, 30 Sep 2013 11:26:54 +0000 (13:26 +0200)]
mlx4_vnic: use netif_set_real_num_tx_queues to dynamically change tx queue size

When network admin vnics are created the network device is
already registered and it is not allowed to change
dev->real_num_tx_queues directly.

This fixes a bug where the unload of mlx4_vnic hangs with
the following error message: waiting for eth442 to become
free. Usage count = 16

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Extend num_mtt in dev caps to avoid overflow.
Majd Dibbiny [Tue, 27 Aug 2013 11:07:36 +0000 (14:07 +0300)]
mlx4_core: Extend num_mtt in dev caps to avoid overflow.

Some legitimate combinations of log_num_mtt and log_mtts_per_seg
cause overflow in the calculation of the num_mtt when initializing
the HCA which causes Kernel panic. Changed the variable to be 'u64'
instead of 'int' to avoid the overflow and made the needed changes
to support the new type.

Signed-off-by: Majd Dibbiny <majd@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: fix FMR unmapping to allow remapping afterward
Moshe Lazer [Sun, 8 Sep 2013 06:59:09 +0000 (08:59 +0200)]
mlx4_core: fix FMR unmapping to allow remapping afterward

The FMR common use flow (as implemented in fmr_pool) is:
 - Allocate FMR (ib_alloc_fmr)
 - Use the FMR to remap DMA memory until remaps limit
   exceeded (ib_map_phys_fmr)
 - Unmap the FMR (ib_unmap_fmr)
 - Use the FMR to remap DMA memory until remaps limit
   exceeded (ib_map_phys_fmr)
 - ...

The current implementation of mlx4_fmr_unmap is not following
this use flow since it is using the HW2SW MPT command.
The HW2SW MPT command notifies the FW that the MPT entry is
not used by HW anymore. The FW may act according to this information,
therefore it is not safe for the driver to manipulate the MPT
directly.  The patch fixes this by manipulating the MPT directly
to unmap the memory instead of using the HW2SW MPT command.

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib/ipoib: unlock dev_start_xmit() on ipoib_cm_rep_handler()
Tal Alon [Sun, 14 Jul 2013 07:40:17 +0000 (10:40 +0300)]
ib/ipoib: unlock dev_start_xmit() on ipoib_cm_rep_handler()

Signed-off-by: Tal Alon <talal@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib_core: fixed resource leak in case of error
Saeed Mahameed [Sun, 23 Jun 2013 16:26:50 +0000 (19:26 +0300)]
ib_core: fixed resource leak in case of error

Fixed off-by-one bug, we need to decrement the port number only after
we released the resources to the current port.

Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib/ipoib: fix illegal locking on ipoib_cm_rep_handler
Tal Alon [Mon, 8 Jul 2013 08:48:44 +0000 (11:48 +0300)]
ib/ipoib: fix illegal locking on ipoib_cm_rep_handler

Signed-off-by: Tal Alon <talal@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib/ipoib: ipoib_cm_rep_handler lock skb queue while dequeue before xmit
Tal Alon [Wed, 26 Jun 2013 08:12:51 +0000 (11:12 +0300)]
ib/ipoib: ipoib_cm_rep_handler lock skb queue while dequeue before xmit

Signed-off-by: Tal Alon <talal@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: resolvs kernel panic when connectx_port_config fail to set ports
Moshe Lazer [Sun, 16 Jun 2013 08:04:17 +0000 (11:04 +0300)]
mlx4_core: resolvs kernel panic when connectx_port_config fail to set ports

When changing ports configutation (e.g. from ib,ib to eth,eth)
the device is disconnected from interfaces and catas error lists
than we change ports config and reconnecting the device.
In case ports config changing fails the device left disconnected.
If we try again to configure the ports the driver retry to
disconnect the device form its lists and crashes in list_del
function.  To aviod this the list_del replaced by list_del_init
(to allow redeleting the device).

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Avoid setting ports for auto when only one port type is supported
Moshe Lazer [Sun, 28 Apr 2013 14:19:17 +0000 (17:19 +0300)]
mlx4_core: Avoid setting ports for auto when only one port type is supported

When only one port type is supported driver should reject requests
to change mode to auto sense.

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: sysfs, fix usage of log_num_mtt module parameter
Yishai Hadas [Mon, 22 Apr 2013 11:36:43 +0000 (14:36 +0300)]
mlx4_core: sysfs, fix usage of log_num_mtt module parameter

When was auto calculated based on RAM size it wrongly includes
also log_mtts_per_seg.

It's wrong in 2 ways:
First, log_mtts_per_seg should be added by the application itself,
no reason to a have total in log_num_mtt itself.
Second, in case that an extra  NIC exists it may get an invalid
value as it depends on a larger value.
Specifically, it may cause an overflow and later leads on to
kernel panic via mlx4_buddy_init.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: fix ib_uverbs_get_context flow
Yishai Hadas [Wed, 20 Mar 2013 16:00:02 +0000 (18:00 +0200)]
mlx4_core: fix ib_uverbs_get_context flow

Fix flow to prevent kernel panic in case of a failure in copy_to_user.

INIT_IB_EVENT_HANDLER must be called to initialize the event handler
list before releasing filp as part of fput.
Otherwise will get a kernel panic at ib_unregister_event_handler
when calling list_del.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Fix Coverity issues.
Hadar Hen Zion [Mon, 4 Mar 2013 11:54:27 +0000 (13:54 +0200)]
mlx4_core: Fix Coverity issues.

Signed-off-by: Itai Garbi <igarbi@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/mlx4: Fix Coverity issues
Hadar Hen Zion [Mon, 4 Mar 2013 11:53:37 +0000 (13:53 +0200)]
IB/mlx4: Fix Coverity issues

Signed-off-by: Itai Garbi <igarbi@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoIB/core: Fix Coverity issues for rdma_cm
Hadar Hen Zion [Mon, 4 Mar 2013 11:48:55 +0000 (13:48 +0200)]
IB/core: Fix Coverity issues for rdma_cm

Signed-off-by: Itai Garbi <igarbi@mellanox.com>
Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Derived from(subset of!) Mellanox OFED-2.4 patch
84c6d50a470b4b61ca6b2ed1c718b121870daa37
(IB/core: Fix Coverity issues)

Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoRelease Date is updated to __DATE__ instead of a static string
Alex Markuze [Mon, 4 Mar 2013 14:05:23 +0000 (16:05 +0200)]
Release Date is updated to __DATE__ instead of a static string

Signed-off-by: Alex Markuze <markuze@mellanox.com>
(Ported from Mellanox OFED 2.4)
Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: use msi_x module param to limit num of MSI-X irqs
Moshe Lazer [Tue, 5 Mar 2013 12:08:47 +0000 (14:08 +0200)]
mlx4_core: use msi_x module param to limit num of MSI-X irqs

The msi_x module param usage is:
0 - don't use MSI-X
1 - use MSI-X (driver decide the num of MSI-X irqs)
>1 - limit number of MSI-X irqs to msi_x
In case of SRIOV the msi_x>1 treated as msi_x==1

Signed-off-by: Moshe Lazer <moshel@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoSeting ring size to default when module param set incorrectly
Alex Markuze [Tue, 5 Mar 2013 12:22:53 +0000 (14:22 +0200)]
Seting ring size to default when module param set incorrectly

Signed-off-by: Alex Markuze <markuze@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agoib/core: change error prints in cm module to debug prints.
Jack Morgenstein [Mon, 25 Feb 2013 12:04:18 +0000 (14:04 +0200)]
ib/core: change error prints in cm module to debug prints.

commit acd10b49 added prints to the cm module.
These, however, should really be debug prints, to be activated
when it is necessary to track down some cm problem.

To activate the debug mechanism, you need to do the following:
1. mount the debug fs (do this once)
   mount -t debugfs none /sys/kernel/debug/

2. activate debug output for ib_cm:
   echo -n "module ib_cm +p" > /sys/kernel/debug/dynamic_debug/control

3. To de-activate debug output when you are done, do the following
   echo -n "module ib_cm -p" > /sys/kernel/debug/dynamic_debug/control

You will see the debug output in dmesg.

This change was suggested by Moni Shoua (monis@mellanox.com)

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: Add more info to mlx4_cmd_post failure error messages
Jack Morgenstein [Thu, 19 Mar 2015 01:20:31 +0000 (18:20 -0700)]
mlx4_core: Add more info to mlx4_cmd_post failure error messages

To assist in debugging and support, add additional information
to output generated when fail to post a FW command. In addition,
add in_param, in_modifier, and op_modifier values to output
when commands are successfully posted but time out.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: disable mlx4_QP_ATTACH calls from guests if master is doing flow steering.
Jack Morgenstein [Wed, 20 Feb 2013 14:43:59 +0000 (16:43 +0200)]
mlx4_core: disable mlx4_QP_ATTACH calls from guests if master is doing flow steering.

Old upstream kernel guests do not detect if device-enabled flow
steering is activated by the master. If DMFS is activated,
the master should return error to guests which try to use
the B0-steering flow calls (mlx4_QP_ATTACH).

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: change resource quotas to enable supporting upstream-kernel guests
Jack Morgenstein [Mon, 18 Feb 2013 10:34:59 +0000 (12:34 +0200)]
mlx4_core: change resource quotas to enable supporting upstream-kernel guests

The resource-quota code passed non-power-of-2 quotas to guests.
In the upstream kernel (bugs), resource quotas for MPTs and QPs
are assumed to be powers-of-2. In MPT case, mlx4_init_mr_table
checks for num_mpts being a power-of-2 before checking if it
is running as a slave.

In the QP case, procedure mlx4_qp_alloc() assumes that
(num_qps - 1) is a power-of-2 when calling radix_tree_insert()
and radix_tree_delete().

In the MPT case, mlx4_init_mr_table() failed on the guest,
causing abort of the guest driver bringup.

In the QP case, although create-qp succeeded on the
hypervisor, the radix_tree_insert() call failed, resulting
in failure to create QPs with certain qp numbers.

The fix, for both cases, is to round-up the quota to the
next power-of-2 for guests for MPTs and QPs.  This does no
harm, as these two resources were not really meant to be
limited by an upper quota.  The guaranteed resources for QPs
and MPTs per VF/PF are not affected by this change.
The only effect is that no guest will ever be able to
actually reach its max-quota for QPs and MPTs.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: device revision support
Yishai Hadas [Tue, 12 Feb 2013 13:53:46 +0000 (15:53 +0200)]
mlx4_core: device revision support

The device revision field returned by the NodeInfo MAD
is incorrect on ConnectX3 devices.

This patch is driver side handling to complete a FW fix
added at 2.11.1172. INIT_HCA - bit at offset 0x0C.12 is
set to 1 so that FW will report correct device revision.

Older FW versions won't be affected from turning on that bit,
no capability bit is needed.

Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
10 years agomlx4_core: print more info when command times out
Jack Morgenstein [Mon, 11 Feb 2013 16:44:14 +0000 (18:44 +0200)]
mlx4_core: print more info when command times out

To assist in diagnosing command timeouts, print the
go-bit status and toggle-bit status in the warning
output.

In addition, print an indication of the pci_bus is offline.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>