openwrt/staging/blogic.git
7 years agoIB/ipoib: Use NAPI in UD/TX flows
Erez Shitrit [Thu, 19 Oct 2017 04:56:43 +0000 (07:56 +0300)]
IB/ipoib: Use NAPI in UD/TX flows

Instead of explicit call to poll_cq of the tx ring, use the NAPI mechanism
to handle the completions of each packet that has been sent to the HW.

The next major changes were taken:
 * The driver init completion function in the creation of the send CQ,
   that function triggers the napi scheduling.
 * The driver uses CQ for RX for both modes UD and CM, and CQ for TX
   for CM and UD.

Cc: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/ipoib: Get rid of the tx_outstanding variable in all modes
Erez Shitrit [Thu, 19 Oct 2017 04:56:42 +0000 (07:56 +0300)]
IB/ipoib: Get rid of the tx_outstanding variable in all modes

The first step toward using NAPI in the UD/TX flow is to separate
between two flows, the NAPI and the xmit, meaning no use of shared
variables between both flows.

This patch takes out the tx_outstanding variable that was used in both
flows and instead the driver uses the 2 cyclic ring variables: tx_head
and tx_tail, tx_head used in the xmit flow and tx_tail in the NAPI flow.

Cc: Kamal Heib <kamalh@mellanox.com>
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Reviewed-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA: Remove Sean's and Hal's emails from MAINTAINER file
Leon Romanovsky [Sun, 15 Oct 2017 06:56:48 +0000 (09:56 +0300)]
RDMA: Remove Sean's and Hal's emails from MAINTAINER file

RDMA subsystem has one active maintainer who can apply
patches - Doug Ledford, but the RDMA entries in MAINTAINER file
are not stating it. The following patch removes Sean's and Hal's
emails from the maintainers list.

It will allow clean get_maintaner.pl output which is needed for people
outside of our community and various semi-automatic tools.

Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Move cqp_cmd_head init to CQP initialization
Bob Sharp [Mon, 16 Oct 2017 20:46:05 +0000 (15:46 -0500)]
i40iw: Move cqp_cmd_head init to CQP initialization

Control QP (CQP) command backlog list is initialized at
device initialization time.  It is not reinitialized in
the reset flow.  Move the initialization to CQP creation
time so the list can be initialized correctly for reset as well.

Fixes: 86dbcd0f12e9 ("i40iw: add file to handle cqp calls")
Signed-off-by: Bob Sharp <Robert.O.Sharp@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Remove UDA QP from QoS list if creation fails
Ivan Barrera [Mon, 16 Oct 2017 20:46:04 +0000 (15:46 -0500)]
i40iw: Remove UDA QP from QoS list if creation fails

If User-space Direct Access (UDA) QP creation fails,
the QP entry is not removed from QoS list. Fix this
by removing QP from QoS list if create QP fails.

Fixes: 0fc2dc58896f ("i40iw: Add Quality of Service support")
Signed-off-by: Ivan Barrera <ivan.d.barrera@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Clear CQP Head/Tail during initialization
Christopher Bednarz [Mon, 16 Oct 2017 20:46:03 +0000 (15:46 -0500)]
i40iw: Clear CQP Head/Tail during initialization

Clear Control Queue Pair (CQP) Head/Tail on CQP
initialization as during an adapter reset, these
values are not reinitialized. Tail is cleared by
writing 0 to CQP's tail register. Head is cleared
by writing 0 to CQP's doorbell register.

Fixes: 86dbcd0f12e9 ("i40iw: add file to handle cqp calls")
Signed-off-by: Christopher Bednarz <christopher.n.bednarz@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Refactor queue depth calculation
Shiraz Saleem [Mon, 16 Oct 2017 20:46:02 +0000 (15:46 -0500)]
i40iw: Refactor queue depth calculation

Queue depth calculations use a mix of work requests
and actual number of bytes. Consolidate all calculations
using minimum WQE size to avoid confusion.

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Reinitialize IEQ on MTU change
Shiraz Saleem [Mon, 16 Oct 2017 20:46:01 +0000 (15:46 -0500)]
i40iw: Reinitialize IEQ on MTU change

On a netdev MTU change event, the iWARP
Exception Queue (IEQ) buffers may not be
sized properly to handle the new MTU.

Reinitialize the IEQ with new MTU size on MTU
change event.

Also, add define for the max ethernet frame size
field in IEQ QP context instead of the snd_mss
define which is for iWARP QPs' MSS field.

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Move ceq_valid to i40iw_sc_dev structure
Shiraz Saleem [Mon, 16 Oct 2017 20:46:00 +0000 (15:46 -0500)]
i40iw: Move ceq_valid to i40iw_sc_dev structure

Completion Event Queues are created and destroyed on
a per device basis as opposed to per User-space Direct
Access resource.

Move ceq_valid to the correct place in i40iw_sc_dev
from i40iw_puda_rsrc.

Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Account for IPv6 header when setting MSS
Shiraz Saleem [Mon, 16 Oct 2017 20:45:59 +0000 (15:45 -0500)]
i40iw: Account for IPv6 header when setting MSS

The IPv6 header size is not subtracted from MTU when MSS is
set for QPs.

Save MTU opposed to MSS in the vsi struct during
initialization and calculate the MSS based on IPv4 vs
IPv6 connection.

Fixes: f27b4746f378 ("i40iw: add connection management code")
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Remove unused structures
Mustafa Ismail [Mon, 16 Oct 2017 20:45:58 +0000 (15:45 -0500)]
i40iw: Remove unused structures

Some structures for post SQ operation are not used.
Remove the following:

i40iw_post_send_w_inv
i40iw_post_inline_send_w_inv
send_w_sol
send_w_inv
send_w_sol_inv
inline_send_w_sol
inline_send_w_inv
inline_send_w_sol_inv

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Move exception_lan_queue to VSI structure
Mustafa Ismail [Mon, 16 Oct 2017 20:45:57 +0000 (15:45 -0500)]
i40iw: Move exception_lan_queue to VSI structure

Consolidate exception_lan_queue under VSI structure
where it belongs. Remove it from device and QP structures.

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Remove unused static_rsrc from i40iw_create_qp_info
Mustafa Ismail [Mon, 16 Oct 2017 20:45:56 +0000 (15:45 -0500)]
i40iw: Remove unused static_rsrc from i40iw_create_qp_info

The field static_rsrc in i40iw_create_qp_info is unused
and not needed. Remove it.

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Ignore AE source field in AEQE for some AEs
Mustafa Ismail [Mon, 16 Oct 2017 20:45:55 +0000 (15:45 -0500)]
i40iw: Ignore AE source field in AEQE for some AEs

The AE source field in Asynchronous Event Queue Entry (AEQE) is
not set by the hardware for some AEs, but the code assumes it does.
This results in incorrect processing of some AEs.
Fix this by setting ae_src to I40IW_AE_SOURCE_RSVD for those AEs.

Fixes: 86dbcd0f12e9 ("i40iw: add file to handle cqp calls")
Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoi40iw: Cleanup AE processing
Mustafa Ismail [Mon, 16 Oct 2017 20:45:54 +0000 (15:45 -0500)]
i40iw: Cleanup AE processing

Remove unimplemented Asynchronous Events (AE) and correct names.

Signed-off-by: Mustafa Ismail <mustafa.ismail@intel.com>
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoMerge branch 'timer_setup' into for-next
Doug Ledford [Wed, 18 Oct 2017 17:12:09 +0000 (13:12 -0400)]
Merge branch 'timer_setup' into for-next

Conflicts:
drivers/infiniband/hw/cxgb4/cm.c
drivers/infiniband/hw/qib/qib_driver.c
drivers/infiniband/hw/qib/qib_mad.c

There were minor fixups needed in these files.  Just minor context diffs
due to patches from independent sources touching the same basic area.

Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoMerge branch 'for-next-early' into for-next
Doug Ledford [Wed, 18 Oct 2017 17:07:13 +0000 (13:07 -0400)]
Merge branch 'for-next-early' into for-next

The early for-next branch was based on v4.14-rc2, while the shared pull
request I got from Mellanox used a v4.14-rc4 base.  I'm making the
branch that was the shared Mellanox pull request the new for-next branch
and merging the early for-next branch into it.

Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/mlx5: Use ARRAY_SIZE
Jérémy Lefaure [Mon, 16 Oct 2017 05:45:17 +0000 (08:45 +0300)]
IB/mlx5: Use ARRAY_SIZE

Using the ARRAY_SIZE macro improves the readability of the code.

Found with Coccinelle with the following semantic patch:
@r depends on (org || report)@
type T;
T[] E;
position p;
@@
(
 (sizeof(E)@p /sizeof(*E))
|
 (sizeof(E)@p /sizeof(E[...]))
|
 (sizeof(E)@p /sizeof(T))
)

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@lse.epita.fr>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/core: Fix calculation of maximum RoCE MTU
Parav Pandit [Mon, 16 Oct 2017 05:45:16 +0000 (08:45 +0300)]
IB/core: Fix calculation of maximum RoCE MTU

The original code only took into consideration the largest header
possible after the IB_BTH_BYTES.  This was incorrect, as the largest
possible header size is the largest possible combination of headers we
might run into.  The new code accounts for all possible headers in the
largest possible combination and subtracts that from the MTU to make
sure that all packets will fit on the wire.

Link: https://www.spinics.net/lists/linux-rdma/msg54558.html
Fixes: 3c86aa70bf67 ("RDMA/cm: Add RDMA CM support for IBoE devices")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Reported-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/core: Fix use workqueue without WQ_MEM_RECLAIM
Parav Pandit [Mon, 16 Oct 2017 05:45:15 +0000 (08:45 +0300)]
IB/core: Fix use workqueue without WQ_MEM_RECLAIM

The IB/core provides address resolution service and invokes callback
handler when address resolve request completes of requester in worker
thread context.

Such caller might allocate or free memory in callback handler
depending on the completion status to make further progress or to
terminate a connection. Most ULPs resolve route which involves
allocating route entry and path record elements in callback event handler.

It has been noticed that WQ_MEM_RECLAIM flag should not be used for
workers that tend to allocate memory in this [1] thread discussion.

In order to mitigate this situation, WQ_MEM_RECLAIM flag was dropped for
other such WQs in this [2] patch.

Similar problem might arise with address resolution path, though its not
yet noticed. The ib_addr workqueue is not memory reclaim path due to its
nature of invoking callback that might allocate memory or don't free any
memory under memory pressure.

[1] https://www.spinics.net/lists/linux-rdma/msg53239.html
[2] https://www.spinics.net/lists/linux-rdma/msg53416.html

Fixes: f54816261c2b ("IB/addr: Remove deprecated create_singlethread_workqueue")
Fixes: 5fff41e1f89d ("IB/core: Fix race condition in resolving IP to MAC")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/core: Fix unable to change lifespan entry for hw_counters
Parav Pandit [Mon, 16 Oct 2017 05:45:14 +0000 (08:45 +0300)]
IB/core: Fix unable to change lifespan entry for hw_counters

This patch fixes the case where 'lifespan' entry of the hw_counters
is not writable. Currently write callback is not exposed for for
the hw_counters sysfs operation. Due to this, modifying lifespan
value results into permission denied error in below example.

echo 10 > /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan
-bash: /sys/class/infiniband/mlx5_0/ports/1/hw_counters/lifespan:
Permission denied

This patch adds the hook to modify any attribute which implements
store() operation.

Fixes: b40f4757daa1 ("IB/core: Make device counter infrastructure dynamic")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB: Let ib_core resolve destination mac address
Parav Pandit [Mon, 16 Oct 2017 05:45:13 +0000 (08:45 +0300)]
IB: Let ib_core resolve destination mac address

Since IB/core resolves the destination mac address for user and kernel
consumers, avoid resolving in multiple provider drivers.

Only ib_core resolves DMAC now, therefore resolve_eth_dmac is removed as
exported symbol.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/core: Introduce and use rdma_create_user_ah
Parav Pandit [Mon, 16 Oct 2017 05:45:12 +0000 (08:45 +0300)]
IB/core: Introduce and use rdma_create_user_ah

Introduce rdma_create_user_ah API which allows passing udata to
provider driver and additionally which resolves DMAC for RoCE.

ib_resolve_eth_dmac() resolves destination mac address for unicast,
multicast, link local ipv4 mapped ipv6 and ipv6 destination gid entry.
This allows all RoCE provider drivers to avoid duplicating such code.

Such change brings consistency where IB core always resolves dmac and pass
it to RoCE provider drivers for user and kernel consumers, with this
ah_attr->roce.dmac is always an input field for provider drivers.

This uniformity avoids exporting ib_resolve_eth_dmac symbol to providers
or other modules. Therefore its removed as exported symbol at later in
the patch series.

Now uverbs and umad both makes use of rdma_create_user_ah API which
fixes the issue where umad has invalid DMAC for address.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb4: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 22:52:31 +0000 (15:52 -0700)]
RDMA/cxgb4: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Also removes an unused timer and
drops a redundant initialization.

Cc: Steve Wise <swise@chelsio.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/i40iw: Convert timers to use timer_setup() (part 2)
Kees Cook [Tue, 17 Oct 2017 18:37:54 +0000 (11:37 -0700)]
RDMA/i40iw: Convert timers to use timer_setup() (part 2)

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

This includes the remaining timers missed in the earlier i40iw patch.

Cc: Faisal Latif <faisal.latif@intel.com>
Cc: Shiraz Saleem <shiraz.saleem@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb3: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 22:54:11 +0000 (15:54 -0700)]
RDMA/cxgb3: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Also removes an unused timer.

Cc: Steve Wise <swise@chelsio.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 22:51:54 +0000 (15:51 -0700)]
IB/hfi1: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly. Switches test of .data field to
.function, since .data will be going away.

Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/rdmavt: Convert timers to use timer_setup()
Kees Cook [Mon, 16 Oct 2017 22:51:13 +0000 (15:51 -0700)]
IB/rdmavt: Convert timers to use timer_setup()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

setup_timer() was already being called before the open-coded init_timer()
and .data assignment. These are removed as well.

Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Hal Rosenstock <hal.rosenstock@gmail.com>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoMerge tag 'mlx5-updates-2017-10-11' of git://git.kernel.org/pub/scm/linux/kernel...
Doug Ledford [Wed, 18 Oct 2017 15:03:35 +0000 (11:03 -0400)]
Merge tag 'mlx5-updates-2017-10-11' of git://git./linux/kernel/git/mellanox/linux into mlnx-shared

mlx5-updates-2017-10-11: IPoIB Muli Pkey support

This series provides the support for IPoIB Multi Pkey.  InfiniBand Pkeys
are the equivalent of Ethernet vlans.  Currently IPoIB device driver
supports only default Pkey and IPoIB Pkey child interfaces are not
supported with IPoIB offloads mode, this series will add the support for
that by allowing creating mlx5 multiple IPoIB netdevices with a
non-default Pkey.

mlx5 IPoIB Pkey child interface is smaller version of mlx5i IPoIB
interfaces and shares most of its resources with the parent IPoIB
interface, namely RX steering and ring queue resources.

The only mlx5 resources a child Pkey interface will be creating are the
TX rings, since they should be assigned to a specific Pkey.

mlx5i Pkey netdev is implemented via new mlx5e netdev profile
implemented in mlx5/core/ipoib/ipoib_vlan.c.

The series starts with a refactoring of mlx5e PTP and mlx5 clock
implementation to move the code to be part of mlx5 core rather than
mlx5e netdevice, in order to make mlx5 clock and PTP registration part
of the core to be shared with mlx5e master Ethernet netdev/IPoIB parent
netdev and mlx5_ib in the near future.

Add the support for attaching multiple underlay QPs for the different
Pkeys in mlx5 core RX steering.

Add Pkey index to rdma_netdev to add the ability to set PKEY index to
lower IPoIB offload netdev.

Use hash-table to map between DQPN (Destination QP number) to child
netdev for the IPoIB parent netdev to forward RX packets to the
corresponding child Pkey netdev, since the RX rings are shared.

The reset of the series adds the ipoib child Pkey: mlx5e netdev profile,
netdev nods implementation and minimal set of ethtool callbacks.

Thanks,
Saeed.

Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srp: Make CM timeout dependent on subnet timeout
Bart Van Assche [Wed, 11 Oct 2017 17:27:29 +0000 (10:27 -0700)]
IB/srp: Make CM timeout dependent on subnet timeout

For small networks it is safe to reduce the subnet timeout from
its default value (18 for opensm) to 16. Make the SRP CM timeout
dependent on the subnet timeout such that decreasing the subnet
timeout also causes SRP failover and failback to occur faster.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srp: Cache global rkey
Bart Van Assche [Wed, 11 Oct 2017 17:27:28 +0000 (10:27 -0700)]
IB/srp: Cache global rkey

This is a micro-optimization for the hot path.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srp: Remove second argument of srp_destroy_qp()
Bart Van Assche [Wed, 11 Oct 2017 17:27:27 +0000 (10:27 -0700)]
IB/srp: Remove second argument of srp_destroy_qp()

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srp: Avoid that a cable pull can trigger a kernel crash
Bart Van Assche [Wed, 11 Oct 2017 17:27:26 +0000 (10:27 -0700)]
IB/srp: Avoid that a cable pull can trigger a kernel crash

This patch fixes the following kernel crash:

general protection fault: 0000 [#1] PREEMPT SMP
Workqueue: ib_mad2 timeout_sends [ib_core]
Call Trace:
 ib_sa_path_rec_callback+0x1c4/0x1d0 [ib_core]
 send_handler+0xb2/0xd0 [ib_core]
 timeout_sends+0x14d/0x220 [ib_core]
 process_one_work+0x200/0x630
 worker_thread+0x4e/0x3b0
 kthread+0x113/0x150

Fixes: commit aef9ec39c47f ("IB: Add SCSI RDMA Protocol (SRP) initiator")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Cc: <stable@vger.kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srpt: Change default behavior from using SRQ to using RC
Bart Van Assche [Wed, 11 Oct 2017 17:27:25 +0000 (10:27 -0700)]
IB/srpt: Change default behavior from using SRQ to using RC

Although in the RC mode more resources are needed that mode has three
advantages over SRQ:
- It works with all RDMA adapters, even those that do not support
  SRQ.
- Posting WRs and polling WCs does not trigger lock contention
  because only one thread at a time accesses a WR or WC queue in
  non-SRQ mode.
- The end-to-end flow control mechanism is used.

>From the IB spec:

    C9-150.2.1: For QPs that are not associated with an SRQ, each HCA
    receive queue shall generate end-to-end flow control credits. If
    a QP is associated with an SRQ, the HCA receive queue shall not
    generate end-to-end flow control credits.

Add new configfs attributes that allow to configure which mode to use
(/sys/kernel/config/target/srpt/$GUID/$GUID/attrib/use_srq). Note:
only the attribute for port 1 is relevant on multi-port adapters.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srpt: Cache global L_Key
Bart Van Assche [Wed, 11 Oct 2017 17:27:24 +0000 (10:27 -0700)]
IB/srpt: Cache global L_Key

This patch is a micro-optimization for the hot path.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srpt: Limit the send and receive queue sizes to what the HCA supports
Bart Van Assche [Wed, 11 Oct 2017 17:27:23 +0000 (10:27 -0700)]
IB/srpt: Limit the send and receive queue sizes to what the HCA supports

Additionally, correct the comment about ch->rq_size.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/srpt: Do not accept invalid initiator port names
Bart Van Assche [Wed, 11 Oct 2017 17:27:22 +0000 (10:27 -0700)]
IB/srpt: Do not accept invalid initiator port names

Make srpt_parse_i_port_id() return a negative value if hex2bin()
fails.

Fixes: commit a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/uverbs: Make the code in ib_uverbs_cmd_verbs() less confusing
Bart Van Assche [Mon, 16 Oct 2017 15:47:45 +0000 (08:47 -0700)]
RDMA/uverbs: Make the code in ib_uverbs_cmd_verbs() less confusing

This patch reduces the number of #ifdefs and also avoids that
smatch reports the following:

drivers/infiniband/core/uverbs_ioctl.c:276: ib_uverbs_cmd_verbs() warn: if statement not indented
drivers/infiniband/core/uverbs_ioctl.c:280: ib_uverbs_cmd_verbs() warn: possible memory leak of 'ctx'
drivers/infiniband/core/uverbs_ioctl.c:315: ib_uverbs_cmd_verbs() warn: if statement not indented

References: commit fac9658cabb9 ("IB/core: Add new ioctl interface")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Matan Barak <matanb@mellanox.com>
Cc: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agobnxt_re: Make room for mapping beyond 32 entries
Somnath Kotur [Tue, 17 Oct 2017 08:31:35 +0000 (14:01 +0530)]
bnxt_re: Make room for mapping beyond 32 entries

Latest chip requires indexes 32 to 47 be used for the internal HW block
that manages queue mapping.

Signed-off-by: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agobnxt_re: Fix incorrect usage of test_bit()
Somnath Kotur [Fri, 13 Oct 2017 06:08:00 +0000 (11:38 +0530)]
bnxt_re: Fix incorrect usage of test_bit()

test_bit() takes a bit number while the 'flags' field in
struct bnxt_qplib_rcfw was using actual BIT position converted
values.
Fix this by assigning bit numbers and use consistent APIs
all the flag values.
Also logging a message in case of failure.

Thanks to Dan Carpenter for pointing this out.

Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Add MODULE_FIRMWARE statements
Thomas Bogendoerfer [Wed, 11 Oct 2017 12:41:34 +0000 (14:41 +0200)]
IB/hfi1: Add MODULE_FIRMWARE statements

Provide information about used firmware files via modinfo.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/hns: fix spelling mistake: "Reseved" -> "Reserved"
Colin Ian King [Tue, 10 Oct 2017 15:14:51 +0000 (16:14 +0100)]
RDMA/hns: fix spelling mistake: "Reseved" -> "Reserved"

Trivial fix to spelling mistake in dev_err error message

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoMerge branch 'hfi1' into k.o/for-next
Doug Ledford [Wed, 18 Oct 2017 14:15:14 +0000 (10:15 -0400)]
Merge branch 'hfi1' into k.o/for-next

Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/rdmavt: Don't wait for resources in QP reset
Alex Estrin [Mon, 9 Oct 2017 19:38:33 +0000 (12:38 -0700)]
IB/rdmavt: Don't wait for resources in QP reset

Per the IBTA spec, QP destroy shall fail if the QP is attached
to multicast groups, although the spec is silent on modify_qp
to reset state. It implies that ULP must deregister QP from
all mcast groups for destroy to succeed.
The faulty patch "IB/ipoib: Update broadcast object if PKey value
was changed in index 0" exposed two issues in rdmavt:
1. Rvt QP reset waits for qp references to go to zero.
This will hang if QP is attached to multicast groups.
2. The mcast group detach will fail for a QP in reset state
therefore preventing ULP from correcting the issue.
This patch moves the reference count wait to the the destroy QP
path and allows a QP mcast detach to work in the reset state.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Set hdr_type when tx req is allocated
Kaike Wan [Mon, 9 Oct 2017 19:38:26 +0000 (12:38 -0700)]
IB/hfi1: Set hdr_type when tx req is allocated

Setting the protocol type should be part of initializing the tx request.
For UC and RC, the current protocol type is part of the qp priv structure.
For ud requests, it needs to be adjusted dynamically, based on the AV
posted with the WQE. This patch will simplify the initialization of the
tx request.

Fixes: 5b6cabb0db77 ("IB/hfi1: Add 16B RC/UC support")
Reviewed-by: Don Hiatt <don.hiatt@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Eliminate allocation while atomic
Don Hiatt [Mon, 9 Oct 2017 19:38:19 +0000 (12:38 -0700)]
IB/hfi1: Eliminate allocation while atomic

The PIO trailing buffer was being dynamically allocated
but the kcalloc return value was not being checked. Further,
the GFP_KERNEL was being used even though the send engine
might be called with interrupts disabled.

Since the maximum size of the trailing buffer is only 12
bytes (CRC = 4, LT = 1, Pad = 0 to 7 bytes) just statically
allocate the buffer, remove the alloc entirely and share it
with the SDMA engine by making it global.

Reported-by: Leon Romanovsky <leon@kernel.org>
Fixes: 566d53a82644 ("IB/hfi1: Enhance PIO/SDMA send for 16B")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Mask out A bit from psn trace
Don Hiatt [Mon, 9 Oct 2017 19:38:12 +0000 (12:38 -0700)]
IB/hfi1: Mask out A bit from psn trace

The trace logic prior to the fixes below used to mask the
A bit from the psn. It now mistakenly displays the A bit,
which is already displayed separately.

Fix by adding the appropriate mask to the psn tracing.

Fixes: 228d2af1b723 ("IB/hfi1: Separate input/output header tracing")
Fixes: 863cf89d472f ("IB/hfi1: Add 16B trace support")
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Don Hiatt <don.hiatt@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Correct unnecessary acquisition of HW mutex
Grzegorz Morys [Mon, 9 Oct 2017 19:38:04 +0000 (12:38 -0700)]
IB/hfi1: Correct unnecessary acquisition of HW mutex

Avoid acquiring already acquired hardware mutex and releasing
the unacquired one as these are redundant operations.
Add printouts for such situations to help detect potential errors
within the driver.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Grzegorz Morys <grzegorz.morys@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Allow meta version 4 for platform configuration
Jakub Byczkowski [Mon, 9 Oct 2017 19:37:56 +0000 (12:37 -0700)]
IB/hfi1: Allow meta version 4 for platform configuration

Parsing of platform configuration format 4 will fail on meta
version check. Allow meta version 4 during parsing.

Reviewed-by: Jan Sokolowski <jan.sokolowski@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jakub Byczkowski <jakub.byczkowski@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Fix serdes loopback set-up
Jan Sokolowski [Mon, 9 Oct 2017 20:08:28 +0000 (13:08 -0700)]
IB/hfi1: Fix serdes loopback set-up

Change serdes mode setting to use MISC_CONFIG_BITS in
VERIFY_CAP_LOCAL_LINK_WIDTH register. This method of
setting up serdes loopback is universally compatible
across all firmware versions.

Reviewed-by: Jakub Byczkowski <jakub.byczkowski@intel.com>
Signed-off-by: Jan Sokolowski <jan.sokolowski@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/usnic: Instantiate data structures once
Bart Van Assche [Wed, 11 Oct 2017 17:49:27 +0000 (10:49 -0700)]
RDMA/usnic: Instantiate data structures once

Data structures should not be defined in a header file. Hence move
the min_transport_spec[] definition from a header file to a .c file.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christian Benvenuti <benve@cisco.com>
Cc: Dave Goodell <dgoodell@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/usnic: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:49:26 +0000 (10:49 -0700)]
RDMA/usnic: Remove a set-but-not-used variable

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christian Benvenuti <benve@cisco.com>
Cc: Dave Goodell <dgoodell@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/usnic: Make the compiler check declaration consistency during compilation
Bart Van Assche [Wed, 11 Oct 2017 17:49:25 +0000 (10:49 -0700)]
RDMA/usnic: Make the compiler check declaration consistency during compilation

This patch avoids that sparse complains about missing declarations.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Christian Benvenuti <benve@cisco.com>
Cc: Dave Goodell <dgoodell@cisco.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/rxe: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:24 +0000 (10:49 -0700)]
RDMA/rxe: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Cc: Moni Shoua <monis@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/rdmavt: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:23 +0000 (10:49 -0700)]
RDMA/rdmavt: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/qib: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:49:22 +0000 (10:49 -0700)]
IB/qib: Remove set-but-not-used variables

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Tested-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/qib: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:21 +0000 (10:49 -0700)]
IB/qib: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Mike Marciniszyn <infinipath@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/qib: Remove remaining code related to writing the EEPROM
Bart Van Assche [Wed, 11 Oct 2017 17:49:20 +0000 (10:49 -0700)]
IB/qib: Remove remaining code related to writing the EEPROM

Due to removal of the EEPROM writing code, the qib_inc_eeprom_err()
macro became a no-op. Remove the code that calls it. Since that
change removes all code that reads the eep_st_masks array, also
remove the code that updates that array and the array itself.

References: commit 18c0b82a3e45 ("IB/qib: Do not write EEPROM")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Mike Marciniszyn <infinipath@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/qedr: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:49:19 +0000 (10:49 -0700)]
RDMA/qedr: Remove set-but-not-used variables

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ram Amrani <Ram.Amrani@cavium.com>
Cc: Michal Kalderon <Michal.Kalderon@cavium.com>
Cc: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/qedr: Annotate iomem pointers correctly
Bart Van Assche [Wed, 11 Oct 2017 17:49:18 +0000 (10:49 -0700)]
RDMA/qedr: Annotate iomem pointers correctly

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ram Amrani <Ram.Amrani@cavium.com>
Cc: Michal Kalderon <Michal.Kalderon@cavium.com>
Cc: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/qedr: Declare local functions static
Bart Van Assche [Wed, 11 Oct 2017 17:49:17 +0000 (10:49 -0700)]
RDMA/qedr: Declare local functions static

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Michal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/qedr: Use NULL instead of 0 to represent a pointer
Bart Van Assche [Wed, 11 Oct 2017 17:49:16 +0000 (10:49 -0700)]
RDMA/qedr: Use NULL instead of 0 to represent a pointer

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Ram Amrani <Ram.Amrani@cavium.com>
Cc: Michal Kalderon <Michal.Kalderon@cavium.com>
Cc: Ariel Elior <Ariel.Elior@cavium.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/ocrdma: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:49:15 +0000 (10:49 -0700)]
RDMA/ocrdma: Remove set-but-not-used variables

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/ocrdma: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:14 +0000 (10:49 -0700)]
RDMA/ocrdma: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with
W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/ocrdma: Use NULL instead of 0 to represent a pointer
Bart Van Assche [Wed, 11 Oct 2017 17:49:13 +0000 (10:49 -0700)]
RDMA/ocrdma: Use NULL instead of 0 to represent a pointer

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>
Cc: Devesh Sharma <devesh.sharma@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/nes: Fix a race condition in nes_inetaddr_event()
Bart Van Assche [Wed, 11 Oct 2017 17:49:12 +0000 (10:49 -0700)]
IB/nes: Fix a race condition in nes_inetaddr_event()

This patch has been compile-tested only.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Faisal Latif <faisal.latif@intel.com>
Acked-by: Faisal Latif <fasial.latif@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/nes: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:49:11 +0000 (10:49 -0700)]
IB/nes: Remove set-but-not-used variables

This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Faisal Latif <faisal.latif@intel.com>
Acked-by: Faisal Latif <fasial.latif@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/nes: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:10 +0000 (10:49 -0700)]
IB/nes: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Faisal Latif <faisal.latif@intel.com>
Acked-by: Faisal Latif <fasial.latif@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/nes: Fix indentation
Bart Van Assche [Wed, 11 Oct 2017 17:49:09 +0000 (10:49 -0700)]
IB/nes: Fix indentation

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Faisal Latif <faisal.latif@intel.com>
Acked-by: Faisal Latif <fasial.latif@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/mlx5: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:49:08 +0000 (10:49 -0700)]
IB/mlx5: Remove a set-but-not-used variable

References: commit 5fe9dec0d045 ("IB/mlx5: Use blue flame register allocator in mlx5_ib")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/mlx5: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:07 +0000 (10:49 -0700)]
IB/mlx5: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/mlx4: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:06 +0000 (10:49 -0700)]
IB/mlx4: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/mthca: Fix indentation
Bart Van Assche [Wed, 11 Oct 2017 17:49:05 +0000 (10:49 -0700)]
IB/mthca: Fix indentation

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/i40iw: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:49:04 +0000 (10:49 -0700)]
RDMA/i40iw: Remove a set-but-not-used variable

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/i40iw: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:49:03 +0000 (10:49 -0700)]
RDMA/i40iw: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/i40iw: Fix a race condition
Bart Van Assche [Wed, 11 Oct 2017 17:49:02 +0000 (10:49 -0700)]
RDMA/i40iw: Fix a race condition

Use the proper primitives to dereference the RCU pointer
upper_dev->ip_ptr. Compile-tested only.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hns: Declare local functions 'static'
Bart Van Assche [Wed, 11 Oct 2017 17:49:01 +0000 (10:49 -0700)]
IB/hns: Declare local functions 'static'

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Lijun Ou <oulijun@huawei.com>
Cc: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Cc: Shaobo Xu <xushaobo2@huawei.com>
Acked-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hns: Annotate iomem pointers correctly
Bart Van Assche [Wed, 11 Oct 2017 17:49:00 +0000 (10:49 -0700)]
IB/hns: Annotate iomem pointers correctly

This patch avoids that sparse complains that there is an address
space mismatch.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Lijun Ou <oulijun@huawei.com>
Cc: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Cc: Shaobo Xu <xushaobo2@huawei.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Define hfi1_handle_cnp_tbl[] once
Bart Van Assche [Wed, 11 Oct 2017 17:48:59 +0000 (10:48 -0700)]
IB/hfi1: Define hfi1_handle_cnp_tbl[] once

Move the hfi1_handle_cnp_tbl[] from a header file to a .c file
such that only one copy ends up in the hfi1 kernel module. This
patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:48:58 +0000 (10:48 -0700)]
IB/hfi1: Remove set-but-not-used variables

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/hfi1: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:48:57 +0000 (10:48 -0700)]
IB/hfi1: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb4: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:48:56 +0000 (10:48 -0700)]
RDMA/cxgb4: Remove a set-but-not-used variable

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb4: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:48:55 +0000 (10:48 -0700)]
RDMA/cxgb4: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb4: Remove the obsolete kernel module option 'c4iw_debug'
Bart Van Assche [Wed, 11 Oct 2017 17:48:54 +0000 (10:48 -0700)]
RDMA/cxgb4: Remove the obsolete kernel module option 'c4iw_debug'

This patch avoids that building the cxgb4 module with W=1 triggers
a complaint about a local variable that has not been declared static.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb4: Fix indentation
Bart Van Assche [Wed, 11 Oct 2017 17:48:53 +0000 (10:48 -0700)]
RDMA/cxgb4: Fix indentation

This patch avoids that smatch reports the following:

drivers/infiniband/hw/cxgb4/device.c:1105: copy_gl_to_skb_pkt() warn: inconsistent indenting
drivers/infiniband/hw/cxgb4/cm.c:835: send_connect() warn: inconsistent indenting
drivers/infiniband/hw/cxgb4/cm.c:841: send_connect() warn: inconsistent indenting
drivers/infiniband/hw/cxgb4/cm.c:888: send_connect() warn: inconsistent indenting
drivers/infiniband/hw/cxgb4/cm.c:894: send_connect() warn: inconsistent indenting

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb3: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:48:52 +0000 (10:48 -0700)]
RDMA/cxgb3: Remove a set-but-not-used variable

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb3: Annotate an RCU pointer
Bart Van Assche [Wed, 11 Oct 2017 17:48:51 +0000 (10:48 -0700)]
RDMA/cxgb3: Annotate an RCU pointer

Annotate t3cdev.l2opt with __rcu since it is used as an RCU pointer.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cxgb3: Annotate locking assumptions
Bart Van Assche [Wed, 11 Oct 2017 17:48:50 +0000 (10:48 -0700)]
RDMA/cxgb3: Annotate locking assumptions

Tell sparse what the locking assumptions are for __flush_qp() such
that it does not complain about the locking operations inside that
function.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/bnxt_re: Remove set-but-not-used variables
Bart Van Assche [Wed, 11 Oct 2017 17:48:49 +0000 (10:48 -0700)]
RDMA/bnxt_re: Remove set-but-not-used variables

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/bnxt_re: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:48:48 +0000 (10:48 -0700)]
RDMA/bnxt_re: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/isert: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:48:47 +0000 (10:48 -0700)]
RDMA/isert: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/iwcm: Remove a set-but-not-used variable
Bart Van Assche [Wed, 11 Oct 2017 17:48:46 +0000 (10:48 -0700)]
RDMA/iwcm: Remove a set-but-not-used variable

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoRDMA/cma: Avoid triggering undefined behavior
Bart Van Assche [Wed, 11 Oct 2017 17:48:45 +0000 (10:48 -0700)]
RDMA/cma: Avoid triggering undefined behavior

According to the C standard the behavior of computations with
integer operands is as follows:
* A computation involving unsigned operands can never overflow,
  because a result that cannot be represented by the resulting
  unsigned integer type is reduced modulo the number that is one
  greater than the largest value that can be represented by the
  resulting type.
* The behavior for signed integer underflow and overflow is
  undefined.

Hence only use unsigned integers when checking for integer
overflow.

This patch is what I came up with after having analyzed the
following smatch warnings:

drivers/infiniband/core/cma.c:3448: cma_resolve_ib_udp() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len'
drivers/infiniband/core/cma.c:3505: cma_connect_ib() warn: signed overflow undefined. 'offset + conn_param->private_data_len < conn_param->private_data_len'

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/cm: Suppress gcc 7 fall-through complaints
Bart Van Assche [Wed, 11 Oct 2017 17:48:44 +0000 (10:48 -0700)]
IB/cm: Suppress gcc 7 fall-through complaints

Avoid that gcc 7 reports the following warning when building with W=1:

warning: this statement may fall through [-Wimplicit-fallthrough=]

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agoIB/core: Fix endianness annotation in rdma_is_multicast_addr()
Bart Van Assche [Wed, 11 Oct 2017 17:48:43 +0000 (10:48 -0700)]
IB/core: Fix endianness annotation in rdma_is_multicast_addr()

Since ipv4_addr is a big endian 32-bit number, annotate it as such.

Fixes: commit be1d325a3358 ("IB/core: Set RoCEv2 MGID according to spec")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
7 years agonet/mlx5e: IPoIB, Modify rdma netdev allocate and free to support PKEY
Alex Vesker [Thu, 14 Sep 2017 15:22:50 +0000 (18:22 +0300)]
net/mlx5e: IPoIB, Modify rdma netdev allocate and free to support PKEY

Resources such as FT, QPN HT and mdev resources should be allocated
only by parent netdev. Shared resources are allocated and freed by the
parent interface since the parent is always present and created
before the IPoIB PKEY sub-interface.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
7 years agonet/mlx5e: IPoIB, Add PKEY child interface ethtool ops
Alex Vesker [Thu, 14 Sep 2017 15:02:31 +0000 (18:02 +0300)]
net/mlx5e: IPoIB, Add PKEY child interface ethtool ops

Similar to VLAN interfaces child interfaces have limited ethtool
support. In current code the main limitation that does not
allow child interface ethtool configuration is due to shared
resources which are managed by the parent.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
7 years agonet/mlx5e: IPoIB, Add PKEY child interface ndos
Alex Vesker [Thu, 14 Sep 2017 13:33:35 +0000 (16:33 +0300)]
net/mlx5e: IPoIB, Add PKEY child interface ndos

Child interface ndos will be called to support child interface
specific behaviour.

ndo_init flow:
-Acquire shared QPN to net-device HT from parent
-Continue with the same flow as parent interface

ndo_open flow:
-Initialize child underlay QP and connect to shared FT
-Create child send TIS
-Open child send channels

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
7 years agonet/mlx5e: IPoIB, Add PKEY child interface nic profile
Alex Vesker [Thu, 14 Sep 2017 11:08:39 +0000 (14:08 +0300)]
net/mlx5e: IPoIB, Add PKEY child interface nic profile

Child interface profile will be called to support child interface
specific behaviour. The child code is sparse compared to the parent
since the RX channels are shared between the interfaces.
Creating a septate profile for child and parent will make a smother
code with a better ability for future expansion.
The profile stuct is exposed to the parent using a getter function.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>
7 years agonet/mlx5e: IPoIB, Use hash-table to map between QPN to child netdev
Alex Vesker [Thu, 14 Sep 2017 07:27:25 +0000 (10:27 +0300)]
net/mlx5e: IPoIB, Use hash-table to map between QPN to child netdev

This change is needed for PKEY support, since the RQs are shared
between the child interface and the parent. The parent is responsible
for NAPI and the precessing of RX completions. Using the dqpn in the
completion descriptor we set the corresponding child IPoIB netdevice
on the SKB.
The mapping between the dqpn and the netdevice is done using a HT,
each mlx5 IPoIB interface registers its mapping on creation.

Signed-off-by: Alex Vesker <valex@mellanox.com>
Reviewed-by: Erez Shitrit <erezsh@mellanox.com>