Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Tesarik <ptesarik@suse.cz>2018-11-09 14:09:07 +0100
committerPetr Tesarik <ptesarik@suse.cz>2018-11-09 14:09:07 +0100
commit067873e0095576382d9af2820e466fce78b61a91 (patch)
treef2c00db298ef90a079c7175a8a1265fa4900b231
parent8d89ecc0e3eedd10b68ef90966fb8194667d1a7d (diff)
parente06fd99ca035995ed04eac988ab24133c7f9b98f (diff)
Merge branch 'users/tbogendoerfer/SLE15-SP1/for-next' into SLE15-SP1
Pull Infiniband patches from Thomas Bogendoerfer
-rw-r--r--blacklist.conf35
-rw-r--r--config/arm64/default4
-rw-r--r--config/ppc64le/default4
-rw-r--r--config/s390x/default5
-rw-r--r--config/x86_64/debug1
-rw-r--r--config/x86_64/default4
-rw-r--r--patches.drivers/IB-Let-ib_core-resolve-destination-mac-address.patch171
-rw-r--r--patches.drivers/IB-Update-references-to-libibverbs.patch63
-rw-r--r--patches.drivers/IB-addr-Constify-dst_entry-pointer.patch68
-rw-r--r--patches.drivers/IB-cm-Add-and-use-a-helper-function-to-add-cm_id-s-t.patch66
-rw-r--r--patches.drivers/IB-cm-Add-debug-prints-to-ib_cm.patch211
-rw-r--r--patches.drivers/IB-cm-Block-processing-alternate-path-handling-RoCE-.patch64
-rw-r--r--patches.drivers/IB-cm-Fix-sleeping-while-spin-lock-is-held.patch57
-rw-r--r--patches.drivers/IB-cm-Handle-address-handle-attribute-init-error.patch36
-rw-r--r--patches.drivers/IB-cm-Introduce-and-use-helper-function-to-get-cm_po.patch66
-rw-r--r--patches.drivers/IB-cm-Refactor-to-avoid-setting-path-record-software.patch139
-rw-r--r--patches.drivers/IB-cm-Suppress-gcc-7-fall-through-complaints.patch29
-rw-r--r--patches.drivers/IB-cm-umad-Handle-av-init-error.patch116
-rw-r--r--patches.drivers/IB-cma-Resolve-route-only-while-receiving-CM-request.patch113
-rw-r--r--patches.drivers/IB-cma-Use-rdma_protocol_roce-and-remove-cma_protoco.patch65
-rw-r--r--patches.drivers/IB-cma-use-strlcpy-instead-of-strncpy.patch34
-rw-r--r--patches.drivers/IB-core-Add-PCI-write-end-padding-flags-for-WQ-and-Q.patch81
-rw-r--r--patches.drivers/IB-core-Add-null-pointer-check-in-addr_resolve.patch6
-rw-r--r--patches.drivers/IB-core-Attempt-DMAC-resolution-for-only-RoCE.patch42
-rw-r--r--patches.drivers/IB-core-Avoid-SGID-attributes-query-while-converting.patch39
-rw-r--r--patches.drivers/IB-core-Avoid-exporting-module-internal-function.patch78
-rw-r--r--patches.drivers/IB-core-Avoid-exporting-module-internal-ib_find_gid_.patch29
-rw-r--r--patches.drivers/IB-core-Avoid-unnecessary-type-cast.patch30
-rw-r--r--patches.drivers/IB-core-Change-roce_rescan_device-to-return-void.patch63
-rw-r--r--patches.drivers/IB-core-Depend-on-IPv6-stack-to-resolve-link-local-a.patch64
-rw-r--r--patches.drivers/IB-core-Don-t-allow-default-GID-addition-at-non-rese.patch57
-rw-r--r--patches.drivers/IB-core-Fix-comments-of-GID-query-functions.patch134
-rw-r--r--patches.drivers/IB-core-Fix-deleting-default-GIDs-when-changing-mac-.patch173
-rw-r--r--patches.drivers/IB-core-Fix-memory-leak-in-cm_req_handler-error-flow.patch41
-rw-r--r--patches.drivers/IB-core-Fix-to-avoid-deleting-IPv6-look-alike-defaul.patch79
-rw-r--r--patches.drivers/IB-core-Honor-return-status-of-ib_init_ah_from_mcmem.patch42
-rw-r--r--patches.drivers/IB-core-Increase-number-of-char-device-minors.patch548
-rw-r--r--patches.drivers/IB-core-Introduce-and-use-rdma_create_user_ah.patch165
-rw-r--r--patches.drivers/IB-core-Introduce-driver-QP-type.patch36
-rw-r--r--patches.drivers/IB-core-Limit-DMAC-resolution-to-RoCE-Connected-QPs.patch46
-rw-r--r--patches.drivers/IB-core-Limit-DMAC-resolution-to-userspace-QPs.patch98
-rw-r--r--patches.drivers/IB-core-Make-sure-that-PSN-does-not-overflow.patch52
-rw-r--r--patches.drivers/IB-core-Move-rdma_addr_find_l2_eth_by_grh-to-core_pr.patch52
-rw-r--r--patches.drivers/IB-core-Perform-modify-QP-on-real-one.patch6
-rw-r--r--patches.drivers/IB-core-Protect-against-concurrent-access-to-hardwar.patch127
-rw-r--r--patches.drivers/IB-core-Refactor-GID-modify-code-for-RoCE.patch825
-rw-r--r--patches.drivers/IB-core-Refactor-ib_init_ah_attr_from_path-for-RoCE.patch267
-rw-r--r--patches.drivers/IB-core-Refactor-to-avoid-unnecessary-check-on-GID-l.patch57
-rw-r--r--patches.drivers/IB-core-Refer-to-RoCE-port-property-instead-of-GID-t-98f1f4e0.patch36
-rw-r--r--patches.drivers/IB-core-Refer-to-RoCE-port-property-to-decide-buildi.patch50
-rw-r--r--patches.drivers/IB-core-Remove-rdma_resolve_ip_route-as-exported-sym.patch57
-rw-r--r--patches.drivers/IB-core-Remove-the-locking-for-character-device-bitm.patch92
-rw-r--r--patches.drivers/IB-core-Remove-unimplemented-ib_peek_cq.patch43
-rw-r--r--patches.drivers/IB-core-Removed-unused-function.patch62
-rw-r--r--patches.drivers/IB-core-Search-GID-only-for-IB-link-layer.patch32
-rw-r--r--patches.drivers/IB-core-Set-speed-string-to-SDR-for-invalid-active-r.patch32
-rw-r--r--patches.drivers/IB-core-Simplify-ib_query_gid-to-always-refer-to-cac.patch93
-rw-r--r--patches.drivers/IB-core-Simplify-sa_path_set_-sd-lid-calls.patch153
-rw-r--r--patches.drivers/IB-core-Use-PTR_ERR_OR_ZERO.patch36
-rw-r--r--patches.drivers/IB-core-Use-rdma_cap_opa_mad-to-check-for-OPA.patch29
-rw-r--r--patches.drivers/IB-core-Use-rdma_is_port_valid.patch40
-rw-r--r--patches.drivers/IB-core-cm-Fix-generating-a-return-AH-for-RoCEE.patch312
-rw-r--r--patches.drivers/IB-core-cm-cma-ipoib-Rename-ib_init_ah_from_path-to-.patch109
-rw-r--r--patches.drivers/IB-core-fix-spelling-mistake-aceess-access.patch28
-rw-r--r--patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-for-unused-ndev.patch63
-rw-r--r--patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-to-search-only-fo.patch86
-rw-r--r--patches.drivers/IB-core-postpone-WR-initialization-during-queue-drai.patch62
-rw-r--r--patches.drivers/IB-core-remove-redundant-check-on-prot_sg_cnt.patch55
-rw-r--r--patches.drivers/IB-core-umad-cm-Rename-ib_init_ah_from_wc-to-ib_init.patch123
-rw-r--r--patches.drivers/IB-cxgb3-remove-cxio_dbg.c.patch293
-rw-r--r--patches.drivers/IB-hfi1-Add-16B-rcvhdr-trace-support.patch63
-rw-r--r--patches.drivers/IB-hfi1-Add-a-missing-rcu_read_unlock.patch30
-rw-r--r--patches.drivers/IB-hfi1-Add-new-state-complete-decodes-for-LNI-failu.patch33
-rw-r--r--patches.drivers/IB-hfi1-Change-slid-arg-in-ingress_pkey_table_fail-t.patch47
-rw-r--r--patches.drivers/IB-hfi1-Convert-PortXmitWait-PortVLXmitWait-counters.patch22
-rw-r--r--patches.drivers/IB-hfi1-Convert-kzalloc_node-and-kcalloc-to-use-kcal.patch111
-rw-r--r--patches.drivers/IB-hfi1-Convert-the-macro-AHG_HEADER_SET-into-an-inl.patch168
-rw-r--r--patches.drivers/IB-hfi1-Correct-unnecessary-acquisition-of-HW-mutex.patch56
-rw-r--r--patches.drivers/IB-hfi1-Define-hfi1_handle_cnp_tbl-once.patch50
-rw-r--r--patches.drivers/IB-hfi1-Eliminate-allocation-while-atomic.patch8
-rw-r--r--patches.drivers/IB-hfi1-Fix-a-kernel-doc-warning.patch30
-rw-r--r--patches.drivers/IB-hfi1-Fix-handling-of-FECN-marked-multicast-packet.patch10
-rw-r--r--patches.drivers/IB-hfi1-Fix-infinite-loop-in-8051-command-error-path.patch10
-rw-r--r--patches.drivers/IB-hfi1-Fix-loss-of-BECN-with-AHG.patch18
-rw-r--r--patches.drivers/IB-hfi1-Fix-parenthesis-alignment-issues.patch68
-rw-r--r--patches.drivers/IB-hfi1-Look-up-ibport-using-a-pointer-in-receive-pa.patch35
-rw-r--r--patches.drivers/IB-hfi1-Optimize-process_receive_ib.patch112
-rw-r--r--patches.drivers/IB-hfi1-Reduce-8051-command-timeout.patch34
-rw-r--r--patches.drivers/IB-hfi1-Refactor-get_base_info.patch4
-rw-r--r--patches.drivers/IB-hfi1-Refactor-reset_ctxt-IOCTL.patch165
-rw-r--r--patches.drivers/IB-hfi1-Remove-dependence-on-qp-s_hdrwords.patch22
-rw-r--r--patches.drivers/IB-hfi1-Remove-set-but-not-used-variables.patch176
-rw-r--r--patches.drivers/IB-hfi1-Remove-the-debug-trace-message-in-pin_sdma_p.patch37
-rw-r--r--patches.drivers/IB-hfi1-Remove-unnecessary-error-messages-on-alloc-f.patch48
-rw-r--r--patches.drivers/IB-hfi1-Remove-unnecessary-fecn-and-becn-fields.patch241
-rw-r--r--patches.drivers/IB-hfi1-Remove-unnecessary-if-check.patch68
-rw-r--r--patches.drivers/IB-hfi1-Remove-unused-link_default-variable.patch79
-rw-r--r--patches.drivers/IB-hfi1-Set-default_desc1-just-one-time.patch49
-rw-r--r--patches.drivers/IB-hfi1-Suppress-gcc-7-fall-through-complaints.patch62
-rw-r--r--patches.drivers/IB-hfi1-Take-advantage-of-kvzalloc_node-in-sdma-init.patch41
-rw-r--r--patches.drivers/IB-hfi1-qib-Fix-a-concurrency-issue-with-device-name.patch197
-rw-r--r--patches.drivers/IB-ipoib-Delete-unused-struct.patch33
-rw-r--r--patches.drivers/IB-ipoib-Fix-for-potential-no-carrier-state.patch4
-rw-r--r--patches.drivers/IB-ipoib-Remove-device-when-one-port-fails-to-init.patch29
-rw-r--r--patches.drivers/IB-ipoib-Replace-printk-with-pr_warn.patch149
-rw-r--r--patches.drivers/IB-ipoib-Update-pathrec-field-if-not-valid-record.patch124
-rw-r--r--patches.drivers/IB-ipoib-Warn-when-one-port-fails-to-initialize.patch43
-rw-r--r--patches.drivers/IB-ipoib-fix-ipoib_start_xmit-s-return-type.patch33
-rw-r--r--patches.drivers/IB-ipoib-iser-Consistent-print-format-of-vendor-erro.patch91
-rw-r--r--patches.drivers/IB-iser-Combine-substrings-for-three-messages.patch54
-rw-r--r--patches.drivers/IB-iser-Delete-an-error-message-for-a-failed-memory-.patch34
-rw-r--r--patches.drivers/IB-iser-Delete-an-unnecessary-variable-initialisatio.patch30
-rw-r--r--patches.drivers/IB-make-INFINIBAND_ADDR_TRANS-configurable.patch35
-rw-r--r--patches.drivers/IB-mlx4-Add-CQ-moderation-capability-to-query_device.patch31
-rw-r--r--patches.drivers/IB-mlx4-Add-Scatter-FCS-support-over-WQ-creation.patch112
-rw-r--r--patches.drivers/IB-mlx4-Add-support-to-RSS-hash-for-inner-headers.patch93
-rw-r--r--patches.drivers/IB-mlx4-Check-for-egress-flow-steering.patch32
-rw-r--r--patches.drivers/IB-mlx4-Eliminate-duplicate-barriers-on-weakly-order.patch37
-rw-r--r--patches.drivers/IB-mlx4-Exposing-modify-CQ-callback-to-uverbs-layer.patch55
-rw-r--r--patches.drivers/IB-mlx4-Move-mlx4_uverbs_ex_query_device_resp-to-inc.patch6
-rw-r--r--patches.drivers/IB-mlx4-Potential-buffer-overflow-in-_mlx4_set_path.patch35
-rw-r--r--patches.drivers/IB-mlx4-Remove-unused-ibpd-parameter.patch37
-rw-r--r--patches.drivers/IB-mlx4-Report-TSO-capabilities.patch97
-rw-r--r--patches.drivers/IB-mlx4-Suppress-gcc-7-fall-through-complaints.patch46
-rw-r--r--patches.drivers/IB-mlx5-Add-128B-CQE-compression-and-padding-HW-bits.patch34
-rw-r--r--patches.drivers/IB-mlx5-Add-CQ-moderation-capability-to-query_device.patch35
-rw-r--r--patches.drivers/IB-mlx5-Add-IPsec-support-for-egress-and-ingress.patch279
-rw-r--r--patches.drivers/IB-mlx5-Add-PCI-write-end-padding-support.patch139
-rw-r--r--patches.drivers/IB-mlx5-Add-ability-to-hash-by-IPSEC_SPI-when-creati.patch84
-rw-r--r--patches.drivers/IB-mlx5-Add-basic-regiser-unregister-representors-co.patch239
-rw-r--r--patches.drivers/IB-mlx5-Add-implementation-for-create-and-destroy-ac.patch324
-rw-r--r--patches.drivers/IB-mlx5-Add-information-for-querying-IPsec-capabilit.patch78
-rw-r--r--patches.drivers/IB-mlx5-Add-match-on-vport-when-in-switchdev-mode.patch41
-rw-r--r--patches.drivers/IB-mlx5-Add-modify_flow_action_esp-verb.patch86
-rw-r--r--patches.drivers/IB-mlx5-Add-proper-representors-support.patch457
-rw-r--r--patches.drivers/IB-mlx5-Add-support-for-DC-Initiator-QP.patch166
-rw-r--r--patches.drivers/IB-mlx5-Add-support-for-DC-target-QP.patch354
-rw-r--r--patches.drivers/IB-mlx5-Add-support-for-RSS-on-the-inner-packet.patch62
-rw-r--r--patches.drivers/IB-mlx5-Add-tunneling-offloads-support.patch206
-rw-r--r--patches.drivers/IB-mlx5-Allocate-flow-DB-only-on-PF-IB-device.patch179
-rw-r--r--patches.drivers/IB-mlx5-Allow-creation-of-a-multi-packet-RQ.patch161
-rw-r--r--patches.drivers/IB-mlx5-Change-debugfs-to-have-per-port-contents.patch284
-rw-r--r--patches.drivers/IB-mlx5-Create-profile-infrastructure-to-add-and-rem.patch506
-rw-r--r--patches.drivers/IB-mlx5-Device-memory-mr-registration-support.patch139
-rw-r--r--patches.drivers/IB-mlx5-Device-memory-support-in-mlx5_ib.patch570
-rw-r--r--patches.drivers/IB-mlx5-Disable-self-loopback-check-when-in-switchde.patch44
-rw-r--r--patches.drivers/IB-mlx5-Don-t-advertise-RAW-QP-support-in-dual-port-.patch104
-rw-r--r--patches.drivers/IB-mlx5-Don-t-clean-uninitialized-UMR-resources.patch70
-rw-r--r--patches.drivers/IB-mlx5-Don-t-expose-MR-cache-in-switchdev-mode.patch50
-rw-r--r--patches.drivers/IB-mlx5-E-Switch-Add-rule-to-forward-traffic-to-vpor.patch130
-rw-r--r--patches.drivers/IB-mlx5-Enable-QP-creation-with-a-given-blue-flame-i.patch163
-rw-r--r--patches.drivers/IB-mlx5-Expose-dynamic-mmap-allocation.patch276
-rw-r--r--patches.drivers/IB-mlx5-Expose-more-priorities-for-bypass-namespace.patch35
-rw-r--r--patches.drivers/IB-mlx5-Expose-multi-packet-RQ-capabilities.patch96
-rw-r--r--patches.drivers/IB-mlx5-Exposing-modify-CQ-callback-to-uverbs-layer.patch57
-rw-r--r--patches.drivers/IB-mlx5-Extend-UAR-stuff-to-support-dynamic-allocati.patch190
-rw-r--r--patches.drivers/IB-mlx5-Fix-ABI-alignment-to-64-bit.patch30
-rw-r--r--patches.drivers/IB-mlx5-Fix-cleanup-order-on-unload.patch114
-rw-r--r--patches.drivers/IB-mlx5-Fix-out-of-bounds-read-in-create_raw_packet_.patch24
-rw-r--r--patches.drivers/IB-mlx5-Fix-represent-correct-netdevice-in-dual-port.patch39
-rw-r--r--patches.drivers/IB-mlx5-Handle-type-IB_QPT_DRIVER-when-creating-a-QP.patch231
-rw-r--r--patches.drivers/IB-mlx5-Implement-dual-port-functionality-in-query-r.patch199
-rw-r--r--patches.drivers/IB-mlx5-Implement-fragmented-completion-queue-CQ.patch592
-rw-r--r--patches.drivers/IB-mlx5-Initialize-the-parsing-tree-root-without-the.patch116
-rw-r--r--patches.drivers/IB-mlx5-Listen-to-netdev-register-unresiter-events-i.patch73
-rw-r--r--patches.drivers/IB-mlx5-Maintain-a-single-emergency-page.patch184
-rw-r--r--patches.drivers/IB-mlx5-Make-netdev-notifications-multiport-capable.patch283
-rw-r--r--patches.drivers/IB-mlx5-Mmap-the-HCA-s-clock-info-to-user-space.patch163
-rw-r--r--patches.drivers/IB-mlx5-Move-IB-event-processing-onto-a-workqueue.patch172
-rw-r--r--patches.drivers/IB-mlx5-Move-ODP-initialization-to-the-corresponding.patch38
-rw-r--r--patches.drivers/IB-mlx5-Move-RoCE-ETH-initialization-to-the-correspo.patch83
-rw-r--r--patches.drivers/IB-mlx5-Move-hardware-counters-initialization-to-the.patch48
-rw-r--r--patches.drivers/IB-mlx5-Move-locks-initialization-to-the-correspondi.patch127
-rw-r--r--patches.drivers/IB-mlx5-Move-loopback-initialization-to-the-correspo.patch70
-rw-r--r--patches.drivers/IB-mlx5-Only-synchronize-RCU-once-when-removing-mkey.patch103
-rw-r--r--patches.drivers/IB-mlx5-Packet-packing-enhancement-for-RAW-QP.patch270
-rw-r--r--patches.drivers/IB-mlx5-Pass-mlx5_flow_act-struct-instead-of-multipl.patch102
-rw-r--r--patches.drivers/IB-mlx5-Reduce-the-use-of-num_port-capability.patch130
-rw-r--r--patches.drivers/IB-mlx5-Remove-a-set-but-not-used-variable.patch33
-rw-r--r--patches.drivers/IB-mlx5-Removed-not-used-parameters.patch46
-rw-r--r--patches.drivers/IB-mlx5-Report-inner-RSS-capability.patch46
-rw-r--r--patches.drivers/IB-mlx5-Respect-new-UMR-capabilities.patch26
-rw-r--r--patches.drivers/IB-mlx5-Route-MADs-for-dual-port-RoCE.patch87
-rw-r--r--patches.drivers/IB-mlx5-Set-the-default-active-rate-and-width-to-QDR.patch4
-rw-r--r--patches.drivers/IB-mlx5-Support-128B-CQE-compression-feature.patch77
-rw-r--r--patches.drivers/IB-mlx5-Support-padded-128B-CQE-feature.patch173
-rw-r--r--patches.drivers/IB-mlx5-Suppress-gcc-7-fall-through-complaints.patch46
-rw-r--r--patches.drivers/IB-mlx5-Update-counter-implementation-for-dual-port-.patch179
-rw-r--r--patches.drivers/IB-mlx5-Update-tunnel-offloads-bits.patch35
-rw-r--r--patches.drivers/IB-mlx5-Use-ARRAY_SIZE.patch56
-rw-r--r--patches.drivers/IB-mlx5-When-in-switchdev-mode-expose-only-raw-packe.patch279
-rw-r--r--patches.drivers/IB-mlx5-When-not-in-dual-port-RoCE-mode-use-provided.patch48
-rw-r--r--patches.drivers/IB-mlx5-fix-uaccess-beyond-count-in-debugfs-read-wri.patch6
-rw-r--r--patches.drivers/IB-mlx5-remove-duplicate-header-file.patch30
-rw-r--r--patches.drivers/IB-mlx5-remove-redundant-assignment-of-mdev.patch34
-rw-r--r--patches.drivers/IB-mthca-Fix-gup-usage-in-mthca_map_user_db.patch33
-rw-r--r--patches.drivers/IB-mthca-Fix-indentation.patch34
-rw-r--r--patches.drivers/IB-mthca-Use-zeroing-memory-allocator-than-allocator.patch40
-rw-r--r--patches.drivers/IB-mthca-remove-mthca_user.h.patch134
-rw-r--r--patches.drivers/IB-nes-Fix-a-race-condition-in-nes_inetaddr_event.patch41
-rw-r--r--patches.drivers/IB-nes-Fix-indentation.patch128
-rw-r--r--patches.drivers/IB-nes-Remove-set-but-not-used-variables.patch85
-rw-r--r--patches.drivers/IB-nes-Suppress-gcc-7-fall-through-complaints.patch42
-rw-r--r--patches.drivers/IB-nes-fix-nes_netdev_start_xmit-s-return-type.patch32
-rw-r--r--patches.drivers/IB-ocrdma-Remove-unneeded-conversions-to-bool.patch27
-rw-r--r--patches.drivers/IB-ocrdma-Removed-GID-add-del-null-routines.patch78
-rw-r--r--patches.drivers/IB-ocrdma-Use-zeroing-memory-allocator-than-allocato.patch147
-rw-r--r--patches.drivers/IB-ocrdma-pr_err-strings-should-end-with-newlines.patch41
-rw-r--r--patches.drivers/IB-ocrdma_hw-Remove-redundant-checks-and-goto-labels.patch66
-rw-r--r--patches.drivers/IB-ocrdma_hw-remove-unnecessary-code-in-ocrdma_mbx_d.patch40
-rw-r--r--patches.drivers/IB-opa_vnic-Add-routing-control-information.patch165
-rw-r--r--patches.drivers/IB-opa_vnic-Allow-reset-of-MAC-address.patch29
-rw-r--r--patches.drivers/IB-opa_vnic-Mark-unused-Ethernet-MTU-fields-as-reser.patch96
-rw-r--r--patches.drivers/IB-opa_vnic-Properly-set-vesw-port-status.patch88
-rw-r--r--patches.drivers/IB-opa_vnic-Set-POD-value-for-Ethernet-MTU.patch39
-rw-r--r--patches.drivers/IB-providers-Avoid-null-netdev-check-for-RoCE.patch260
-rw-r--r--patches.drivers/IB-providers-Avoid-zero-GID-check-for-RoCE.patch96
-rw-r--r--patches.drivers/IB-qedr-Remove-GID-add-del-dummy-routines.patch89
-rw-r--r--patches.drivers/IB-qib-Cleanup-qib_set_part_key-with-direct-returns.patch134
-rw-r--r--patches.drivers/IB-qib-Move-char-qib_sdma_state_names-and-constify-w.patch78
-rw-r--r--patches.drivers/IB-qib-Remove-remaining-code-related-to-writing-the-.patch205
-rw-r--r--patches.drivers/IB-qib-Remove-set-but-not-used-variables.patch282
-rw-r--r--patches.drivers/IB-qib-Remove-unused-variable-char-qib_sdma_event_na.patch61
-rw-r--r--patches.drivers/IB-qib-Suppress-gcc-7-fall-through-complaints.patch53
-rw-r--r--patches.drivers/IB-qib-Update-QIB-to-use-the-latest-PCI-API.patch733
-rw-r--r--patches.drivers/IB-qib-Use-setup_timer-and-mod_timer.patch68
-rw-r--r--patches.drivers/IB-qib-remove-qib_keys.c.patch256
-rw-r--r--patches.drivers/IB-qib-remove-redundant-setting-of-any-in-for-loop.patch34
-rw-r--r--patches.drivers/IB-rdmavt-Correct-issues-with-read-mostly-and-send-s.patch68
-rw-r--r--patches.drivers/IB-rdmavt-hfi1-qib-Remove-get_card_name-downcall.patch193
-rw-r--r--patches.drivers/IB-rdmavt-hfi1-qib-Self-determine-driver-name.patch102
-rw-r--r--patches.drivers/IB-remove-duplicate-header-files.patch39
-rw-r--r--patches.drivers/IB-rxe-Avoid-passing-unused-index-pointer-which-is-o.patch38
-rw-r--r--patches.drivers/IB-rxe-Change-RDMA_RXE-kconfig-to-use-select.patch32
-rw-r--r--patches.drivers/IB-rxe-Remove-unused-variable-char-rxe_qp_state_name.patch55
-rw-r--r--patches.drivers/IB-rxe-Removed-GID-add-del-dummy-routines.patch55
-rw-r--r--patches.drivers/IB-rxe-add-the-static-type-to-the-variable.patch43
-rw-r--r--patches.drivers/IB-rxe-change-the-function-rxe_av_fill_ip_info-to-vo.patch69
-rw-r--r--patches.drivers/IB-rxe-change-the-function-rxe_init_device_param-typ.patch39
-rw-r--r--patches.drivers/IB-rxe-change-the-function-to-void-from-int-a402dc44.patch49
-rw-r--r--patches.drivers/IB-rxe-change-the-function-to-void-from-int.patch66
-rw-r--r--patches.drivers/IB-rxe-optimize-mcast-recv-process.patch65
-rw-r--r--patches.drivers/IB-rxe-remove-redudant-parameter-in-function.patch82
-rw-r--r--patches.drivers/IB-rxe-remove-redudant-parameter-in-rxe_av_fill_ip_i.patch79
-rw-r--r--patches.drivers/IB-rxe-remove-unnecessary-parameter-in-rxe_av_to_att.patch86
-rw-r--r--patches.drivers/IB-rxe-remove-unnecessary-rxe-in-rxe_send.patch52
-rw-r--r--patches.drivers/IB-rxe-remove-unnecessary-skb_clone-in-xmit.patch104
-rw-r--r--patches.drivers/IB-rxe-remove-unnecessary-skb_clone.patch101
-rw-r--r--patches.drivers/IB-srp-Add-RDMA-CM-support.patch1213
-rw-r--r--patches.drivers/IB-srp-Add-target_can_queue-login-parameter.patch88
-rw-r--r--patches.drivers/IB-srp-Cache-global-rkey.patch154
-rw-r--r--patches.drivers/IB-srp-Disallow-duplicate-RDMA-CM-connections.patch43
-rw-r--r--patches.drivers/IB-srp-Fix-IPv6-address-parsing.patch64
-rw-r--r--patches.drivers/IB-srp-Improve-path-record-query-error-message.patch30
-rw-r--r--patches.drivers/IB-srp-Make-CM-timeout-dependent-on-subnet-timeout.patch67
-rw-r--r--patches.drivers/IB-srp-Refactor-srp_send_req.patch127
-rw-r--r--patches.drivers/IB-srp-Remove-second-argument-of-srp_destroy_qp.patch62
-rw-r--r--patches.drivers/IB-srp-Use-kstrtoull-instead-of-simple_strtoull.patch87
-rw-r--r--patches.drivers/IB-srp-Use-pIS-instead-of-inet_ntop.patch125
-rw-r--r--patches.drivers/IB-srp-Use-the-IB_DEVICE_SG_GAPS_REG-HCA-feature-if-.patch113
-rw-r--r--patches.drivers/IB-srp-replace-custom-implementation-of-hex2bin.patch50
-rw-r--r--patches.drivers/IB-srpt-Add-P_Key-support.patch81
-rw-r--r--patches.drivers/IB-srpt-Add-RDMA-CM-support.patch692
-rw-r--r--patches.drivers/IB-srpt-Cache-global-L_Key.patch65
-rw-r--r--patches.drivers/IB-srpt-Change-default-behavior-from-using-SRQ-to-us.patch411
-rw-r--r--patches.drivers/IB-srpt-Convert-a-warning-into-a-debug-message.patch31
-rw-r--r--patches.drivers/IB-srpt-Document-all-structure-members-in-ib_srpt.h.patch133
-rw-r--r--patches.drivers/IB-srpt-Don-t-allow-reordering-of-commands-on-wait-l.patch190
-rw-r--r--patches.drivers/IB-srpt-Ensure-that-modifying-the-use_srq-configfs-a.patch49
-rw-r--r--patches.drivers/IB-srpt-Fix-a-race-condition-related-to-wait-list-pr.patch46
-rw-r--r--patches.drivers/IB-srpt-Fix-an-out-of-bounds-stack-access-in-srpt_ze.patch5
-rw-r--r--patches.drivers/IB-srpt-Fix-kernel-doc-warnings-in-ib_srpt.c.patch608
-rw-r--r--patches.drivers/IB-srpt-Fix-login-related-race-conditions.patch318
-rw-r--r--patches.drivers/IB-srpt-Inline-srpt_get_cmd_state.patch71
-rw-r--r--patches.drivers/IB-srpt-Introduce-helper-functions-for-SRQ-allocatio.patch170
-rw-r--r--patches.drivers/IB-srpt-Introduce-srpt_disconnect_ch_sync.patch89
-rw-r--r--patches.drivers/IB-srpt-Introduce-srpt_format_guid.patch78
-rw-r--r--patches.drivers/IB-srpt-Limit-the-send-and-receive-queue-sizes-to-wh.patch44
-rw-r--r--patches.drivers/IB-srpt-Log-all-zero-length-writes-and-completions.patch48
-rw-r--r--patches.drivers/IB-srpt-Make-it-safe-to-use-RCU-for-srpt_device.rch_.patch83
-rw-r--r--patches.drivers/IB-srpt-Micro-optimize-I-O-context-state-manipulatio.patch128
-rw-r--r--patches.drivers/IB-srpt-Move-the-code-for-parsing-struct-ib_cm_req_e.patch142
-rw-r--r--patches.drivers/IB-srpt-One-target-per-port.patch336
-rw-r--r--patches.drivers/IB-srpt-Post-receive-work-requests-after-qp-transiti.patch45
-rw-r--r--patches.drivers/IB-srpt-Preparations-for-adding-RDMA-CM-support.patch147
-rw-r--r--patches.drivers/IB-srpt-Reduce-frequency-of-receive-failure-messages.patch31
-rw-r--r--patches.drivers/IB-srpt-Reduce-the-severity-level-of-a-log-message.patch28
-rw-r--r--patches.drivers/IB-srpt-Rename-a-local-variable-a-member-variable-an.patch144
-rw-r--r--patches.drivers/IB-srpt-Rework-multi-channel-support.patch413
-rw-r--r--patches.drivers/IB-srpt-Rework-srpt_disconnect_ch_sync.patch124
-rw-r--r--patches.drivers/IB-srpt-Simplify-srpt_close_session.patch69
-rw-r--r--patches.drivers/IB-srpt-Use-the-IPv6-format-for-GIDs-in-log-messages.patch40
-rw-r--r--patches.drivers/IB-srpt-Use-the-source-GID-as-session-name.patch85
-rw-r--r--patches.drivers/IB-srpt-Verify-port-numbers-in-srpt_event_handler.patch69
-rw-r--r--patches.drivers/IB-srpt-Wait-until-channel-release-has-finished-duri.patch104
-rw-r--r--patches.drivers/IB-umem-Use-the-correct-mm-during-ib_umem_release.patch13
-rw-r--r--patches.drivers/IB-usnic-Delete-an-error-message-for-a-failed-memory.patch33
-rw-r--r--patches.drivers/IB-uverbs-Add-CQ-moderation-capability-to-query_devi.patch89
-rw-r--r--patches.drivers/IB-uverbs-Add-action_handle-flow-steering-specificat.patch297
-rw-r--r--patches.drivers/IB-uverbs-Add-alloc-free-dm-uverbs-ioctl-support.patch248
-rw-r--r--patches.drivers/IB-uverbs-Add-device-memory-capabilities-reporting.patch44
-rw-r--r--patches.drivers/IB-uverbs-Add-device-memory-registration-ioctl-suppo.patch316
-rw-r--r--patches.drivers/IB-uverbs-Add-enum-attribute-type-to-ioctl-interface.patch206
-rw-r--r--patches.drivers/IB-uverbs-Add-flow_action-create-and-destroy-verbs.patch656
-rw-r--r--patches.drivers/IB-uverbs-Add-ioctl-support-for-32bit-processes.patch43
-rw-r--r--patches.drivers/IB-uverbs-Add-macros-to-simplify-adding-driver-speci.patch60
-rw-r--r--patches.drivers/IB-uverbs-Add-missing-braces-in-anonymous-union-init.patch92
-rw-r--r--patches.drivers/IB-uverbs-Add-modify-ESP-flow_action.patch232
-rw-r--r--patches.drivers/IB-uverbs-Allow-CQ-moderation-with-modify-CQ.patch143
-rw-r--r--patches.drivers/IB-uverbs-Always-use-the-attribute-size-provided-by-.patch114
-rw-r--r--patches.drivers/IB-uverbs-Enable-compact-representation-of-uverbs_at.patch107
-rw-r--r--patches.drivers/IB-uverbs-Enable-ioctl-uAPI-by-default-for-new-verbs.patch81
-rw-r--r--patches.drivers/IB-uverbs-Expose-device-memory-capabilities-to-user.patch29
-rw-r--r--patches.drivers/IB-uverbs-Expose-parsing-tree-of-all-common-objects-.patch128
-rw-r--r--patches.drivers/IB-uverbs-Extend-uverbs_ioctl-header-with-driver_id.patch308
-rw-r--r--patches.drivers/IB-uverbs-Fix-kernel-crash-during-MR-deregistration-.patch45
-rw-r--r--patches.drivers/IB-uverbs-Fix-uverbs_attr_get_obj.patch39
-rw-r--r--patches.drivers/IB-uverbs-Introduce-ESP-steering-match-filter.patch118
-rw-r--r--patches.drivers/IB-uverbs-Introduce-egress-flow-steering.patch34
-rw-r--r--patches.drivers/IB-uverbs-Move-ioctl-path-of-create_cq-and-destroy_c.patch482
-rw-r--r--patches.drivers/IB-uverbs-Move-to-new-headers-and-make-naming-consis.patch1273
-rw-r--r--patches.drivers/IB-uverbs-Prevent-reregistration-of-DM_MR-to-regular.patch34
-rw-r--r--patches.drivers/IB-uverbs-Refactor-kern_spec_to_ib_spec_filter.patch123
-rw-r--r--patches.drivers/IB-uverbs-Safely-extend-existing-attributes.patch293
-rw-r--r--patches.drivers/IB-uverbs-Tidy-uverbs_uobject_add.patch62
-rw-r--r--patches.drivers/IB-uverbs-UAPI-pointers-should-use-__aligned_u64-typ.patch36
-rw-r--r--patches.drivers/IB-uverbs-Use-__aligned_u64-for-uapi-headers.patch39
-rw-r--r--patches.drivers/IB-uverbs-Use-inline-data-transfer-for-UHW_IN.patch37
-rw-r--r--patches.drivers/IB-uverbs-Use-the-standard-kConfig-format-for-experi.patch28
-rw-r--r--patches.drivers/IB-uverbs-Use-u64_to_user_ptr-not-a-union.patch72
-rw-r--r--patches.drivers/IB-uverbs-clean-up-INIT_UDATA-macro-usage.patch445
-rw-r--r--patches.drivers/PCI-Add-decoding-for-16-GT-s-link-speed.patch110
-rw-r--r--patches.drivers/PCI-Add-pcie_bandwidth_available-to-compute-bandwidt.patch115
-rw-r--r--patches.drivers/PCI-Add-pcie_bandwidth_capable-to-compute-max-suppor.patch84
-rw-r--r--patches.drivers/PCI-Add-pcie_get_speed_cap-to-find-max-supported-lin.patch132
-rw-r--r--patches.drivers/PCI-Add-pcie_get_width_cap-to-find-max-supported-lin.patch79
-rw-r--r--patches.drivers/PCI-Add-pcie_print_link_status-to-log-link-speed-and.patch83
-rw-r--r--patches.drivers/PCI-Add-sysfs-max_link_speed-width-current_link_spee.patch271
-rw-r--r--patches.drivers/RDMA-CM-move-rdma_id_private-to-cma_priv.h.patch158
-rw-r--r--patches.drivers/RDMA-CMA-Add-rdma_port_space-to-UAPI.patch220
-rw-r--r--patches.drivers/RDMA-CMA-remove-RDMA_PS_SDP.patch26
-rw-r--r--patches.drivers/RDMA-Change-all-uapi-headers-to-use-__aligned_u64-in.patch1721
-rw-r--r--patches.drivers/RDMA-Do-not-used-__packed-in-uapi-headers.patch68
-rw-r--r--patches.drivers/RDMA-Mark-imm_data-as-be32-in-the-verbs-uapi-header.patch75
-rw-r--r--patches.drivers/RDMA-Move-enum-ib_cq_creation_flags-to-uapi-headers.patch101
-rw-r--r--patches.drivers/RDMA-Remove-minor-pahole-differences-between-32-64.patch47
-rw-r--r--patches.drivers/RDMA-Use-ib_gid_attr-during-GID-modification.patch411
-rw-r--r--patches.drivers/RDMA-Use-u64_to_user_ptr-everywhere.patch269
-rw-r--r--patches.drivers/RDMA-bnxt-Fix-structure-layout-for-bnxt_re_pd_resp.patch48
-rw-r--r--patches.drivers/RDMA-bnxt_re-Add-SRQ-support-for-Broadcom-adapters.patch34
-rw-r--r--patches.drivers/RDMA-bnxt_re-Delete-two-error-messages-for-a-failed-.patch42
-rw-r--r--patches.drivers/RDMA-bnxt_re-Fix-static-checker-warning.patch43
-rw-r--r--patches.drivers/RDMA-bnxt_re-Remove-an-unused-variable.patch39
-rw-r--r--patches.drivers/RDMA-bnxt_re-Remove-set-but-not-used-variables.patch126
-rw-r--r--patches.drivers/RDMA-bnxt_re-Remove-unused-vlan_tag-variable.patch51
-rw-r--r--patches.drivers/RDMA-bnxt_re-Suppress-gcc-7-fall-through-complaints.patch30
-rw-r--r--patches.drivers/RDMA-bnxt_re-Use-common-error-handling-code-in-bnxt_.patch56
-rw-r--r--patches.drivers/RDMA-bnxt_re-Use-zeroing-memory-allocator-than-alloc.patch42
-rw-r--r--patches.drivers/RDMA-bnxt_re-expose-detailed-stats-retrieved-from-HW.patch4
-rw-r--r--patches.drivers/RDMA-bnxt_re-qplib_sp-Use-true-and-false-for-boolean.patch30
-rw-r--r--patches.drivers/RDMA-bnxt_re-report-vlan_id-and-sl-in-qp1-recv-compl.patch103
-rw-r--r--patches.drivers/RDMA-cm-Fix-access-to-uninitialized-variable.patch32
-rw-r--r--patches.drivers/RDMA-cma-Move-rdma_cm_state-to-cma_priv.h.patch66
-rw-r--r--patches.drivers/RDMA-cma-Refactor-to-access-multiple-fields-of-rdma_.patch61
-rw-r--r--patches.drivers/RDMA-cma-Update-RoCE-multicast-routines-to-use-net-n.patch49
-rw-r--r--patches.drivers/RDMA-cma-Update-cma_validate_port-to-honor-net-names.patch31
-rw-r--r--patches.drivers/RDMA-cma-Use-existing-netif_is_bond_master-function.patch32
-rw-r--r--patches.drivers/RDMA-core-Add-encode-decode-FDR-EDR-rates.patch94
-rw-r--r--patches.drivers/RDMA-core-Add-resource-tracking-for-create-and-destr-08f294a1.patch99
-rw-r--r--patches.drivers/RDMA-core-Add-resource-tracking-for-create-and-destr-9d5f8c20.patch51
-rw-r--r--patches.drivers/RDMA-core-Add-resource-tracking-for-create-and-destr.patch108
-rw-r--r--patches.drivers/RDMA-core-Avoid-copying-ifindex-twice.patch36
-rw-r--r--patches.drivers/RDMA-core-Avoid-redundant-memcpy-in-rdma_addr_find_l.patch48
-rw-r--r--patches.drivers/RDMA-core-Avoid-that-ib_drain_qp-triggers-an-out-of-.patch11
-rw-r--r--patches.drivers/RDMA-core-Make-function-rdma_copy_addr-return-void.patch159
-rw-r--r--patches.drivers/RDMA-core-Rename-kernel-modify_cq-to-better-describe.patch84
-rw-r--r--patches.drivers/RDMA-core-Replace-open-coded-variant-of-put_device.patch29
-rw-r--r--patches.drivers/RDMA-core-Save-kernel-caller-name-when-creating-PD-a.patch108
-rw-r--r--patches.drivers/RDMA-core-Simplify-rdma_addr_get_sgid-to-not-support.patch70
-rw-r--r--patches.drivers/RDMA-core-Update-query_gid-documentation-for-HCA-dri.patch32
-rw-r--r--patches.drivers/RDMA-core-Use-the-MODNAME-instead-of-the-function-na.patch30
-rw-r--r--patches.drivers/RDMA-core-cma-Simplify-rdma_translate_ip.patch100
-rw-r--r--patches.drivers/RDMA-cxgb3-Annotate-locking-assumptions.patch35
-rw-r--r--patches.drivers/RDMA-cxgb3-Remove-a-set-but-not-used-variable.patch38
-rw-r--r--patches.drivers/RDMA-cxgb3-Use-structs-to-describe-the-uABI-instead-.patch43
-rw-r--r--patches.drivers/RDMA-cxgb4-Add-a-sanity-check-in-process_work.patch45
-rw-r--r--patches.drivers/RDMA-hns-Drop-local-zgid-in-favor-of-core-defined-va.patch6
-rw-r--r--patches.drivers/RDMA-hns-Implement-the-disassociate_ucontext-API.patch2
-rw-r--r--patches.drivers/RDMA-i40iw-Fix-a-race-condition.patch41
-rw-r--r--patches.drivers/RDMA-i40iw-Move-uapi-header-to-include-uapi.patch262
-rw-r--r--patches.drivers/RDMA-i40iw-Remove-a-set-but-not-used-variable.patch33
-rw-r--r--patches.drivers/RDMA-i40iw-Suppress-gcc-7-fall-through-complaints.patch51
-rw-r--r--patches.drivers/RDMA-i40iw-include-linux-irq.h.patch35
-rw-r--r--patches.drivers/RDMA-ipoib-Update-paths-on-CLIENT_REREG-SM_CHANGE-ev.patch12
-rw-r--r--patches.drivers/RDMA-isert-Suppress-gcc-7-fall-through-complaints.patch58
-rw-r--r--patches.drivers/RDMA-iwcm-Remove-a-set-but-not-used-variable.patch27
-rw-r--r--patches.drivers/RDMA-iwpm-Delete-an-error-message-for-a-failed-memor.patch34
-rw-r--r--patches.drivers/RDMA-mlx4-Add-missed-RSS-hash-inner-header-flag.patch33
-rw-r--r--patches.drivers/RDMA-mlx4-Fix-uABI-structure-layouts-for-32-64-compa.patch4
-rw-r--r--patches.drivers/RDMA-mlx4-Move-flag-constants-to-uapi-header.patch106
-rw-r--r--patches.drivers/RDMA-mlx5-Fix-definition-of-mlx5_ib_create_qp_resp.patch53
-rw-r--r--patches.drivers/RDMA-mlx5-Fix-multiple-NULL-ptr-deref-errors-in-rere.patch10
-rw-r--r--patches.drivers/RDMA-mlx5-Guard-ODP-specific-assignments-with-specif.patch39
-rw-r--r--patches.drivers/RDMA-mlx5-Properly-check-return-value-of-mlx5_get_ua.patch33
-rw-r--r--patches.drivers/RDMA-mlx5-Refactor-QP-type-check-to-be-as-early-as-p.patch54
-rw-r--r--patches.drivers/RDMA-mlx5-Remove-redundant-allocation-warning-print.patch49
-rw-r--r--patches.drivers/RDMA-mlx5-Return-proper-value-for-not-supported-comm.patch27
-rw-r--r--patches.drivers/RDMA-mlx5-Simplify-clean-and-destroy-MR-calls.patch104
-rw-r--r--patches.drivers/RDMA-mlx5-Unify-error-flows-in-rereg-MR-failure-path.patch87
-rw-r--r--patches.drivers/RDMA-netlink-Hide-unimplemented-NLDEV-commands.patch44
-rw-r--r--patches.drivers/RDMA-netlink-Simplify-code-of-autoload-modules.patch41
-rw-r--r--patches.drivers/RDMA-nldev-Provide-detailed-QP-information.patch338
-rw-r--r--patches.drivers/RDMA-nldev-Provide-global-resource-utilization.patch239
-rw-r--r--patches.drivers/RDMA-nldev-Provide-netdevice-name-and-index.patch119
-rw-r--r--patches.drivers/RDMA-nldev-Refactor-setting-the-nldev-handle-to-a-co.patch61
-rw-r--r--patches.drivers/RDMA-nldev-common-resource-dumpit-function.patch161
-rw-r--r--patches.drivers/RDMA-nldev-missing-error-code-in-nldev_res_get_doit.patch33
-rw-r--r--patches.drivers/RDMA-nldev-provide-detailed-CM_ID-information.patch605
-rw-r--r--patches.drivers/RDMA-nldev-provide-detailed-CQ-information.patch132
-rw-r--r--patches.drivers/RDMA-nldev-provide-detailed-MR-information.patch268
-rw-r--r--patches.drivers/RDMA-nldev-provide-detailed-PD-information.patch136
-rw-r--r--patches.drivers/RDMA-ocrdma-Fix-structure-layout-for-ocrdma_alloc_pd.patch40
-rw-r--r--patches.drivers/RDMA-ocrdma-Remove-set-but-not-used-variables.patch49
-rw-r--r--patches.drivers/RDMA-ocrdma-Suppress-gcc-7-fall-through-complaints.patch39
-rw-r--r--patches.drivers/RDMA-ocrdma-Use-NULL-instead-of-0-to-represent-a-poi.patch27
-rw-r--r--patches.drivers/RDMA-providers-Simplify-query_gid-callback-of-RoCE-p.patch245
-rw-r--r--patches.drivers/RDMA-pvrdma-Properly-annotate-QP-states.patch28
-rw-r--r--patches.drivers/RDMA-qedr-Fix-uABI-structure-layouts-for-32-64-compa.patch60
-rw-r--r--patches.drivers/RDMA-rdmavt-Suppress-gcc-7-fall-through-complaints.patch29
-rw-r--r--patches.drivers/RDMA-restrack-Add-general-infrastructure-to-track-RD.patch466
-rw-r--r--patches.drivers/RDMA-restrack-Don-t-rely-on-uninitialized-variable-i.patch111
-rw-r--r--patches.drivers/RDMA-restrack-Increment-CQ-restrack-object-before-co.patch41
-rw-r--r--patches.drivers/RDMA-restrack-Move-restrack_clean-to-be-symmetrical-.patch84
-rw-r--r--patches.drivers/RDMA-restrack-Remove-ambiguity-in-resource-track-cle.patch107
-rw-r--r--patches.drivers/RDMA-restrack-Remove-unimplemented-XRCD-object.patch53
-rw-r--r--patches.drivers/RDMA-restrack-clean-up-res_to_dev.patch56
-rw-r--r--patches.drivers/RDMA-restrack-don-t-use-uaccess_kernel.patch130
-rw-r--r--patches.drivers/RDMA-rxe-Fix-uABI-structure-layouts-for-32-64-compat.patch87
-rw-r--r--patches.drivers/RDMA-rxe-Get-rid-of-confusing-udata-parameter-to-rxe.patch60
-rw-r--r--patches.drivers/RDMA-rxe-Remove-useless-EXPORT_SYMBOL.patch56
-rw-r--r--patches.drivers/RDMA-rxe-Suppress-gcc-7-fall-through-complaints.patch56
-rw-r--r--patches.drivers/RDMA-rxe-Use-structs-to-describe-the-uABI-instead-of.patch508
-rw-r--r--patches.drivers/RDMA-srpt-Fix-RCU-debug-build-error.patch46
-rw-r--r--patches.drivers/RDMA-ucma-Check-for-a-cm_id-device-in-all-user-calls.patch118
-rw-r--r--patches.drivers/RDMA-ucma-Fix-uABI-structure-layouts-for-32-64-compa.patch65
-rw-r--r--patches.drivers/RDMA-ucma-Introduce-safer-rdma_addr_size-variants.patch6
-rw-r--r--patches.drivers/RDMA-ucma-Use-rdma-cm-API-to-query-GID.patch51
-rw-r--r--patches.drivers/RDMA-ucma-ucma_context-reference-leak-in-error-path.patch4
-rw-r--r--patches.drivers/RDMA-usnic-Instantiate-data-structures-once.patch87
-rw-r--r--patches.drivers/RDMA-usnic-Make-the-compiler-check-declaration-consi.patch40
-rw-r--r--patches.drivers/RDMA-usnic-Remove-a-set-but-not-used-variable.patch33
-rw-r--r--patches.drivers/RDMA-uverbs-Convert-command-mask-validity-check-func.patch52
-rw-r--r--patches.drivers/RDMA-uverbs-Ensure-validity-of-current-QP-state-valu.patch35
-rw-r--r--patches.drivers/RDMA-uverbs-Fail-as-early-as-possible-if-not-enough-.patch61
-rw-r--r--patches.drivers/RDMA-uverbs-Fix-kernel-panic-while-using-XRC_TGT-QP-.patch71
-rw-r--r--patches.drivers/RDMA-uverbs-Make-the-code-in-ib_uverbs_cmd_verbs-les.patch63
-rw-r--r--patches.drivers/RDMA-uverbs-Move-uncontext-check-before-SRCU-read-lo.patch55
-rw-r--r--patches.drivers/RDMA-uverbs-Properly-check-command-supported-mask.patch58
-rw-r--r--patches.drivers/RDMA-uverbs-Reduce-number-of-command-header-flags-ch.patch56
-rw-r--r--patches.drivers/RDMA-uverbs-Refactor-command-header-processing.patch117
-rw-r--r--patches.drivers/RDMA-uverbs-Refactor-flags-checks-and-update-return-.patch58
-rw-r--r--patches.drivers/RDMA-uverbs-Refactor-the-header-validation-logic.patch141
-rw-r--r--patches.drivers/RDMA-uverbs-Replace-user-s-types-with-kernel-s-types.patch54
-rw-r--r--patches.drivers/RDMA-uverbs-Return-not-supported-error-code-for-unsu.patch28
-rw-r--r--patches.drivers/RDMA-uverbs-Unify-return-values-of-not-supported-com.patch58
-rw-r--r--patches.drivers/RDMA-uverbs-Update-sizeof-users.patch59
-rw-r--r--patches.drivers/RDMA-uverbs-Use-an-unambiguous-errno-for-method-not-.patch12
-rw-r--r--patches.drivers/RDMA-verbs-Check-existence-of-function-prior-to-acce.patch95
-rw-r--r--patches.drivers/RDMA-verbs-Remove-restrack-entry-from-XRCD-structure.patch30
-rw-r--r--patches.drivers/RDMA-verbs-Return-proper-error-code-for-not-supporte.patch226
-rw-r--r--patches.drivers/RDMA-verbs-Simplify-modify-QP-check.patch80
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Clarify-QP-and-CQ-is_kernel-logic.patch92
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Do-not-re-calculate-npages.patch66
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Remove-usage-of-BIT-from-UAPI-header.patch39
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Use-more-specific-sizeof-in-kcalloc.patch38
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Use-refcount_t-instead-of-atomic_t.patch137
-rw-r--r--patches.drivers/RDMA-vmw_pvrdma-Use-zeroing-memory-allocator-than-al.patch43
-rw-r--r--patches.drivers/RDMa-uverbs-Copy-ex_hdr-outside-of-SRCU-read-lock.patch47
-rw-r--r--patches.drivers/Revert-IB-srp-Avoid-that-a-cable-pull-can-trigger-a-.patch74
-rw-r--r--patches.drivers/bnxt_re-report-RoCE-device-support-at-info-level.patch31
-rw-r--r--patches.drivers/bug-define-the-cut-here-string-in-a-single-place.patch71
-rw-r--r--patches.drivers/drivers-infiniband-Remove-now-redundant-smp_read_bar.patch229
-rw-r--r--patches.drivers/drivers-infiniband-remove-duplicate-includes.patch82
-rw-r--r--patches.drivers/drivers-net-mlx4-convert-mlx4_cq.refcount-from-atomi.patch94
-rw-r--r--patches.drivers/drivers-net-mlx4-convert-mlx4_qp.refcount-from-atomi.patch85
-rw-r--r--patches.drivers/drivers-net-mlx4-convert-mlx4_srq.refcount-from-atom.patch85
-rw-r--r--patches.drivers/drivers-net-mlx4-use-setup_timer-helper.patch37
-rw-r--r--patches.drivers/drivers-net-mlx5-convert-fs_node.refcount-from-atomi.patch172
-rw-r--r--patches.drivers/drivers-net-mlx5-convert-mlx5_cq.refcount-from-atomi.patch130
-rw-r--r--patches.drivers/drivers-net-mlx5-use-setup_timer-helper.patch36
-rw-r--r--patches.drivers/esp4-Support-RX-checksum-with-crypto-offload.patch71
-rw-r--r--patches.drivers/esp6-Fix-RX-checksum-after-header-pull.patch40
-rw-r--r--patches.drivers/esp6-Support-RX-checksum-with-crypto-offload.patch71
-rw-r--r--patches.drivers/ethtool-Add-support-for-configuring-PFC-stall-preven.patch69
-rw-r--r--patches.drivers/i40iw-Add-notifier-for-network-device-events.patch139
-rw-r--r--patches.drivers/i40iw-Change-accelerated-flag-to-bool.patch51
-rw-r--r--patches.drivers/i40iw-Cleanup-AE-processing.patch2
-rw-r--r--patches.drivers/i40iw-Ignore-LLP_DOUBT_REACHABILITY-AE.patch48
-rw-r--r--patches.drivers/i40iw-Implement-get_vector_affinity-API.patch59
-rw-r--r--patches.drivers/i40iw-Improve-CM-node-lookup-time-on-connection-setu.patch364
-rw-r--r--patches.drivers/i40iw-Move-ceq_valid-to-i40iw_sc_dev-structure.patch135
-rw-r--r--patches.drivers/i40iw-Refactor-handling-of-txpend-list.patch43
-rw-r--r--patches.drivers/i40iw-Refactor-queue-depth-calculation.patch225
-rw-r--r--patches.drivers/i40iw-Reinitialize-add_sd_cnt.patch30
-rw-r--r--patches.drivers/i40iw-Remove-extra-call-to-i40iw_est_sd.patch28
-rw-r--r--patches.drivers/i40iw-Remove-pre-production-workaround-for-resource-.patch29
-rw-r--r--patches.drivers/i40iw-Remove-setting-of-rem_addr.len.patch44
-rw-r--r--patches.drivers/i40iw-Remove-unused-static_rsrc-from-i40iw_create_qp.patch68
-rw-r--r--patches.drivers/i40iw-Remove-unused-structures.patch68
-rw-r--r--patches.drivers/i40iw-Replace-mdelay-with-msleep-in-i40iw_wait_pe_re.patch32
-rw-r--r--patches.drivers/i40iw-Set-MAX_IRD_SIZE-to-64.patch27
-rw-r--r--patches.drivers/i40iw-Use-sqsize-to-initialize-cqp_requests-elements.patch30
-rw-r--r--patches.drivers/i40iw-Use-utility-function-roundup_pow_of_two.patch109
-rw-r--r--patches.drivers/i40iw-delete-some-stray-tabs.patch31
-rw-r--r--patches.drivers/i40iw-remove-unused-timeval-struct-member.patch31
-rw-r--r--patches.drivers/i40w-Remove-garbage-at-end-of-INFINIBAND_I40IW-Kconf.patch25
-rw-r--r--patches.drivers/ib_srp-depend-on-INFINIBAND_ADDR_TRANS.patch30
-rw-r--r--patches.drivers/ib_srpt-depend-on-INFINIBAND_ADDR_TRANS.patch30
-rw-r--r--patches.drivers/infiniband-cxgb4-use-ktime_get-for-timestamps.patch168
-rw-r--r--patches.drivers/infiniband-fix-core-fmr_pool.c-kernel-doc-notation.patch43
-rw-r--r--patches.drivers/infiniband-fix-core-verbs.c-kernel-doc-notation.patch38
-rw-r--r--patches.drivers/infiniband-fix-sw-rdmavt-kernel-doc-notation.patch156
-rw-r--r--patches.drivers/infiniband-fix-ulp-opa_vnic-opa_vnic_vema.c-kernel-d.patch34
-rw-r--r--patches.drivers/infiniband-hw-Drop-unnecessary-continue.patch32
-rw-r--r--patches.drivers/infiniband-mlx5-fix-build-errors-when-INFINIBAND_USE.patch41
-rw-r--r--patches.drivers/infiniband-remove-redundant-assignment-to-pointer-rd.patch33
-rw-r--r--patches.drivers/kobject-Export-kobj_ns_grab_current-and-kobj_ns_drop.patch38
-rw-r--r--patches.drivers/mlx4-setup-xdp_rxq_info.patch135
-rw-r--r--patches.drivers/mlx4_core-allocate-ICM-memory-in-page-size-chunks.patch94
-rw-r--r--patches.drivers/mlx4_ib-set-user-mr-attributes-in-struct-ib_mr.patch30
-rw-r--r--patches.drivers/mlx4_ib-zero-out-struct-ib_pd-when-allocating.patch38
-rw-r--r--patches.drivers/mlx5-Move-dump-error-CQE-function-out-of-mlx5_ib-for.patch53
-rw-r--r--patches.drivers/mlx5-Remove-call-to-ida_pre_get.patch29
-rw-r--r--patches.drivers/mlx5-use-tc_cls_can_offload_and_chain0.patch62
-rw-r--r--patches.drivers/mlx5_-ib-core-Add-query-SQ-state-helper-function.patch95
-rw-r--r--patches.drivers/nes-Change-accelerated-flag-to-bool.patch41
-rw-r--r--patches.drivers/nes-remove-unused-timeval-struct-member.patch30
-rw-r--r--patches.drivers/net-Add-asynchronous-callbacks-for-xfrm-on-layer-2.patch495
-rw-r--r--patches.drivers/net-Allow-IPsec-GSO-for-local-sockets.patch63
-rw-r--r--patches.drivers/net-Fix-netdev_WARN_ONCE-macro.patch33
-rw-r--r--patches.drivers/net-IB-mlx5-Add-flow-steering-helpers.patch220
-rw-r--r--patches.drivers/net-IB-mlx5-Add-has_tag-to-mlx5_flow_act.patch80
-rw-r--r--patches.drivers/net-IB-mlx5-Add-ipsec-helper.patch35
-rw-r--r--patches.drivers/net-IB-mlx5-Change-set_roce_gid-to-take-a-port-numbe.patch96
-rw-r--r--patches.drivers/net-IB-mlx5-Manage-port-association-for-multiport-Ro.patch961
-rw-r--r--patches.drivers/net-IB-mlx5-Raise-fatal-IB-event-when-sys-error-occu.patch92
-rw-r--r--patches.drivers/net-Introduce-netdev_-_once-functions.patch66
-rw-r--r--patches.drivers/net-dcb-Add-dscp-to-priority-selector-type.patch30
-rw-r--r--patches.drivers/net-dim-Fix-fixpoint-divide-exception-in-net_dim_sta.patch47
-rw-r--r--patches.drivers/net-dim-Fix-int-overflow.patch32
-rw-r--r--patches.drivers/net-dim-use-struct-net_dim_sample-as-arg-to-net_dim.patch78
-rw-r--r--patches.drivers/net-mlx4-fix-spelling-mistake-Inrerface-Interface-an.patch30
-rw-r--r--patches.drivers/net-mlx4-fix-spelling-mistake-failedi-failed.patch27
-rw-r--r--patches.drivers/net-mlx4_core-Report-PCIe-link-properties-with-pcie_.patch117
-rw-r--r--patches.drivers/net-mlx4_en-Add-physical-RX-TX-bytes-packets-counter.patch156
-rw-r--r--patches.drivers/net-mlx4_en-Align-behavior-of-set-ring-size-flow-via.patch49
-rw-r--r--patches.drivers/net-mlx4_en-CHECKSUM_COMPLETE-support-for-fragments.patch42
-rw-r--r--patches.drivers/net-mlx4_en-Combine-checks-of-end-cases-in-RX-comple.patch32
-rw-r--r--patches.drivers/net-mlx4_en-Increase-number-of-default-RX-rings.patch30
-rw-r--r--patches.drivers/net-mlx4_en-Limit-the-number-of-RX-rings.patch39
-rw-r--r--patches.drivers/net-mlx4_en-Limit-the-number-of-TX-rings.patch85
-rw-r--r--patches.drivers/net-mlx4_en-Obsolete-call-to-generic-write_desc-in-X.patch58
-rw-r--r--patches.drivers/net-mlx4_en-RX-csum-pre-define-enabled-protocols-for.patch52
-rw-r--r--patches.drivers/net-mlx4_en-RX-csum-remove-redundant-branches-and-ch.patch59
-rw-r--r--patches.drivers/net-mlx4_en-RX-csum-reorder-branches.patch78
-rw-r--r--patches.drivers/net-mlx4_en-Remove-unnecessary-warn-print-in-reset-c.patch37
-rw-r--r--patches.drivers/net-mlx4_en-Replace-netdev-parameter-with-priv-in-XD.patch56
-rw-r--r--patches.drivers/net-mlx4_en-XDP_TX-assign-constant-values-of-TX-desc.patch125
-rw-r--r--patches.drivers/net-mlx4_en-try-to-use-high-order-pages-for-RX-rings.patch58
-rw-r--r--patches.drivers/net-mlx5-Add-DCT-command-interface.patch380
-rw-r--r--patches.drivers/net-mlx5-Add-FGs-and-FTEs-memory-pool.patch279
-rw-r--r--patches.drivers/net-mlx5-Add-MLX5_SET16-and-MLX5_GET16.patch57
-rw-r--r--patches.drivers/net-mlx5-Add-core-support-for-vlan-push-pop-steering.patch148
-rw-r--r--patches.drivers/net-mlx5-Add-empty-egress-namespace-to-flow-steering.patch153
-rw-r--r--patches.drivers/net-mlx5-Add-flow-steering-commands-for-FPGA-IPSec-i.patch1003
-rw-r--r--patches.drivers/net-mlx5-Add-hairpin-definitions-to-the-FW-API.patch106
-rw-r--r--patches.drivers/net-mlx5-Add-missing-likely-unlikely-hints-to-cq-eve.patch43
-rw-r--r--patches.drivers/net-mlx5-Add-packet-dropped-while-vport-down-statist.patch150
-rw-r--r--patches.drivers/net-mlx5-Add-shim-layer-between-fs-and-cmd.patch678
-rw-r--r--patches.drivers/net-mlx5-Add-support-for-QUERY_VNIC_ENV-command.patch117
-rw-r--r--patches.drivers/net-mlx5-Added-required-metadata-capability-for-ipse.patch45
-rw-r--r--patches.drivers/net-mlx5-Address-static-checker-warnings-on-non-cons.patch40
-rw-r--r--patches.drivers/net-mlx5-Adjust-clock-overflow-work-period.patch6
-rw-r--r--patches.drivers/net-mlx5-Allocate-FTE-object-without-lock.patch177
-rw-r--r--patches.drivers/net-mlx5-Avoid-cleaning-flow-steering-table-twice-du.patch6
-rw-r--r--patches.drivers/net-mlx5-CQ-Database-per-EQ.patch375
-rw-r--r--patches.drivers/net-mlx5-CQ-hold-put-API.patch141
-rw-r--r--patches.drivers/net-mlx5-Change-teardown-with-force-mode-failure-mes.patch28
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Add-callback-to-get-representor-de.patch116
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Add-definition-of-IB-representor.patch30
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Create-a-dedicated-send-to-vport-r.patch57
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Create-generic-header-struct-to-be.patch362
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Fix-drop-counters-use-before-creat.patch43
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Increase-number-of-FTEs-in-FDB-in-.patch53
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Move-mlx5e-only-logic-outside-E-Sw.patch198
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Move-representors-definition-to-a-.patch250
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Optimize-HW-steering-tables-in-swi.patch152
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Refactor-load-unload-of-represento.patch115
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Refactor-vport-representors-initia.patch161
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Reload-IB-interface-when-switching.patch149
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Simplify-representor-load-unload-c.patch132
-rw-r--r--patches.drivers/net-mlx5-E-Switch-Use-same-source-for-offloaded-acti.patch33
-rw-r--r--patches.drivers/net-mlx5-EQ-add-del-CQ-API.patch190
-rw-r--r--patches.drivers/net-mlx5-Embed-mlx5_flow_act-into-fs_fte.patch159
-rw-r--r--patches.drivers/net-mlx5-Enable-DC-transport.patch30
-rw-r--r--patches.drivers/net-mlx5-Enable-setting-hairpin-queue-size.patch74
-rw-r--r--patches.drivers/net-mlx5-Enlarge-the-NIC-TC-offload-table-size.patch62
-rw-r--r--patches.drivers/net-mlx5-Export-building-of-matched-flow-groups-list.patch159
-rw-r--r--patches.drivers/net-mlx5-Export-ipsec-capabilities.patch224
-rw-r--r--patches.drivers/net-mlx5-FPGA-and-IPSec-initialization-to-be-before-.patch100
-rw-r--r--patches.drivers/net-mlx5-Fix-creating-a-new-FTE-when-an-existing-but.patch51
-rw-r--r--patches.drivers/net-mlx5-Fix-error-handling-when-adding-flow-rules.patch49
-rw-r--r--patches.drivers/net-mlx5-Fix-mlx5_get_vector_affinity-function.patch6
-rw-r--r--patches.drivers/net-mlx5-Fix-steering-memory-leak.patch67
-rw-r--r--patches.drivers/net-mlx5-Fix-use-after-free.patch36
-rw-r--r--patches.drivers/net-mlx5-Fix-wrongly-assigned-CQ-reference-counter.patch68
-rw-r--r--patches.drivers/net-mlx5-Fixed-compilation-issue-when-CONFIG_MLX5_AC.patch31
-rw-r--r--patches.drivers/net-mlx5-Flow-steering-cmd-interface-should-get-the-.patch74
-rw-r--r--patches.drivers/net-mlx5-Free-IRQs-in-shutdown-path.patch16
-rw-r--r--patches.drivers/net-mlx5-Hairpin-pair-core-object-setup.patch240
-rw-r--r--patches.drivers/net-mlx5-IPSec-Add-command-V2-support.patch247
-rw-r--r--patches.drivers/net-mlx5-IPSec-Add-support-for-ESN.patch405
-rw-r--r--patches.drivers/net-mlx5-IPSec-Fix-a-race-between-concurrent-sandbox.patch8
-rw-r--r--patches.drivers/net-mlx5-IPSec-Generalize-sandbox-QP-commands.patch261
-rw-r--r--patches.drivers/net-mlx5-Initialize-destination_flow-struct-to-0.patch167
-rw-r--r--patches.drivers/net-mlx5-Mkey-creation-command-adjustments.patch189
-rw-r--r--patches.drivers/net-mlx5-Move-CQ-completion-and-event-forwarding-log.patch161
-rw-r--r--patches.drivers/net-mlx5-Move-the-entry-index-allocator-to-flow-grou.patch130
-rw-r--r--patches.drivers/net-mlx5-Packet-pacing-enhancement.patch311
-rw-r--r--patches.drivers/net-mlx5-Properly-deal-with-flow-counters-when-delet.patch4
-rw-r--r--patches.drivers/net-mlx5-QCAM-register-firmware-command-support.patch186
-rw-r--r--patches.drivers/net-mlx5-QPTS-and-QPDPM-register-firmware-command-su.patch200
-rw-r--r--patches.drivers/net-mlx5-Query-device-memory-capabilities.patch104
-rw-r--r--patches.drivers/net-mlx5-Refactor-FTE-and-FG-creation-code.patch597
-rw-r--r--patches.drivers/net-mlx5-Refactor-accel-IPSec-code.patch1243
-rw-r--r--patches.drivers/net-mlx5-Remove-redundant-EQ-API-exports.patch114
-rw-r--r--patches.drivers/net-mlx5-Remove-redundant-unlikely.patch27
-rw-r--r--patches.drivers/net-mlx5-Replace-fs_node-mutex-with-reader-writer-se.patch133
-rw-r--r--patches.drivers/net-mlx5-Report-PCIe-link-properties-with-pcie_print.patch32
-rw-r--r--patches.drivers/net-mlx5-Separate-ingress-egress-namespaces-for-each.patch14
-rw-r--r--patches.drivers/net-mlx5-Set-num_vhca_ports-capability.patch34
-rw-r--r--patches.drivers/net-mlx5-Set-software-owner-ID-during-init-HCA.patch133
-rw-r--r--patches.drivers/net-mlx5-Support-multiple-updates-of-steering-rules-.patch764
-rw-r--r--patches.drivers/net-mlx5-Use-128B-cacheline-size-for-128B-or-larger-.patch4
-rw-r--r--patches.drivers/net-mlx5-Use-MLX5_IPSEC_DEV-macro-for-ipsec-caps.patch30
-rw-r--r--patches.drivers/net-mlx5-Vectorize-the-low-level-core-hairpin-object.patch214
-rw-r--r--patches.drivers/net-mlx5-increase-async-EQ-to-avoid-EQ-overrun.patch34
-rw-r--r--patches.drivers/net-mlx5e-Add-802.1ad-VLAN-filter-steering-rules.patch279
-rw-r--r--patches.drivers/net-mlx5e-Add-802.1ad-VLAN-insertion-support.patch51
-rw-r--r--patches.drivers/net-mlx5e-Add-Event-Queue-meta-data-info-for-TX-time.patch47
-rw-r--r--patches.drivers/net-mlx5e-Add-RSS-support-for-hairpin.patch365
-rw-r--r--patches.drivers/net-mlx5e-Add-VLAN-offload-features-to-hw_enc_featur.patch32
-rw-r--r--patches.drivers/net-mlx5e-Add-VLAN-offloads-statistics.patch139
-rw-r--r--patches.drivers/net-mlx5e-Add-a-helper-macro-in-set-features-ndo.patch55
-rw-r--r--patches.drivers/net-mlx5e-Add-clock-info-page-to-mlx5-core-devices.patch200
-rw-r--r--patches.drivers/net-mlx5e-Add-dcbnl-dscp-to-priority-support.patch380
-rw-r--r--patches.drivers/net-mlx5e-Add-error-print-in-ETS-init.patch6
-rw-r--r--patches.drivers/net-mlx5e-Add-ethtool-priv-flag-for-Striding-RQ.patch167
-rw-r--r--patches.drivers/net-mlx5e-Add-interface-down-dropped-packets-statist.patch270
-rw-r--r--patches.drivers/net-mlx5e-Add-likely-to-the-common-RX-checksum-flow.patch28
-rw-r--r--patches.drivers/net-mlx5e-Add-per-channel-counters-infrastructure-us.patch149
-rw-r--r--patches.drivers/net-mlx5e-Add-rollback-on-add-VLAN-failure.patch8
-rw-r--r--patches.drivers/net-mlx5e-Add-support-for-ethtool-msglvl-support.patch12
-rw-r--r--patches.drivers/net-mlx5e-Add-vnic-steering-drop-statistics.patch136
-rw-r--r--patches.drivers/net-mlx5e-Added-common-function-for-to_ipsec_sa_entr.patch74
-rw-r--r--patches.drivers/net-mlx5e-Basic-setup-of-hairpin-object.patch134
-rw-r--r--patches.drivers/net-mlx5e-CHECKSUM_COMPLETE-offload-for-VLAN-QinQ-pa.patch111
-rw-r--r--patches.drivers/net-mlx5e-Change-Mellanox-references-in-DIM-code.patch784
-rw-r--r--patches.drivers/net-mlx5e-Code-movements-in-RX-UMR-WQE-post.patch165
-rw-r--r--patches.drivers/net-mlx5e-DCBNL-Add-debug-messages-log.patch79
-rw-r--r--patches.drivers/net-mlx5e-DCBNL-fix-min-inline-header-size-for-dscp.patch42
-rw-r--r--patches.drivers/net-mlx5e-Declare-bitmap-using-kernel-macro.patch28
-rw-r--r--patches.drivers/net-mlx5e-Derive-Striding-RQ-size-from-MTU.patch449
-rw-r--r--patches.drivers/net-mlx5e-Disable-Striding-RQ-when-PCI-is-slower-tha.patch41
-rw-r--r--patches.drivers/net-mlx5e-Do-not-busy-wait-for-UMR-completion-in-Str.patch29
-rw-r--r--patches.drivers/net-mlx5e-Do-not-reset-Receive-Queue-params-on-every.patch34
-rw-r--r--patches.drivers/net-mlx5e-Don-t-override-netdev-features-field-unles.patch10
-rw-r--r--patches.drivers/net-mlx5e-Dump-xmit-error-completions.patch98
-rw-r--r--patches.drivers/net-mlx5e-E-Switch-Move-send-to-vport-rule-struct-to.patch108
-rw-r--r--patches.drivers/net-mlx5e-E-switch-Add-steering-drop-counters.patch270
-rw-r--r--patches.drivers/net-mlx5e-Eliminate-build-warnings-on-no-previous-pr.patch45
-rw-r--r--patches.drivers/net-mlx5e-Enable-CQE-based-moderation-on-TX-CQ.patch283
-rw-r--r--patches.drivers/net-mlx5e-Enlarge-the-NIC-TC-offload-steering-prio-t.patch39
-rw-r--r--patches.drivers/net-mlx5e-Expose-PFC-stall-prevention-counters.patch169
-rw-r--r--patches.drivers/net-mlx5e-Extend-the-stats-group-API-to-have-update_.patch636
-rw-r--r--patches.drivers/net-mlx5e-Fix-TCP-checksum-in-LRO-buffers.patch4
-rw-r--r--patches.drivers/net-mlx5e-Fix-defaulting-RX-ring-size-when-not-neede.patch18
-rw-r--r--patches.drivers/net-mlx5e-Fix-traffic-being-dropped-on-VF-represento.patch6
-rw-r--r--patches.drivers/net-mlx5e-Fix-traffic-between-VF-and-representor.patch50
-rw-r--r--patches.drivers/net-mlx5e-Fix-trailing-semicolon.patch29
-rw-r--r--patches.drivers/net-mlx5e-IPSec-Add-support-for-ESP-trailer-removal-.patch211
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Add-PTP-ioctl-support-for-child-inte.patch82
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Add-ethtool-support-to-get-child-tim.patch31
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Add-inner-TTC-table-to-IPoIB-flow-st.patch87
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Fix-copy-paste-bug-in-flow-steering-.patch31
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Fix-spelling-mistake-functionts-func.patch27
-rw-r--r--patches.drivers/net-mlx5e-IPoIB-Fix-spelling-mistake.patch28
-rw-r--r--patches.drivers/net-mlx5e-Introduce-stats-group-API.patch270
-rw-r--r--patches.drivers/net-mlx5e-Keep-single-pre-initialized-UMR-WQE-per-RQ.patch162
-rw-r--r--patches.drivers/net-mlx5e-Keep-updating-ethtool-statistics-when-the-.patch4
-rw-r--r--patches.drivers/net-mlx5e-Make-choose-LRO-timeout-function-static.patch39
-rw-r--r--patches.drivers/net-mlx5e-Merge-per-priority-stats-groups.patch67
-rw-r--r--patches.drivers/net-mlx5e-Move-AM-logic-enums.patch88
-rw-r--r--patches.drivers/net-mlx5e-Move-all-TX-timeout-logic-to-be-under-stat.patch123
-rw-r--r--patches.drivers/net-mlx5e-Move-dynamic-interrupt-coalescing-code-to-.patch864
-rw-r--r--patches.drivers/net-mlx5e-Move-ethernet-representors-data-into-separ.patch373
-rw-r--r--patches.drivers/net-mlx5e-Move-generic-functions-to-new-file.patch959
-rw-r--r--patches.drivers/net-mlx5e-Move-interrupt-moderation-forward-declarat.patch45
-rw-r--r--patches.drivers/net-mlx5e-Move-interrupt-moderation-structs-to-new-f.patch149
-rw-r--r--patches.drivers/net-mlx5e-Offload-tc-vlan-push-pop-using-HW-action.patch140
-rw-r--r--patches.drivers/net-mlx5e-PFC-stall-prevention-support.patch261
-rw-r--r--patches.drivers/net-mlx5e-Poll-event-queue-upon-TX-timeout-before-pe.patch150
-rw-r--r--patches.drivers/net-mlx5e-Print-delta-since-last-transmit-per-SQ-upo.patch42
-rw-r--r--patches.drivers/net-mlx5e-RX-Recycle-buffer-of-UMR-WQEs.patch57
-rw-r--r--patches.drivers/net-mlx5e-Recover-Send-Queue-SQ-from-error-state.patch300
-rw-r--r--patches.drivers/net-mlx5e-Refactor-RQ-XDP_TX-indication.patch84
-rw-r--r--patches.drivers/net-mlx5e-Refactor-RSS-related-objects-and-code.patch373
-rw-r--r--patches.drivers/net-mlx5e-Refine-ets-validation-function.patch10
-rw-r--r--patches.drivers/net-mlx5e-Remove-RQ-MPWQE-fields-from-params.patch182
-rw-r--r--patches.drivers/net-mlx5e-Remove-page_ref-bulking-in-Striding-RQ.patch205
-rw-r--r--patches.drivers/net-mlx5e-Remove-redundant-check-in-get-ethtool-stat.patch29
-rw-r--r--patches.drivers/net-mlx5e-Remove-redundant-checks-in-set_ringparam.patch63
-rw-r--r--patches.drivers/net-mlx5e-Remove-redundant-vport-context-vlan-update.patch8
-rw-r--r--patches.drivers/net-mlx5e-Remove-rq-references-in-mlx5e_rx_am.patch109
-rw-r--r--patches.drivers/net-mlx5e-Remove-rq_headroom-field-from-params.patch73
-rw-r--r--patches.drivers/net-mlx5e-Remove-timestamp-set-from-netdevice-open-f.patch16
-rw-r--r--patches.drivers/net-mlx5e-Remove-unused-max-inline-related-code.patch149
-rw-r--r--patches.drivers/net-mlx5e-Removed-not-need-synchronize_rcu.patch30
-rw-r--r--patches.drivers/net-mlx5e-Rename-VLAN-related-variables-and-function.patch245
-rw-r--r--patches.drivers/net-mlx5e-Replace-WARN_ONCE-with-netdev_WARN_ONCE.patch42
-rw-r--r--patches.drivers/net-mlx5e-Save-MTU-in-channels-params.patch324
-rw-r--r--patches.drivers/net-mlx5e-Separate-dma-base-address-and-offset-in-dm.patch32
-rw-r--r--patches.drivers/net-mlx5e-Set-EQE-based-as-default-TX-interrupt-mode.patch59
-rw-r--r--patches.drivers/net-mlx5e-Set-hairpin-queue-size.patch47
-rw-r--r--patches.drivers/net-mlx5e-Set-per-priority-hairpin-pairs.patch147
-rw-r--r--patches.drivers/net-mlx5e-Support-DSCP-trust-state-to-Ethernet-s-IP-.patch180
-rw-r--r--patches.drivers/net-mlx5e-Support-XDP-over-Striding-RQ.patch139
-rw-r--r--patches.drivers/net-mlx5e-Support-offloading-TC-NIC-hairpin-flows.patch321
-rw-r--r--patches.drivers/net-mlx5e-Switch-IEEE-802.3-counters-to-use-stats-gr.patch175
-rw-r--r--patches.drivers/net-mlx5e-Switch-Q-counters-to-use-the-stats-group-A.patch130
-rw-r--r--patches.drivers/net-mlx5e-Switch-RFC-2819-counters-to-use-stats-grou.patch164
-rw-r--r--patches.drivers/net-mlx5e-Switch-RFC-2863-counters-to-use-stats-grou.patch144
-rw-r--r--patches.drivers/net-mlx5e-Switch-channels-counters-to-use-stats-grou.patch290
-rw-r--r--patches.drivers/net-mlx5e-Switch-ethernet-extended-counters-to-use-s.patch143
-rw-r--r--patches.drivers/net-mlx5e-Switch-ipsec-counters-to-use-stats-group-A.patch105
-rw-r--r--patches.drivers/net-mlx5e-Switch-pcie-counters-to-use-stats-group-AP.patch242
-rw-r--r--patches.drivers/net-mlx5e-Switch-per-prio-pfc-counters-to-use-stats-.patch307
-rw-r--r--patches.drivers/net-mlx5e-Switch-per-prio-traffic-counters-to-use-st.patch150
-rw-r--r--patches.drivers/net-mlx5e-Switch-physical-statistical-counters-to-us.patch149
-rw-r--r--patches.drivers/net-mlx5e-Switch-pme-counters-to-use-stats-group-API.patch156
-rw-r--r--patches.drivers/net-mlx5e-Switch-vport-counters-to-use-the-stats-gro.patch214
-rw-r--r--patches.drivers/net-mlx5e-Sync-netdev-vxlan-ports-at-open.patch15
-rw-r--r--patches.drivers/net-mlx5e-Unify-slow-PCI-heuristic.patch99
-rw-r--r--patches.drivers/net-mlx5e-Use-32-bits-to-store-VF-representor-SQ-num.patch42
-rw-r--r--patches.drivers/net-mlx5e-Use-eq-ptr-from-cq.patch42
-rw-r--r--patches.drivers/net-mlx5e-Use-inline-MTTs-in-UMR-WQEs.patch294
-rw-r--r--patches.drivers/net-mlx5e-Use-linear-SKB-in-Striding-RQ.patch493
-rw-r--r--patches.drivers/net-mlx5e-Use-no-offset-function-in-skb-header-copy.patch32
-rw-r--r--patches.drivers/net-mlx5e-Use-pcie_bandwidth_available-to-compute-ba.patch78
-rw-r--r--patches.drivers/net-mlx5e-Use-vhca-id-as-the-hairpin-peer-identifier.patch89
-rw-r--r--patches.drivers/net-mlx5e-Verify-coalescing-parameters-in-range.patch57
-rw-r--r--patches.drivers/net-mlx5e-Wait-for-FPGA-command-responses-with-a-tim.patch46
-rw-r--r--patches.drivers/net-mlx5e-fix-error-return-code-in-mlx5e_alloc_rq.patch31
-rw-r--r--patches.drivers/net-mlx5e-fix-spelling-mistake-loobpack-loopback.patch27
-rw-r--r--patches.drivers/net-mlx5e-hide-an-unused-variable.patch39
-rw-r--r--patches.drivers/nvmet-rxe-defer-ip-datagram-sending-to-tasklet.patch133
-rw-r--r--patches.drivers/rdma_rxe-make-rxe-work-over-802.1q-VLAN-devices.patch181
-rw-r--r--patches.drivers/rxe-Do-not-use-struct-sockaddr-in-a-uapi-header.patch51
-rw-r--r--patches.drivers/xdp-mlx5-setup-xdp_rxq_info.patch106
-rw-r--r--patches.drivers/xfrm-Add-ESN-support-for-IPSec-HW-offload.patch119
-rw-r--r--patches.drivers/xfrm-Add-support-for-network-devices-capable-of-remo.patch258
-rw-r--r--patches.drivers/xfrm-Allow-to-use-the-layer2-IPsec-GSO-codepath-for-.patch30
-rw-r--r--patches.drivers/xfrm-Auto-load-xfrm-offload-modules.patch140
-rw-r--r--patches.drivers/xfrm-Separate-ESP-handling-from-segmentation-for-GRO.patch506
-rw-r--r--patches.drivers/xfrm-add-documentation-for-xfrm-device-offload-api.patch165
-rw-r--r--patches.drivers/xfrm-check-for-xdo_dev_ops-add-and-delete.patch81
-rw-r--r--patches.drivers/xfrm-fix-boolean-assignment-in-xfrm_get_type_offload.patch30
-rw-r--r--patches.drivers/xfrm-fix-rcu-usage-in-xfrm_get_type_offload.patch40
-rw-r--r--patches.fixes/xfrm-Add-SA-to-hardware-at-the-end-of-xfrm_state_con.patch25
-rw-r--r--patches.suse/net-mlx5-E-Switch-Avoid-setup-attempt-if-not-being-e.patch28
-rw-r--r--patches.suse/net-mlx5e-When-RXFCS-is-set-add-FCS-data-into-checks.patch10
-rw-r--r--series.conf721
782 files changed, 93267 insertions, 325 deletions
diff --git a/blacklist.conf b/blacklist.conf
index 515930a1c2..14aa60fea4 100644
--- a/blacklist.conf
+++ b/blacklist.conf
@@ -336,7 +336,6 @@ a09acf4b43b90581bf53b0c03cc84ed693bf27e2 # cleanup for future afs change
3172485f4f8032649c144e4aafa550e1e6179332 # cleanup
6e2fb22103b99c26ae30a46512abe75526d8e4c9 # Only for Alpha architecture
191eac33009e6a6d31e87cfa425a20d0e79704b4 # Only part of dec214d00e0d78a08b947d7dccdfdb84407a9f4d present
-4f9ca2d8686ecfdd40ca4f0294a3d94f83f05cea # not applicable
af8a41cccf8f469165c6debc8fe07c5fd2ca501a # rtlwifi: btc_power_on_setting ops is missing in SLE15
3cd091a773936c54344a519f7ee1379ccb620bee # ACPI/EC: suspend_noirq & resume_noirq ops not defined yet in SLE15
bc137dfdbec27c0ec5731a89002daded4a4aa1ea # gpio_wdt: prerequisite is 4.13
@@ -955,3 +954,37 @@ de7a7e34e27c029fbb3c4e764db045548629b834
c411104115e6821f26fc8f6de8b235ddf98de688
9e3f2f5ecee69b0f70003fb3e07639151e91de73
f592f804831f1cf9d1f9966f58c80f150e6829b5
+2f10a61cee8fdb9f8da90f5db687e1862b22cf06
+545d8ae7affff7fb4f8bfd327c7c7790056535c4
+885892fb378dc096693557ba4f2b875188619b36
+e6125a254d7d2af806752c9b776d1ff4b565ce2e
+a5c57d327272bdf3a8b19686eaca2ec683449e67
+33edc3b2db8735cafa9d72f8510dc6bb394ddec8
+c1191a19fecad92b73c25770a7f47174280ca564
+828d810550abc1fffff9b20545fec4bc150d5e82
+1eb9364ce81d9445ad6f9d44921a91d2a6597156
+7350cdd0257e73a37df57253fb9decd8effacd37
+aff2252a2ad3844ca47bf2f18af071101baace40
+443a858158d35916e572b75667ca4924a6af2182
+2e8e70d249e8c5c79bf88bbb36bb68154ab15471
+8e1d162d8e81838119de18b4ca1e302ce906f2a6
+816f670623692b5da2787f278cbfdb331ed29b8a
+f280c6a1e548cd3223a56bb480454ffb96050e87
+d3398a4f1887eee46c22b37f6245faa6c51b130b
+921c0f5ba58e4064deb18b4985a202508fc5527f
+05f58ceba123bdb420cf44c6ea04b6db467edd1c
+847462de3a0aabc5343a1e338537f69a03bb61af
+6869e0004fe16184acd6488f0c637e0081a84a8a
+0625b4ba1a5d4703c7fb01c497bd6c156908af00
+54c73f8651500181a948aa6767ae8c2bcfbe9f35
+8d71e818506718e8d7032ce824b5c74a17d4f7a5
+071304772fc747d5df13c51f1cf48a4b922a5e0d
+ad9421e36a77056a4f095d49b9605e80b4d216ed
+6b359d5550a1ae7a1269c9dc1dd73dfdc4d6fe58
+4eeed3686981ff887bbdd7254139e2eca276534c
+4d8fcf216c90bc25e34ae2200aa8985ee3158898
+fd7e848077c1a466b9187537adce16658f7cb94b
+aa7e80b220f3a543eefbe4b7e2c5d2b73e2e2ef7
+99ed748e878a99c6c7b87bbec063eefd9e47cb42
+0430e74f9fbe4d027a86f39fdb6f20427912088f
+ed7a01fd3fd77f40b4ef2562b966a5decd8928d2
diff --git a/config/arm64/default b/config/arm64/default
index 6fe79f3a53..55fa98c461 100644
--- a/config/arm64/default
+++ b/config/arm64/default
@@ -1873,7 +1873,6 @@ CONFIG_BLK_DEV_SX8=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_BLK_DEV_RAM_DAX=y
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
CONFIG_CDROM_PKTCDVD_WCACHE=y
@@ -5858,7 +5857,7 @@ CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_MAD=m
CONFIG_INFINIBAND_USER_ACCESS=m
-# CONFIG_INFINIBAND_EXP_USER_ACCESS is not set
+# CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI is not set
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
@@ -5867,7 +5866,6 @@ CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_QIB=m
CONFIG_INFINIBAND_CXGB3=m
-# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
CONFIG_INFINIBAND_CXGB4=m
CONFIG_INFINIBAND_I40IW=m
CONFIG_MLX4_INFINIBAND=m
diff --git a/config/ppc64le/default b/config/ppc64le/default
index acd8ca4c76..608b0ef6ed 100644
--- a/config/ppc64le/default
+++ b/config/ppc64le/default
@@ -1676,7 +1676,6 @@ CONFIG_BLK_DEV_SKD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=123456
-CONFIG_BLK_DEV_RAM_DAX=y
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
CONFIG_CDROM_PKTCDVD_WCACHE=y
@@ -4111,7 +4110,7 @@ CONFIG_LEDS_TRIGGER_CAMERA=m
CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_MAD=m
CONFIG_INFINIBAND_USER_ACCESS=m
-# CONFIG_INFINIBAND_EXP_USER_ACCESS is not set
+# CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI is not set
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
@@ -4120,7 +4119,6 @@ CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_QIB=m
CONFIG_INFINIBAND_CXGB3=m
-# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
CONFIG_INFINIBAND_CXGB4=m
CONFIG_INFINIBAND_I40IW=m
CONFIG_MLX4_INFINIBAND=m
diff --git a/config/s390x/default b/config/s390x/default
index 56390a83c2..ef565ec1b9 100644
--- a/config/s390x/default
+++ b/config/s390x/default
@@ -1354,7 +1354,6 @@ CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=32768
-CONFIG_BLK_DEV_RAM_DAX=y
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
# CONFIG_CDROM_PKTCDVD_WCACHE is not set
@@ -1372,7 +1371,6 @@ CONFIG_DASD_FBA=m
CONFIG_DASD_DIAG=m
CONFIG_DASD_EER=y
CONFIG_SCM_BLOCK=m
-CONFIG_SCM_BLOCK_CLUSTER_WRITE=y
CONFIG_VIRTIO_BLK=m
# CONFIG_VIRTIO_BLK_SCSI is not set
CONFIG_BLK_DEV_RBD=m
@@ -1924,7 +1922,6 @@ CONFIG_VIRTIO_CONSOLE=y
CONFIG_HW_RANDOM=m
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
CONFIG_HW_RANDOM_VIRTIO=m
-CONFIG_HW_RANDOM_TPM=m
CONFIG_HW_RANDOM_S390=m
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
@@ -2107,7 +2104,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_INFINIBAND=m
# CONFIG_INFINIBAND_USER_MAD is not set
CONFIG_INFINIBAND_USER_ACCESS=m
-# CONFIG_INFINIBAND_EXP_USER_ACCESS is not set
+# CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI is not set
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
diff --git a/config/x86_64/debug b/config/x86_64/debug
index 5c27666d44..9272703c54 100644
--- a/config/x86_64/debug
+++ b/config/x86_64/debug
@@ -27,7 +27,6 @@ CONFIG_FUJITSU_LAPTOP_DEBUG=y
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CORE=y
-CONFIG_INFINIBAND_CXGB3_DEBUG=y
CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
CONFIG_INFINIBAND_NES_DEBUG=y
CONFIG_JBD2_DEBUG=y
diff --git a/config/x86_64/default b/config/x86_64/default
index 9524cf8d02..7fdb12e2e3 100644
--- a/config/x86_64/default
+++ b/config/x86_64/default
@@ -2006,7 +2006,6 @@ CONFIG_BLK_DEV_SX8=m
CONFIG_BLK_DEV_RAM=m
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_BLK_DEV_RAM_DAX=y
CONFIG_CDROM_PKTCDVD=m
CONFIG_CDROM_PKTCDVD_BUFFERS=8
CONFIG_CDROM_PKTCDVD_WCACHE=y
@@ -5737,7 +5736,7 @@ CONFIG_LEDS_TRIGGER_CAMERA=m
CONFIG_INFINIBAND=m
CONFIG_INFINIBAND_USER_MAD=m
CONFIG_INFINIBAND_USER_ACCESS=m
-# CONFIG_INFINIBAND_EXP_USER_ACCESS is not set
+# CONFIG_INFINIBAND_EXP_LEGACY_VERBS_NEW_UAPI is not set
CONFIG_INFINIBAND_USER_MEM=y
CONFIG_INFINIBAND_ON_DEMAND_PAGING=y
CONFIG_INFINIBAND_ADDR_TRANS=y
@@ -5747,7 +5746,6 @@ CONFIG_INFINIBAND_MTHCA_DEBUG=y
CONFIG_INFINIBAND_QIB=m
CONFIG_INFINIBAND_QIB_DCA=y
CONFIG_INFINIBAND_CXGB3=m
-# CONFIG_INFINIBAND_CXGB3_DEBUG is not set
CONFIG_INFINIBAND_CXGB4=m
CONFIG_INFINIBAND_I40IW=m
CONFIG_MLX4_INFINIBAND=m
diff --git a/patches.drivers/IB-Let-ib_core-resolve-destination-mac-address.patch b/patches.drivers/IB-Let-ib_core-resolve-destination-mac-address.patch
new file mode 100644
index 0000000000..c17df9478a
--- /dev/null
+++ b/patches.drivers/IB-Let-ib_core-resolve-destination-mac-address.patch
@@ -0,0 +1,171 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 16 Oct 2017 08:45:13 +0300
+Subject: IB: Let ib_core resolve destination mac address
+Patch-mainline: v4.15-rc1
+Git-commit: c0348eb069687a2f27c0cd23dafb35918edf9e75
+References: bsc#1103992 FATE#326009
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 8 +++++---
+ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 8 --------
+ drivers/infiniband/hw/hns/hns_roce_ah.c | 14 +-------------
+ drivers/infiniband/hw/mlx4/ah.c | 8 +++-----
+ drivers/infiniband/hw/mlx5/ah.c | 4 ----
+ drivers/infiniband/hw/ocrdma/ocrdma_ah.c | 15 ---------------
+ include/rdma/ib_verbs.h | 2 --
+ 7 files changed, 9 insertions(+), 50 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -53,6 +53,9 @@
+
+ #include "core_priv.h"
+
++static int ib_resolve_eth_dmac(struct ib_device *device,
++ struct rdma_ah_attr *ah_attr);
++
+ static const char * const ib_events[] = {
+ [IB_EVENT_CQ_ERR] = "CQ error",
+ [IB_EVENT_QP_FATAL] = "QP fatal error",
+@@ -1258,8 +1261,8 @@ int ib_modify_qp_is_ok(enum ib_qp_state
+ }
+ EXPORT_SYMBOL(ib_modify_qp_is_ok);
+
+-int ib_resolve_eth_dmac(struct ib_device *device,
+- struct rdma_ah_attr *ah_attr)
++static int ib_resolve_eth_dmac(struct ib_device *device,
++ struct rdma_ah_attr *ah_attr)
+ {
+ int ret = 0;
+ struct ib_global_route *grh;
+@@ -1318,7 +1321,6 @@ int ib_resolve_eth_dmac(struct ib_device
+ out:
+ return ret;
+ }
+-EXPORT_SYMBOL(ib_resolve_eth_dmac);
+
+ /**
+ * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
+--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
+@@ -729,14 +729,6 @@ struct ib_ah *bnxt_re_create_ah(struct i
+ ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V1;
+ break;
+ }
+- rc = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
+- ah_attr->roce.dmac, &vlan_tag,
+- &sgid_attr.ndev->ifindex,
+- NULL);
+- if (rc) {
+- dev_err(rdev_to_dev(rdev), "Failed to get dmac\n");
+- goto fail;
+- }
+ }
+
+ memcpy(ah->qplib_ah.dmac, ah_attr->roce.dmac, ETH_ALEN);
+--- a/drivers/infiniband/hw/hns/hns_roce_ah.c
++++ b/drivers/infiniband/hw/hns/hns_roce_ah.c
+@@ -48,7 +48,6 @@ struct ib_ah *hns_roce_create_ah(struct
+ struct ib_gid_attr gid_attr;
+ struct hns_roce_ah *ah;
+ u16 vlan_tag = 0xffff;
+- struct in6_addr in6;
+ const struct ib_global_route *grh = rdma_ah_read_grh(ah_attr);
+ union ib_gid sgid;
+ int ret;
+@@ -58,18 +57,7 @@ struct ib_ah *hns_roce_create_ah(struct
+ return ERR_PTR(-ENOMEM);
+
+ /* Get mac address */
+- memcpy(&in6, grh->dgid.raw, sizeof(grh->dgid.raw));
+- if (rdma_is_multicast_addr(&in6)) {
+- rdma_get_mcast_mac(&in6, ah->av.mac);
+- } else {
+- u8 *dmac = rdma_ah_retrieve_dmac(ah_attr);
+-
+- if (!dmac) {
+- kfree(ah);
+- return ERR_PTR(-EINVAL);
+- }
+- memcpy(ah->av.mac, dmac, ETH_ALEN);
+- }
++ memcpy(ah->av.mac, ah_attr->roce.dmac, ETH_ALEN);
+
+ /* Get source gid */
+ ret = ib_get_cached_gid(ibpd->device, rdma_ah_get_port_num(ah_attr),
+--- a/drivers/infiniband/hw/mlx4/ah.c
++++ b/drivers/infiniband/hw/mlx4/ah.c
+@@ -92,12 +92,10 @@ static struct ib_ah *create_iboe_ah(stru
+ int ret;
+
+ memcpy(&in6, grh->dgid.raw, sizeof(in6));
+- if (rdma_is_multicast_addr(&in6)) {
++ if (rdma_is_multicast_addr(&in6))
+ is_mcast = 1;
+- rdma_get_mcast_mac(&in6, ah->av.eth.mac);
+- } else {
+- memcpy(ah->av.eth.mac, ah_attr->roce.dmac, ETH_ALEN);
+- }
++
++ memcpy(ah->av.eth.mac, ah_attr->roce.dmac, ETH_ALEN);
+ ret = ib_get_cached_gid(pd->device, rdma_ah_get_port_num(ah_attr),
+ grh->sgid_index, &sgid, &gid_attr);
+ if (ret)
+--- a/drivers/infiniband/hw/mlx5/ah.c
++++ b/drivers/infiniband/hw/mlx5/ah.c
+@@ -89,10 +89,6 @@ struct ib_ah *mlx5_ib_create_ah(struct i
+
+ resp.response_length = min_resp_len;
+
+- err = ib_resolve_eth_dmac(pd->device, ah_attr);
+- if (err)
+- return ERR_PTR(err);
+-
+ memcpy(resp.dmac, ah_attr->roce.dmac, ETH_ALEN);
+ err = ib_copy_to_udata(udata, &resp, resp.response_length);
+ if (err)
+--- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
++++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
+@@ -201,21 +201,6 @@ struct ib_ah *ocrdma_create_ah(struct ib
+ /* Get network header type for this GID */
+ ah->hdr_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
+
+- if ((pd->uctx) &&
+- (!rdma_is_multicast_addr((struct in6_addr *)grh->dgid.raw)) &&
+- (!rdma_link_local_addr((struct in6_addr *)grh->dgid.raw))) {
+- status = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
+- attr->roce.dmac,
+- &vlan_tag,
+- &sgid_attr.ndev->ifindex,
+- NULL);
+- if (status) {
+- pr_err("%s(): Failed to resolve dmac from gid."
+- "status = %d\n", __func__, status);
+- goto av_conf_err;
+- }
+- }
+-
+ status = set_av_attr(dev, ah, attr, &sgid, pd->id, &isvlan, vlan_tag);
+ if (status)
+ goto av_conf_err;
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -3622,8 +3622,6 @@ void ib_drain_rq(struct ib_qp *qp);
+ void ib_drain_sq(struct ib_qp *qp);
+ void ib_drain_qp(struct ib_qp *qp);
+
+-int ib_resolve_eth_dmac(struct ib_device *device,
+- struct rdma_ah_attr *ah_attr);
+ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width);
+
+ static inline u8 *rdma_ah_retrieve_dmac(struct rdma_ah_attr *attr)
diff --git a/patches.drivers/IB-Update-references-to-libibverbs.patch b/patches.drivers/IB-Update-references-to-libibverbs.patch
new file mode 100644
index 0000000000..05faf40ea0
--- /dev/null
+++ b/patches.drivers/IB-Update-references-to-libibverbs.patch
@@ -0,0 +1,63 @@
+From: Jason Gunthorpe <jgg@mellanox.com>
+Date: Fri, 2 Feb 2018 14:35:29 -0700
+Subject: IB: Update references to libibverbs
+Patch-mainline: v4.16-rc1
+Git-commit: 46adb17982fae89aa3d41a0ba5706bc3f9d8f80d
+References: bsc#1103992 FATE#326009
+
+These days the userspace comes from rdma-core, revise references
+in the kernel to point to the current repository.
+
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ Documentation/infiniband/user_verbs.txt | 2 +-
+ MAINTAINERS | 2 +-
+ drivers/infiniband/Kconfig | 5 +++--
+ 3 files changed, 5 insertions(+), 4 deletions(-)
+
+--- a/Documentation/infiniband/user_verbs.txt
++++ b/Documentation/infiniband/user_verbs.txt
+@@ -5,7 +5,7 @@ USERSPACE VERBS ACCESS
+ described in chapter 11 of the InfiniBand Architecture Specification.
+
+ To use the verbs, the libibverbs library, available from
+- http://www.openfabrics.org/, is required. libibverbs contains a
++ https://github.com/linux-rdma/rdma-core, is required. libibverbs contains a
+ device-independent API for using the ib_uverbs interface.
+ libibverbs also requires appropriate device-dependent kernel and
+ userspace driver for your InfiniBand hardware. For example, to use
+--- a/MAINTAINERS
++++ b/MAINTAINERS
+@@ -6574,7 +6574,7 @@ M: Doug Ledford <dledford@redhat.com>
+ M: Sean Hefty <sean.hefty@intel.com>
+ M: Hal Rosenstock <hal.rosenstock@gmail.com>
+ L: linux-rdma@vger.kernel.org
+-W: http://www.openfabrics.org/
++W: https://github.com/linux-rdma/rdma-core
+ Q: http://patchwork.kernel.org/project/linux-rdma/list/
+ T: git git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git
+ S: Supported
+--- a/drivers/infiniband/Kconfig
++++ b/drivers/infiniband/Kconfig
+@@ -20,7 +20,8 @@ config INFINIBAND_USER_MAD
+ Userspace InfiniBand Management Datagram (MAD) support. This
+ is the kernel side of the userspace MAD support, which allows
+ userspace processes to send and receive MADs. You will also
+- need libibumad from <http://www.openfabrics.org/downloads/management/>.
++ need libibumad from rdma-core
++ <https://github.com/linux-rdma/rdma-core>.
+
+ config INFINIBAND_USER_ACCESS
+ tristate "InfiniBand userspace access (verbs and CM)"
+@@ -32,7 +33,7 @@ config INFINIBAND_USER_ACCESS
+ to set up connections and directly access InfiniBand
+ hardware for fast-path operations. You will also need
+ libibverbs, libibcm and a hardware driver library from
+- <http://www.openfabrics.org/git/>.
++ rdma-core <https://github.com/linux-rdma/rdma-core>.
+
+ config INFINIBAND_EXP_USER_ACCESS
+ bool "Allow experimental support for Infiniband ABI"
diff --git a/patches.drivers/IB-addr-Constify-dst_entry-pointer.patch b/patches.drivers/IB-addr-Constify-dst_entry-pointer.patch
new file mode 100644
index 0000000000..c9d8c7ff11
--- /dev/null
+++ b/patches.drivers/IB-addr-Constify-dst_entry-pointer.patch
@@ -0,0 +1,68 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Thu, 29 Mar 2018 13:26:32 +0300
+Subject: IB/addr: Constify dst_entry pointer
+Patch-mainline: v4.17-rc1
+Git-commit: fd59015d68ee5bb0397a13cc02dbce9525f7c593
+References: bsc#1103992 FATE#326009
+
+Make dst_entry pointer as const struct dst_entry* to improve code
+readablity to make sure that dst structure fields are not modified by
+various functions which are using it.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/addr.c | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/core/addr.c
++++ b/drivers/infiniband/core/addr.c
+@@ -329,7 +329,8 @@ static void queue_req(struct addr_req *r
+ mutex_unlock(&lock);
+ }
+
+-static int ib_nl_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
++static int ib_nl_fetch_ha(const struct dst_entry *dst,
++ struct rdma_dev_addr *dev_addr,
+ const void *daddr, u32 seq, u16 family)
+ {
+ if (rdma_nl_chk_listeners(RDMA_NL_GROUP_LS))
+@@ -340,7 +341,8 @@ static int ib_nl_fetch_ha(struct dst_ent
+ return ib_nl_ip_send_msg(dev_addr, daddr, seq, family);
+ }
+
+-static int dst_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
++static int dst_fetch_ha(const struct dst_entry *dst,
++ struct rdma_dev_addr *dev_addr,
+ const void *daddr)
+ {
+ struct neighbour *n;
+@@ -364,7 +366,7 @@ static int dst_fetch_ha(struct dst_entry
+ return ret;
+ }
+
+-static bool has_gateway(struct dst_entry *dst, sa_family_t family)
++static bool has_gateway(const struct dst_entry *dst, sa_family_t family)
+ {
+ struct rtable *rt;
+ struct rt6_info *rt6;
+@@ -378,7 +380,7 @@ static bool has_gateway(struct dst_entry
+ return rt6->rt6i_flags & RTF_GATEWAY;
+ }
+
+-static int fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
++static int fetch_ha(const struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
+ const struct sockaddr *dst_in, u32 seq)
+ {
+ const struct sockaddr_in *dst_in4 =
+@@ -482,7 +484,7 @@ static int addr6_resolve(struct sockaddr
+ }
+ #endif
+
+-static int addr_resolve_neigh(struct dst_entry *dst,
++static int addr_resolve_neigh(const struct dst_entry *dst,
+ const struct sockaddr *dst_in,
+ struct rdma_dev_addr *addr,
+ u32 seq)
diff --git a/patches.drivers/IB-cm-Add-and-use-a-helper-function-to-add-cm_id-s-t.patch b/patches.drivers/IB-cm-Add-and-use-a-helper-function-to-add-cm_id-s-t.patch
new file mode 100644
index 0000000000..4b1f9c762c
--- /dev/null
+++ b/patches.drivers/IB-cm-Add-and-use-a-helper-function-to-add-cm_id-s-t.patch
@@ -0,0 +1,66 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:18 +0200
+Subject: IB/cm: Add and use a helper function to add cm_id's to the port list
+Patch-mainline: v4.17-rc1
+Git-commit: a22af59ea9a5f9496c37bc4e4654da45a4e0ca2a
+References: bsc#1103992 FATE#326009
+
+Add and use helper function add_cm_id_to_port_list() to attach
+cm_id to port list.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 31 +++++++++++++++++++++----------
+ 1 file changed, 21 insertions(+), 10 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -462,6 +462,26 @@ static int cm_init_av_for_response(struc
+ grh, &av->ah_attr);
+ }
+
++static int add_cm_id_to_port_list(struct cm_id_private *cm_id_priv,
++ struct cm_av *av,
++ struct cm_port *port)
++{
++ unsigned long flags;
++ int ret = 0;
++
++ spin_lock_irqsave(&cm.lock, flags);
++
++ if (&cm_id_priv->av == av)
++ list_add_tail(&cm_id_priv->prim_list, &port->cm_priv_prim_list);
++ else if (&cm_id_priv->alt_av == av)
++ list_add_tail(&cm_id_priv->altr_list, &port->cm_priv_altr_list);
++ else
++ ret = -EINVAL;
++
++ spin_unlock_irqrestore(&cm.lock, flags);
++ return ret;
++}
++
+ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
+ struct cm_id_private *cm_id_priv)
+ {
+@@ -502,16 +522,7 @@ static int cm_init_av_by_path(struct sa_
+
+ av->timeout = path->packet_life_time + 1;
+
+- spin_lock_irqsave(&cm.lock, flags);
+- if (&cm_id_priv->av == av)
+- list_add_tail(&cm_id_priv->prim_list, &port->cm_priv_prim_list);
+- else if (&cm_id_priv->alt_av == av)
+- list_add_tail(&cm_id_priv->altr_list, &port->cm_priv_altr_list);
+- else
+- ret = -EINVAL;
+-
+- spin_unlock_irqrestore(&cm.lock, flags);
+-
++ ret = add_cm_id_to_port_list(cm_id_priv, av, port);
+ return ret;
+ }
+
diff --git a/patches.drivers/IB-cm-Add-debug-prints-to-ib_cm.patch b/patches.drivers/IB-cm-Add-debug-prints-to-ib_cm.patch
new file mode 100644
index 0000000000..b3cfad8e81
--- /dev/null
+++ b/patches.drivers/IB-cm-Add-debug-prints-to-ib_cm.patch
@@ -0,0 +1,211 @@
+From: Daniel Jurgens <danielj@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:58 +0200
+Subject: IB/cm: Add debug prints to ib_cm
+Patch-mainline: v4.16-rc1
+Git-commit: 119bf81793ea952fcd46e44378ff3c75562d16f8
+References: bsc#1103992 FATE#326009
+
+Add debug prints to the error paths in the connection manager control
+flows, to help debug connection management problems.
+
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 51 +++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 51 insertions(+)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1875,6 +1875,8 @@ static int cm_req_handler(struct cm_work
+
+ listen_cm_id_priv = cm_match_req(work, cm_id_priv);
+ if (!listen_cm_id_priv) {
++ pr_debug("%s: local_id %d, no listen_cm_id_priv\n", __func__,
++ be32_to_cpu(cm_id->local_id));
+ ret = -EINVAL;
+ goto free_timeinfo;
+ }
+@@ -2032,6 +2034,8 @@ int ib_send_cm_rep(struct ib_cm_id *cm_i
+ spin_lock_irqsave(&cm_id_priv->lock, flags);
+ if (cm_id->state != IB_CM_REQ_RCVD &&
+ cm_id->state != IB_CM_MRA_REQ_SENT) {
++ pr_debug("%s: local_comm_id %d, cm_id->state: %d\n", __func__,
++ be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
+ ret = -EINVAL;
+ goto out;
+ }
+@@ -2098,6 +2102,8 @@ int ib_send_cm_rtu(struct ib_cm_id *cm_i
+ spin_lock_irqsave(&cm_id_priv->lock, flags);
+ if (cm_id->state != IB_CM_REP_RCVD &&
+ cm_id->state != IB_CM_MRA_REP_SENT) {
++ pr_debug("%s: local_id %d, cm_id->state %d\n", __func__,
++ be32_to_cpu(cm_id->local_id), cm_id->state);
+ ret = -EINVAL;
+ goto error;
+ }
+@@ -2205,6 +2211,8 @@ static int cm_rep_handler(struct cm_work
+ cm_id_priv = cm_acquire_id(rep_msg->remote_comm_id, 0);
+ if (!cm_id_priv) {
+ cm_dup_rep_handler(work);
++ pr_debug("%s: remote_comm_id %d, no cm_id_priv\n", __func__,
++ be32_to_cpu(rep_msg->remote_comm_id));
+ return -EINVAL;
+ }
+
+@@ -2218,6 +2226,10 @@ static int cm_rep_handler(struct cm_work
+ default:
+ spin_unlock_irq(&cm_id_priv->lock);
+ ret = -EINVAL;
++ pr_debug("%s: cm_id_priv->id.state: %d, local_comm_id %d, remote_comm_id %d\n",
++ __func__, cm_id_priv->id.state,
++ be32_to_cpu(rep_msg->local_comm_id),
++ be32_to_cpu(rep_msg->remote_comm_id));
+ goto error;
+ }
+
+@@ -2231,6 +2243,8 @@ static int cm_rep_handler(struct cm_work
+ spin_unlock(&cm.lock);
+ spin_unlock_irq(&cm_id_priv->lock);
+ ret = -EINVAL;
++ pr_debug("%s: Failed to insert remote id %d\n", __func__,
++ be32_to_cpu(rep_msg->remote_comm_id));
+ goto error;
+ }
+ /* Check for a stale connection. */
+@@ -2248,6 +2262,10 @@ static int cm_rep_handler(struct cm_work
+ IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REP,
+ NULL, 0);
+ ret = -EINVAL;
++ pr_debug("%s: Stale connection. local_comm_id %d, remote_comm_id %d\n",
++ __func__, be32_to_cpu(rep_msg->local_comm_id),
++ be32_to_cpu(rep_msg->remote_comm_id));
++
+ if (cur_cm_id_priv) {
+ cm_id = &cur_cm_id_priv->id;
+ ib_send_cm_dreq(cm_id, NULL, 0);
+@@ -2394,6 +2412,8 @@ int ib_send_cm_dreq(struct ib_cm_id *cm_
+ cm_id_priv = container_of(cm_id, struct cm_id_private, id);
+ spin_lock_irqsave(&cm_id_priv->lock, flags);
+ if (cm_id->state != IB_CM_ESTABLISHED) {
++ pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
++ be32_to_cpu(cm_id->local_id), cm_id->state);
+ ret = -EINVAL;
+ goto out;
+ }
+@@ -2463,6 +2483,8 @@ int ib_send_cm_drep(struct ib_cm_id *cm_
+ if (cm_id->state != IB_CM_DREQ_RCVD) {
+ spin_unlock_irqrestore(&cm_id_priv->lock, flags);
+ kfree(data);
++ pr_debug("%s: local_id %d, cm_idcm_id->state(%d) != IB_CM_DREQ_RCVD\n",
++ __func__, be32_to_cpu(cm_id->local_id), cm_id->state);
+ return -EINVAL;
+ }
+
+@@ -2528,6 +2550,9 @@ static int cm_dreq_handler(struct cm_wor
+ atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES].
+ counter[CM_DREQ_COUNTER]);
+ cm_issue_drep(work->port, work->mad_recv_wc);
++ pr_debug("%s: no cm_id_priv, local_comm_id %d, remote_comm_id %d\n",
++ __func__, be32_to_cpu(dreq_msg->local_comm_id),
++ be32_to_cpu(dreq_msg->remote_comm_id));
+ return -EINVAL;
+ }
+
+@@ -2570,6 +2595,9 @@ static int cm_dreq_handler(struct cm_wor
+ counter[CM_DREQ_COUNTER]);
+ goto unlock;
+ default:
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ goto unlock;
+ }
+ cm_id_priv->id.state = IB_CM_DREQ_RCVD;
+@@ -2673,6 +2701,8 @@ int ib_send_cm_rej(struct ib_cm_id *cm_i
+ cm_enter_timewait(cm_id_priv);
+ break;
+ default:
++ pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
++ be32_to_cpu(cm_id_priv->id.local_id), cm_id->state);
+ ret = -EINVAL;
+ goto out;
+ }
+@@ -2783,6 +2813,9 @@ static int cm_rej_handler(struct cm_work
+ /* fall through */
+ default:
+ spin_unlock_irq(&cm_id_priv->lock);
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ ret = -EINVAL;
+ goto out;
+ }
+@@ -2846,6 +2879,9 @@ int ib_send_cm_mra(struct ib_cm_id *cm_i
+ }
+ /* fall through */
+ default:
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ ret = -EINVAL;
+ goto error1;
+ }
+@@ -2947,6 +2983,9 @@ static int cm_mra_handler(struct cm_work
+ counter[CM_MRA_COUNTER]);
+ /* fall through */
+ default:
++ pr_debug("%s local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ goto out;
+ }
+
+@@ -3727,6 +3766,7 @@ static void cm_work_handler(struct work_
+ ret = cm_timewait_handler(work);
+ break;
+ default:
++ pr_debug("cm_event.event: 0x%x\n", work->cm_event.event);
+ ret = -EINVAL;
+ break;
+ }
+@@ -3762,6 +3802,8 @@ static int cm_establish(struct ib_cm_id
+ ret = -EISCONN;
+ break;
+ default:
++ pr_debug("%s: local_id %d, cm_id->state: %d\n", __func__,
++ be32_to_cpu(cm_id->local_id), cm_id->state);
+ ret = -EINVAL;
+ break;
+ }
+@@ -3959,6 +4001,9 @@ static int cm_init_qp_init_attr(struct c
+ ret = 0;
+ break;
+ default:
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ ret = -EINVAL;
+ break;
+ }
+@@ -4006,6 +4051,9 @@ static int cm_init_qp_rtr_attr(struct cm
+ ret = 0;
+ break;
+ default:
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ ret = -EINVAL;
+ break;
+ }
+@@ -4065,6 +4113,9 @@ static int cm_init_qp_rts_attr(struct cm
+ ret = 0;
+ break;
+ default:
++ pr_debug("%s: local_id %d, cm_id_priv->id.state: %d\n",
++ __func__, be32_to_cpu(cm_id_priv->id.local_id),
++ cm_id_priv->id.state);
+ ret = -EINVAL;
+ break;
+ }
diff --git a/patches.drivers/IB-cm-Block-processing-alternate-path-handling-RoCE-.patch b/patches.drivers/IB-cm-Block-processing-alternate-path-handling-RoCE-.patch
new file mode 100644
index 0000000000..1cac67e992
--- /dev/null
+++ b/patches.drivers/IB-cm-Block-processing-alternate-path-handling-RoCE-.patch
@@ -0,0 +1,64 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 25 Mar 2018 13:40:19 +0300
+Subject: IB/cm: Block processing alternate path handling RoCE Rx cm messages
+Patch-mainline: v4.17-rc1
+Git-commit: 97c45c2c28cd291e06778d9d36a0f60ee74726bc
+References: bsc#1103992 FATE#326009
+
+Due to below reasons, it is better to not support alternate path receive
+messages for RoCE in near term.
+
+1. Alternate path for RoCE is not supported at rdmacm layer.
+2. It is not supported in uverbs/core layer for RoCE.
+3. Alternate path for IPv6 for link local address cannot resolve route
+determinstically without a valid incoming interface id whose usecase
+make sense only with dual port mode.
+4. init_av_from_path while processing LAP messages for IB and RoCE can
+lead to adding duplicate entry of AV into the port list, leads to list
+corruption.
+5. rdma-core userspace a well known userspace implementation has removed
+support of libucm which use ucm.ko module, which is the only module that
+can trigger alternate path related messages.
+6. ucm kernel module is requested to be removed from the IB core in
+patch [1].
+
+[1] https://patchwork.kernel.org/patch/10268503/
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -3175,6 +3175,13 @@ static int cm_lap_handler(struct cm_work
+ struct ib_mad_send_buf *msg = NULL;
+ int ret;
+
++ /* Currently Alternate path messages are not supported for
++ * RoCE link layer.
++ */
++ if (rdma_protocol_roce(work->port->cm_dev->ib_device,
++ work->port->port_num))
++ return -EINVAL;
++
+ /* todo: verify LAP request and send reject APR if invalid. */
+ lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad;
+ cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id,
+@@ -3324,6 +3331,13 @@ static int cm_apr_handler(struct cm_work
+ struct cm_apr_msg *apr_msg;
+ int ret;
+
++ /* Currently Alternate path messages are not supported for
++ * RoCE link layer.
++ */
++ if (rdma_protocol_roce(work->port->cm_dev->ib_device,
++ work->port->port_num))
++ return -EINVAL;
++
+ apr_msg = (struct cm_apr_msg *)work->mad_recv_wc->recv_buf.mad;
+ cm_id_priv = cm_acquire_id(apr_msg->remote_comm_id,
+ apr_msg->local_comm_id);
diff --git a/patches.drivers/IB-cm-Fix-sleeping-while-spin-lock-is-held.patch b/patches.drivers/IB-cm-Fix-sleeping-while-spin-lock-is-held.patch
new file mode 100644
index 0000000000..37c4207595
--- /dev/null
+++ b/patches.drivers/IB-cm-Fix-sleeping-while-spin-lock-is-held.patch
@@ -0,0 +1,57 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:15 +0200
+Subject: IB/cm: Fix sleeping while spin lock is held
+Patch-mainline: v4.16-rc1
+Git-commit: 33f93e1ebcf5acfaef06cda2d3e373730519e33e
+References: bsc#1103992 FATE#326009
+
+In case of LAP are used for RoCE, it can lead to a problem of sleeping a
+context while spin lock is held in below flow.
+
+cm_lap_handler
+ ->spin_lock
+ -> <..switch_case..>
+ -> cm_init_av_for_response
+ -> ib_init_ah_from_wc
+ -> rdma_addr_find_l2_eth_by_grh
+ wait_for_completion()
+
+Therefore ah attribute initialization is done for incoming lap requests
+outside of the lock context.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -3164,6 +3164,12 @@ static int cm_lap_handler(struct cm_work
+ if (!cm_id_priv)
+ return -EINVAL;
+
++ ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
++ work->mad_recv_wc->recv_buf.grh,
++ &cm_id_priv->av);
++ if (ret)
++ goto deref;
++
+ param = &work->cm_event.param.lap_rcvd;
+ memset(&work->path[0], 0, sizeof(work->path[1]));
+ cm_path_set_rec_type(work->port->cm_dev->ib_device,
+@@ -3210,11 +3216,6 @@ static int cm_lap_handler(struct cm_work
+
+ cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
+ cm_id_priv->tid = lap_msg->hdr.tid;
+- ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+- work->mad_recv_wc->recv_buf.grh,
+- &cm_id_priv->av);
+- if (ret)
+- goto unlock;
+ cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av,
+ cm_id_priv);
+ ret = atomic_inc_and_test(&cm_id_priv->work_count);
diff --git a/patches.drivers/IB-cm-Handle-address-handle-attribute-init-error.patch b/patches.drivers/IB-cm-Handle-address-handle-attribute-init-error.patch
new file mode 100644
index 0000000000..f6f4464b87
--- /dev/null
+++ b/patches.drivers/IB-cm-Handle-address-handle-attribute-init-error.patch
@@ -0,0 +1,36 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:14 +0200
+Subject: IB/cm: Handle address handle attribute init error
+Patch-mainline: v4.16-rc1
+Git-commit: 5cf3968afcc752fa2db6910e9694120b3373c73b
+References: bsc#1103992 FATE#326009
+
+cm_init_av_by_path depends on ib_init_ah_from_path to initialize ah
+attribute and ib_init_ah_from_path() can fail, such error should not
+be ignored.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -494,8 +494,11 @@ static int cm_init_av_by_path(struct sa_
+ return ret;
+
+ av->port = port;
+- ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
+- &av->ah_attr);
++ ret = ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
++ &av->ah_attr);
++ if (ret)
++ return ret;
++
+ av->timeout = path->packet_life_time + 1;
+
+ spin_lock_irqsave(&cm.lock, flags);
diff --git a/patches.drivers/IB-cm-Introduce-and-use-helper-function-to-get-cm_po.patch b/patches.drivers/IB-cm-Introduce-and-use-helper-function-to-get-cm_po.patch
new file mode 100644
index 0000000000..909b4b6627
--- /dev/null
+++ b/patches.drivers/IB-cm-Introduce-and-use-helper-function-to-get-cm_po.patch
@@ -0,0 +1,66 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:22 +0200
+Subject: IB/cm: Introduce and use helper function to get cm_port from path
+Patch-mainline: v4.17-rc1
+Git-commit: cb12a8e2fa5fc6381aa8ae542276099a64dee6e9
+References: bsc#1103992 FATE#326009
+
+Introduce and use helper function get_cm_port_from_path() to get
+cm_port based on the the path record entry.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -482,13 +482,11 @@ static int add_cm_id_to_port_list(struct
+ return ret;
+ }
+
+-static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
+- struct cm_id_private *cm_id_priv)
++static struct cm_port *get_cm_port_from_path(struct sa_path_rec *path)
+ {
+ struct cm_device *cm_dev;
+ struct cm_port *port = NULL;
+ unsigned long flags;
+- int ret;
+ u8 p;
+ struct net_device *ndev = ib_get_ndev_from_path(path);
+
+@@ -497,7 +495,7 @@ static int cm_init_av_by_path(struct sa_
+ if (!ib_find_cached_gid(cm_dev->ib_device, &path->sgid,
+ sa_conv_pathrec_to_gid_type(path),
+ ndev, &p, NULL)) {
+- port = cm_dev->port[p-1];
++ port = cm_dev->port[p - 1];
+ break;
+ }
+ }
+@@ -505,9 +503,20 @@ static int cm_init_av_by_path(struct sa_
+
+ if (ndev)
+ dev_put(ndev);
++ return port;
++}
++
++static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
++ struct cm_id_private *cm_id_priv)
++{
++ struct cm_device *cm_dev;
++ struct cm_port *port;
++ int ret;
+
++ port = get_cm_port_from_path(path);
+ if (!port)
+ return -EINVAL;
++ cm_dev = port->cm_dev;
+
+ ret = ib_find_cached_pkey(cm_dev->ib_device, port->port_num,
+ be16_to_cpu(path->pkey), &av->pkey_index);
diff --git a/patches.drivers/IB-cm-Refactor-to-avoid-setting-path-record-software.patch b/patches.drivers/IB-cm-Refactor-to-avoid-setting-path-record-software.patch
new file mode 100644
index 0000000000..71af003128
--- /dev/null
+++ b/patches.drivers/IB-cm-Refactor-to-avoid-setting-path-record-software.patch
@@ -0,0 +1,139 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:18 +0200
+Subject: IB/cm: Refactor to avoid setting path record software only fields
+Patch-mainline: v4.16-rc1
+Git-commit: 16c72e402867e956fd558d55cbe2f1a40c742e73
+References: bsc#1103992 FATE#326009
+
+When path ah_attr initialization from path record
+fails, ib_cm_send_rej() uses av.ah_attr fields to send out reject
+message. In such cases initialization of path record software fields
+is not needed. Code is simplified for same.
+
+Additionally in current code in cm_req_handler, when ib_get_cached_gid
+fails for a given sgid_index of the GID of the GRH of the incoming CM MAD,
+error code 12 is sent. This error code refers to primary GID in incoming
+CM REQ and not for the GID in in MAD packet.
+Therefore code is refactored to send code 5 (unsupported request) for such
+error.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Reviewed-by: Hal Rosenstock <hal@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 92 ++++++++++++++++++++-----------------------
+ 1 file changed, 44 insertions(+), 48 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1902,56 +1902,52 @@ static int cm_req_handler(struct cm_work
+ work->port->port_num,
+ grh->sgid_index,
+ &gid, &gid_attr);
+- if (!ret) {
+- if (gid_attr.ndev) {
+- work->path[0].rec_type =
+- sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
+- sa_path_set_ifindex(&work->path[0],
+- gid_attr.ndev->ifindex);
+- sa_path_set_ndev(&work->path[0],
+- dev_net(gid_attr.ndev));
++ if (ret) {
++ if (gid_attr.ndev)
+ dev_put(gid_attr.ndev);
+- } else {
+- cm_path_set_rec_type(work->port->cm_dev->ib_device,
+- work->port->port_num,
+- &work->path[0],
+- &req_msg->primary_local_gid);
+- }
+- if (cm_req_has_alt_path(req_msg))
+- work->path[1].rec_type = work->path[0].rec_type;
+- cm_format_paths_from_req(req_msg, &work->path[0],
+- &work->path[1]);
+- if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
+- sa_path_set_dmac(&work->path[0],
+- cm_id_priv->av.ah_attr.roce.dmac);
+- work->path[0].hop_limit = grh->hop_limit;
+- ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av,
+- cm_id_priv);
++ ib_send_cm_rej(cm_id, IB_CM_REJ_UNSUPPORTED, NULL, 0, NULL, 0);
++ goto rejected;
+ }
++
++ if (gid_attr.ndev) {
++ work->path[0].rec_type =
++ sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
++ sa_path_set_ifindex(&work->path[0],
++ gid_attr.ndev->ifindex);
++ sa_path_set_ndev(&work->path[0],
++ dev_net(gid_attr.ndev));
++ dev_put(gid_attr.ndev);
++ } else {
++ cm_path_set_rec_type(work->port->cm_dev->ib_device,
++ work->port->port_num,
++ &work->path[0],
++ &req_msg->primary_local_gid);
++ }
++ if (cm_req_has_alt_path(req_msg))
++ work->path[1].rec_type = work->path[0].rec_type;
++ cm_format_paths_from_req(req_msg, &work->path[0],
++ &work->path[1]);
++ if (cm_id_priv->av.ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE)
++ sa_path_set_dmac(&work->path[0],
++ cm_id_priv->av.ah_attr.roce.dmac);
++ work->path[0].hop_limit = grh->hop_limit;
++ ret = cm_init_av_by_path(&work->path[0], &cm_id_priv->av,
++ cm_id_priv);
+ if (ret) {
+- int err = ib_get_cached_gid(work->port->cm_dev->ib_device,
+- work->port->port_num, 0,
+- &work->path[0].sgid,
+- &gid_attr);
+- if (!err && gid_attr.ndev) {
+- work->path[0].rec_type =
+- sa_conv_gid_to_pathrec_type(gid_attr.gid_type);
+- sa_path_set_ifindex(&work->path[0],
+- gid_attr.ndev->ifindex);
+- sa_path_set_ndev(&work->path[0],
+- dev_net(gid_attr.ndev));
+- dev_put(gid_attr.ndev);
+- } else {
+- cm_path_set_rec_type(work->port->cm_dev->ib_device,
+- work->port->port_num,
+- &work->path[0],
+- &req_msg->primary_local_gid);
+- }
+- if (cm_req_has_alt_path(req_msg))
+- work->path[1].rec_type = work->path[0].rec_type;
+- ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
+- &work->path[0].sgid, sizeof work->path[0].sgid,
+- NULL, 0);
++ int err;
++
++ err = ib_get_cached_gid(work->port->cm_dev->ib_device,
++ work->port->port_num, 0,
++ &work->path[0].sgid,
++ NULL);
++ if (err)
++ ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
++ NULL, 0, NULL, 0);
++ else
++ ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_GID,
++ &work->path[0].sgid,
++ sizeof(work->path[0].sgid),
++ NULL, 0);
+ goto rejected;
+ }
+ if (cm_req_has_alt_path(req_msg)) {
+@@ -1960,7 +1956,7 @@ static int cm_req_handler(struct cm_work
+ if (ret) {
+ ib_send_cm_rej(cm_id, IB_CM_REJ_INVALID_ALT_GID,
+ &work->path[0].sgid,
+- sizeof work->path[0].sgid, NULL, 0);
++ sizeof(work->path[0].sgid), NULL, 0);
+ goto rejected;
+ }
+ }
diff --git a/patches.drivers/IB-cm-Suppress-gcc-7-fall-through-complaints.patch b/patches.drivers/IB-cm-Suppress-gcc-7-fall-through-complaints.patch
new file mode 100644
index 0000000000..51e1ceef19
--- /dev/null
+++ b/patches.drivers/IB-cm-Suppress-gcc-7-fall-through-complaints.patch
@@ -0,0 +1,29 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 11 Oct 2017 10:48:44 -0700
+Subject: IB/cm: Suppress gcc 7 fall-through complaints
+Patch-mainline: v4.15-rc1
+Git-commit: 401c6ae363bdc66e724b4589881a0c0ffc9d7775
+References: bsc#1103992 FATE#326009
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -2808,6 +2808,7 @@ int ib_send_cm_mra(struct ib_cm_id *cm_i
+ msg_response = CM_MSG_RESPONSE_OTHER;
+ break;
+ }
++ /* fall through */
+ default:
+ ret = -EINVAL;
+ goto error1;
diff --git a/patches.drivers/IB-cm-umad-Handle-av-init-error.patch b/patches.drivers/IB-cm-umad-Handle-av-init-error.patch
new file mode 100644
index 0000000000..9bc3eb431f
--- /dev/null
+++ b/patches.drivers/IB-cm-umad-Handle-av-init-error.patch
@@ -0,0 +1,116 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:13 +0200
+Subject: IB/{cm, umad}: Handle av init error
+Patch-mainline: v4.16-rc1
+Git-commit: 0c4386ec77cfcd0ccbdbe8c2e67dd3a49b2a4c7f
+References: bsc#1103992 FATE#326009
+
+cm_init_av_for_response depends on ib_init_ah_from_wc() whose return
+status is ignored.
+ib_init_ah_from_wc() can fail and its return status should be handled as
+done in this patch.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 34 +++++++++++++++++++++-------------
+ drivers/infiniband/core/user_mad.c | 10 +++++++---
+ 2 files changed, 28 insertions(+), 16 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -452,13 +452,13 @@ static void cm_set_private_data(struct c
+ cm_id_priv->private_data_len = private_data_len;
+ }
+
+-static void cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
+- struct ib_grh *grh, struct cm_av *av)
++static int cm_init_av_for_response(struct cm_port *port, struct ib_wc *wc,
++ struct ib_grh *grh, struct cm_av *av)
+ {
+ av->port = port;
+ av->pkey_index = wc->pkey_index;
+- ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
+- grh, &av->ah_attr);
++ return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
++ grh, &av->ah_attr);
+ }
+
+ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
+@@ -1860,9 +1860,11 @@ static int cm_req_handler(struct cm_work
+
+ cm_id_priv = container_of(cm_id, struct cm_id_private, id);
+ cm_id_priv->id.remote_id = req_msg->local_comm_id;
+- cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+- work->mad_recv_wc->recv_buf.grh,
+- &cm_id_priv->av);
++ ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
++ work->mad_recv_wc->recv_buf.grh,
++ &cm_id_priv->av);
++ if (ret)
++ goto destroy;
+ cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv->
+ id.local_id);
+ if (IS_ERR(cm_id_priv->timewait_info)) {
+@@ -3205,9 +3207,11 @@ static int cm_lap_handler(struct cm_work
+
+ cm_id_priv->id.lap_state = IB_CM_LAP_RCVD;
+ cm_id_priv->tid = lap_msg->hdr.tid;
+- cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+- work->mad_recv_wc->recv_buf.grh,
+- &cm_id_priv->av);
++ ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
++ work->mad_recv_wc->recv_buf.grh,
++ &cm_id_priv->av);
++ if (ret)
++ goto unlock;
+ cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av,
+ cm_id_priv);
+ ret = atomic_inc_and_test(&cm_id_priv->work_count);
+@@ -3460,6 +3464,7 @@ static int cm_sidr_req_handler(struct cm
+ struct cm_id_private *cm_id_priv, *cur_cm_id_priv;
+ struct cm_sidr_req_msg *sidr_req_msg;
+ struct ib_wc *wc;
++ int ret;
+
+ cm_id = ib_create_cm_id(work->port->cm_dev->ib_device, NULL, NULL);
+ if (IS_ERR(cm_id))
+@@ -3472,9 +3477,12 @@ static int cm_sidr_req_handler(struct cm
+ wc = work->mad_recv_wc->wc;
+ cm_id_priv->av.dgid.global.subnet_prefix = cpu_to_be64(wc->slid);
+ cm_id_priv->av.dgid.global.interface_id = 0;
+- cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
+- work->mad_recv_wc->recv_buf.grh,
+- &cm_id_priv->av);
++ ret = cm_init_av_for_response(work->port, work->mad_recv_wc->wc,
++ work->mad_recv_wc->recv_buf.grh,
++ &cm_id_priv->av);
++ if (ret)
++ goto out;
++
+ cm_id_priv->id.remote_id = sidr_req_msg->request_id;
+ cm_id_priv->tid = sidr_req_msg->hdr.tid;
+ atomic_inc(&cm_id_priv->work_count);
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -246,10 +246,14 @@ static void recv_handler(struct ib_mad_a
+ if (packet->mad.hdr.grh_present) {
+ struct rdma_ah_attr ah_attr;
+ const struct ib_global_route *grh;
++ int ret;
+
+- ib_init_ah_from_wc(agent->device, agent->port_num,
+- mad_recv_wc->wc, mad_recv_wc->recv_buf.grh,
+- &ah_attr);
++ ret = ib_init_ah_from_wc(agent->device, agent->port_num,
++ mad_recv_wc->wc,
++ mad_recv_wc->recv_buf.grh,
++ &ah_attr);
++ if (ret)
++ goto err2;
+
+ grh = rdma_ah_read_grh(&ah_attr);
+ packet->mad.hdr.gid_index = grh->sgid_index;
diff --git a/patches.drivers/IB-cma-Resolve-route-only-while-receiving-CM-request.patch b/patches.drivers/IB-cma-Resolve-route-only-while-receiving-CM-request.patch
new file mode 100644
index 0000000000..70968dc538
--- /dev/null
+++ b/patches.drivers/IB-cma-Resolve-route-only-while-receiving-CM-request.patch
@@ -0,0 +1,113 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Wed, 21 Mar 2018 17:16:35 +0200
+Subject: IB/cma: Resolve route only while receiving CM requests
+Patch-mainline: v4.17-rc1
+Git-commit: 114cc9c4b18232452f7dcc8bb3e5749f8d9a6837
+References: bsc#1103992 FATE#326009
+
+Currently CM request for RoCE follows following flow.
+rdma_create_id()
+rdma_resolve_addr()
+rdma_resolve_route()
+For RC QPs:
+rdma_connect()
+->cma_connect_ib()
+ ->ib_send_cm_req()
+ ->cm_init_av_by_path()
+ ->ib_init_ah_attr_from_path()
+For UD QPs:
+rdma_connect()
+->cma_resolve_ib_udp()
+ ->ib_send_cm_sidr_req()
+ ->cm_init_av_by_path()
+ ->ib_init_ah_attr_from_path()
+
+In both the flows, route is already resolved before sending CM requests.
+Therefore, code is refactored to avoid resolving route second time in
+ib_cm layer.
+ib_init_ah_attr_from_path() is extended to resolve route when it is not
+yet resolved for RoCE link layer. This is achieved by caller setting
+route_resolved field in path record whenever it has route already
+resolved.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 5 +++++
+ drivers/infiniband/core/cma.c | 1 +
+ drivers/infiniband/core/sa_query.c | 5 +++++
+ include/rdma/ib_sa.h | 8 ++++++++
+ 4 files changed, 19 insertions(+)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1543,6 +1543,8 @@ static void cm_format_paths_from_req(str
+ cm_req_get_primary_local_ack_timeout(req_msg);
+ primary_path->packet_life_time -= (primary_path->packet_life_time > 0);
+ primary_path->service_id = req_msg->service_id;
++ if (sa_path_is_roce(primary_path))
++ primary_path->roce.route_resolved = false;
+
+ if (cm_req_has_alt_path(req_msg)) {
+ alt_path->dgid = req_msg->alt_local_gid;
+@@ -1562,6 +1564,9 @@ static void cm_format_paths_from_req(str
+ cm_req_get_alt_local_ack_timeout(req_msg);
+ alt_path->packet_life_time -= (alt_path->packet_life_time > 0);
+ alt_path->service_id = req_msg->service_id;
++
++ if (sa_path_is_roce(alt_path))
++ alt_path->roce.route_resolved = false;
+ }
+ cm_format_path_lid_from_req(req_msg, primary_path, alt_path);
+ }
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -2506,6 +2506,7 @@ cma_iboe_set_path_rec_l2_fields(struct r
+ gid_type = ib_network_to_gid_type(addr->dev_addr.network);
+ route->path_rec->rec_type = sa_conv_gid_to_pathrec_type(gid_type);
+
++ route->path_rec->roce.route_resolved = true;
+ sa_path_set_ndev(route->path_rec, addr->dev_addr.net);
+ sa_path_set_ifindex(route->path_rec, ndev->ifindex);
+ sa_path_set_dmac(route->path_rec, addr->dev_addr.dst_dev_addr);
+--- a/drivers/infiniband/core/sa_query.c
++++ b/drivers/infiniband/core/sa_query.c
+@@ -1248,6 +1248,9 @@ roce_resolve_route_from_path(struct ib_d
+ } sgid_addr, dgid_addr;
+ int ret;
+
++ if (rec->roce.route_resolved)
++ return 0;
++
+ if (!device->get_netdev)
+ return -EOPNOTSUPP;
+
+@@ -1287,6 +1290,8 @@ roce_resolve_route_from_path(struct ib_d
+ dev_put(ndev);
+ done:
+ dev_put(idev);
++ if (!ret)
++ rec->roce.route_resolved = true;
+ return ret;
+ }
+
+--- a/include/rdma/ib_sa.h
++++ b/include/rdma/ib_sa.h
+@@ -163,7 +163,15 @@ struct sa_path_rec_ib {
+ u8 raw_traffic;
+ };
+
++/**
++ * struct sa_path_rec_roce - RoCE specific portion of the path record entry
++ * @route_resolved: When set, it indicates that this route is already
++ * resolved for this path record entry.
++ * @dmac: Destination mac address for the given DGID entry
++ * of the path record entry.
++ */
+ struct sa_path_rec_roce {
++ bool route_resolved;
+ u8 dmac[ETH_ALEN];
+ /* ignored in IB */
+ int ifindex;
diff --git a/patches.drivers/IB-cma-Use-rdma_protocol_roce-and-remove-cma_protoco.patch b/patches.drivers/IB-cma-Use-rdma_protocol_roce-and-remove-cma_protoco.patch
new file mode 100644
index 0000000000..ad115ab48a
--- /dev/null
+++ b/patches.drivers/IB-cma-Use-rdma_protocol_roce-and-remove-cma_protoco.patch
@@ -0,0 +1,65 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:15 +0200
+Subject: IB/cma: Use rdma_protocol_roce() and remove
+ cma_protocol_roce_dev_port()
+Patch-mainline: v4.17-rc1
+Git-commit: 5ac08a341303dd2105d7b5dc26b38b0d85ac726b
+References: bsc#1103992 FATE#326009
+
+rdma_protocol_roce() API from the ib_core already provides a way to
+detect whether a given device+port is RoCE or not.
+Therefore, make use of it and avoid implementing it again in rdmacm
+module.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cma.c | 15 +++------------
+ 1 file changed, 3 insertions(+), 12 deletions(-)
+
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -1407,21 +1407,12 @@ static bool cma_match_private_data(struc
+ return true;
+ }
+
+-static bool cma_protocol_roce_dev_port(struct ib_device *device, int port_num)
+-{
+- enum rdma_link_layer ll = rdma_port_get_link_layer(device, port_num);
+- enum rdma_transport_type transport =
+- rdma_node_get_transport(device->node_type);
+-
+- return ll == IB_LINK_LAYER_ETHERNET && transport == RDMA_TRANSPORT_IB;
+-}
+-
+ static bool cma_protocol_roce(const struct rdma_cm_id *id)
+ {
+ struct ib_device *device = id->device;
+ const int port_num = id->port_num ?: rdma_start_port(device);
+
+- return cma_protocol_roce_dev_port(device, port_num);
++ return rdma_protocol_roce(device, port_num);
+ }
+
+ static bool cma_match_net_dev(const struct rdma_cm_id *id,
+@@ -1434,7 +1425,7 @@ static bool cma_match_net_dev(const stru
+ /* This request is an AF_IB request or a RoCE request */
+ return (!id->port_num || id->port_num == port_num) &&
+ (addr->src_addr.ss_family == AF_IB ||
+- cma_protocol_roce_dev_port(id->device, port_num));
++ rdma_protocol_roce(id->device, port_num));
+
+ return !addr->dev_addr.bound_dev_if ||
+ (net_eq(dev_net(net_dev), addr->dev_addr.net) &&
+@@ -1489,7 +1480,7 @@ static struct rdma_id_private *cma_id_fr
+ if (PTR_ERR(*net_dev) == -EAFNOSUPPORT) {
+ /* Assuming the protocol is AF_IB */
+ *net_dev = NULL;
+- } else if (cma_protocol_roce_dev_port(req.device, req.port)) {
++ } else if (rdma_protocol_roce(req.device, req.port)) {
+ /* TODO find the net dev matching the request parameters
+ * through the RoCE GID table */
+ *net_dev = NULL;
diff --git a/patches.drivers/IB-cma-use-strlcpy-instead-of-strncpy.patch b/patches.drivers/IB-cma-use-strlcpy-instead-of-strncpy.patch
new file mode 100644
index 0000000000..0f00b399e7
--- /dev/null
+++ b/patches.drivers/IB-cma-use-strlcpy-instead-of-strncpy.patch
@@ -0,0 +1,34 @@
+From: Xiongfeng Wang <xiongfeng.wang@linaro.org>
+Date: Fri, 12 Jan 2018 15:56:05 +0800
+Subject: IB/cma: use strlcpy() instead of strncpy()
+Patch-mainline: v4.16-rc1
+Git-commit: 979a459c8347a797fd03717a3f12289c91617982
+References: bsc#1103992 FATE#326009
+
+gcc-8 reports
+
+drivers/infiniband/core/cma_configfs.c: In function 'make_cma_dev':
+./include/linux/string.h:245:9: warning: '__builtin_strncpy' specified
+bound 64 equals destination size [-Wstringop-truncation]
+
+We need to use strlcpy() to make sure the string is nul-terminated.
+
+Signed-off-by: Xiongfeng Wang <xiongfeng.wang@linaro.org>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cma_configfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/cma_configfs.c
++++ b/drivers/infiniband/core/cma_configfs.c
+@@ -295,7 +295,7 @@ static struct config_group *make_cma_dev
+ goto fail;
+ }
+
+- strncpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
++ strlcpy(cma_dev_group->name, name, sizeof(cma_dev_group->name));
+
+ config_group_init_type_name(&cma_dev_group->ports_group, "ports",
+ &cma_ports_group_type);
diff --git a/patches.drivers/IB-core-Add-PCI-write-end-padding-flags-for-WQ-and-Q.patch b/patches.drivers/IB-core-Add-PCI-write-end-padding-flags-for-WQ-and-Q.patch
new file mode 100644
index 0000000000..6bb809be28
--- /dev/null
+++ b/patches.drivers/IB-core-Add-PCI-write-end-padding-flags-for-WQ-and-Q.patch
@@ -0,0 +1,81 @@
+From: Noa Osherovich <noaos@mellanox.com>
+Date: Sun, 29 Oct 2017 13:59:44 +0200
+Subject: IB/core: Add PCI write end padding flags for WQ and QP
+Patch-mainline: v4.15-rc1
+Git-commit: e1d2e88733695038754d3303b180f8005a02b6f1
+References: bsc#1103992 FATE#326009
+
+There are root complexes that are able to optimize their
+performance when incoming data is multiple full cache lines.
+
+PCI write end padding is the device's ability to pad the ending of
+incoming packets (scatter) to full cache line such that the last
+upstream write generated by an incoming packet will be a full cache
+line.
+
+Add a relevant entry to ib_device_cap_flags to report such capability
+of an RDMA device.
+
+Add the QP and WQ create flags:
+ * A QP/WQ created with a scatter end padding flag will cause
+ HW to pad the last upstream write generated by a packet to cache line.
+
+User should consider several factors before activating this feature:
+- In case of high CPU memory load (which may cause PCI back pressure in
+ turn), if a large percent of the writes are partial cache line, this
+ feature should be checked as an optional solution.
+- This feature might reduce performance if most packets are between one
+ and two cache lines and PCIe throughput has reached its maximum
+ capacity. E.g. 65B packet from the network port will lead to 128B
+ write on PCIe, which may cause traffic on PCIe to reach high
+ throughput.
+
+Signed-off-by: Noa Osherovich <noaos@mellanox.com>
+Reviewed-by: Majd Dibbiny <majd@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/uverbs_cmd.c | 3 ++-
+ include/rdma/ib_verbs.h | 4 ++++
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/uverbs_cmd.c
++++ b/drivers/infiniband/core/uverbs_cmd.c
+@@ -1491,7 +1491,8 @@ static int create_qp(struct ib_uverbs_fi
+ IB_QP_CREATE_MANAGED_RECV |
+ IB_QP_CREATE_SCATTER_FCS |
+ IB_QP_CREATE_CVLAN_STRIPPING |
+- IB_QP_CREATE_SOURCE_QPN)) {
++ IB_QP_CREATE_SOURCE_QPN |
++ IB_QP_CREATE_PCI_WRITE_END_PADDING)) {
+ ret = -EINVAL;
+ goto err_put;
+ }
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -229,6 +229,8 @@ enum ib_device_cap_flags {
+ /* Deprecated. Please use IB_RAW_PACKET_CAP_SCATTER_FCS. */
+ IB_DEVICE_RAW_SCATTER_FCS = (1ULL << 34),
+ IB_DEVICE_RDMA_NETDEV_OPA_VNIC = (1ULL << 35),
++ /* The device supports padding incoming writes to cacheline. */
++ IB_DEVICE_PCI_WRITE_END_PADDING = (1ULL << 36),
+ };
+
+ enum ib_signature_prot_cap {
+@@ -1098,6 +1100,7 @@ enum ib_qp_create_flags {
+ IB_QP_CREATE_SCATTER_FCS = 1 << 8,
+ IB_QP_CREATE_CVLAN_STRIPPING = 1 << 9,
+ IB_QP_CREATE_SOURCE_QPN = 1 << 10,
++ IB_QP_CREATE_PCI_WRITE_END_PADDING = 1 << 11,
+ /* reserve bits 26-31 for low level drivers' internal use */
+ IB_QP_CREATE_RESERVED_START = 1 << 26,
+ IB_QP_CREATE_RESERVED_END = 1 << 31,
+@@ -1621,6 +1624,7 @@ enum ib_wq_flags {
+ IB_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0,
+ IB_WQ_FLAGS_SCATTER_FCS = 1 << 1,
+ IB_WQ_FLAGS_DELAY_DROP = 1 << 2,
++ IB_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3,
+ };
+
+ struct ib_wq_init_attr {
diff --git a/patches.drivers/IB-core-Add-null-pointer-check-in-addr_resolve.patch b/patches.drivers/IB-core-Add-null-pointer-check-in-addr_resolve.patch
index e443c9f2a9..ca5f700c57 100644
--- a/patches.drivers/IB-core-Add-null-pointer-check-in-addr_resolve.patch
+++ b/patches.drivers/IB-core-Add-null-pointer-check-in-addr_resolve.patch
@@ -71,19 +71,19 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
-@@ -556,18 +556,13 @@ static int addr_resolve(struct sockaddr
+@@ -552,18 +552,13 @@ static int addr_resolve(struct sockaddr
dst_release(dst);
}
- if (ndev->flags & IFF_LOOPBACK) {
-- ret = rdma_translate_ip(dst_in, addr, NULL);
+- ret = rdma_translate_ip(dst_in, addr);
- /*
- * Put the loopback device and get the translated
- * device instead.
- */
+ if (ndev) {
+ if (ndev->flags & IFF_LOOPBACK)
-+ ret = rdma_translate_ip(dst_in, addr, NULL);
++ ret = rdma_translate_ip(dst_in, addr);
+ else
+ addr->bound_dev_if = ndev->ifindex;
dev_put(ndev);
diff --git a/patches.drivers/IB-core-Attempt-DMAC-resolution-for-only-RoCE.patch b/patches.drivers/IB-core-Attempt-DMAC-resolution-for-only-RoCE.patch
new file mode 100644
index 0000000000..d8f6ce27d4
--- /dev/null
+++ b/patches.drivers/IB-core-Attempt-DMAC-resolution-for-only-RoCE.patch
@@ -0,0 +1,42 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 9 Jan 2018 15:24:52 +0200
+Subject: IB/core: Attempt DMAC resolution for only RoCE
+Patch-mainline: v4.16-rc1
+Git-commit: f2290d6d522dbcdb8c2bd36e98e57c05bf5ed523
+References: bsc#1103992 FATE#326009
+
+Instead of returning 0 (success) for RoCE scenarios where DMAC should
+not be resolved, avoid such attempt and make code consistent with
+ib_create_user_ah().
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -1302,9 +1302,6 @@ static int ib_resolve_eth_dmac(struct ib
+ if (!rdma_is_port_valid(device, rdma_ah_get_port_num(ah_attr)))
+ return -EINVAL;
+
+- if (ah_attr->type != RDMA_AH_ATTR_TYPE_ROCE)
+- return 0;
+-
+ grh = rdma_ah_retrieve_grh(ah_attr);
+
+ if (rdma_is_multicast_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) {
+@@ -1370,7 +1367,8 @@ int ib_modify_qp_with_udata(struct ib_qp
+ struct ib_qp *qp = ib_qp->real_qp;
+ int ret;
+
+- if (attr_mask & IB_QP_AV) {
++ if (attr_mask & IB_QP_AV &&
++ attr->ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) {
+ ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
+ if (ret)
+ return ret;
diff --git a/patches.drivers/IB-core-Avoid-SGID-attributes-query-while-converting.patch b/patches.drivers/IB-core-Avoid-SGID-attributes-query-while-converting.patch
new file mode 100644
index 0000000000..4adb491740
--- /dev/null
+++ b/patches.drivers/IB-core-Avoid-SGID-attributes-query-while-converting.patch
@@ -0,0 +1,39 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 28 Jan 2018 11:25:31 +0200
+Subject: IB/core: Avoid SGID attributes query while converting GID from OPA to
+ IB
+Patch-mainline: v4.16-rc1
+Git-commit: 708ea056b30de17e38f2842c8e953df04b3e8b31
+References: bsc#1103992 FATE#326009
+
+SGID attributes are not used during OPA to IB GID conversion.
+Therefore don't query it.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1577,15 +1577,13 @@ static void cm_opa_to_ib_sgid(struct cm_
+ struct sa_path_rec *path)
+ {
+ struct ib_device *dev = work->port->cm_dev->ib_device;
+- struct ib_gid_attr gid_attr;
+ u8 port_num = work->port->port_num;
+
+ if (rdma_cap_opa_ah(dev, port_num) &&
+ (ib_is_opa_gid(&path->sgid))) {
+ union ib_gid sgid;
+
+- if (ib_get_cached_gid(dev, port_num, 0,
+- &sgid, &gid_attr)) {
++ if (ib_get_cached_gid(dev, port_num, 0, &sgid, NULL)) {
+ dev_warn(&dev->dev,
+ "Error updating sgid in CM request\n");
+ return;
diff --git a/patches.drivers/IB-core-Avoid-exporting-module-internal-function.patch b/patches.drivers/IB-core-Avoid-exporting-module-internal-function.patch
new file mode 100644
index 0000000000..a8100eab1b
--- /dev/null
+++ b/patches.drivers/IB-core-Avoid-exporting-module-internal-function.patch
@@ -0,0 +1,78 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:51 +0200
+Subject: IB/core: Avoid exporting module internal function
+Patch-mainline: v4.16-rc1
+Git-commit: df8441c668f70573f4706bb59a18fc67dc5d20dc
+References: bsc#1103992 FATE#326009
+
+ib_security_modify_qp and ib_security_pkey_access are core internal
+function. So avoid exporting them.
+ib_security_pkey_access is used only when secuirty hooks are enabled so
+avoid defining it otherwise.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/core_priv.h | 13 -------------
+ drivers/infiniband/core/security.c | 10 ++++------
+ 2 files changed, 4 insertions(+), 19 deletions(-)
+
+--- a/drivers/infiniband/core/core_priv.h
++++ b/drivers/infiniband/core/core_priv.h
+@@ -213,11 +213,6 @@ int ib_get_cached_subnet_prefix(struct i
+ u64 *sn_pfx);
+
+ #ifdef CONFIG_SECURITY_INFINIBAND
+-int ib_security_pkey_access(struct ib_device *dev,
+- u8 port_num,
+- u16 pkey_index,
+- void *sec);
+-
+ void ib_security_destroy_port_pkey_list(struct ib_device *device);
+
+ void ib_security_cache_change(struct ib_device *device,
+@@ -240,14 +235,6 @@ int ib_mad_agent_security_setup(struct i
+ void ib_mad_agent_security_cleanup(struct ib_mad_agent *agent);
+ int ib_mad_enforce_security(struct ib_mad_agent_private *map, u16 pkey_index);
+ #else
+-static inline int ib_security_pkey_access(struct ib_device *dev,
+- u8 port_num,
+- u16 pkey_index,
+- void *sec)
+-{
+- return 0;
+-}
+-
+ static inline void ib_security_destroy_port_pkey_list(struct ib_device *device)
+ {
+ }
+--- a/drivers/infiniband/core/security.c
++++ b/drivers/infiniband/core/security.c
+@@ -653,12 +653,11 @@ int ib_security_modify_qp(struct ib_qp *
+ }
+ return ret;
+ }
+-EXPORT_SYMBOL(ib_security_modify_qp);
+
+-int ib_security_pkey_access(struct ib_device *dev,
+- u8 port_num,
+- u16 pkey_index,
+- void *sec)
++static int ib_security_pkey_access(struct ib_device *dev,
++ u8 port_num,
++ u16 pkey_index,
++ void *sec)
+ {
+ u64 subnet_prefix;
+ u16 pkey;
+@@ -678,7 +677,6 @@ int ib_security_pkey_access(struct ib_de
+
+ return security_ib_pkey_access(sec, subnet_prefix, pkey);
+ }
+-EXPORT_SYMBOL(ib_security_pkey_access);
+
+ static int ib_mad_agent_security_change(struct notifier_block *nb,
+ unsigned long event,
diff --git a/patches.drivers/IB-core-Avoid-exporting-module-internal-ib_find_gid_.patch b/patches.drivers/IB-core-Avoid-exporting-module-internal-ib_find_gid_.patch
new file mode 100644
index 0000000000..e62caebe4b
--- /dev/null
+++ b/patches.drivers/IB-core-Avoid-exporting-module-internal-ib_find_gid_.patch
@@ -0,0 +1,29 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:07 +0200
+Subject: IB/core: Avoid exporting module internal ib_find_gid_by_filter()
+Patch-mainline: v4.16-rc1
+Git-commit: 1c43d5d308f0858e763f46bc2bd01cd32b67c63e
+References: bsc#1103992 FATE#326009
+
+ib_find_gid_by_filter() is used only by ib_core, therefore avoid
+exporting it.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -880,7 +880,6 @@ int ib_find_gid_by_filter(struct ib_devi
+ port_num, filter,
+ context, index);
+ }
+-EXPORT_SYMBOL(ib_find_gid_by_filter);
+
+ int ib_get_cached_pkey(struct ib_device *device,
+ u8 port_num,
diff --git a/patches.drivers/IB-core-Avoid-unnecessary-type-cast.patch b/patches.drivers/IB-core-Avoid-unnecessary-type-cast.patch
new file mode 100644
index 0000000000..529f6ad0b4
--- /dev/null
+++ b/patches.drivers/IB-core-Avoid-unnecessary-type-cast.patch
@@ -0,0 +1,30 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:04 +0200
+Subject: IB/core: Avoid unnecessary type cast
+Patch-mainline: v4.16-rc1
+Git-commit: b0dd0d335364a2a748a63413ca4812c9398bf2ae
+References: bsc#1103992 FATE#326009
+
+Type cast from void to struct find_gid_index_context is not needed.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -421,8 +421,7 @@ static bool find_gid_index(const union i
+ const struct ib_gid_attr *gid_attr,
+ void *context)
+ {
+- struct find_gid_index_context *ctx =
+- (struct find_gid_index_context *)context;
++ struct find_gid_index_context *ctx = context;
+
+ if (ctx->gid_type != gid_attr->gid_type)
+ return false;
diff --git a/patches.drivers/IB-core-Change-roce_rescan_device-to-return-void.patch b/patches.drivers/IB-core-Change-roce_rescan_device-to-return-void.patch
new file mode 100644
index 0000000000..a437511478
--- /dev/null
+++ b/patches.drivers/IB-core-Change-roce_rescan_device-to-return-void.patch
@@ -0,0 +1,63 @@
+From: Daniel Jurgens <danielj@mellanox.com>
+Date: Thu, 4 Jan 2018 17:25:33 +0200
+Subject: IB/core: Change roce_rescan_device to return void
+Patch-mainline: v4.16-rc1
+Git-commit: 908d6460b3d81dd2dca9e9e8fc7fa19b5a1e4d99
+References: bsc#1103992 FATE#326009
+
+It always returns 0. Change return type to void.
+
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 7 +------
+ drivers/infiniband/core/core_priv.h | 2 +-
+ drivers/infiniband/core/roce_gid_mgmt.c | 4 +---
+ 3 files changed, 3 insertions(+), 10 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -821,12 +821,7 @@ static int gid_table_setup_one(struct ib
+ if (err)
+ return err;
+
+- err = roce_rescan_device(ib_dev);
+-
+- if (err) {
+- gid_table_cleanup_one(ib_dev);
+- gid_table_release_one(ib_dev);
+- }
++ roce_rescan_device(ib_dev);
+
+ return err;
+ }
+--- a/drivers/infiniband/core/core_priv.h
++++ b/drivers/infiniband/core/core_priv.h
+@@ -137,7 +137,7 @@ int ib_cache_gid_del_all_netdev_gids(str
+ int roce_gid_mgmt_init(void);
+ void roce_gid_mgmt_cleanup(void);
+
+-int roce_rescan_device(struct ib_device *ib_dev);
++void roce_rescan_device(struct ib_device *ib_dev);
+ unsigned long roce_gid_type_mask_support(struct ib_device *ib_dev, u8 port);
+
+ int ib_cache_setup_one(struct ib_device *device);
+--- a/drivers/infiniband/core/roce_gid_mgmt.c
++++ b/drivers/infiniband/core/roce_gid_mgmt.c
+@@ -412,12 +412,10 @@ static void enum_all_gids_of_dev_cb(stru
+
+ /* This function will rescan all of the network devices in the system
+ * and add their gids, as needed, to the relevant RoCE devices. */
+-int roce_rescan_device(struct ib_device *ib_dev)
++void roce_rescan_device(struct ib_device *ib_dev)
+ {
+ ib_enum_roce_netdev(ib_dev, pass_all_filter, NULL,
+ enum_all_gids_of_dev_cb, NULL);
+-
+- return 0;
+ }
+
+ static void callback_for_addr_gid_device_scan(struct ib_device *device,
diff --git a/patches.drivers/IB-core-Depend-on-IPv6-stack-to-resolve-link-local-a.patch b/patches.drivers/IB-core-Depend-on-IPv6-stack-to-resolve-link-local-a.patch
new file mode 100644
index 0000000000..c425890e65
--- /dev/null
+++ b/patches.drivers/IB-core-Depend-on-IPv6-stack-to-resolve-link-local-a.patch
@@ -0,0 +1,64 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:50 +0200
+Subject: IB/core: Depend on IPv6 stack to resolve link local address for
+ RoCEv2
+Patch-mainline: v4.16-rc1
+Git-commit: 56d0a7d9a0f045ee27a001762deac28c7d28e2e4
+References: bsc#1103992 FATE#326009
+
+RoCEv1 does not use the IPv6 stack to resolve the link local DGID since it
+uses GID address. It forms the DMAC directly from the DGID.
+
+The code became confused and also tried to use this bypass for RoCEv2
+packets, however RoCEv2 always uses a IP address in the GID and must
+always use ARP or neighbor discovery to get the DMAC address.
+
+Now that rdma_addr_find_l2_eth_by_grh() supports resolving link local
+address to find destination mac address, lets make use of it.
+This aligns it to how the rest of the IPv6 stack resolves link local
+destination IPv6 address.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Reviewed-by: Eli Cohen <eli@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -506,9 +506,20 @@ static int ib_resolve_unicast_gid_dmac(s
+ return ret;
+ }
+
++ /* If destination is link local and source GID is RoCEv1,
++ * IP stack is not used.
++ */
++ if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw) &&
++ sgid_attr.gid_type == IB_GID_TYPE_ROCE) {
++ rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
++ ah_attr->roce.dmac);
++ goto done;
++ }
++
+ ret = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
+ ah_attr->roce.dmac,
+ sgid_attr.ndev, &hop_limit);
++done:
+ dev_put(sgid_attr.ndev);
+
+ grh->hop_limit = hop_limit;
+@@ -1281,11 +1292,6 @@ static int ib_resolve_eth_dmac(struct ib
+
+ grh = rdma_ah_retrieve_grh(ah_attr);
+
+- if (rdma_link_local_addr((struct in6_addr *)grh->dgid.raw)) {
+- rdma_get_ll_mac((struct in6_addr *)grh->dgid.raw,
+- ah_attr->roce.dmac);
+- return 0;
+- }
+ if (rdma_is_multicast_addr((struct in6_addr *)ah_attr->grh.dgid.raw)) {
+ if (ipv6_addr_v4mapped((struct in6_addr *)ah_attr->grh.dgid.raw)) {
+ __be32 addr = 0;
diff --git a/patches.drivers/IB-core-Don-t-allow-default-GID-addition-at-non-rese.patch b/patches.drivers/IB-core-Don-t-allow-default-GID-addition-at-non-rese.patch
new file mode 100644
index 0000000000..94ffc18f52
--- /dev/null
+++ b/patches.drivers/IB-core-Don-t-allow-default-GID-addition-at-non-rese.patch
@@ -0,0 +1,57 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 23 Apr 2018 16:58:17 +0300
+Subject: IB/core: Don't allow default GID addition at non reseved slots
+Patch-mainline: v4.17-rc4
+Git-commit: a66ed149b0da5b97fa7486ee2bcd00f3f9df5442
+References: bsc#1103992 FATE#326009
+
+Default GIDs are marked reserved at the start of the GID table at index
+0 and 1 by gid_table_reserve_default(). Currently when default GID is
+requested, it can still allocates an empty slot which was not marked as
+RESERVED for default GID, which is incorrect.
+
+At least in current code flow of roce_gid_mgmt.c, in theory we can
+still request to allocate more than one/two default GIDs depending
+on how upper devices are setup.
+
+Therefore, it is better for cache layer to only allow our reserved slots
+to be used by default GID allocation requests.
+
+Fixes: 598ff6bae689 ("IB/core: Refactor GID modify code for RoCE")
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 20 ++++++++++++--------
+ 1 file changed, 12 insertions(+), 8 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -291,14 +291,18 @@ static int find_gid(struct ib_gid_table
+ * so lookup free slot only if requested.
+ */
+ if (pempty && empty < 0) {
+- if (data->props & GID_TABLE_ENTRY_INVALID) {
+- /* Found an invalid (free) entry; allocate it */
+- if (data->props & GID_TABLE_ENTRY_DEFAULT) {
+- if (default_gid)
+- empty = curr_index;
+- } else {
+- empty = curr_index;
+- }
++ if (data->props & GID_TABLE_ENTRY_INVALID &&
++ (default_gid ==
++ !!(data->props & GID_TABLE_ENTRY_DEFAULT))) {
++ /*
++ * Found an invalid (free) entry; allocate it.
++ * If default GID is requested, then our
++ * found slot must be one of the DEFAULT
++ * reserved slots or we fail.
++ * This ensures that only DEFAULT reserved
++ * slots are used for default property GIDs.
++ */
++ empty = curr_index;
+ }
+ }
+
diff --git a/patches.drivers/IB-core-Fix-comments-of-GID-query-functions.patch b/patches.drivers/IB-core-Fix-comments-of-GID-query-functions.patch
new file mode 100644
index 0000000000..1549c940b6
--- /dev/null
+++ b/patches.drivers/IB-core-Fix-comments-of-GID-query-functions.patch
@@ -0,0 +1,134 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:11 +0200
+Subject: IB/core: Fix comments of GID query functions
+Patch-mainline: v4.17-rc1
+Git-commit: 6612b4983f7e8d295a7503452719b113464b395f
+References: bsc#1103992 FATE#326009
+
+Exported symbol's comments should be with function definition and not in
+the header file. Therefore comments of ib_find_cached_gid() and
+ib_find_cached_gid_by_port() functions are moved closer to their
+definitions.
+
+The function name in then comment is different than the actual function
+name, fix it to be same as ib_cache_gid_find_by_filter().
+
+Also current comment section of ib_find_cached_gid_by_port() contains the
+desciption of ib_find_cached_gid(), fix that as well.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 31 +++++++++++++++++++++++++++++--
+ include/rdma/ib_cache.h | 29 -----------------------------
+ 2 files changed, 29 insertions(+), 31 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -492,6 +492,19 @@ static int ib_cache_gid_find(struct ib_d
+ mask, port, index);
+ }
+
++/**
++ * ib_find_cached_gid_by_port - Returns the GID table index where a specified
++ * GID value occurs. It searches for the specified GID value in the local
++ * software cache.
++ * @device: The device to query.
++ * @gid: The GID value to search for.
++ * @gid_type: The GID type to search for.
++ * @port_num: The port number of the device where the GID value should be
++ * searched.
++ * @ndev: In RoCE, the net device of the device. Null means ignore.
++ * @index: The index into the cached GID table where the GID was found. This
++ * parameter may be NULL.
++ */
+ int ib_find_cached_gid_by_port(struct ib_device *ib_dev,
+ const union ib_gid *gid,
+ enum ib_gid_type gid_type,
+@@ -528,7 +541,7 @@ int ib_find_cached_gid_by_port(struct ib
+ EXPORT_SYMBOL(ib_find_cached_gid_by_port);
+
+ /**
+- * ib_find_gid_by_filter - Returns the GID table index where a specified
++ * ib_cache_gid_find_by_filter - Returns the GID table index where a specified
+ * GID value occurs
+ * @device: The device to query.
+ * @gid: The GID value to search for.
+@@ -539,7 +552,7 @@ EXPORT_SYMBOL(ib_find_cached_gid_by_port
+ * otherwise, we continue searching the GID table. It's guaranteed that
+ * while filter is executed, ndev field is valid and the structure won't
+ * change. filter is executed in an atomic context. filter must not be NULL.
+- * @index: The index into the cached GID table where the GID was found. This
++ * @index: The index into the cached GID table where the GID was found. This
+ * parameter may be NULL.
+ *
+ * ib_cache_gid_find_by_filter() searches for the specified GID value
+@@ -848,6 +861,20 @@ int ib_get_cached_gid(struct ib_device *
+ }
+ EXPORT_SYMBOL(ib_get_cached_gid);
+
++/**
++ * ib_find_cached_gid - Returns the port number and GID table index where
++ * a specified GID value occurs.
++ * @device: The device to query.
++ * @gid: The GID value to search for.
++ * @gid_type: The GID type to search for.
++ * @ndev: In RoCE, the net device of the device. NULL means ignore.
++ * @port_num: The port number of the device where the GID value was found.
++ * @index: The index into the cached GID table where the GID was found. This
++ * parameter may be NULL.
++ *
++ * ib_find_cached_gid() searches for the specified GID value in
++ * the local software cache.
++ */
+ int ib_find_cached_gid(struct ib_device *device,
+ const union ib_gid *gid,
+ enum ib_gid_type gid_type,
+--- a/include/rdma/ib_cache.h
++++ b/include/rdma/ib_cache.h
+@@ -55,20 +55,6 @@ int ib_get_cached_gid(struct ib_device
+ union ib_gid *gid,
+ struct ib_gid_attr *attr);
+
+-/**
+- * ib_find_cached_gid - Returns the port number and GID table index where
+- * a specified GID value occurs.
+- * @device: The device to query.
+- * @gid: The GID value to search for.
+- * @gid_type: The GID type to search for.
+- * @ndev: In RoCE, the net device of the device. NULL means ignore.
+- * @port_num: The port number of the device where the GID value was found.
+- * @index: The index into the cached GID table where the GID was found. This
+- * parameter may be NULL.
+- *
+- * ib_find_cached_gid() searches for the specified GID value in
+- * the local software cache.
+- */
+ int ib_find_cached_gid(struct ib_device *device,
+ const union ib_gid *gid,
+ enum ib_gid_type gid_type,
+@@ -76,21 +62,6 @@ int ib_find_cached_gid(struct ib_device
+ u8 *port_num,
+ u16 *index);
+
+-/**
+- * ib_find_cached_gid_by_port - Returns the GID table index where a specified
+- * GID value occurs
+- * @device: The device to query.
+- * @gid: The GID value to search for.
+- * @gid_type: The GID type to search for.
+- * @port_num: The port number of the device where the GID value sould be
+- * searched.
+- * @ndev: In RoCE, the net device of the device. Null means ignore.
+- * @index: The index into the cached GID table where the GID was found. This
+- * parameter may be NULL.
+- *
+- * ib_find_cached_gid() searches for the specified GID value in
+- * the local software cache.
+- */
+ int ib_find_cached_gid_by_port(struct ib_device *device,
+ const union ib_gid *gid,
+ enum ib_gid_type gid_type,
diff --git a/patches.drivers/IB-core-Fix-deleting-default-GIDs-when-changing-mac-.patch b/patches.drivers/IB-core-Fix-deleting-default-GIDs-when-changing-mac-.patch
new file mode 100644
index 0000000000..0e02fc6bb8
--- /dev/null
+++ b/patches.drivers/IB-core-Fix-deleting-default-GIDs-when-changing-mac-.patch
@@ -0,0 +1,173 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 23 Apr 2018 16:58:19 +0300
+Subject: IB/core: Fix deleting default GIDs when changing mac adddress
+Patch-mainline: v4.17-rc4
+Git-commit: dc5640f294e4ff6b89047cb4a0dfa931d5f0cd1f
+References: bsc#1103992 FATE#326009
+
+Before [1], When MAC address of the netdevice is changed, default GID is
+supposed to get deleted and added back which affects the node and/or port
+GUID in below sequence.
+
+netdevice_event()
+-> NETDEV_CHANGEADDR
+ default_del_cmd()
+ del_netdev_default_ips()
+ bond_delete_netdev_default_gids()
+ ib_cache_gid_set_default_gid()
+ ib_cache_gid_del()
+ add_cmd()
+ [..]
+
+However, ib_cache_gid_del() was not getting invoked in non bonding
+scenarios because event_ndev and rdma_ndev are same.
+Therefore, fix such condition to ignore checking upper device when event
+ndev and rdma_dev are same; similar to bond_set_netdev_default_gids().
+
+Which this fix ib_cache_gid_del() is invoked correctly; however
+ib_cache_gid_del() doesn't find the default GID for deletion because
+find_gid() was given default_gid = false with
+GID_ATTR_FIND_MASK_DEFAULT set.
+But it was getting overwritten by ib_cache_gid_set_default_gid() later
+on as part of add_cmd().
+Therefore, mac address change used to work for default GID.
+
+With refactor series [1], this incorrect behavior is detected.
+
+Therefore,
+when deleting default GID, set default_gid and set MASK flag.
+when deleting IP based GID, clear default_gid and set MASK flag.
+
+[1] https://patchwork.kernel.org/patch/10319151/
+
+Fixes: 238fdf48f2b5 ("IB/core: Add RoCE table bonding support")
+Fixes: 598ff6bae689 ("IB/core: Refactor GID modify code for RoCE")
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 28 +++++++++++++++-------------
+ drivers/infiniband/core/roce_gid_mgmt.c | 26 ++++++++++++++------------
+ 2 files changed, 29 insertions(+), 25 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -427,7 +427,7 @@ int ib_cache_gid_add(struct ib_device *i
+ static int
+ _ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
+ union ib_gid *gid, struct ib_gid_attr *attr,
+- bool default_gid)
++ unsigned long mask, bool default_gid)
+ {
+ struct ib_gid_table *table;
+ int ret = 0;
+@@ -437,12 +437,7 @@ _ib_cache_gid_del(struct ib_device *ib_d
+
+ mutex_lock(&table->lock);
+
+- ix = find_gid(table, gid, attr, default_gid,
+- GID_ATTR_FIND_MASK_GID |
+- GID_ATTR_FIND_MASK_GID_TYPE |
+- GID_ATTR_FIND_MASK_DEFAULT |
+- GID_ATTR_FIND_MASK_NETDEV,
+- NULL);
++ ix = find_gid(table, gid, attr, default_gid, mask, NULL);
+ if (ix < 0) {
+ ret = -EINVAL;
+ goto out_unlock;
+@@ -462,7 +457,12 @@ out_unlock:
+ int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
+ union ib_gid *gid, struct ib_gid_attr *attr)
+ {
+- return _ib_cache_gid_del(ib_dev, port, gid, attr, false);
++ unsigned long mask = GID_ATTR_FIND_MASK_GID |
++ GID_ATTR_FIND_MASK_GID_TYPE |
++ GID_ATTR_FIND_MASK_DEFAULT |
++ GID_ATTR_FIND_MASK_NETDEV;
++
++ return _ib_cache_gid_del(ib_dev, port, gid, attr, mask, false);
+ }
+
+ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
+@@ -741,7 +741,7 @@ void ib_cache_gid_set_default_gid(struct
+ unsigned long gid_type_mask,
+ enum ib_cache_gid_default_mode mode)
+ {
+- union ib_gid gid;
++ union ib_gid gid = { };
+ struct ib_gid_attr gid_attr;
+ struct ib_gid_table *table;
+ unsigned int gid_type;
+@@ -749,7 +749,9 @@ void ib_cache_gid_set_default_gid(struct
+
+ table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
+
+- make_default_gid(ndev, &gid);
++ mask = GID_ATTR_FIND_MASK_GID_TYPE |
++ GID_ATTR_FIND_MASK_DEFAULT |
++ GID_ATTR_FIND_MASK_NETDEV;
+ memset(&gid_attr, 0, sizeof(gid_attr));
+ gid_attr.ndev = ndev;
+
+@@ -760,12 +762,12 @@ void ib_cache_gid_set_default_gid(struct
+ gid_attr.gid_type = gid_type;
+
+ if (mode == IB_CACHE_GID_DEFAULT_MODE_SET) {
+- mask = GID_ATTR_FIND_MASK_GID_TYPE |
+- GID_ATTR_FIND_MASK_DEFAULT;
++ make_default_gid(ndev, &gid);
+ __ib_cache_gid_add(ib_dev, port, &gid,
+ &gid_attr, mask, true);
+ } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
+- _ib_cache_gid_del(ib_dev, port, &gid, &gid_attr, true);
++ _ib_cache_gid_del(ib_dev, port, &gid,
++ &gid_attr, mask, true);
+ }
+ }
+ }
+--- a/drivers/infiniband/core/roce_gid_mgmt.c
++++ b/drivers/infiniband/core/roce_gid_mgmt.c
+@@ -255,6 +255,7 @@ static void bond_delete_netdev_default_g
+ struct net_device *rdma_ndev)
+ {
+ struct net_device *real_dev = rdma_vlan_dev_real_dev(event_ndev);
++ unsigned long gid_type_mask;
+
+ if (!rdma_ndev)
+ return;
+@@ -264,21 +265,22 @@ static void bond_delete_netdev_default_g
+
+ rcu_read_lock();
+
+- if (rdma_is_upper_dev_rcu(rdma_ndev, event_ndev) &&
+- is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev) ==
+- BONDING_SLAVE_STATE_INACTIVE) {
+- unsigned long gid_type_mask;
+-
++ if (((rdma_ndev != event_ndev &&
++ !rdma_is_upper_dev_rcu(rdma_ndev, event_ndev)) ||
++ is_eth_active_slave_of_bonding_rcu(rdma_ndev, real_dev)
++ ==
++ BONDING_SLAVE_STATE_INACTIVE)) {
+ rcu_read_unlock();
++ return;
++ }
+
+- gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
++ rcu_read_unlock();
+
+- ib_cache_gid_set_default_gid(ib_dev, port, rdma_ndev,
+- gid_type_mask,
+- IB_CACHE_GID_DEFAULT_MODE_DELETE);
+- } else {
+- rcu_read_unlock();
+- }
++ gid_type_mask = roce_gid_type_mask_support(ib_dev, port);
++
++ ib_cache_gid_set_default_gid(ib_dev, port, rdma_ndev,
++ gid_type_mask,
++ IB_CACHE_GID_DEFAULT_MODE_DELETE);
+ }
+
+ static void enum_netdev_ipv4_ips(struct ib_device *ib_dev,
diff --git a/patches.drivers/IB-core-Fix-memory-leak-in-cm_req_handler-error-flow.patch b/patches.drivers/IB-core-Fix-memory-leak-in-cm_req_handler-error-flow.patch
new file mode 100644
index 0000000000..20c28238a5
--- /dev/null
+++ b/patches.drivers/IB-core-Fix-memory-leak-in-cm_req_handler-error-flow.patch
@@ -0,0 +1,41 @@
+From: Matan Barak <matanb@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:57 +0200
+Subject: IB/core: Fix memory leak in cm_req_handler error flows
+Patch-mainline: v4.16-rc1
+Git-commit: 8b00914654ef56ff5473f4fe1f1168254dbb8a17
+References: bsc#1103992 FATE#326009
+
+In cm_req_handler error flows, sometimes cm_id_priv->timewait_info
+isn't free'd.
+
+Signed-off-by: Matan Barak <matanb@mellanox.com>
+Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1876,8 +1876,7 @@ static int cm_req_handler(struct cm_work
+ listen_cm_id_priv = cm_match_req(work, cm_id_priv);
+ if (!listen_cm_id_priv) {
+ ret = -EINVAL;
+- kfree(cm_id_priv->timewait_info);
+- goto destroy;
++ goto free_timeinfo;
+ }
+
+ cm_id_priv->id.cm_handler = listen_cm_id_priv->id.cm_handler;
+@@ -1979,6 +1978,8 @@ static int cm_req_handler(struct cm_work
+ rejected:
+ atomic_dec(&cm_id_priv->refcount);
+ cm_deref_id(listen_cm_id_priv);
++free_timeinfo:
++ kfree(cm_id_priv->timewait_info);
+ destroy:
+ ib_destroy_cm_id(cm_id);
+ return ret;
diff --git a/patches.drivers/IB-core-Fix-to-avoid-deleting-IPv6-look-alike-defaul.patch b/patches.drivers/IB-core-Fix-to-avoid-deleting-IPv6-look-alike-defaul.patch
new file mode 100644
index 0000000000..5a2dc2122a
--- /dev/null
+++ b/patches.drivers/IB-core-Fix-to-avoid-deleting-IPv6-look-alike-defaul.patch
@@ -0,0 +1,79 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 23 Apr 2018 16:58:18 +0300
+Subject: IB/core: Fix to avoid deleting IPv6 look alike default GIDs
+Patch-mainline: v4.17-rc4
+Git-commit: 22c01ee4b8a8c000c490dfc479e175404e64167b
+References: bsc#1103992 FATE#326009
+
+When IPv6 link local address is removed, if it matches with the default
+GID, default GID(s)s gets removed which may not be a desired behavior.
+This behavior is introduced by refactor work in Fixes tag.
+
+When IPv6 link address is removed, removing its equivalent RoCEv2 GID
+which exactly matches with default RoCEv2 GID, is right thing to do.
+However achieving it correctly requires lot more changes, likely in
+roce_gid_mgmt.c and core/cache.c. This should be done as independent
+patch.
+
+Therefore, this patch preserves behavior of not deleteing default GIDs.
+This is done by providing explicit hint to consider default GID property
+using mask and default_gid; similar to add_gid().
+
+Fixes: 598ff6bae68 ("IB/core: Refactor GID modify code for RoCE")
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -424,8 +424,10 @@ int ib_cache_gid_add(struct ib_device *i
+ return ret;
+ }
+
+-int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
+- union ib_gid *gid, struct ib_gid_attr *attr)
++static int
++_ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
++ union ib_gid *gid, struct ib_gid_attr *attr,
++ bool default_gid)
+ {
+ struct ib_gid_table *table;
+ int ret = 0;
+@@ -435,9 +437,10 @@ int ib_cache_gid_del(struct ib_device *i
+
+ mutex_lock(&table->lock);
+
+- ix = find_gid(table, gid, attr, false,
++ ix = find_gid(table, gid, attr, default_gid,
+ GID_ATTR_FIND_MASK_GID |
+ GID_ATTR_FIND_MASK_GID_TYPE |
++ GID_ATTR_FIND_MASK_DEFAULT |
+ GID_ATTR_FIND_MASK_NETDEV,
+ NULL);
+ if (ix < 0) {
+@@ -456,6 +459,12 @@ out_unlock:
+ return ret;
+ }
+
++int ib_cache_gid_del(struct ib_device *ib_dev, u8 port,
++ union ib_gid *gid, struct ib_gid_attr *attr)
++{
++ return _ib_cache_gid_del(ib_dev, port, gid, attr, false);
++}
++
+ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
+ struct net_device *ndev)
+ {
+@@ -756,7 +765,7 @@ void ib_cache_gid_set_default_gid(struct
+ __ib_cache_gid_add(ib_dev, port, &gid,
+ &gid_attr, mask, true);
+ } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
+- ib_cache_gid_del(ib_dev, port, &gid, &gid_attr);
++ _ib_cache_gid_del(ib_dev, port, &gid, &gid_attr, true);
+ }
+ }
+ }
diff --git a/patches.drivers/IB-core-Honor-return-status-of-ib_init_ah_from_mcmem.patch b/patches.drivers/IB-core-Honor-return-status-of-ib_init_ah_from_mcmem.patch
new file mode 100644
index 0000000000..e0ca65f359
--- /dev/null
+++ b/patches.drivers/IB-core-Honor-return-status-of-ib_init_ah_from_mcmem.patch
@@ -0,0 +1,42 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:13 +0200
+Subject: IB/core: Honor return status of ib_init_ah_from_mcmember()
+Patch-mainline: v4.17-rc1
+Git-commit: 6d337179f28cc50ddd7e224f677b4cda70b275fc
+References: bsc#1103992 FATE#326009
+
+The return status of ib_init_ah_from_mcmember() is ignored by
+cma_ib_mc_handler(). Honor it and return error event if ah attribute
+initialization failed.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cma.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -3918,10 +3918,14 @@ static int cma_ib_mc_handler(int status,
+ rdma_start_port(id_priv->cma_dev->device)];
+
+ event.event = RDMA_CM_EVENT_MULTICAST_JOIN;
+- ib_init_ah_from_mcmember(id_priv->id.device,
+- id_priv->id.port_num, &multicast->rec,
+- ndev, gid_type,
+- &event.param.ud.ah_attr);
++ ret = ib_init_ah_from_mcmember(id_priv->id.device,
++ id_priv->id.port_num,
++ &multicast->rec,
++ ndev, gid_type,
++ &event.param.ud.ah_attr);
++ if (ret)
++ event.event = RDMA_CM_EVENT_MULTICAST_ERROR;
++
+ event.param.ud.qp_num = 0xFFFFFF;
+ event.param.ud.qkey = be32_to_cpu(multicast->rec.qkey);
+ if (ndev)
diff --git a/patches.drivers/IB-core-Increase-number-of-char-device-minors.patch b/patches.drivers/IB-core-Increase-number-of-char-device-minors.patch
new file mode 100644
index 0000000000..7968872bb5
--- /dev/null
+++ b/patches.drivers/IB-core-Increase-number-of-char-device-minors.patch
@@ -0,0 +1,548 @@
+From: Huy Nguyen <huyn@mellanox.com>
+Date: Mon, 8 Jan 2018 12:15:38 +0200
+Subject: IB/core: Increase number of char device minors
+Patch-mainline: v4.16-rc1
+Git-commit: 8cf12d7780b72ee421d18e1f8a15daf43fa6d1e6
+References: bsc#1103992 FATE#326009
+
+There is a need to increase number of possible char devices to support
+large number of SR-IOV instances. The current limit is in the range of
+64-128 devices/ports. Increase it to support up to 1024.
+
+The patch performs the following steps to refactor the code:
+1. Removes the split bitmap for fixed and overflow dev numbers.
+2. Pre-allocates the non-legacy major number range during driver
+ initialization, choosen for simplicity.
+3. Add new define (RDMA_MAX_PORTS) that is shared between all drivers.
+ This is the maximum total number of ports on all struct ib_devices.
+4. Set RDMA_MAX_PORTS to 1024.
+
+Signed-off-by: Huy Nguyen <huyn@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/core_priv.h | 3
+ drivers/infiniband/core/ucm.c | 73 +++++++++---------------
+ drivers/infiniband/core/user_mad.c | 103 +++++++++++++++-------------------
+ drivers/infiniband/core/uverbs_main.c | 90 +++++++++++------------------
+ 4 files changed, 113 insertions(+), 156 deletions(-)
+
+--- a/drivers/infiniband/core/core_priv.h
++++ b/drivers/infiniband/core/core_priv.h
+@@ -42,6 +42,9 @@
+ #include <rdma/ib_mad.h>
+ #include "mad_priv.h"
+
++/* Total number of ports combined across all struct ib_devices's */
++#define RDMA_MAX_PORTS 1024
++
+ struct pkey_index_qp_list {
+ struct list_head pkey_index_list;
+ u16 pkey_index;
+--- a/drivers/infiniband/core/ucm.c
++++ b/drivers/infiniband/core/ucm.c
+@@ -53,6 +53,8 @@
+ #include <rdma/ib_user_cm.h>
+ #include <rdma/ib_marshall.h>
+
++#include "core_priv.h"
++
+ MODULE_AUTHOR("Libor Michalek");
+ MODULE_DESCRIPTION("InfiniBand userspace Connection Manager access");
+ MODULE_LICENSE("Dual BSD/GPL");
+@@ -104,10 +106,13 @@ struct ib_ucm_event {
+ enum {
+ IB_UCM_MAJOR = 231,
+ IB_UCM_BASE_MINOR = 224,
+- IB_UCM_MAX_DEVICES = 32
++ IB_UCM_MAX_DEVICES = RDMA_MAX_PORTS,
++ IB_UCM_NUM_FIXED_MINOR = 32,
++ IB_UCM_NUM_DYNAMIC_MINOR = IB_UCM_MAX_DEVICES - IB_UCM_NUM_FIXED_MINOR,
+ };
+
+ #define IB_UCM_BASE_DEV MKDEV(IB_UCM_MAJOR, IB_UCM_BASE_MINOR)
++static dev_t dynamic_ucm_dev;
+
+ static void ib_ucm_add_one(struct ib_device *device);
+ static void ib_ucm_remove_one(struct ib_device *device, void *client_data);
+@@ -1199,7 +1204,6 @@ static int ib_ucm_close(struct inode *in
+ return 0;
+ }
+
+-static DECLARE_BITMAP(overflow_map, IB_UCM_MAX_DEVICES);
+ static void ib_ucm_release_dev(struct device *dev)
+ {
+ struct ib_ucm_device *ucm_dev;
+@@ -1210,10 +1214,7 @@ static void ib_ucm_release_dev(struct de
+
+ static void ib_ucm_free_dev(struct ib_ucm_device *ucm_dev)
+ {
+- if (ucm_dev->devnum < IB_UCM_MAX_DEVICES)
+- clear_bit(ucm_dev->devnum, dev_map);
+- else
+- clear_bit(ucm_dev->devnum - IB_UCM_MAX_DEVICES, overflow_map);
++ clear_bit(ucm_dev->devnum, dev_map);
+ }
+
+ static const struct file_operations ucm_fops = {
+@@ -1235,27 +1236,6 @@ static ssize_t show_ibdev(struct device
+ }
+ static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
+
+-static dev_t overflow_maj;
+-static int find_overflow_devnum(void)
+-{
+- int ret;
+-
+- if (!overflow_maj) {
+- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UCM_MAX_DEVICES,
+- "infiniband_cm");
+- if (ret) {
+- pr_err("ucm: couldn't register dynamic device number\n");
+- return ret;
+- }
+- }
+-
+- ret = find_first_zero_bit(overflow_map, IB_UCM_MAX_DEVICES);
+- if (ret >= IB_UCM_MAX_DEVICES)
+- return -1;
+-
+- return ret;
+-}
+-
+ static void ib_ucm_add_one(struct ib_device *device)
+ {
+ int devnum;
+@@ -1274,19 +1254,14 @@ static void ib_ucm_add_one(struct ib_dev
+ ucm_dev->dev.release = ib_ucm_release_dev;
+
+ devnum = find_first_zero_bit(dev_map, IB_UCM_MAX_DEVICES);
+- if (devnum >= IB_UCM_MAX_DEVICES) {
+- devnum = find_overflow_devnum();
+- if (devnum < 0)
+- goto err;
+-
+- ucm_dev->devnum = devnum + IB_UCM_MAX_DEVICES;
+- base = devnum + overflow_maj;
+- set_bit(devnum, overflow_map);
+- } else {
+- ucm_dev->devnum = devnum;
+- base = devnum + IB_UCM_BASE_DEV;
+- set_bit(devnum, dev_map);
+- }
++ if (devnum >= IB_UCM_MAX_DEVICES)
++ goto err;
++ ucm_dev->devnum = devnum;
++ set_bit(devnum, dev_map);
++ if (devnum >= IB_UCM_NUM_FIXED_MINOR)
++ base = dynamic_ucm_dev + devnum - IB_UCM_NUM_FIXED_MINOR;
++ else
++ base = IB_UCM_BASE_DEV + devnum;
+
+ cdev_init(&ucm_dev->cdev, &ucm_fops);
+ ucm_dev->cdev.owner = THIS_MODULE;
+@@ -1334,13 +1309,20 @@ static int __init ib_ucm_init(void)
+ {
+ int ret;
+
+- ret = register_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES,
++ ret = register_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_NUM_FIXED_MINOR,
+ "infiniband_cm");
+ if (ret) {
+ pr_err("ucm: couldn't register device number\n");
+ goto error1;
+ }
+
++ ret = alloc_chrdev_region(&dynamic_ucm_dev, 0, IB_UCM_NUM_DYNAMIC_MINOR,
++ "infiniband_cm");
++ if (ret) {
++ pr_err("ucm: couldn't register dynamic device number\n");
++ goto err_alloc;
++ }
++
+ ret = class_create_file(&cm_class, &class_attr_abi_version.attr);
+ if (ret) {
+ pr_err("ucm: couldn't create abi_version attribute\n");
+@@ -1357,7 +1339,9 @@ static int __init ib_ucm_init(void)
+ error3:
+ class_remove_file(&cm_class, &class_attr_abi_version.attr);
+ error2:
+- unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
++ unregister_chrdev_region(dynamic_ucm_dev, IB_UCM_NUM_DYNAMIC_MINOR);
++err_alloc:
++ unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_NUM_FIXED_MINOR);
+ error1:
+ return ret;
+ }
+@@ -1366,9 +1350,8 @@ static void __exit ib_ucm_cleanup(void)
+ {
+ ib_unregister_client(&ucm_client);
+ class_remove_file(&cm_class, &class_attr_abi_version.attr);
+- unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_MAX_DEVICES);
+- if (overflow_maj)
+- unregister_chrdev_region(overflow_maj, IB_UCM_MAX_DEVICES);
++ unregister_chrdev_region(IB_UCM_BASE_DEV, IB_UCM_NUM_FIXED_MINOR);
++ unregister_chrdev_region(dynamic_ucm_dev, IB_UCM_NUM_DYNAMIC_MINOR);
+ idr_destroy(&ctx_id_table);
+ }
+
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -55,16 +55,21 @@
+ #include <rdma/ib_mad.h>
+ #include <rdma/ib_user_mad.h>
+
++#include "core_priv.h"
++
+ MODULE_AUTHOR("Roland Dreier");
+ MODULE_DESCRIPTION("InfiniBand userspace MAD packet access");
+ MODULE_LICENSE("Dual BSD/GPL");
+
+ enum {
+- IB_UMAD_MAX_PORTS = 64,
++ IB_UMAD_MAX_PORTS = RDMA_MAX_PORTS,
+ IB_UMAD_MAX_AGENTS = 32,
+
+ IB_UMAD_MAJOR = 231,
+- IB_UMAD_MINOR_BASE = 0
++ IB_UMAD_MINOR_BASE = 0,
++ IB_UMAD_NUM_FIXED_MINOR = 64,
++ IB_UMAD_NUM_DYNAMIC_MINOR = IB_UMAD_MAX_PORTS - IB_UMAD_NUM_FIXED_MINOR,
++ IB_ISSM_MINOR_BASE = IB_UMAD_NUM_FIXED_MINOR,
+ };
+
+ /*
+@@ -127,7 +132,11 @@ struct ib_umad_packet {
+
+ static struct class *umad_class;
+
+-static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
++static const dev_t base_umad_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
++static const dev_t base_issm_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE) +
++ IB_UMAD_NUM_FIXED_MINOR;
++static dev_t dynamic_umad_dev;
++static dev_t dynamic_issm_dev;
+
+ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
+
+@@ -1141,49 +1150,25 @@ static DEVICE_ATTR(port, S_IRUGO, show_p
+ static CLASS_ATTR_STRING(abi_version, S_IRUGO,
+ __stringify(IB_USER_MAD_ABI_VERSION));
+
+-static dev_t overflow_maj;
+-static DECLARE_BITMAP(overflow_map, IB_UMAD_MAX_PORTS);
+-static int find_overflow_devnum(struct ib_device *device)
+-{
+- int ret;
+-
+- if (!overflow_maj) {
+- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UMAD_MAX_PORTS * 2,
+- "infiniband_mad");
+- if (ret) {
+- dev_err(&device->dev,
+- "couldn't register dynamic device number\n");
+- return ret;
+- }
+- }
+-
+- ret = find_first_zero_bit(overflow_map, IB_UMAD_MAX_PORTS);
+- if (ret >= IB_UMAD_MAX_PORTS)
+- return -1;
+-
+- return ret;
+-}
+-
+ static int ib_umad_init_port(struct ib_device *device, int port_num,
+ struct ib_umad_device *umad_dev,
+ struct ib_umad_port *port)
+ {
+ int devnum;
+- dev_t base;
++ dev_t base_umad;
++ dev_t base_issm;
+
+ devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS);
+- if (devnum >= IB_UMAD_MAX_PORTS) {
+- devnum = find_overflow_devnum(device);
+- if (devnum < 0)
+- return -1;
+-
+- port->dev_num = devnum + IB_UMAD_MAX_PORTS;
+- base = devnum + overflow_maj;
+- set_bit(devnum, overflow_map);
++ if (devnum >= IB_UMAD_MAX_PORTS)
++ return -1;
++ port->dev_num = devnum;
++ set_bit(devnum, dev_map);
++ if (devnum >= IB_UMAD_NUM_FIXED_MINOR) {
++ base_umad = dynamic_umad_dev + devnum - IB_UMAD_NUM_FIXED_MINOR;
++ base_issm = dynamic_issm_dev + devnum - IB_UMAD_NUM_FIXED_MINOR;
+ } else {
+- port->dev_num = devnum;
+- base = devnum + base_dev;
+- set_bit(devnum, dev_map);
++ base_umad = devnum + base_umad_dev;
++ base_issm = devnum + base_issm_dev;
+ }
+
+ port->ib_dev = device;
+@@ -1196,7 +1181,7 @@ static int ib_umad_init_port(struct ib_d
+ port->cdev.owner = THIS_MODULE;
+ cdev_set_parent(&port->cdev, &umad_dev->kobj);
+ kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num);
+- if (cdev_add(&port->cdev, base, 1))
++ if (cdev_add(&port->cdev, base_umad, 1))
+ goto err_cdev;
+
+ port->dev = device_create(umad_class, device->dev.parent,
+@@ -1210,12 +1195,11 @@ static int ib_umad_init_port(struct ib_d
+ if (device_create_file(port->dev, &dev_attr_port))
+ goto err_dev;
+
+- base += IB_UMAD_MAX_PORTS;
+ cdev_init(&port->sm_cdev, &umad_sm_fops);
+ port->sm_cdev.owner = THIS_MODULE;
+ cdev_set_parent(&port->sm_cdev, &umad_dev->kobj);
+ kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num);
+- if (cdev_add(&port->sm_cdev, base, 1))
++ if (cdev_add(&port->sm_cdev, base_issm, 1))
+ goto err_sm_cdev;
+
+ port->sm_dev = device_create(umad_class, device->dev.parent,
+@@ -1242,10 +1226,7 @@ err_dev:
+
+ err_cdev:
+ cdev_del(&port->cdev);
+- if (port->dev_num < IB_UMAD_MAX_PORTS)
+- clear_bit(devnum, dev_map);
+- else
+- clear_bit(devnum, overflow_map);
++ clear_bit(devnum, dev_map);
+
+ return -1;
+ }
+@@ -1279,11 +1260,7 @@ static void ib_umad_kill_port(struct ib_
+ }
+
+ mutex_unlock(&port->file_mutex);
+-
+- if (port->dev_num < IB_UMAD_MAX_PORTS)
+- clear_bit(port->dev_num, dev_map);
+- else
+- clear_bit(port->dev_num - IB_UMAD_MAX_PORTS, overflow_map);
++ clear_bit(port->dev_num, dev_map);
+ }
+
+ static void ib_umad_add_one(struct ib_device *device)
+@@ -1359,13 +1336,23 @@ static int __init ib_umad_init(void)
+ {
+ int ret;
+
+- ret = register_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2,
++ ret = register_chrdev_region(base_umad_dev,
++ IB_UMAD_NUM_FIXED_MINOR * 2,
+ "infiniband_mad");
+ if (ret) {
+ pr_err("couldn't register device number\n");
+ goto out;
+ }
+
++ ret = alloc_chrdev_region(&dynamic_umad_dev, 0,
++ IB_UMAD_NUM_DYNAMIC_MINOR * 2,
++ "infiniband_mad");
++ if (ret) {
++ pr_err("couldn't register dynamic device number\n");
++ goto out_alloc;
++ }
++ dynamic_issm_dev = dynamic_umad_dev + IB_UMAD_NUM_DYNAMIC_MINOR;
++
+ umad_class = class_create(THIS_MODULE, "infiniband_mad");
+ if (IS_ERR(umad_class)) {
+ ret = PTR_ERR(umad_class);
+@@ -1393,7 +1380,12 @@ out_class:
+ class_destroy(umad_class);
+
+ out_chrdev:
+- unregister_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2);
++ unregister_chrdev_region(dynamic_umad_dev,
++ IB_UMAD_NUM_DYNAMIC_MINOR * 2);
++
++out_alloc:
++ unregister_chrdev_region(base_umad_dev,
++ IB_UMAD_NUM_FIXED_MINOR * 2);
+
+ out:
+ return ret;
+@@ -1403,9 +1395,10 @@ static void __exit ib_umad_cleanup(void)
+ {
+ ib_unregister_client(&umad_client);
+ class_destroy(umad_class);
+- unregister_chrdev_region(base_dev, IB_UMAD_MAX_PORTS * 2);
+- if (overflow_maj)
+- unregister_chrdev_region(overflow_maj, IB_UMAD_MAX_PORTS * 2);
++ unregister_chrdev_region(base_umad_dev,
++ IB_UMAD_NUM_FIXED_MINOR * 2);
++ unregister_chrdev_region(dynamic_umad_dev,
++ IB_UMAD_NUM_DYNAMIC_MINOR * 2);
+ }
+
+ module_init(ib_umad_init);
+--- a/drivers/infiniband/core/uverbs_main.c
++++ b/drivers/infiniband/core/uverbs_main.c
+@@ -62,11 +62,14 @@ MODULE_LICENSE("Dual BSD/GPL");
+ enum {
+ IB_UVERBS_MAJOR = 231,
+ IB_UVERBS_BASE_MINOR = 192,
+- IB_UVERBS_MAX_DEVICES = 32
++ IB_UVERBS_MAX_DEVICES = RDMA_MAX_PORTS,
++ IB_UVERBS_NUM_FIXED_MINOR = 32,
++ IB_UVERBS_NUM_DYNAMIC_MINOR = IB_UVERBS_MAX_DEVICES - IB_UVERBS_NUM_FIXED_MINOR,
+ };
+
+ #define IB_UVERBS_BASE_DEV MKDEV(IB_UVERBS_MAJOR, IB_UVERBS_BASE_MINOR)
+
++static dev_t dynamic_uverbs_dev;
+ static struct class *uverbs_class;
+
+ static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES);
+@@ -1004,34 +1007,6 @@ static DEVICE_ATTR(abi_version, S_IRUGO,
+ static CLASS_ATTR_STRING(abi_version, S_IRUGO,
+ __stringify(IB_USER_VERBS_ABI_VERSION));
+
+-static dev_t overflow_maj;
+-static DECLARE_BITMAP(overflow_map, IB_UVERBS_MAX_DEVICES);
+-
+-/*
+- * If we have more than IB_UVERBS_MAX_DEVICES, dynamically overflow by
+- * requesting a new major number and doubling the number of max devices we
+- * support. It's stupid, but simple.
+- */
+-static int find_overflow_devnum(void)
+-{
+- int ret;
+-
+- if (!overflow_maj) {
+- ret = alloc_chrdev_region(&overflow_maj, 0, IB_UVERBS_MAX_DEVICES,
+- "infiniband_verbs");
+- if (ret) {
+- pr_err("user_verbs: couldn't register dynamic device number\n");
+- return ret;
+- }
+- }
+-
+- ret = find_first_zero_bit(overflow_map, IB_UVERBS_MAX_DEVICES);
+- if (ret >= IB_UVERBS_MAX_DEVICES)
+- return -1;
+-
+- return ret;
+-}
+-
+ static void ib_uverbs_add_one(struct ib_device *device)
+ {
+ int devnum;
+@@ -1062,19 +1037,14 @@ static void ib_uverbs_add_one(struct ib_
+ INIT_LIST_HEAD(&uverbs_dev->uverbs_events_file_list);
+
+ devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
+- if (devnum >= IB_UVERBS_MAX_DEVICES) {
+- devnum = find_overflow_devnum();
+- if (devnum < 0)
+- goto err;
+-
+- uverbs_dev->devnum = devnum + IB_UVERBS_MAX_DEVICES;
+- base = devnum + overflow_maj;
+- set_bit(devnum, overflow_map);
+- } else {
+- uverbs_dev->devnum = devnum;
+- base = devnum + IB_UVERBS_BASE_DEV;
+- set_bit(devnum, dev_map);
+- }
++ if (devnum >= IB_UVERBS_MAX_DEVICES)
++ goto err;
++ uverbs_dev->devnum = devnum;
++ set_bit(devnum, dev_map);
++ if (devnum >= IB_UVERBS_NUM_FIXED_MINOR)
++ base = dynamic_uverbs_dev + devnum - IB_UVERBS_NUM_FIXED_MINOR;
++ else
++ base = IB_UVERBS_BASE_DEV + devnum;
+
+ rcu_assign_pointer(uverbs_dev->ib_dev, device);
+ uverbs_dev->num_comp_vectors = device->num_comp_vectors;
+@@ -1119,10 +1089,7 @@ err_class:
+
+ err_cdev:
+ cdev_del(&uverbs_dev->cdev);
+- if (uverbs_dev->devnum < IB_UVERBS_MAX_DEVICES)
+- clear_bit(devnum, dev_map);
+- else
+- clear_bit(devnum, overflow_map);
++ clear_bit(devnum, dev_map);
+
+ err:
+ if (atomic_dec_and_test(&uverbs_dev->refcount))
+@@ -1214,11 +1181,7 @@ static void ib_uverbs_remove_one(struct
+ dev_set_drvdata(uverbs_dev->dev, NULL);
+ device_destroy(uverbs_class, uverbs_dev->cdev.dev);
+ cdev_del(&uverbs_dev->cdev);
+-
+- if (uverbs_dev->devnum < IB_UVERBS_MAX_DEVICES)
+- clear_bit(uverbs_dev->devnum, dev_map);
+- else
+- clear_bit(uverbs_dev->devnum - IB_UVERBS_MAX_DEVICES, overflow_map);
++ clear_bit(uverbs_dev->devnum, dev_map);
+
+ if (device->disassociate_ucontext) {
+ /* We disassociate HW resources and immediately return.
+@@ -1260,13 +1223,22 @@ static int __init ib_uverbs_init(void)
+ {
+ int ret;
+
+- ret = register_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES,
++ ret = register_chrdev_region(IB_UVERBS_BASE_DEV,
++ IB_UVERBS_NUM_FIXED_MINOR,
+ "infiniband_verbs");
+ if (ret) {
+ pr_err("user_verbs: couldn't register device number\n");
+ goto out;
+ }
+
++ ret = alloc_chrdev_region(&dynamic_uverbs_dev, 0,
++ IB_UVERBS_NUM_DYNAMIC_MINOR,
++ "infiniband_verbs");
++ if (ret) {
++ pr_err("couldn't register dynamic device number\n");
++ goto out_alloc;
++ }
++
+ uverbs_class = class_create(THIS_MODULE, "infiniband_verbs");
+ if (IS_ERR(uverbs_class)) {
+ ret = PTR_ERR(uverbs_class);
+@@ -1294,7 +1266,12 @@ out_class:
+ class_destroy(uverbs_class);
+
+ out_chrdev:
+- unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES);
++ unregister_chrdev_region(dynamic_uverbs_dev,
++ IB_UVERBS_NUM_DYNAMIC_MINOR);
++
++out_alloc:
++ unregister_chrdev_region(IB_UVERBS_BASE_DEV,
++ IB_UVERBS_NUM_FIXED_MINOR);
+
+ out:
+ return ret;
+@@ -1304,9 +1281,10 @@ static void __exit ib_uverbs_cleanup(voi
+ {
+ ib_unregister_client(&uverbs_client);
+ class_destroy(uverbs_class);
+- unregister_chrdev_region(IB_UVERBS_BASE_DEV, IB_UVERBS_MAX_DEVICES);
+- if (overflow_maj)
+- unregister_chrdev_region(overflow_maj, IB_UVERBS_MAX_DEVICES);
++ unregister_chrdev_region(IB_UVERBS_BASE_DEV,
++ IB_UVERBS_NUM_FIXED_MINOR);
++ unregister_chrdev_region(dynamic_uverbs_dev,
++ IB_UVERBS_NUM_DYNAMIC_MINOR);
+ }
+
+ module_init(ib_uverbs_init);
diff --git a/patches.drivers/IB-core-Introduce-and-use-rdma_create_user_ah.patch b/patches.drivers/IB-core-Introduce-and-use-rdma_create_user_ah.patch
new file mode 100644
index 0000000000..9e1157adf0
--- /dev/null
+++ b/patches.drivers/IB-core-Introduce-and-use-rdma_create_user_ah.patch
@@ -0,0 +1,165 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 16 Oct 2017 08:45:12 +0300
+Subject: IB/core: Introduce and use rdma_create_user_ah
+Patch-mainline: v4.15-rc1
+Git-commit: 5cda6587feec790a089703dde2e6e1f82de50bbd
+References: bsc#1103992 FATE#326009
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/user_mad.c | 2 -
+ drivers/infiniband/core/uverbs_cmd.c | 10 --------
+ drivers/infiniband/core/verbs.c | 40 +++++++++++++++++++++++++++++++++--
+ include/rdma/ib_verbs.h | 15 +++++++++++++
+ 4 files changed, 55 insertions(+), 12 deletions(-)
+
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -506,7 +506,7 @@ static ssize_t ib_umad_write(struct file
+ rdma_ah_set_dgid_raw(&ah_attr, packet->mad.hdr.gid);
+ }
+
+- ah = rdma_create_ah(agent->qp->pd, &ah_attr);
++ ah = rdma_create_user_ah(agent->qp->pd, &ah_attr, NULL);
+ if (IS_ERR(ah)) {
+ ret = PTR_ERR(ah);
+ goto err_up;
+--- a/drivers/infiniband/core/uverbs_cmd.c
++++ b/drivers/infiniband/core/uverbs_cmd.c
+@@ -2537,7 +2537,6 @@ ssize_t ib_uverbs_create_ah(struct ib_uv
+ struct rdma_ah_attr attr;
+ int ret;
+ struct ib_udata udata;
+- u8 *dmac;
+
+ if (out_len < sizeof resp)
+ return -ENOSPC;
+@@ -2580,20 +2579,13 @@ ssize_t ib_uverbs_create_ah(struct ib_uv
+ } else {
+ rdma_ah_set_ah_flags(&attr, 0);
+ }
+- dmac = rdma_ah_retrieve_dmac(&attr);
+- if (dmac)
+- memset(dmac, 0, ETH_ALEN);
+-
+- ah = pd->device->create_ah(pd, &attr, &udata);
+
++ ah = rdma_create_user_ah(pd, &attr, &udata);
+ if (IS_ERR(ah)) {
+ ret = PTR_ERR(ah);
+ goto err_put;
+ }
+
+- ah->device = pd->device;
+- ah->pd = pd;
+- atomic_inc(&pd->usecnt);
+ ah->uobject = uobj;
+ uobj->user_handle = cmd.user_handle;
+ uobj->object = ah;
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -302,11 +302,13 @@ EXPORT_SYMBOL(ib_dealloc_pd);
+
+ /* Address handles */
+
+-struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr)
++static struct ib_ah *_rdma_create_ah(struct ib_pd *pd,
++ struct rdma_ah_attr *ah_attr,
++ struct ib_udata *udata)
+ {
+ struct ib_ah *ah;
+
+- ah = pd->device->create_ah(pd, ah_attr, NULL);
++ ah = pd->device->create_ah(pd, ah_attr, udata);
+
+ if (!IS_ERR(ah)) {
+ ah->device = pd->device;
+@@ -318,8 +320,42 @@ struct ib_ah *rdma_create_ah(struct ib_p
+
+ return ah;
+ }
++
++struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr)
++{
++ return _rdma_create_ah(pd, ah_attr, NULL);
++}
+ EXPORT_SYMBOL(rdma_create_ah);
+
++/**
++ * rdma_create_user_ah - Creates an address handle for the
++ * given address vector.
++ * It resolves destination mac address for ah attribute of RoCE type.
++ * @pd: The protection domain associated with the address handle.
++ * @ah_attr: The attributes of the address vector.
++ * @udata: pointer to user's input output buffer information need by
++ * provider driver.
++ *
++ * It returns 0 on success and returns appropriate error code on error.
++ * The address handle is used to reference a local or global destination
++ * in all UD QP post sends.
++ */
++struct ib_ah *rdma_create_user_ah(struct ib_pd *pd,
++ struct rdma_ah_attr *ah_attr,
++ struct ib_udata *udata)
++{
++ int err;
++
++ if (ah_attr->type == RDMA_AH_ATTR_TYPE_ROCE) {
++ err = ib_resolve_eth_dmac(pd->device, ah_attr);
++ if (err)
++ return ERR_PTR(err);
++ }
++
++ return _rdma_create_ah(pd, ah_attr, udata);
++}
++EXPORT_SYMBOL(rdma_create_user_ah);
++
+ int ib_get_rdma_header_version(const union rdma_network_hdr *hdr)
+ {
+ const struct iphdr *ip4h = (struct iphdr *)&hdr->roce4grh;
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -2858,6 +2858,21 @@ void ib_dealloc_pd(struct ib_pd *pd);
+ struct ib_ah *rdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr);
+
+ /**
++ * rdma_create_user_ah - Creates an address handle for the given address vector.
++ * It resolves destination mac address for ah attribute of RoCE type.
++ * @pd: The protection domain associated with the address handle.
++ * @ah_attr: The attributes of the address vector.
++ * @udata: pointer to user's input output buffer information need by
++ * provider driver.
++ *
++ * It returns 0 on success and returns appropriate error code on error.
++ * The address handle is used to reference a local or global destination
++ * in all UD QP post sends.
++ */
++struct ib_ah *rdma_create_user_ah(struct ib_pd *pd,
++ struct rdma_ah_attr *ah_attr,
++ struct ib_udata *udata);
++/**
+ * ib_get_gids_from_rdma_hdr - Get sgid and dgid from GRH or IPv4 header
+ * work completion.
+ * @hdr: the L3 header to parse
diff --git a/patches.drivers/IB-core-Introduce-driver-QP-type.patch b/patches.drivers/IB-core-Introduce-driver-QP-type.patch
new file mode 100644
index 0000000000..3d58a9fb19
--- /dev/null
+++ b/patches.drivers/IB-core-Introduce-driver-QP-type.patch
@@ -0,0 +1,36 @@
+From: Moni Shoua <monis@mellanox.com>
+Date: Tue, 2 Jan 2018 16:19:30 +0200
+Subject: IB/core: Introduce driver QP type
+Patch-mainline: v4.16-rc1
+Git-commit: 8011c1e33626ea7b04f74f648aad7bb2e48f8a81
+References: bsc#1103992 FATE#326009
+
+Vendors can implement type of QPs that are not described in the
+InfiniBand specification. To still be able to use the IB/core layer
+services (e.g. user object management) without tainting this layer with
+driver proprietary logic, a new QP type is added - IB_QPT_DRIVER. This
+will be a general QP type that the core layer doesn't know about its true nature.
+When a command like create_qp() is passed to a hardware driver the extra
+data that is required is taken from the driver channel.
+Downstream patches from this series will use that QP type in the mlx5
+driver.
+
+Signed-off-by: Moni Shoua <monis@mellanox.com>
+Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ include/rdma/ib_verbs.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -1082,6 +1082,7 @@ enum ib_qp_type {
+ IB_QPT_XRC_INI = 9,
+ IB_QPT_XRC_TGT,
+ IB_QPT_MAX,
++ IB_QPT_DRIVER = 0xFF,
+ /* Reserve a range for qp types internal to the low level driver.
+ * These qp types will not be visible at the IB core layer, so the
+ * IB_QPT_MAX usages should not be affected in the core layer
diff --git a/patches.drivers/IB-core-Limit-DMAC-resolution-to-RoCE-Connected-QPs.patch b/patches.drivers/IB-core-Limit-DMAC-resolution-to-RoCE-Connected-QPs.patch
new file mode 100644
index 0000000000..48d30ff832
--- /dev/null
+++ b/patches.drivers/IB-core-Limit-DMAC-resolution-to-RoCE-Connected-QPs.patch
@@ -0,0 +1,46 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 9 Jan 2018 15:24:53 +0200
+Subject: IB/core: Limit DMAC resolution to RoCE Connected QPs
+Patch-mainline: v4.16-rc1
+Git-commit: a6753c4d6257feef2a82522d0d222166d4be4aa8
+References: bsc#1103992 FATE#326009
+
+Resolving DMAC for RoCE is applicable to only Connected mode QPs.
+So resolve DMAC for only for Connected mode QPs.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -1350,6 +1350,14 @@ static int _ib_modify_qp(struct ib_qp *q
+ return ret;
+ }
+
++static bool is_qp_type_connected(const struct ib_qp *qp)
++{
++ return (qp->qp_type == IB_QPT_UC ||
++ qp->qp_type == IB_QPT_RC ||
++ qp->qp_type == IB_QPT_XRC_INI ||
++ qp->qp_type == IB_QPT_XRC_TGT);
++}
++
+ /**
+ * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
+ * @ib_qp: The QP to modify.
+@@ -1368,7 +1376,8 @@ int ib_modify_qp_with_udata(struct ib_qp
+ int ret;
+
+ if (attr_mask & IB_QP_AV &&
+- attr->ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE) {
++ attr->ah_attr.type == RDMA_AH_ATTR_TYPE_ROCE &&
++ is_qp_type_connected(qp)) {
+ ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
+ if (ret)
+ return ret;
diff --git a/patches.drivers/IB-core-Limit-DMAC-resolution-to-userspace-QPs.patch b/patches.drivers/IB-core-Limit-DMAC-resolution-to-userspace-QPs.patch
new file mode 100644
index 0000000000..2816be88e7
--- /dev/null
+++ b/patches.drivers/IB-core-Limit-DMAC-resolution-to-userspace-QPs.patch
@@ -0,0 +1,98 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 9 Jan 2018 15:24:51 +0200
+Subject: IB/core: Limit DMAC resolution to userspace QPs
+Patch-mainline: v4.16-rc1
+Git-commit: b96ac05a87da602d501b05883385a049862c0476
+References: bsc#1103992 FATE#326009
+
+Currently ah_attr is initialized by the ib_cm layer for rdma_cm
+based applications. For RoCE transport ah_attr.roce.dmac is already
+initialized by ib_cm, rdma_cm either from wc, path record, route
+resolve, explicit path record setting depending on active or passive
+side QP. Therefore avoid resolving DMAC for QP of kernel consumers.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 48 ++++++++++++++++++++++++----------------
+ 1 file changed, 29 insertions(+), 19 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -1324,29 +1324,14 @@ static int ib_resolve_eth_dmac(struct ib
+ }
+
+ /**
+- * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
+- * @ib_qp: The QP to modify.
+- * @attr: On input, specifies the QP attributes to modify. On output,
+- * the current values of selected QP attributes are returned.
+- * @attr_mask: A bit-mask used to specify which attributes of the QP
+- * are being modified.
+- * @udata: pointer to user's input output buffer information
+- * are being modified.
+- * It returns 0 on success and returns appropriate error code on error.
++ * IB core internal function to perform QP attributes modification.
+ */
+-int ib_modify_qp_with_udata(struct ib_qp *ib_qp, struct ib_qp_attr *attr,
+- int attr_mask, struct ib_udata *udata)
++static int _ib_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
++ int attr_mask, struct ib_udata *udata)
+ {
+- struct ib_qp *qp = ib_qp->real_qp;
+ u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
+ int ret;
+
+- if (attr_mask & IB_QP_AV) {
+- ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
+- if (ret)
+- return ret;
+- }
+-
+ if (rdma_ib_or_roce(qp->device, port)) {
+ if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
+ pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
+@@ -1367,6 +1352,31 @@ int ib_modify_qp_with_udata(struct ib_qp
+
+ return ret;
+ }
++
++/**
++ * ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
++ * @ib_qp: The QP to modify.
++ * @attr: On input, specifies the QP attributes to modify. On output,
++ * the current values of selected QP attributes are returned.
++ * @attr_mask: A bit-mask used to specify which attributes of the QP
++ * are being modified.
++ * @udata: pointer to user's input output buffer information
++ * are being modified.
++ * It returns 0 on success and returns appropriate error code on error.
++ */
++int ib_modify_qp_with_udata(struct ib_qp *ib_qp, struct ib_qp_attr *attr,
++ int attr_mask, struct ib_udata *udata)
++{
++ struct ib_qp *qp = ib_qp->real_qp;
++ int ret;
++
++ if (attr_mask & IB_QP_AV) {
++ ret = ib_resolve_eth_dmac(qp->device, &attr->ah_attr);
++ if (ret)
++ return ret;
++ }
++ return _ib_modify_qp(qp, attr, attr_mask, udata);
++}
+ EXPORT_SYMBOL(ib_modify_qp_with_udata);
+
+ int ib_get_eth_speed(struct ib_device *dev, u8 port_num, u8 *speed, u8 *width)
+@@ -1428,7 +1438,7 @@ int ib_modify_qp(struct ib_qp *qp,
+ struct ib_qp_attr *qp_attr,
+ int qp_attr_mask)
+ {
+- return ib_modify_qp_with_udata(qp, qp_attr, qp_attr_mask, NULL);
++ return _ib_modify_qp(qp->real_qp, qp_attr, qp_attr_mask, NULL);
+ }
+ EXPORT_SYMBOL(ib_modify_qp);
+
diff --git a/patches.drivers/IB-core-Make-sure-that-PSN-does-not-overflow.patch b/patches.drivers/IB-core-Make-sure-that-PSN-does-not-overflow.patch
new file mode 100644
index 0000000000..b59c1734a3
--- /dev/null
+++ b/patches.drivers/IB-core-Make-sure-that-PSN-does-not-overflow.patch
@@ -0,0 +1,52 @@
+From: Majd Dibbiny <majd@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:56 +0200
+Subject: IB/core: Make sure that PSN does not overflow
+Patch-mainline: v4.16-rc1
+Git-commit: 727b7e9a65c01569f8e4f9809d6f2be8c331c42a
+References: bsc#1103992 FATE#326009
+
+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 modify_qp.
+
+Signed-off-by: Majd Dibbiny <majd@mellanox.com>
+Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -1321,6 +1321,7 @@ static int ib_resolve_eth_dmac(struct ib
+ int ib_modify_qp_with_udata(struct ib_qp *qp, struct ib_qp_attr *attr,
+ int attr_mask, struct ib_udata *udata)
+ {
++ u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
+ int ret;
+
+ if (attr_mask & IB_QP_AV) {
+@@ -1328,6 +1329,21 @@ int ib_modify_qp_with_udata(struct ib_qp
+ if (ret)
+ return ret;
+ }
++
++ if (rdma_ib_or_roce(qp->device, port)) {
++ if (attr_mask & IB_QP_RQ_PSN && attr->rq_psn & ~0xffffff) {
++ pr_warn("%s: %s rq_psn overflow, masking to 24 bits\n",
++ __func__, qp->device->name);
++ attr->rq_psn &= 0xffffff;
++ }
++
++ if (attr_mask & IB_QP_SQ_PSN && attr->sq_psn & ~0xffffff) {
++ pr_warn("%s: %s sq_psn overflow, masking to 24 bits\n",
++ __func__, qp->device->name);
++ attr->sq_psn &= 0xffffff;
++ }
++ }
++
+ ret = ib_security_modify_qp(qp, attr, attr_mask, udata);
+ if (!ret && (attr_mask & IB_QP_PORT))
+ qp->port = attr->port_num;
diff --git a/patches.drivers/IB-core-Move-rdma_addr_find_l2_eth_by_grh-to-core_pr.patch b/patches.drivers/IB-core-Move-rdma_addr_find_l2_eth_by_grh-to-core_pr.patch
new file mode 100644
index 0000000000..82839cc9fe
--- /dev/null
+++ b/patches.drivers/IB-core-Move-rdma_addr_find_l2_eth_by_grh-to-core_pr.patch
@@ -0,0 +1,52 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:23 +0200
+Subject: IB/core: Move rdma_addr_find_l2_eth_by_grh to core_priv.h
+Patch-mainline: v4.17-rc1
+Git-commit: e41a7c41947d33dbca16d1695460c121342a4601
+References: bsc#1103992 FATE#326009
+
+Before commit [1], rdma_addr_find_l2_eth_by_grh() was an exported function
+and therefore declaration in include/rdma/ib_addr.h was fine.
+
+But now that its scope is limited to ib_core module, its better to have it
+in core_priv.h.
+
+[1] commit 1060f8653414 ("IB/{core/cm}: Fix generating a return AH for
+RoCEE")
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/core_priv.h | 5 +++++
+ include/rdma/ib_addr.h | 5 -----
+ 2 files changed, 5 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/core/core_priv.h
++++ b/drivers/infiniband/core/core_priv.h
+@@ -339,4 +339,9 @@ int rdma_resolve_ip_route(struct sockadd
+ const struct sockaddr *dst_addr,
+ struct rdma_dev_addr *addr);
+
++int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
++ const union ib_gid *dgid,
++ u8 *dmac, const struct net_device *ndev,
++ int *hoplimit);
++
+ #endif /* _CORE_PRIV_H */
+--- a/include/rdma/ib_addr.h
++++ b/include/rdma/ib_addr.h
+@@ -129,11 +129,6 @@ int rdma_addr_size(struct sockaddr *addr
+ int rdma_addr_size_in6(struct sockaddr_in6 *addr);
+ int rdma_addr_size_kss(struct __kernel_sockaddr_storage *addr);
+
+-int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
+- const union ib_gid *dgid,
+- u8 *dmac, const struct net_device *ndev,
+- int *hoplimit);
+-
+ static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
+ {
+ return ((u16)dev_addr->broadcast[8] << 8) | (u16)dev_addr->broadcast[9];
diff --git a/patches.drivers/IB-core-Perform-modify-QP-on-real-one.patch b/patches.drivers/IB-core-Perform-modify-QP-on-real-one.patch
index c28f515525..9277b542e0 100644
--- a/patches.drivers/IB-core-Perform-modify-QP-on-real-one.patch
+++ b/patches.drivers/IB-core-Perform-modify-QP-on-real-one.patch
@@ -24,7 +24,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
-@@ -1286,7 +1286,7 @@ EXPORT_SYMBOL(ib_resolve_eth_dmac);
+@@ -1309,7 +1309,7 @@ static int ib_resolve_eth_dmac(struct ib
/**
* ib_modify_qp_with_udata - Modifies the attributes for the specified QP.
@@ -33,7 +33,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
* @attr: On input, specifies the QP attributes to modify. On output,
* the current values of selected QP attributes are returned.
* @attr_mask: A bit-mask used to specify which attributes of the QP
-@@ -1295,9 +1295,10 @@ EXPORT_SYMBOL(ib_resolve_eth_dmac);
+@@ -1318,9 +1318,10 @@ static int ib_resolve_eth_dmac(struct ib
* are being modified.
* It returns 0 on success and returns appropriate error code on error.
*/
@@ -42,6 +42,6 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
int attr_mask, struct ib_udata *udata)
{
+ struct ib_qp *qp = ib_qp->real_qp;
+ u8 port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
int ret;
- if (attr_mask & IB_QP_AV) {
diff --git a/patches.drivers/IB-core-Protect-against-concurrent-access-to-hardwar.patch b/patches.drivers/IB-core-Protect-against-concurrent-access-to-hardwar.patch
new file mode 100644
index 0000000000..a80f13cad4
--- /dev/null
+++ b/patches.drivers/IB-core-Protect-against-concurrent-access-to-hardwar.patch
@@ -0,0 +1,127 @@
+From: Mark Bloch <markb@mellanox.com>
+Date: Tue, 27 Mar 2018 15:51:05 +0300
+Subject: IB/core: Protect against concurrent access to hardware stats
+Patch-mainline: v4.17-rc1
+Git-commit: e945130b52bea65d15f9bdf54949d4cb7a88db7f
+References: bsc#1103992 FATE#326009
+
+Currently access to hardware stats buffer isn't protected, this can
+result in multiple writes and reads at the same time to the same
+memory location. This can lead to providing an incorrect value to
+the user. Add a mutex to protect against it.
+
+Fixes: b40f4757daa1 ("IB/core: Make device counter infrastructure dynamic")
+Signed-off-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/sysfs.c | 34 ++++++++++++++++++++++++++++------
+ include/rdma/ib_verbs.h | 4 ++++
+ 2 files changed, 32 insertions(+), 6 deletions(-)
+
+--- a/drivers/infiniband/core/sysfs.c
++++ b/drivers/infiniband/core/sysfs.c
+@@ -811,10 +811,15 @@ static ssize_t show_hw_stats(struct kobj
+ dev = port->ibdev;
+ stats = port->hw_stats;
+ }
++ mutex_lock(&stats->lock);
+ ret = update_hw_stats(dev, stats, hsa->port_num, hsa->index);
+ if (ret)
+- return ret;
+- return print_hw_stat(stats, hsa->index, buf);
++ goto unlock;
++ ret = print_hw_stat(stats, hsa->index, buf);
++unlock:
++ mutex_unlock(&stats->lock);
++
++ return ret;
+ }
+
+ static ssize_t show_stats_lifespan(struct kobject *kobj,
+@@ -822,17 +827,25 @@ static ssize_t show_stats_lifespan(struc
+ char *buf)
+ {
+ struct hw_stats_attribute *hsa;
++ struct rdma_hw_stats *stats;
+ int msecs;
+
+ hsa = container_of(attr, struct hw_stats_attribute, attr);
+ if (!hsa->port_num) {
+ struct ib_device *dev = container_of((struct device *)kobj,
+ struct ib_device, dev);
+- msecs = jiffies_to_msecs(dev->hw_stats->lifespan);
++
++ stats = dev->hw_stats;
+ } else {
+ struct ib_port *p = container_of(kobj, struct ib_port, kobj);
+- msecs = jiffies_to_msecs(p->hw_stats->lifespan);
++
++ stats = p->hw_stats;
+ }
++
++ mutex_lock(&stats->lock);
++ msecs = jiffies_to_msecs(stats->lifespan);
++ mutex_unlock(&stats->lock);
++
+ return sprintf(buf, "%d\n", msecs);
+ }
+
+@@ -841,6 +854,7 @@ static ssize_t set_stats_lifespan(struct
+ const char *buf, size_t count)
+ {
+ struct hw_stats_attribute *hsa;
++ struct rdma_hw_stats *stats;
+ int msecs;
+ int jiffies;
+ int ret;
+@@ -855,11 +869,18 @@ static ssize_t set_stats_lifespan(struct
+ if (!hsa->port_num) {
+ struct ib_device *dev = container_of((struct device *)kobj,
+ struct ib_device, dev);
+- dev->hw_stats->lifespan = jiffies;
++
++ stats = dev->hw_stats;
+ } else {
+ struct ib_port *p = container_of(kobj, struct ib_port, kobj);
+- p->hw_stats->lifespan = jiffies;
++
++ stats = p->hw_stats;
+ }
++
++ mutex_lock(&stats->lock);
++ stats->lifespan = jiffies;
++ mutex_unlock(&stats->lock);
++
+ return count;
+ }
+
+@@ -952,6 +973,7 @@ static void setup_hw_stats(struct ib_dev
+ sysfs_attr_init(hsag->attrs[i]);
+ }
+
++ mutex_init(&stats->lock);
+ /* treat an error here as non-fatal */
+ hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num);
+ if (hsag->attrs[i])
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -470,6 +470,9 @@ enum ib_port_speed {
+
+ /**
+ * struct rdma_hw_stats
++ * @lock - Mutex to protect parallel write access to lifespan and values
++ * of counters, which are 64bits and not guaranteeed to be written
++ * atomicaly on 32bits systems.
+ * @timestamp - Used by the core code to track when the last update was
+ * @lifespan - Used by the core code to determine how old the counters
+ * should be before being updated again. Stored in jiffies, defaults
+@@ -485,6 +488,7 @@ enum ib_port_speed {
+ * filled in by the drivers get_stats routine
+ */
+ struct rdma_hw_stats {
++ struct mutex lock; /* Protect lifespan and values[] */
+ unsigned long timestamp;
+ unsigned long lifespan;
+ const char * const *names;
diff --git a/patches.drivers/IB-core-Refactor-GID-modify-code-for-RoCE.patch b/patches.drivers/IB-core-Refactor-GID-modify-code-for-RoCE.patch
new file mode 100644
index 0000000000..033f977ba0
--- /dev/null
+++ b/patches.drivers/IB-core-Refactor-GID-modify-code-for-RoCE.patch
@@ -0,0 +1,825 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 1 Apr 2018 15:08:21 +0300
+Subject: IB/core: Refactor GID modify code for RoCE
+Patch-mainline: v4.17-rc1
+Git-commit: 598ff6bae689453aa894bc38f3f1bb78eb131a61
+References: bsc#1103992 FATE#326009
+
+Code is refactored to prepare separate functions for RoCE which can do more
+complex operations related to reference counting, while still
+maintainining code readability. This includes
+(a) Simplification to not perform netdevice checks and modifications
+for IB link layer.
+(b) Do not add RoCE GID entry which has NULL netdevice; instead return
+an error.
+(c) If GID addition fails at provider level add_gid(), do not add the
+entry in the cache and keep the entry marked as INVALID.
+(d) Simplify and reuse the ib_cache_gid_add()/del() routines so that they
+can be used even for modifying default GIDs. This avoid some code
+duplication in modifying default GIDs.
+(e) find_gid() routine refers to the data entry flags to qualify a GID
+as valid or invalid GID rather than depending on attributes and zeroness
+of the GID content.
+(f) gid_table_reserve_default() sets the GID default attribute at
+beginning while setting up the GID table. There is no need to use
+default_gid flag in low level functions such as write_gid(), add_gid(),
+del_gid(), as they never need to update the DEFAULT property of the GID
+entry while during GID table update.
+
+As as result of this refactor, reserved GID 0:0:0:0:0:0:0:0 is no longer
+searchable as described below.
+
+A unicast GID entry of 0:0:0:0:0:0:0:0 is Reserved GID as per the IB
+spec version 1.3 section 4.1.1, point (6) whose snippet is below.
+
+"The unicast GID address 0:0:0:0:0:0:0:0 is reserved - referred to as
+the Reserved GID. It shall never be assigned to any endport. It shall
+not be used as a destination address or in a global routing header
+(GRH)."
+
+GID table cache now only stores valid GID entries. Before this patch,
+Reserved GID 0:0:0:0:0:0:0:0 was searchable in the GID table using
+ib_find_cached_gid_by_port() and other similar find routines.
+
+Zero GID is no longer searchable as it shall not to be present in GRH or
+path recored entry as described in IB spec version 1.3 section 4.1.1,
+point (6), section 12.7.10 and section 12.7.20.
+
+ib_cache_update() is simplified to check link layer once, use unified
+locking scheme for all link layers, removed temporary gid table
+allocation/free logic.
+
+Additionally,
+(a) Expand ib_gid_attr to store port and index so that GID query
+routines can get port and index information from the attribute structure.
+(b) Expand ib_gid_attr to store device as well so that in future code when
+GID reference counting is done, device is used to reach back to the GID
+table entry.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 496 ++++++++++++++++++++--------------------
+ drivers/infiniband/core/sysfs.c | 18 +
+ include/rdma/ib_verbs.h | 5
+ 3 files changed, 278 insertions(+), 241 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -59,8 +59,6 @@ struct ib_update_work {
+ union ib_gid zgid;
+ EXPORT_SYMBOL(zgid);
+
+-static const struct ib_gid_attr zattr;
+-
+ enum gid_attr_find_mask {
+ GID_ATTR_FIND_MASK_GID = 1UL << 0,
+ GID_ATTR_FIND_MASK_NETDEV = 1UL << 1,
+@@ -73,15 +71,6 @@ enum gid_table_entry_props {
+ GID_TABLE_ENTRY_DEFAULT = 1UL << 1,
+ };
+
+-enum gid_table_write_action {
+- GID_TABLE_WRITE_ACTION_ADD,
+- GID_TABLE_WRITE_ACTION_DEL,
+- /* MODIFY only updates the GID table. Currently only used by
+- * ib_cache_update.
+- */
+- GID_TABLE_WRITE_ACTION_MODIFY
+-};
+-
+ struct ib_gid_table_entry {
+ unsigned long props;
+ union ib_gid gid;
+@@ -100,16 +89,13 @@ struct ib_gid_table {
+ * (a) Find the GID
+ * (b) Delete it.
+ *
+- * Add/delete should be carried out atomically.
+- * This is done by locking this mutex from multiple
+- * writers. We don't need this lock for IB, as the MAD
+- * layer replaces all entries. All data_vec entries
+- * are locked by this lock.
+ **/
+- struct mutex lock;
+- /* This lock protects the table entries from being
+- * read and written simultaneously.
++ /* Any writer to data_vec must hold this lock and the write side of
++ * rwlock. readers must hold only rwlock. All writers must be in a
++ * sleepable context.
+ */
++ struct mutex lock;
++ /* rwlock protects data_vec[ix]->props. */
+ rwlock_t rwlock;
+ struct ib_gid_table_entry *data_vec;
+ };
+@@ -163,94 +149,128 @@ int ib_cache_gid_parse_type_str(const ch
+ }
+ EXPORT_SYMBOL(ib_cache_gid_parse_type_str);
+
+-/* This function expects that rwlock will be write locked in all
+- * scenarios and that lock will be locked in sleep-able (RoCE)
+- * scenarios.
+- */
+-static int write_gid(struct ib_device *ib_dev, u8 port,
+- struct ib_gid_table *table, int ix,
+- const union ib_gid *gid,
+- const struct ib_gid_attr *attr,
+- enum gid_table_write_action action,
+- bool default_gid)
+- __releases(&table->rwlock) __acquires(&table->rwlock)
++static void del_roce_gid(struct ib_device *device, u8 port_num,
++ struct ib_gid_table *table, int ix)
++{
++ pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__,
++ device->name, port_num, ix,
++ table->data_vec[ix].gid.raw);
++
++ if (rdma_cap_roce_gid_table(device, port_num))
++ device->del_gid(device, port_num, ix,
++ &table->data_vec[ix].context);
++ dev_put(table->data_vec[ix].attr.ndev);
++}
++
++static int add_roce_gid(struct ib_gid_table *table,
++ const union ib_gid *gid,
++ const struct ib_gid_attr *attr)
+ {
++ struct ib_gid_table_entry *entry;
++ int ix = attr->index;
+ int ret = 0;
+- struct net_device *old_net_dev;
+- enum ib_gid_type old_gid_type;
+
+- /* in rdma_cap_roce_gid_table, this funciton should be protected by a
+- * sleep-able lock.
+- */
++ if (!attr->ndev) {
++ pr_err("%s NULL netdev device=%s port=%d index=%d\n",
++ __func__, attr->device->name, attr->port_num,
++ attr->index);
++ return -EINVAL;
++ }
+
+- if (rdma_cap_roce_gid_table(ib_dev, port)) {
+- table->data_vec[ix].props |= GID_TABLE_ENTRY_INVALID;
+- write_unlock_irq(&table->rwlock);
+- /* GID_TABLE_WRITE_ACTION_MODIFY currently isn't supported by
+- * RoCE providers and thus only updates the cache.
+- */
+- if (action == GID_TABLE_WRITE_ACTION_ADD)
+- ret = ib_dev->add_gid(ib_dev, port, ix, gid, attr,
+- &table->data_vec[ix].context);
+- else if (action == GID_TABLE_WRITE_ACTION_DEL)
+- ret = ib_dev->del_gid(ib_dev, port, ix,
+- &table->data_vec[ix].context);
+- write_lock_irq(&table->rwlock);
+- }
+-
+- old_net_dev = table->data_vec[ix].attr.ndev;
+- old_gid_type = table->data_vec[ix].attr.gid_type;
+- if (old_net_dev && old_net_dev != attr->ndev)
+- dev_put(old_net_dev);
+- /* if modify_gid failed, just delete the old gid */
+- if (ret || action == GID_TABLE_WRITE_ACTION_DEL) {
+- gid = &zgid;
+- attr = &zattr;
+- table->data_vec[ix].context = NULL;
+- }
+-
+- memcpy(&table->data_vec[ix].gid, gid, sizeof(*gid));
+- memcpy(&table->data_vec[ix].attr, attr, sizeof(*attr));
+- if (default_gid) {
+- table->data_vec[ix].props |= GID_TABLE_ENTRY_DEFAULT;
+- if (action == GID_TABLE_WRITE_ACTION_DEL)
+- table->data_vec[ix].attr.gid_type = old_gid_type;
+- }
+- if (table->data_vec[ix].attr.ndev &&
+- table->data_vec[ix].attr.ndev != old_net_dev)
+- dev_hold(table->data_vec[ix].attr.ndev);
++ entry = &table->data_vec[ix];
++ if ((entry->props & GID_TABLE_ENTRY_INVALID) == 0) {
++ WARN(1, "GID table corruption device=%s port=%d index=%d\n",
++ attr->device->name, attr->port_num,
++ attr->index);
++ return -EINVAL;
++ }
+
+- table->data_vec[ix].props &= ~GID_TABLE_ENTRY_INVALID;
++ if (rdma_cap_roce_gid_table(attr->device, attr->port_num)) {
++ ret = attr->device->add_gid(attr->device, attr->port_num,
++ ix, gid, attr, &entry->context);
++ if (ret) {
++ pr_err("%s GID add failed device=%s port=%d index=%d\n",
++ __func__, attr->device->name, attr->port_num,
++ attr->index);
++ goto add_err;
++ }
++ }
++ dev_hold(attr->ndev);
+
++add_err:
++ if (!ret)
++ pr_debug("%s device=%s port=%d index=%d gid %pI6\n", __func__,
++ attr->device->name, attr->port_num, ix, gid->raw);
+ return ret;
+ }
+
+-static int add_gid(struct ib_device *ib_dev, u8 port,
+- struct ib_gid_table *table, int ix,
+- const union ib_gid *gid,
+- const struct ib_gid_attr *attr,
+- bool default_gid) {
+- return write_gid(ib_dev, port, table, ix, gid, attr,
+- GID_TABLE_WRITE_ACTION_ADD, default_gid);
+-}
+-
+-static int modify_gid(struct ib_device *ib_dev, u8 port,
+- struct ib_gid_table *table, int ix,
+- const union ib_gid *gid,
+- const struct ib_gid_attr *attr,
+- bool default_gid) {
+- return write_gid(ib_dev, port, table, ix, gid, attr,
+- GID_TABLE_WRITE_ACTION_MODIFY, default_gid);
+-}
+-
+-static int del_gid(struct ib_device *ib_dev, u8 port,
+- struct ib_gid_table *table, int ix,
+- bool default_gid) {
+- return write_gid(ib_dev, port, table, ix, &zgid, &zattr,
+- GID_TABLE_WRITE_ACTION_DEL, default_gid);
++/**
++ * add_modify_gid - Add or modify GID table entry
++ *
++ * @table: GID table in which GID to be added or modified
++ * @gid: GID content
++ * @attr: Attributes of the GID
++ *
++ * Returns 0 on success or appropriate error code. It accepts zero
++ * GID addition for non RoCE ports for HCA's who report them as valid
++ * GID. However such zero GIDs are not added to the cache.
++ */
++static int add_modify_gid(struct ib_gid_table *table,
++ const union ib_gid *gid,
++ const struct ib_gid_attr *attr)
++{
++ int ret;
++
++ if (rdma_protocol_roce(attr->device, attr->port_num)) {
++ ret = add_roce_gid(table, gid, attr);
++ if (ret)
++ return ret;
++ } else {
++ /*
++ * Some HCA's report multiple GID entries with only one
++ * valid GID, but remaining as zero GID.
++ * So ignore such behavior for IB link layer and don't
++ * fail the call, but don't add such entry to GID cache.
++ */
++ if (!memcmp(gid, &zgid, sizeof(*gid)))
++ return 0;
++ }
++
++ lockdep_assert_held(&table->lock);
++ memcpy(&table->data_vec[attr->index].gid, gid, sizeof(*gid));
++ memcpy(&table->data_vec[attr->index].attr, attr, sizeof(*attr));
++
++ write_lock_irq(&table->rwlock);
++ table->data_vec[attr->index].props &= ~GID_TABLE_ENTRY_INVALID;
++ write_unlock_irq(&table->rwlock);
++ return 0;
++}
++
++/**
++ * del_gid - Delete GID table entry
++ *
++ * @ib_dev: IB device whose GID entry to be deleted
++ * @port: Port number of the IB device
++ * @table: GID table of the IB device for a port
++ * @ix: GID entry index to delete
++ *
++ */
++static void del_gid(struct ib_device *ib_dev, u8 port,
++ struct ib_gid_table *table, int ix)
++{
++ lockdep_assert_held(&table->lock);
++ write_lock_irq(&table->rwlock);
++ table->data_vec[ix].props |= GID_TABLE_ENTRY_INVALID;
++ write_unlock_irq(&table->rwlock);
++
++ if (rdma_protocol_roce(ib_dev, port))
++ del_roce_gid(ib_dev, port, table, ix);
++ memcpy(&table->data_vec[ix].gid, &zgid, sizeof(zgid));
++ memset(&table->data_vec[ix].attr, 0, sizeof(table->data_vec[ix].attr));
++ table->data_vec[ix].context = NULL;
+ }
+
+-/* rwlock should be read locked */
++/* rwlock should be read locked, or lock should be held */
+ static int find_gid(struct ib_gid_table *table, const union ib_gid *gid,
+ const struct ib_gid_attr *val, bool default_gid,
+ unsigned long mask, int *pempty)
+@@ -266,15 +286,32 @@ static int find_gid(struct ib_gid_table
+
+ i++;
+
++ /* find_gid() is used during GID addition where it is expected
++ * to return a free entry slot which is not duplicate.
++ * Free entry slot is requested and returned if pempty is set,
++ * so lookup free slot only if requested.
++ */
++ if (pempty && empty < 0) {
++ if (data->props & GID_TABLE_ENTRY_INVALID) {
++ /* Found an invalid (free) entry; allocate it */
++ if (data->props & GID_TABLE_ENTRY_DEFAULT) {
++ if (default_gid)
++ empty = curr_index;
++ } else {
++ empty = curr_index;
++ }
++ }
++ }
++
++ /*
++ * Additionally find_gid() is used to find valid entry during
++ * lookup operation, where validity needs to be checked. So
++ * find the empty entry first to continue to search for a free
++ * slot and ignore its INVALID flag.
++ */
+ if (data->props & GID_TABLE_ENTRY_INVALID)
+ continue;
+
+- if (empty < 0)
+- if (!memcmp(&data->gid, &zgid, sizeof(*gid)) &&
+- !memcmp(attr, &zattr, sizeof(*attr)) &&
+- !data->props)
+- empty = curr_index;
+-
+ if (found >= 0)
+ continue;
+
+@@ -310,20 +347,56 @@ static void make_default_gid(struct net
+ addrconf_ifid_eui48(&gid->raw[8], dev);
+ }
+
+-int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
+- union ib_gid *gid, struct ib_gid_attr *attr)
++static int __ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
++ union ib_gid *gid, struct ib_gid_attr *attr,
++ unsigned long mask, bool default_gid)
+ {
+ struct ib_gid_table *table;
+- int ix;
+ int ret = 0;
+- struct net_device *idev;
+ int empty;
++ int ix;
+
+- table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
+-
++ /* Do not allow adding zero GID in support of
++ * IB spec version 1.3 section 4.1.1 point (6) and
++ * section 12.7.10 and section 12.7.20
++ */
+ if (!memcmp(gid, &zgid, sizeof(*gid)))
+ return -EINVAL;
+
++ table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
++
++ mutex_lock(&table->lock);
++
++ ix = find_gid(table, gid, attr, default_gid, mask, &empty);
++ if (ix >= 0)
++ goto out_unlock;
++
++ if (empty < 0) {
++ ret = -ENOSPC;
++ goto out_unlock;
++ }
++ attr->device = ib_dev;
++ attr->index = empty;
++ attr->port_num = port;
++ ret = add_modify_gid(table, gid, attr);
++ if (!ret)
++ dispatch_gid_change_event(ib_dev, port);
++
++out_unlock:
++ mutex_unlock(&table->lock);
++ if (ret)
++ pr_warn("%s: unable to add gid %pI6 error=%d\n",
++ __func__, gid->raw, ret);
++ return ret;
++}
++
++int ib_cache_gid_add(struct ib_device *ib_dev, u8 port,
++ union ib_gid *gid, struct ib_gid_attr *attr)
++{
++ struct net_device *idev;
++ unsigned long mask;
++ int ret;
++
+ if (ib_dev->get_netdev) {
+ idev = ib_dev->get_netdev(ib_dev, port);
+ if (idev && attr->ndev != idev) {
+@@ -340,27 +413,11 @@ int ib_cache_gid_add(struct ib_device *i
+ dev_put(idev);
+ }
+
+- mutex_lock(&table->lock);
+- write_lock_irq(&table->rwlock);
+-
+- ix = find_gid(table, gid, attr, false, GID_ATTR_FIND_MASK_GID |
+- GID_ATTR_FIND_MASK_GID_TYPE |
+- GID_ATTR_FIND_MASK_NETDEV, &empty);
+- if (ix >= 0)
+- goto out_unlock;
+-
+- if (empty < 0) {
+- ret = -ENOSPC;
+- goto out_unlock;
+- }
+-
+- ret = add_gid(ib_dev, port, table, empty, gid, attr, false);
+- if (!ret)
+- dispatch_gid_change_event(ib_dev, port);
++ mask = GID_ATTR_FIND_MASK_GID |
++ GID_ATTR_FIND_MASK_GID_TYPE |
++ GID_ATTR_FIND_MASK_NETDEV;
+
+-out_unlock:
+- write_unlock_irq(&table->rwlock);
+- mutex_unlock(&table->lock);
++ ret = __ib_cache_gid_add(ib_dev, port, gid, attr, mask, false);
+ return ret;
+ }
+
+@@ -368,29 +425,32 @@ int ib_cache_gid_del(struct ib_device *i
+ union ib_gid *gid, struct ib_gid_attr *attr)
+ {
+ struct ib_gid_table *table;
++ int ret = 0;
+ int ix;
+
+ table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
+
+ mutex_lock(&table->lock);
+- write_lock_irq(&table->rwlock);
+
+ ix = find_gid(table, gid, attr, false,
+ GID_ATTR_FIND_MASK_GID |
+ GID_ATTR_FIND_MASK_GID_TYPE |
+- GID_ATTR_FIND_MASK_NETDEV |
+- GID_ATTR_FIND_MASK_DEFAULT,
++ GID_ATTR_FIND_MASK_NETDEV,
+ NULL);
+- if (ix < 0)
++ if (ix < 0) {
++ ret = -EINVAL;
+ goto out_unlock;
++ }
+
+- if (!del_gid(ib_dev, port, table, ix, false))
+- dispatch_gid_change_event(ib_dev, port);
++ del_gid(ib_dev, port, table, ix);
++ dispatch_gid_change_event(ib_dev, port);
+
+ out_unlock:
+- write_unlock_irq(&table->rwlock);
+ mutex_unlock(&table->lock);
+- return 0;
++ if (ret)
++ pr_debug("%s: can't delete gid %pI6 error=%d\n",
++ __func__, gid->raw, ret);
++ return ret;
+ }
+
+ int ib_cache_gid_del_all_netdev_gids(struct ib_device *ib_dev, u8 port,
+@@ -403,16 +463,14 @@ int ib_cache_gid_del_all_netdev_gids(str
+ table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
+
+ mutex_lock(&table->lock);
+- write_lock_irq(&table->rwlock);
+
+- for (ix = 0; ix < table->sz; ix++)
+- if (table->data_vec[ix].attr.ndev == ndev)
+- if (!del_gid(ib_dev, port, table, ix,
+- !!(table->data_vec[ix].props &
+- GID_TABLE_ENTRY_DEFAULT)))
+- deleted = true;
++ for (ix = 0; ix < table->sz; ix++) {
++ if (table->data_vec[ix].attr.ndev == ndev) {
++ del_gid(ib_dev, port, table, ix);
++ deleted = true;
++ }
++ }
+
+- write_unlock_irq(&table->rwlock);
+ mutex_unlock(&table->lock);
+
+ if (deleted)
+@@ -609,6 +667,7 @@ static struct ib_gid_table *alloc_gid_ta
+ {
+ struct ib_gid_table *table =
+ kzalloc(sizeof(struct ib_gid_table), GFP_KERNEL);
++ int i;
+
+ if (!table)
+ return NULL;
+@@ -622,6 +681,11 @@ static struct ib_gid_table *alloc_gid_ta
+ table->sz = sz;
+ rwlock_init(&table->rwlock);
+
++ /* Mark all entries as invalid so that allocator can allocate
++ * one of the invalid (free) entry.
++ */
++ for (i = 0; i < sz; i++)
++ table->data_vec[i].props |= GID_TABLE_ENTRY_INVALID;
+ return table;
+
+ err_free_table:
+@@ -646,16 +710,15 @@ static void cleanup_gid_table_port(struc
+ if (!table)
+ return;
+
+- write_lock_irq(&table->rwlock);
++ mutex_lock(&table->lock);
+ for (i = 0; i < table->sz; ++i) {
+ if (memcmp(&table->data_vec[i].gid, &zgid,
+- sizeof(table->data_vec[i].gid)))
+- if (!del_gid(ib_dev, port, table, i,
+- table->data_vec[i].props &
+- GID_ATTR_FIND_MASK_DEFAULT))
+- deleted = true;
++ sizeof(table->data_vec[i].gid))) {
++ del_gid(ib_dev, port, table, i);
++ deleted = true;
++ }
+ }
+- write_unlock_irq(&table->rwlock);
++ mutex_unlock(&table->lock);
+
+ if (deleted)
+ dispatch_gid_change_event(ib_dev, port);
+@@ -668,9 +731,9 @@ void ib_cache_gid_set_default_gid(struct
+ {
+ union ib_gid gid;
+ struct ib_gid_attr gid_attr;
+- struct ib_gid_attr zattr_type = zattr;
+ struct ib_gid_table *table;
+ unsigned int gid_type;
++ unsigned long mask;
+
+ table = ib_dev->cache.ports[port - rdma_start_port(ib_dev)].gid;
+
+@@ -679,60 +742,19 @@ void ib_cache_gid_set_default_gid(struct
+ gid_attr.ndev = ndev;
+
+ for (gid_type = 0; gid_type < IB_GID_TYPE_SIZE; ++gid_type) {
+- int ix;
+- union ib_gid current_gid;
+- struct ib_gid_attr current_gid_attr = {};
+-
+ if (1UL << gid_type & ~gid_type_mask)
+ continue;
+
+ gid_attr.gid_type = gid_type;
+
+- mutex_lock(&table->lock);
+- write_lock_irq(&table->rwlock);
+- ix = find_gid(table, NULL, &gid_attr, true,
+- GID_ATTR_FIND_MASK_GID_TYPE |
+- GID_ATTR_FIND_MASK_DEFAULT,
+- NULL);
+-
+- /* Coudn't find default GID location */
+- if (WARN_ON(ix < 0))
+- goto release;
+-
+- zattr_type.gid_type = gid_type;
+-
+- if (!__ib_cache_gid_get(ib_dev, port, ix,
+- &current_gid, &current_gid_attr) &&
+- mode == IB_CACHE_GID_DEFAULT_MODE_SET &&
+- !memcmp(&gid, &current_gid, sizeof(gid)) &&
+- !memcmp(&gid_attr, &current_gid_attr, sizeof(gid_attr)))
+- goto release;
+-
+- if (memcmp(&current_gid, &zgid, sizeof(current_gid)) ||
+- memcmp(&current_gid_attr, &zattr_type,
+- sizeof(current_gid_attr))) {
+- if (del_gid(ib_dev, port, table, ix, true)) {
+- pr_warn("ib_cache_gid: can't delete index %d for default gid %pI6\n",
+- ix, gid.raw);
+- goto release;
+- } else {
+- dispatch_gid_change_event(ib_dev, port);
+- }
+- }
+-
+ if (mode == IB_CACHE_GID_DEFAULT_MODE_SET) {
+- if (add_gid(ib_dev, port, table, ix, &gid, &gid_attr, true))
+- pr_warn("ib_cache_gid: unable to add default gid %pI6\n",
+- gid.raw);
+- else
+- dispatch_gid_change_event(ib_dev, port);
++ mask = GID_ATTR_FIND_MASK_GID_TYPE |
++ GID_ATTR_FIND_MASK_DEFAULT;
++ __ib_cache_gid_add(ib_dev, port, &gid,
++ &gid_attr, mask, true);
++ } else if (mode == IB_CACHE_GID_DEFAULT_MODE_DELETE) {
++ ib_cache_gid_del(ib_dev, port, &gid, &gid_attr);
+ }
+-
+-release:
+- if (current_gid_attr.ndev)
+- dev_put(current_gid_attr.ndev);
+- write_unlock_irq(&table->rwlock);
+- mutex_unlock(&table->lock);
+ }
+ }
+
+@@ -1057,25 +1079,50 @@ int ib_get_cached_port_state(struct ib_d
+ }
+ EXPORT_SYMBOL(ib_get_cached_port_state);
+
++static int config_non_roce_gid_cache(struct ib_device *device,
++ u8 port, int gid_tbl_len)
++{
++ struct ib_gid_attr gid_attr = {};
++ struct ib_gid_table *table;
++ union ib_gid gid;
++ int ret = 0;
++ int i;
++
++ gid_attr.device = device;
++ gid_attr.port_num = port;
++ table = device->cache.ports[port - rdma_start_port(device)].gid;
++
++ mutex_lock(&table->lock);
++ for (i = 0; i < gid_tbl_len; ++i) {
++ if (!device->query_gid)
++ continue;
++ ret = device->query_gid(device, port, i, &gid);
++ if (ret) {
++ pr_warn("query_gid failed (%d) for %s (index %d)\n",
++ ret, device->name, i);
++ goto err;
++ }
++ gid_attr.index = i;
++ add_modify_gid(table, &gid, &gid_attr);
++ }
++err:
++ mutex_unlock(&table->lock);
++ return ret;
++}
++
+ static void ib_cache_update(struct ib_device *device,
+ u8 port,
+ bool enforce_security)
+ {
+ struct ib_port_attr *tprops = NULL;
+ struct ib_pkey_cache *pkey_cache = NULL, *old_pkey_cache;
+- struct ib_gid_cache {
+- int table_len;
+- union ib_gid table[0];
+- } *gid_cache = NULL;
+ int i;
+ int ret;
+ struct ib_gid_table *table;
+- bool use_roce_gid_table;
+
+ if (!rdma_is_port_valid(device, port))
+ return;
+
+- use_roce_gid_table = rdma_protocol_roce(device, port);
+ table = device->cache.ports[port - rdma_start_port(device)].gid;
+
+ tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
+@@ -1089,6 +1136,13 @@ static void ib_cache_update(struct ib_de
+ goto err;
+ }
+
++ if (!rdma_protocol_roce(device, port)) {
++ ret = config_non_roce_gid_cache(device, port,
++ tprops->gid_tbl_len);
++ if (ret)
++ goto err;
++ }
++
+ pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
+ sizeof *pkey_cache->table, GFP_KERNEL);
+ if (!pkey_cache)
+@@ -1096,15 +1150,6 @@ static void ib_cache_update(struct ib_de
+
+ pkey_cache->table_len = tprops->pkey_tbl_len;
+
+- if (!use_roce_gid_table) {
+- gid_cache = kmalloc(sizeof(*gid_cache) + tprops->gid_tbl_len *
+- sizeof(*gid_cache->table), GFP_KERNEL);
+- if (!gid_cache)
+- goto err;
+-
+- gid_cache->table_len = tprops->gid_tbl_len;
+- }
+-
+ for (i = 0; i < pkey_cache->table_len; ++i) {
+ ret = ib_query_pkey(device, port, i, pkey_cache->table + i);
+ if (ret) {
+@@ -1114,33 +1159,12 @@ static void ib_cache_update(struct ib_de
+ }
+ }
+
+- if (!use_roce_gid_table) {
+- for (i = 0; i < gid_cache->table_len; ++i) {
+- ret = device->query_gid(device, port, i,
+- gid_cache->table + i);
+- if (ret) {
+- pr_warn("ib_query_gid failed (%d) for %s (index %d)\n",
+- ret, device->name, i);
+- goto err;
+- }
+- }
+- }
+-
+ write_lock_irq(&device->cache.lock);
+
+ old_pkey_cache = device->cache.ports[port -
+ rdma_start_port(device)].pkey;
+
+ device->cache.ports[port - rdma_start_port(device)].pkey = pkey_cache;
+- if (!use_roce_gid_table) {
+- write_lock(&table->rwlock);
+- for (i = 0; i < gid_cache->table_len; i++) {
+- modify_gid(device, port, table, i, gid_cache->table + i,
+- &zattr, false);
+- }
+- write_unlock(&table->rwlock);
+- }
+-
+ device->cache.ports[port - rdma_start_port(device)].lmc = tprops->lmc;
+ device->cache.ports[port - rdma_start_port(device)].port_state =
+ tprops->state;
+@@ -1154,14 +1178,12 @@ static void ib_cache_update(struct ib_de
+ port,
+ tprops->subnet_prefix);
+
+- kfree(gid_cache);
+ kfree(old_pkey_cache);
+ kfree(tprops);
+ return;
+
+ err:
+ kfree(pkey_cache);
+- kfree(gid_cache);
+ kfree(tprops);
+ }
+
+--- a/drivers/infiniband/core/sysfs.c
++++ b/drivers/infiniband/core/sysfs.c
+@@ -389,14 +389,26 @@ static ssize_t show_port_gid(struct ib_p
+ {
+ struct port_table_attribute *tab_attr =
+ container_of(attr, struct port_table_attribute, attr);
++ union ib_gid *pgid;
+ union ib_gid gid;
+ ssize_t ret;
+
+ ret = ib_query_gid(p->ibdev, p->port_num, tab_attr->index, &gid, NULL);
+- if (ret)
+- return ret;
+
+- return sprintf(buf, "%pI6\n", gid.raw);
++ /* If reading GID fails, it is likely due to GID entry being empty
++ * (invalid) or reserved GID in the table.
++ * User space expects to read GID table entries as long as it given
++ * index is within GID table size.
++ * Administrative/debugging tool fails to query rest of the GID entries
++ * if it hits error while querying a GID of the given index.
++ * To avoid user space throwing such error on fail to read gid, return
++ * zero GID as before. This maintains backward compatibility.
++ */
++ if (ret)
++ pgid = &zgid;
++ else
++ pgid = &gid;
++ return sprintf(buf, "%pI6\n", pgid->raw);
+ }
+
+ static ssize_t show_port_gid_attr_ndev(struct ib_port *p,
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -91,8 +91,11 @@ enum ib_gid_type {
+
+ #define ROCE_V2_UDP_DPORT 4791
+ struct ib_gid_attr {
+- enum ib_gid_type gid_type;
+ struct net_device *ndev;
++ struct ib_device *device;
++ enum ib_gid_type gid_type;
++ u16 index;
++ u8 port_num;
+ };
+
+ enum rdma_node_type {
diff --git a/patches.drivers/IB-core-Refactor-ib_init_ah_attr_from_path-for-RoCE.patch b/patches.drivers/IB-core-Refactor-ib_init_ah_attr_from_path-for-RoCE.patch
new file mode 100644
index 0000000000..916383d11f
--- /dev/null
+++ b/patches.drivers/IB-core-Refactor-ib_init_ah_attr_from_path-for-RoCE.patch
@@ -0,0 +1,267 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:20 +0200
+Subject: IB/core: Refactor ib_init_ah_attr_from_path() for RoCE
+Patch-mainline: v4.17-rc1
+Git-commit: 0a5141593567fca3e1d64da756b8d1b490f6c600
+References: bsc#1103992 FATE#326009
+
+Resolving route for RoCE for a path record is needed only for the
+received CM requests.
+Therefore,
+(a) ib_init_ah_attr_from_path() is refactored first to isolate the
+code of resolving route.
+(b) Setting dlid, path bits is not needed for RoCE.
+
+Additionally ah attribute initialization is done from the path record
+entry, so it is better to refer to path record entry type for
+different link layer instead of ah attribute type while initializing
+ah attribute itself.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/sa_query.c | 201 +++++++++++++++++++------------------
+ include/rdma/ib_sa.h | 5
+ 2 files changed, 109 insertions(+), 97 deletions(-)
+
+--- a/drivers/infiniband/core/sa_query.c
++++ b/drivers/infiniband/core/sa_query.c
+@@ -1227,118 +1227,125 @@ static u8 get_src_path_mask(struct ib_de
+ return src_path_mask;
+ }
+
+-int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
+- struct sa_path_rec *rec,
+- struct rdma_ah_attr *ah_attr)
++static int
++roce_resolve_route_from_path(struct ib_device *device, u8 port_num,
++ struct sa_path_rec *rec)
+ {
++ struct net_device *resolved_dev;
++ struct net_device *ndev;
++ struct net_device *idev;
++ struct rdma_dev_addr dev_addr = {
++ .bound_dev_if = ((sa_path_get_ifindex(rec) >= 0) ?
++ sa_path_get_ifindex(rec) : 0),
++ .net = sa_path_get_ndev(rec) ?
++ sa_path_get_ndev(rec) :
++ &init_net
++ };
++ union {
++ struct sockaddr _sockaddr;
++ struct sockaddr_in _sockaddr_in;
++ struct sockaddr_in6 _sockaddr_in6;
++ } sgid_addr, dgid_addr;
+ int ret;
+- u16 gid_index;
+- int use_roce;
+- struct net_device *ndev = NULL;
+
+- memset(ah_attr, 0, sizeof *ah_attr);
+- ah_attr->type = rdma_ah_find_type(device, port_num);
++ if (!device->get_netdev)
++ return -EOPNOTSUPP;
++
++ rdma_gid2ip(&sgid_addr._sockaddr, &rec->sgid);
++ rdma_gid2ip(&dgid_addr._sockaddr, &rec->dgid);
+
+- rdma_ah_set_dlid(ah_attr, be32_to_cpu(sa_path_get_dlid(rec)));
++ /* validate the route */
++ ret = rdma_resolve_ip_route(&sgid_addr._sockaddr,
++ &dgid_addr._sockaddr, &dev_addr);
++ if (ret)
++ return ret;
++
++ if ((dev_addr.network == RDMA_NETWORK_IPV4 ||
++ dev_addr.network == RDMA_NETWORK_IPV6) &&
++ rec->rec_type != SA_PATH_REC_TYPE_ROCE_V2)
++ return -EINVAL;
++
++ idev = device->get_netdev(device, port_num);
++ if (!idev)
++ return -ENODEV;
++
++ resolved_dev = dev_get_by_index(dev_addr.net,
++ dev_addr.bound_dev_if);
++ if (!resolved_dev) {
++ ret = -ENODEV;
++ goto done;
++ }
++ ndev = ib_get_ndev_from_path(rec);
++ rcu_read_lock();
++ if ((ndev && ndev != resolved_dev) ||
++ (resolved_dev != idev &&
++ !rdma_is_upper_dev_rcu(idev, resolved_dev)))
++ ret = -EHOSTUNREACH;
++ rcu_read_unlock();
++ dev_put(resolved_dev);
++ if (ndev)
++ dev_put(ndev);
++done:
++ dev_put(idev);
++ return ret;
++}
++
++static int init_ah_attr_grh_fields(struct ib_device *device, u8 port_num,
++ struct sa_path_rec *rec,
++ struct rdma_ah_attr *ah_attr)
++{
++ enum ib_gid_type type = sa_conv_pathrec_to_gid_type(rec);
++ struct net_device *ndev;
++ u16 gid_index;
++ int ret;
++
++ ndev = ib_get_ndev_from_path(rec);
++ ret = ib_find_cached_gid_by_port(device, &rec->sgid, type,
++ port_num, ndev, &gid_index);
++ if (ndev)
++ dev_put(ndev);
++ if (ret)
++ return ret;
++
++ rdma_ah_set_grh(ah_attr, &rec->dgid,
++ be32_to_cpu(rec->flow_label),
++ gid_index, rec->hop_limit,
++ rec->traffic_class);
++ return 0;
++}
+
+- if ((ah_attr->type == RDMA_AH_ATTR_TYPE_OPA) &&
+- (rdma_ah_get_dlid(ah_attr) == be16_to_cpu(IB_LID_PERMISSIVE)))
+- rdma_ah_set_make_grd(ah_attr, true);
++int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
++ struct sa_path_rec *rec,
++ struct rdma_ah_attr *ah_attr)
++{
++ int ret = 0;
+
++ memset(ah_attr, 0, sizeof(*ah_attr));
++ ah_attr->type = rdma_ah_find_type(device, port_num);
+ rdma_ah_set_sl(ah_attr, rec->sl);
+- rdma_ah_set_path_bits(ah_attr, be32_to_cpu(sa_path_get_slid(rec)) &
+- get_src_path_mask(device, port_num));
+ rdma_ah_set_port_num(ah_attr, port_num);
+ rdma_ah_set_static_rate(ah_attr, rec->rate);
+- use_roce = rdma_cap_eth_ah(device, port_num);
+
+- if (use_roce) {
+- struct net_device *idev;
+- struct net_device *resolved_dev;
+- struct rdma_dev_addr dev_addr = {
+- .bound_dev_if = ((sa_path_get_ifindex(rec) >= 0) ?
+- sa_path_get_ifindex(rec) : 0),
+- .net = sa_path_get_ndev(rec) ?
+- sa_path_get_ndev(rec) :
+- &init_net
+- };
+- union {
+- struct sockaddr _sockaddr;
+- struct sockaddr_in _sockaddr_in;
+- struct sockaddr_in6 _sockaddr_in6;
+- } sgid_addr, dgid_addr;
+-
+- if (!device->get_netdev)
+- return -EOPNOTSUPP;
+-
+- rdma_gid2ip(&sgid_addr._sockaddr, &rec->sgid);
+- rdma_gid2ip(&dgid_addr._sockaddr, &rec->dgid);
+-
+- /* validate the route */
+- ret = rdma_resolve_ip_route(&sgid_addr._sockaddr,
+- &dgid_addr._sockaddr, &dev_addr);
++ if (sa_path_is_roce(rec)) {
++ ret = roce_resolve_route_from_path(device, port_num, rec);
+ if (ret)
+ return ret;
+
+- if ((dev_addr.network == RDMA_NETWORK_IPV4 ||
+- dev_addr.network == RDMA_NETWORK_IPV6) &&
+- rec->rec_type != SA_PATH_REC_TYPE_ROCE_V2)
+- return -EINVAL;
+-
+- idev = device->get_netdev(device, port_num);
+- if (!idev)
+- return -ENODEV;
+-
+- resolved_dev = dev_get_by_index(dev_addr.net,
+- dev_addr.bound_dev_if);
+- if (!resolved_dev) {
+- dev_put(idev);
+- return -ENODEV;
+- }
+- ndev = ib_get_ndev_from_path(rec);
+- rcu_read_lock();
+- if ((ndev && ndev != resolved_dev) ||
+- (resolved_dev != idev &&
+- !rdma_is_upper_dev_rcu(idev, resolved_dev)))
+- ret = -EHOSTUNREACH;
+- rcu_read_unlock();
+- dev_put(idev);
+- dev_put(resolved_dev);
+- if (ret) {
+- if (ndev)
+- dev_put(ndev);
+- return ret;
+- }
++ memcpy(ah_attr->roce.dmac, sa_path_get_dmac(rec), ETH_ALEN);
++ } else {
++ rdma_ah_set_dlid(ah_attr, be32_to_cpu(sa_path_get_dlid(rec)));
++ if (sa_path_is_opa(rec) &&
++ rdma_ah_get_dlid(ah_attr) == be16_to_cpu(IB_LID_PERMISSIVE))
++ rdma_ah_set_make_grd(ah_attr, true);
++
++ rdma_ah_set_path_bits(ah_attr,
++ be32_to_cpu(sa_path_get_slid(rec)) &
++ get_src_path_mask(device, port_num));
+ }
+
+- if (rec->hop_limit > 0 || use_roce) {
+- enum ib_gid_type type = sa_conv_pathrec_to_gid_type(rec);
+-
+- ret = ib_find_cached_gid_by_port(device, &rec->sgid, type,
+- port_num, ndev, &gid_index);
+- if (ret) {
+- if (ndev)
+- dev_put(ndev);
+- return ret;
+- }
+-
+- rdma_ah_set_grh(ah_attr, &rec->dgid,
+- be32_to_cpu(rec->flow_label),
+- gid_index, rec->hop_limit,
+- rec->traffic_class);
+- if (ndev)
+- dev_put(ndev);
+- }
+-
+- if (use_roce) {
+- u8 *dmac = sa_path_get_dmac(rec);
+-
+- if (!dmac)
+- return -EINVAL;
+- memcpy(ah_attr->roce.dmac, dmac, ETH_ALEN);
+- }
+-
+- return 0;
++ if (rec->hop_limit > 0 || sa_path_is_roce(rec))
++ ret = init_ah_attr_grh_fields(device, port_num, rec, ah_attr);
++ return ret;
+ }
+ EXPORT_SYMBOL(ib_init_ah_attr_from_path);
+
+--- a/include/rdma/ib_sa.h
++++ b/include/rdma/ib_sa.h
+@@ -590,6 +590,11 @@ static inline bool sa_path_is_roce(struc
+ (rec->rec_type == SA_PATH_REC_TYPE_ROCE_V2));
+ }
+
++static inline bool sa_path_is_opa(struct sa_path_rec *rec)
++{
++ return (rec->rec_type == SA_PATH_REC_TYPE_OPA);
++}
++
+ static inline void sa_path_set_slid(struct sa_path_rec *rec, u32 slid)
+ {
+ if (rec->rec_type == SA_PATH_REC_TYPE_IB)
diff --git a/patches.drivers/IB-core-Refactor-to-avoid-unnecessary-check-on-GID-l.patch b/patches.drivers/IB-core-Refactor-to-avoid-unnecessary-check-on-GID-l.patch
new file mode 100644
index 0000000000..7e381a157d
--- /dev/null
+++ b/patches.drivers/IB-core-Refactor-to-avoid-unnecessary-check-on-GID-l.patch
@@ -0,0 +1,57 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:05 +0200
+Subject: IB/core: Refactor to avoid unnecessary check on GID lookup miss
+Patch-mainline: v4.16-rc1
+Git-commit: 151ed9d7009769207cd71065f64f58e7d73add65
+References: bsc#1103992 FATE#326009
+
+Currently on every gid entry comparison miss found variable is checked;
+which is not needed as those two comparison fail already indicate that
+GID is not found yet.
+So refactor to avoid such check and copy the GID index when found.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 15 ++++++---------
+ 1 file changed, 6 insertions(+), 9 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -573,27 +573,24 @@ static int ib_cache_gid_find_by_filter(s
+ struct ib_gid_attr attr;
+
+ if (table->data_vec[i].props & GID_TABLE_ENTRY_INVALID)
+- goto next;
++ continue;
+
+ if (memcmp(gid, &table->data_vec[i].gid, sizeof(*gid)))
+- goto next;
++ continue;
+
+ memcpy(&attr, &table->data_vec[i].attr, sizeof(attr));
+
+- if (filter(gid, &attr, context))
++ if (filter(gid, &attr, context)) {
+ found = true;
+-
+-next:
+- if (found)
++ if (index)
++ *index = i;
+ break;
++ }
+ }
+ read_unlock_irqrestore(&table->rwlock, flags);
+
+ if (!found)
+ return -ENOENT;
+-
+- if (index)
+- *index = i;
+ return 0;
+ }
+
diff --git a/patches.drivers/IB-core-Refer-to-RoCE-port-property-instead-of-GID-t-98f1f4e0.patch b/patches.drivers/IB-core-Refer-to-RoCE-port-property-instead-of-GID-t-98f1f4e0.patch
new file mode 100644
index 0000000000..ee9afe0bf8
--- /dev/null
+++ b/patches.drivers/IB-core-Refer-to-RoCE-port-property-instead-of-GID-t-98f1f4e0.patch
@@ -0,0 +1,36 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Wed, 21 Mar 2018 17:16:36 +0200
+Subject: IB/core: Refer to RoCE port property instead of GID table property
+Patch-mainline: v4.17-rc1
+Git-commit: 98f1f4e0ed26c97a697f1e007416acbc18f4a8a9
+References: bsc#1103992 FATE#326009
+
+ib_query_gid() in commit [1] refers to RoCE GID table capability of
+the HCA using rdma_cap_roce_gid_table().
+ib_core maintains the GID table cache regardless of the HCA provider
+drivers capability to maintain RoCE GID table.
+Therefore, whether to return a GID table entry from the software cache or
+from HCA should be done based on whether the port is RoCE or not.
+
+[1] commit 03db3a2d81e6 ("IB/core: Add RoCE GID table management")
+
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/device.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/device.c
++++ b/drivers/infiniband/core/device.c
+@@ -877,7 +877,7 @@ int ib_query_gid(struct ib_device *devic
+ u8 port_num, int index, union ib_gid *gid,
+ struct ib_gid_attr *attr)
+ {
+- if (rdma_cap_roce_gid_table(device, port_num))
++ if (rdma_protocol_roce(device, port_num))
+ return ib_get_cached_gid(device, port_num, index, gid, attr);
+
+ if (attr)
diff --git a/patches.drivers/IB-core-Refer-to-RoCE-port-property-to-decide-buildi.patch b/patches.drivers/IB-core-Refer-to-RoCE-port-property-to-decide-buildi.patch
new file mode 100644
index 0000000000..dd4244b128
--- /dev/null
+++ b/patches.drivers/IB-core-Refer-to-RoCE-port-property-to-decide-buildi.patch
@@ -0,0 +1,50 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 25 Mar 2018 13:40:23 +0300
+Subject: IB/core: Refer to RoCE port property to decide building cache
+Patch-mainline: v4.17-rc1
+Git-commit: 190fb9c4d130f23b64d73e9921afb9a502340455
+References: bsc#1103992 FATE#326009
+
+IB core maintains the GID cache entries for the GID table.
+This cache table has to be maintained regardless of HCA's
+support of GID table.
+For IB and iWarp ports, cache is created by querying the HCA.
+For RoCE cache is created based on netdev events.
+
+Therefore just refer to the RoCE port property of the {device, port} to
+decide whether to build cache by querying HCA or from netdev events.
+There is no need to check if HCA support GID table or not.
+
+ib_cache_update() referred to RoCE attribute before validating
+port. Though in all current callers port is valid, it is incorrect
+to query RoCE port property before validating the port. Therefore,
+rdma_protocol_roce() check is done after rdma_is_port_valid() verifies
+that port is valid.
+
+Fixes: 115b68aa6ea4 ("IB/ocrdma: Removed GID add/del null routines")
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -1070,12 +1070,12 @@ static void ib_cache_update(struct ib_de
+ int i;
+ int ret;
+ struct ib_gid_table *table;
+- bool use_roce_gid_table =
+- rdma_cap_roce_gid_table(device, port);
++ bool use_roce_gid_table;
+
+ if (!rdma_is_port_valid(device, port))
+ return;
+
++ use_roce_gid_table = rdma_protocol_roce(device, port);
+ table = device->cache.ports[port - rdma_start_port(device)].gid;
+
+ tprops = kmalloc(sizeof *tprops, GFP_KERNEL);
diff --git a/patches.drivers/IB-core-Remove-rdma_resolve_ip_route-as-exported-sym.patch b/patches.drivers/IB-core-Remove-rdma_resolve_ip_route-as-exported-sym.patch
new file mode 100644
index 0000000000..2afc13fa01
--- /dev/null
+++ b/patches.drivers/IB-core-Remove-rdma_resolve_ip_route-as-exported-sym.patch
@@ -0,0 +1,57 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:16 +0200
+Subject: IB/core: Remove rdma_resolve_ip_route() as exported symbol
+Patch-mainline: v4.17-rc1
+Git-commit: a9c06aeba9977e71b81ef3e107cb588e00dae150
+References: bsc#1103992 FATE#326009
+
+rdma_resolve_ip_route() is used only by ib_core module. Therefore it is
+removed as an exported symbol.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/addr.c | 1 -
+ drivers/infiniband/core/core_priv.h | 6 ++++++
+ include/rdma/ib_addr.h | 4 ----
+ 3 files changed, 6 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/core/addr.c
++++ b/drivers/infiniband/core/addr.c
+@@ -736,7 +736,6 @@ int rdma_resolve_ip_route(struct sockadd
+
+ return addr_resolve(src_in, dst_addr, addr, false, 0);
+ }
+-EXPORT_SYMBOL(rdma_resolve_ip_route);
+
+ void rdma_addr_cancel(struct rdma_dev_addr *addr)
+ {
+--- a/drivers/infiniband/core/core_priv.h
++++ b/drivers/infiniband/core/core_priv.h
+@@ -333,4 +333,10 @@ static inline struct ib_qp *_ib_create_q
+
+ return qp;
+ }
++
++struct rdma_dev_addr;
++int rdma_resolve_ip_route(struct sockaddr *src_addr,
++ const struct sockaddr *dst_addr,
++ struct rdma_dev_addr *addr);
++
+ #endif /* _CORE_PRIV_H */
+--- a/include/rdma/ib_addr.h
++++ b/include/rdma/ib_addr.h
+@@ -119,10 +119,6 @@ int rdma_resolve_ip(struct rdma_addr_cli
+ struct rdma_dev_addr *addr, void *context),
+ void *context);
+
+-int rdma_resolve_ip_route(struct sockaddr *src_addr,
+- const struct sockaddr *dst_addr,
+- struct rdma_dev_addr *addr);
+-
+ void rdma_addr_cancel(struct rdma_dev_addr *addr);
+
+ void rdma_copy_addr(struct rdma_dev_addr *dev_addr,
diff --git a/patches.drivers/IB-core-Remove-the-locking-for-character-device-bitm.patch b/patches.drivers/IB-core-Remove-the-locking-for-character-device-bitm.patch
new file mode 100644
index 0000000000..80b2ba57af
--- /dev/null
+++ b/patches.drivers/IB-core-Remove-the-locking-for-character-device-bitm.patch
@@ -0,0 +1,92 @@
+From: Huy Nguyen <huyn@mellanox.com>
+Date: Mon, 8 Jan 2018 12:15:37 +0200
+Subject: IB/core: Remove the locking for character device bitmaps
+Patch-mainline: v4.16-rc1
+Git-commit: 008b656f429824a1987f28150d66eaf8f26d58a1
+References: bsc#1103992 FATE#326009
+
+Remove the locks that protect character device bitmaps of
+uverbs, umad and issm.
+
+The character device bitmaps are accessed in "client->add" and
+"client->remove" calls from ib_register_device and ib_unregister_device
+respectively. These calls are already protected by the "device_mutex"
+mutex. Thus, the spinlocks are not needed.
+
+Signed-off-by: Huy Nguyen <huyn@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/user_mad.c | 5 -----
+ drivers/infiniband/core/uverbs_main.c | 5 -----
+ 2 files changed, 10 deletions(-)
+
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -129,7 +129,6 @@ static struct class *umad_class;
+
+ static const dev_t base_dev = MKDEV(IB_UMAD_MAJOR, IB_UMAD_MINOR_BASE);
+
+-static DEFINE_SPINLOCK(port_lock);
+ static DECLARE_BITMAP(dev_map, IB_UMAD_MAX_PORTS);
+
+ static void ib_umad_add_one(struct ib_device *device);
+@@ -1172,15 +1171,12 @@ static int ib_umad_init_port(struct ib_d
+ int devnum;
+ dev_t base;
+
+- spin_lock(&port_lock);
+ devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS);
+ if (devnum >= IB_UMAD_MAX_PORTS) {
+- spin_unlock(&port_lock);
+ devnum = find_overflow_devnum(device);
+ if (devnum < 0)
+ return -1;
+
+- spin_lock(&port_lock);
+ port->dev_num = devnum + IB_UMAD_MAX_PORTS;
+ base = devnum + overflow_maj;
+ set_bit(devnum, overflow_map);
+@@ -1189,7 +1185,6 @@ static int ib_umad_init_port(struct ib_d
+ base = devnum + base_dev;
+ set_bit(devnum, dev_map);
+ }
+- spin_unlock(&port_lock);
+
+ port->ib_dev = device;
+ port->port_num = port_num;
+--- a/drivers/infiniband/core/uverbs_main.c
++++ b/drivers/infiniband/core/uverbs_main.c
+@@ -69,7 +69,6 @@ enum {
+
+ static struct class *uverbs_class;
+
+-static DEFINE_SPINLOCK(map_lock);
+ static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES);
+
+ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
+@@ -1062,15 +1061,12 @@ static void ib_uverbs_add_one(struct ib_
+ INIT_LIST_HEAD(&uverbs_dev->uverbs_file_list);
+ INIT_LIST_HEAD(&uverbs_dev->uverbs_events_file_list);
+
+- spin_lock(&map_lock);
+ devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
+ if (devnum >= IB_UVERBS_MAX_DEVICES) {
+- spin_unlock(&map_lock);
+ devnum = find_overflow_devnum();
+ if (devnum < 0)
+ goto err;
+
+- spin_lock(&map_lock);
+ uverbs_dev->devnum = devnum + IB_UVERBS_MAX_DEVICES;
+ base = devnum + overflow_maj;
+ set_bit(devnum, overflow_map);
+@@ -1079,7 +1075,6 @@ static void ib_uverbs_add_one(struct ib_
+ base = devnum + IB_UVERBS_BASE_DEV;
+ set_bit(devnum, dev_map);
+ }
+- spin_unlock(&map_lock);
+
+ rcu_assign_pointer(uverbs_dev->ib_dev, device);
+ uverbs_dev->num_comp_vectors = device->num_comp_vectors;
diff --git a/patches.drivers/IB-core-Remove-unimplemented-ib_peek_cq.patch b/patches.drivers/IB-core-Remove-unimplemented-ib_peek_cq.patch
new file mode 100644
index 0000000000..8503ccaf09
--- /dev/null
+++ b/patches.drivers/IB-core-Remove-unimplemented-ib_peek_cq.patch
@@ -0,0 +1,43 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 19 Mar 2018 08:07:14 +0200
+Subject: IB/core: Remove unimplemented ib_peek_cq
+Patch-mainline: v4.17-rc1
+Git-commit: b19744e965abed7ad0167c25097f405b88ce5d13
+References: bsc#1103992 FATE#326009
+
+ib_peek_cq() verb doesn't seem be implemented in current code.
+There is some past reference to it at [1] about it being unimplemented.
+
+Lot of user documentation created out of kdoc refers to this
+unimplemented API. Therefore, remove unimplemented API.
+
+[1] http://lists.openfabrics.org/pipermail/ofw/2008-May/002465.html
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ include/rdma/ib_verbs.h | 12 ------------
+ 1 file changed, 12 deletions(-)
+
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -3222,18 +3222,6 @@ static inline int ib_poll_cq(struct ib_c
+ }
+
+ /**
+- * ib_peek_cq - Returns the number of unreaped completions currently
+- * on the specified CQ.
+- * @cq: The CQ to peek.
+- * @wc_cnt: A minimum number of unreaped completions to check for.
+- *
+- * If the number of unreaped completions is greater than or equal to wc_cnt,
+- * this function returns wc_cnt, otherwise, it returns the actual number of
+- * unreaped completions.
+- */
+-int ib_peek_cq(struct ib_cq *cq, int wc_cnt);
+-
+-/**
+ * ib_req_notify_cq - Request completion notification on a CQ.
+ * @cq: The CQ to generate an event for.
+ * @flags:
diff --git a/patches.drivers/IB-core-Removed-unused-function.patch b/patches.drivers/IB-core-Removed-unused-function.patch
new file mode 100644
index 0000000000..eda42c502d
--- /dev/null
+++ b/patches.drivers/IB-core-Removed-unused-function.patch
@@ -0,0 +1,62 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:09 +0200
+Subject: IB/core: Removed unused function
+Patch-mainline: v4.16-rc1
+Git-commit: 699a83f1eba0f2aa6850e1080a9f4466d8092b7b
+References: bsc#1103992 FATE#326009
+
+rdma_addr_find_smac_by_sgid() is exported symbol not used by any kernel
+module. Therefore its removed.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/addr.c | 23 -----------------------
+ include/rdma/ib_addr.h | 1 -
+ 2 files changed, 24 deletions(-)
+
+--- a/drivers/infiniband/core/addr.c
++++ b/drivers/infiniband/core/addr.c
+@@ -793,29 +793,6 @@ int rdma_addr_find_l2_eth_by_grh(const u
+ return 0;
+ }
+
+-int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id)
+-{
+- int ret = 0;
+- struct rdma_dev_addr dev_addr;
+- union {
+- struct sockaddr _sockaddr;
+- struct sockaddr_in _sockaddr_in;
+- struct sockaddr_in6 _sockaddr_in6;
+- } gid_addr;
+-
+- rdma_gid2ip(&gid_addr._sockaddr, sgid);
+-
+- memset(&dev_addr, 0, sizeof(dev_addr));
+- dev_addr.net = &init_net;
+- ret = rdma_translate_ip(&gid_addr._sockaddr, &dev_addr, vlan_id);
+- if (ret)
+- return ret;
+-
+- memcpy(smac, dev_addr.src_dev_addr, ETH_ALEN);
+- return ret;
+-}
+-EXPORT_SYMBOL(rdma_addr_find_smac_by_sgid);
+-
+ static int netevent_callback(struct notifier_block *self, unsigned long event,
+ void *ctx)
+ {
+--- a/include/rdma/ib_addr.h
++++ b/include/rdma/ib_addr.h
+@@ -131,7 +131,6 @@ void rdma_copy_addr(struct rdma_dev_addr
+
+ int rdma_addr_size(struct sockaddr *addr);
+
+-int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
+ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
+ const union ib_gid *dgid,
+ u8 *dmac, const struct net_device *ndev,
diff --git a/patches.drivers/IB-core-Search-GID-only-for-IB-link-layer.patch b/patches.drivers/IB-core-Search-GID-only-for-IB-link-layer.patch
new file mode 100644
index 0000000000..858134ee27
--- /dev/null
+++ b/patches.drivers/IB-core-Search-GID-only-for-IB-link-layer.patch
@@ -0,0 +1,32 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 25 Mar 2018 13:40:22 +0300
+Subject: IB/core: Search GID only for IB link layer
+Patch-mainline: v4.17-rc1
+Git-commit: 22d24f75a19399bd8c4822541c60e853a16a1956
+References: bsc#1103992 FATE#326009
+
+Even though API is only used by IPoIB driver, its incorrect to refer
+RoCE GID table property to search for GID.
+
+Look for only IB link layer to search for the GID.
+
+Fixes: dbb12562f7c2 ("IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link layer")
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/device.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/device.c
++++ b/drivers/infiniband/core/device.c
+@@ -1060,7 +1060,7 @@ int ib_find_gid(struct ib_device *device
+ int ret, port, i;
+
+ for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) {
+- if (rdma_cap_roce_gid_table(device, port))
++ if (!rdma_protocol_ib(device, port))
+ continue;
+
+ for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) {
diff --git a/patches.drivers/IB-core-Set-speed-string-to-SDR-for-invalid-active-r.patch b/patches.drivers/IB-core-Set-speed-string-to-SDR-for-invalid-active-r.patch
new file mode 100644
index 0000000000..c7648941e6
--- /dev/null
+++ b/patches.drivers/IB-core-Set-speed-string-to-SDR-for-invalid-active-r.patch
@@ -0,0 +1,32 @@
+From: Honggang Li <honli@redhat.com>
+Date: Thu, 15 Mar 2018 17:02:13 +0800
+Subject: IB/core: Set speed string to SDR for invalid active rates
+Patch-mainline: v4.17-rc1
+Git-commit: 311d0da97480d19d4ecd57f3ee264e3c232d78e5
+References: bsc#1103992 FATE#326009
+
+Before commit f1b65df5a232 ("IB/mlx5: Add support for active_width and
+active_speed in RoCE"), the mlx5_ib driver set default active_width and
+active_speed to IB_WIDTH_4X and IB_SPEED_QDR.
+
+Now, the active_width and active_speed are zeros if the RoCE port
+is in DOWN state. The speed string should be set to " SDR" instead of
+a blank string when active_speed is zero.
+
+Signed-off-by: Honggang Li <honli@redhat.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/sysfs.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/infiniband/core/sysfs.c
++++ b/drivers/infiniband/core/sysfs.c
+@@ -273,6 +273,7 @@ static ssize_t rate_show(struct ib_port
+ break;
+ case IB_SPEED_SDR:
+ default: /* default to SDR for invalid rates */
++ speed = " SDR";
+ rate = 25;
+ break;
+ }
diff --git a/patches.drivers/IB-core-Simplify-ib_query_gid-to-always-refer-to-cac.patch b/patches.drivers/IB-core-Simplify-ib_query_gid-to-always-refer-to-cac.patch
new file mode 100644
index 0000000000..19d6f39ef0
--- /dev/null
+++ b/patches.drivers/IB-core-Simplify-ib_query_gid-to-always-refer-to-cac.patch
@@ -0,0 +1,93 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Sun, 1 Apr 2018 15:08:20 +0300
+Subject: IB/core: Simplify ib_query_gid to always refer to cache
+Patch-mainline: v4.17-rc1
+Git-commit: f35faa4ba9568138eea1c58abb92e8ef415dce41
+References: bsc#1103992 FATE#326009
+
+Currently following inconsistencies exist.
+1. ib_query_gid() returns GID from the software cache for a RoCE port
+and returns GID from the HCA for an IB port.
+This is incorrect because software GID cache is maintained regardless
+of HCA port type.
+
+2. GID is queries from the HCA via ib_query_gid and updated in the
+software cache for IB link layer. Both of them might not be in sync.
+
+ULPs such as SRP initiator, SRP target, IPoIB driver have historically
+used ib_query_gid() API to query the GID. However CM used cached version
+during CM processing, When software cache was introduced, this
+inconsitency remained.
+
+In order to simplify, improve readability and avoid link layer
+specific above inconsistencies, this patch brings following changes.
+
+1. ib_query_gid() always refers to the cache layer regardless of link
+layer.
+
+2. cache module who reads the GID entry from HCA and builds the cache,
+directly invokes the HCA provider verb's query_gid() callback function.
+
+3. ib_query_port() is being called in early stage where GID cache is not
+yet build while reading port immutable property. Therefore it needs to
+read the default GID from the HCA for IB link layer to publish the
+subnet prefix.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 4 ++--
+ drivers/infiniband/core/device.c | 15 +++------------
+ 2 files changed, 5 insertions(+), 14 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -1116,8 +1116,8 @@ static void ib_cache_update(struct ib_de
+
+ if (!use_roce_gid_table) {
+ for (i = 0; i < gid_cache->table_len; ++i) {
+- ret = ib_query_gid(device, port, i,
+- gid_cache->table + i, NULL);
++ ret = device->query_gid(device, port, i,
++ gid_cache->table + i);
+ if (ret) {
+ pr_warn("ib_query_gid failed (%d) for %s (index %d)\n",
+ ret, device->name, i);
+--- a/drivers/infiniband/core/device.c
++++ b/drivers/infiniband/core/device.c
+@@ -852,7 +852,7 @@ int ib_query_port(struct ib_device *devi
+ if (rdma_port_get_link_layer(device, port_num) != IB_LINK_LAYER_INFINIBAND)
+ return 0;
+
+- err = ib_query_gid(device, port_num, 0, &gid, NULL);
++ err = device->query_gid(device, port_num, 0, &gid);
+ if (err)
+ return err;
+
+@@ -870,22 +870,13 @@ EXPORT_SYMBOL(ib_query_port);
+ * @attr: Returned GID attributes related to this GID index (only in RoCE).
+ * NULL means ignore.
+ *
+- * ib_query_gid() fetches the specified GID table entry.
++ * ib_query_gid() fetches the specified GID table entry from the cache.
+ */
+ int ib_query_gid(struct ib_device *device,
+ u8 port_num, int index, union ib_gid *gid,
+ struct ib_gid_attr *attr)
+ {
+- if (rdma_protocol_roce(device, port_num))
+- return ib_get_cached_gid(device, port_num, index, gid, attr);
+-
+- if (attr)
+- return -EINVAL;
+-
+- if (!device->query_gid)
+- return -EOPNOTSUPP;
+-
+- return device->query_gid(device, port_num, index, gid);
++ return ib_get_cached_gid(device, port_num, index, gid, attr);
+ }
+ EXPORT_SYMBOL(ib_query_gid);
+
diff --git a/patches.drivers/IB-core-Simplify-sa_path_set_-sd-lid-calls.patch b/patches.drivers/IB-core-Simplify-sa_path_set_-sd-lid-calls.patch
new file mode 100644
index 0000000000..0c816aebd3
--- /dev/null
+++ b/patches.drivers/IB-core-Simplify-sa_path_set_-sd-lid-calls.patch
@@ -0,0 +1,153 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Fri, 6 Oct 2017 13:06:17 -0700
+Subject: IB/core: Simplify sa_path_set_[sd]lid() calls
+Patch-mainline: v4.15-rc1
+Git-commit: 9d18717790c43c904fabe9da7a4c6b2ebed2c4d8
+References: bsc#1103992 FATE#326009
+
+Instead of making every caller convert the second argument of
+sa_path_set_slid() and sa_path_set_dlid() to big endian format,
+make these two functions accept LIDs in CPU endian format.
+This patch does not change any functionality.
+
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Cc: Sean Hefty <sean.hefty@intel.com>
+Cc: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>
+Cc: Don Hiatt <don.hiatt@intel.com>
+Cc: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 26 ++++++++++++--------------
+ drivers/infiniband/core/uverbs_marshall.c | 10 +++++-----
+ drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
+ include/rdma/ib_sa.h | 12 ++++++------
+ 4 files changed, 24 insertions(+), 26 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -1472,31 +1472,29 @@ static void cm_format_path_lid_from_req(
+
+ if (primary_path->rec_type != SA_PATH_REC_TYPE_OPA) {
+ sa_path_set_dlid(primary_path,
+- htonl(ntohs(req_msg->primary_local_lid)));
++ ntohs(req_msg->primary_local_lid));
+ sa_path_set_slid(primary_path,
+- htonl(ntohs(req_msg->primary_remote_lid)));
++ ntohs(req_msg->primary_remote_lid));
+ } else {
+ lid = opa_get_lid_from_gid(&req_msg->primary_local_gid);
+- sa_path_set_dlid(primary_path, cpu_to_be32(lid));
++ sa_path_set_dlid(primary_path, lid);
+
+ lid = opa_get_lid_from_gid(&req_msg->primary_remote_gid);
+- sa_path_set_slid(primary_path, cpu_to_be32(lid));
++ sa_path_set_slid(primary_path, lid);
+ }
+
+ if (!cm_req_has_alt_path(req_msg))
+ return;
+
+ if (alt_path->rec_type != SA_PATH_REC_TYPE_OPA) {
+- sa_path_set_dlid(alt_path,
+- htonl(ntohs(req_msg->alt_local_lid)));
+- sa_path_set_slid(alt_path,
+- htonl(ntohs(req_msg->alt_remote_lid)));
++ sa_path_set_dlid(alt_path, ntohs(req_msg->alt_local_lid));
++ sa_path_set_slid(alt_path, ntohs(req_msg->alt_remote_lid));
+ } else {
+ lid = opa_get_lid_from_gid(&req_msg->alt_local_gid);
+- sa_path_set_dlid(alt_path, cpu_to_be32(lid));
++ sa_path_set_dlid(alt_path, lid);
+
+ lid = opa_get_lid_from_gid(&req_msg->alt_remote_gid);
+- sa_path_set_slid(alt_path, cpu_to_be32(lid));
++ sa_path_set_slid(alt_path, lid);
+ }
+ }
+
+@@ -3037,14 +3035,14 @@ static void cm_format_path_lid_from_lap(
+ u32 lid;
+
+ if (path->rec_type != SA_PATH_REC_TYPE_OPA) {
+- sa_path_set_dlid(path, htonl(ntohs(lap_msg->alt_local_lid)));
+- sa_path_set_slid(path, htonl(ntohs(lap_msg->alt_remote_lid)));
++ sa_path_set_dlid(path, ntohs(lap_msg->alt_local_lid));
++ sa_path_set_slid(path, ntohs(lap_msg->alt_remote_lid));
+ } else {
+ lid = opa_get_lid_from_gid(&lap_msg->alt_local_gid);
+- sa_path_set_dlid(path, cpu_to_be32(lid));
++ sa_path_set_dlid(path, lid);
+
+ lid = opa_get_lid_from_gid(&lap_msg->alt_remote_gid);
+- sa_path_set_slid(path, cpu_to_be32(lid));
++ sa_path_set_slid(path, lid);
+ }
+ }
+
+--- a/drivers/infiniband/core/uverbs_marshall.c
++++ b/drivers/infiniband/core/uverbs_marshall.c
+@@ -176,18 +176,18 @@ EXPORT_SYMBOL(ib_copy_path_rec_to_user);
+ void ib_copy_path_rec_from_user(struct sa_path_rec *dst,
+ struct ib_user_path_rec *src)
+ {
+- __be32 slid, dlid;
++ u32 slid, dlid;
+
+ memset(dst, 0, sizeof(*dst));
+ if ((ib_is_opa_gid((union ib_gid *)src->sgid)) ||
+ (ib_is_opa_gid((union ib_gid *)src->dgid))) {
+ dst->rec_type = SA_PATH_REC_TYPE_OPA;
+- slid = htonl(opa_get_lid_from_gid((union ib_gid *)src->sgid));
+- dlid = htonl(opa_get_lid_from_gid((union ib_gid *)src->dgid));
++ slid = opa_get_lid_from_gid((union ib_gid *)src->sgid);
++ dlid = opa_get_lid_from_gid((union ib_gid *)src->dgid);
+ } else {
+ dst->rec_type = SA_PATH_REC_TYPE_IB;
+- slid = htonl(ntohs(src->slid));
+- dlid = htonl(ntohs(src->dlid));
++ slid = ntohs(src->slid);
++ dlid = ntohs(src->dlid);
+ }
+ memcpy(dst->dgid.raw, src->dgid, sizeof dst->dgid);
+ memcpy(dst->sgid.raw, src->sgid, sizeof dst->sgid);
+--- a/drivers/infiniband/ulp/srp/ib_srp.c
++++ b/drivers/infiniband/ulp/srp/ib_srp.c
+@@ -2403,7 +2403,7 @@ static void srp_cm_rej_handler(struct ib
+ switch (event->param.rej_rcvd.reason) {
+ case IB_CM_REJ_PORT_CM_REDIRECT:
+ cpi = event->param.rej_rcvd.ari;
+- sa_path_set_dlid(&ch->path, htonl(ntohs(cpi->redirect_lid)));
++ sa_path_set_dlid(&ch->path, ntohs(cpi->redirect_lid));
+ ch->path.pkey = cpi->redirect_pkey;
+ cm_id->remote_cm_qpn = be32_to_cpu(cpi->redirect_qp) & 0x00ffffff;
+ memcpy(ch->path.dgid.raw, cpi->redirect_gid, 16);
+--- a/include/rdma/ib_sa.h
++++ b/include/rdma/ib_sa.h
+@@ -590,20 +590,20 @@ static inline bool sa_path_is_roce(struc
+ (rec->rec_type == SA_PATH_REC_TYPE_ROCE_V2));
+ }
+
+-static inline void sa_path_set_slid(struct sa_path_rec *rec, __be32 slid)
++static inline void sa_path_set_slid(struct sa_path_rec *rec, u32 slid)
+ {
+ if (rec->rec_type == SA_PATH_REC_TYPE_IB)
+- rec->ib.slid = htons(ntohl(slid));
++ rec->ib.slid = cpu_to_be16(slid);
+ else if (rec->rec_type == SA_PATH_REC_TYPE_OPA)
+- rec->opa.slid = slid;
++ rec->opa.slid = cpu_to_be32(slid);
+ }
+
+-static inline void sa_path_set_dlid(struct sa_path_rec *rec, __be32 dlid)
++static inline void sa_path_set_dlid(struct sa_path_rec *rec, u32 dlid)
+ {
+ if (rec->rec_type == SA_PATH_REC_TYPE_IB)
+- rec->ib.dlid = htons(ntohl(dlid));
++ rec->ib.dlid = cpu_to_be16(dlid);
+ else if (rec->rec_type == SA_PATH_REC_TYPE_OPA)
+- rec->opa.dlid = dlid;
++ rec->opa.dlid = cpu_to_be32(dlid);
+ }
+
+ static inline void sa_path_set_raw_traffic(struct sa_path_rec *rec,
diff --git a/patches.drivers/IB-core-Use-PTR_ERR_OR_ZERO.patch b/patches.drivers/IB-core-Use-PTR_ERR_OR_ZERO.patch
new file mode 100644
index 0000000000..1fddeed20b
--- /dev/null
+++ b/patches.drivers/IB-core-Use-PTR_ERR_OR_ZERO.patch
@@ -0,0 +1,36 @@
+From: "Gomonovych, Vasyl" <gomonovych@gmail.com>
+Date: Tue, 28 Nov 2017 16:18:07 +0100
+Subject: IB/core: Use PTR_ERR_OR_ZERO()
+Patch-mainline: v4.16-rc1
+Git-commit: f4cd9d588e77c86362ba3c072385cde11c86b611
+References: bsc#1103992 FATE#326009
+
+Fix ptr_ret.cocci warnings:
+drivers/infiniband/core/uverbs_cmd.c:1156:1-3: WARNING: PTR_ERR_OR_ZERO can be used
+
+Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR
+
+Generated by: scripts/coccinelle/api/ptr_ret.cocci
+
+Signed-off-by: Vasyl Gomonovych <gomonovych@gmail.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/uverbs_cmd.c | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/uverbs_cmd.c
++++ b/drivers/infiniband/core/uverbs_cmd.c
+@@ -1145,10 +1145,7 @@ int ib_uverbs_ex_create_cq(struct ib_uve
+ min(ucore->inlen, sizeof(cmd)),
+ ib_uverbs_ex_create_cq_cb, NULL);
+
+- if (IS_ERR(obj))
+- return PTR_ERR(obj);
+-
+- return 0;
++ return PTR_ERR_OR_ZERO(obj);
+ }
+
+ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file,
diff --git a/patches.drivers/IB-core-Use-rdma_cap_opa_mad-to-check-for-OPA.patch b/patches.drivers/IB-core-Use-rdma_cap_opa_mad-to-check-for-OPA.patch
new file mode 100644
index 0000000000..6232ed1840
--- /dev/null
+++ b/patches.drivers/IB-core-Use-rdma_cap_opa_mad-to-check-for-OPA.patch
@@ -0,0 +1,29 @@
+From: Don Hiatt <don.hiatt@intel.com>
+Date: Fri, 22 Dec 2017 08:45:52 -0800
+Subject: IB/core: Use rdma_cap_opa_mad to check for OPA
+Patch-mainline: v4.16-rc1
+Git-commit: 2ef7f2e2706cee6ad7b5eb6ef8d85824008f0425
+References: bsc#1103992 FATE#326009
+
+Use rdma_cap_opa_mad() to check for OPA to promote code reuse.
+
+Signed-off-by: Don Hiatt <don.hiatt@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/user_mad.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -233,8 +233,7 @@ static void recv_handler(struct ib_mad_a
+ * On OPA devices it is okay to lose the upper 16 bits of LID as this
+ * information is obtained elsewhere. Mask off the upper 16 bits.
+ */
+- if (agent->device->port_immutable[agent->port_num].core_cap_flags &
+- RDMA_CORE_PORT_INTEL_OPA)
++ if (rdma_cap_opa_mad(agent->device, agent->port_num))
+ packet->mad.hdr.lid = ib_lid_be16(0xFFFF &
+ mad_recv_wc->wc->slid);
+ else
diff --git a/patches.drivers/IB-core-Use-rdma_is_port_valid.patch b/patches.drivers/IB-core-Use-rdma_is_port_valid.patch
new file mode 100644
index 0000000000..9406a5b45e
--- /dev/null
+++ b/patches.drivers/IB-core-Use-rdma_is_port_valid.patch
@@ -0,0 +1,40 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Mon, 19 Mar 2018 07:59:59 +0200
+Subject: IB/core: Use rdma_is_port_valid()
+Patch-mainline: v4.17-rc1
+Git-commit: 6d5b2047fe62ed83a90f0ecdf1cc9b4ae6fcc974
+References: bsc#1103992 FATE#326009
+
+Use rdma_is_port_valid() which performs port validity check instead of
+open coding the same check.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cache.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/infiniband/core/cache.c
++++ b/drivers/infiniband/core/cache.c
+@@ -937,8 +937,7 @@ int ib_get_cached_subnet_prefix(struct i
+ unsigned long flags;
+ int p;
+
+- if (port_num < rdma_start_port(device) ||
+- port_num > rdma_end_port(device))
++ if (!rdma_is_port_valid(device, port_num))
+ return -EINVAL;
+
+ p = port_num - rdma_start_port(device);
+@@ -1048,7 +1047,7 @@ int ib_get_cached_port_state(struct ib_d
+ unsigned long flags;
+ int ret = 0;
+
+- if (port_num < rdma_start_port(device) || port_num > rdma_end_port(device))
++ if (!rdma_is_port_valid(device, port_num))
+ return -EINVAL;
+
+ read_lock_irqsave(&device->cache.lock, flags);
diff --git a/patches.drivers/IB-core-cm-Fix-generating-a-return-AH-for-RoCEE.patch b/patches.drivers/IB-core-cm-Fix-generating-a-return-AH-for-RoCEE.patch
new file mode 100644
index 0000000000..6de607df39
--- /dev/null
+++ b/patches.drivers/IB-core-cm-Fix-generating-a-return-AH-for-RoCEE.patch
@@ -0,0 +1,312 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:49 +0200
+Subject: IB/{core/cm}: Fix generating a return AH for RoCEE
+Patch-mainline: v4.16-rc1
+Git-commit: 1060f86534147c2830db4bbc9dd849d1892a611b
+References: bsc#1103992 FATE#326009
+
+When computing a UD reverse path (return AH) from a WC the code was not
+doing a route lookup anchored in a specific netdevice. This caused several
+bugs, including broken IPv6 link-local address support in RoCEv2. [1]
+
+This fixes the lookup by determining the GID table entry that the HW
+matched to the SGID for the WC and then using the netdevice from that
+entry to perform the route and ND lookup for the 'DGID' to build a return
+AH.
+
+RoCE GID table management ensures that right upper netdevices of the
+physical netdevices are added. Therefore init_ah_from_wc doesn't need to
+perform such check.
+
+Now that route lookup is done based on the netdevice of the GID entry,
+simplify code to not have ifindex and vlan pointers. As part of that,
+refactor to have netdevice as input parameter. This is already discussed
+at [2].
+
+Finally ib_init_ah_from_wc resolves dmac for unicast GID in similar way as
+what ib_resolve_eth_dmac() does. So ib_resolve_eth_dmac is refactored to
+split for unicast and non unicast GIDs, so that it can be reused by
+ib_init_ah_from_wc.
+
+While we are at refactoring ib_resolve_eth_dmac(), it is further
+simplified
+
+(a) to avoid hoplimit as optional parameter, as there is only one
+ user who always queries hoplimit.
+(b) for empty line.
+(c) avoided zero initialization of ret.
+(d) removed as exported symbol as only ib core uses it.
+
+For IPv6, this is tested using simple rping test as below.
+ rping -sv -a ::0
+ rping -c -a fe80::268a:7ff:fe55:4661%ens2f1 -C 1 -v -d
+
+[1] https://www.spinics.net/lists/linux-rdma/msg45690.html
+[2] https://www.spinics.net/lists/linux-rdma/msg45710.html
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Reviewed-by: Matan Barak <matanb@mellanox.com>
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Reported-by: Roland Dreier <roland@purestorage.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/addr.c | 24 +------
+ drivers/infiniband/core/verbs.c | 136 +++++++++++++++++-----------------------
+ include/rdma/ib_addr.h | 2
+ 3 files changed, 64 insertions(+), 98 deletions(-)
+
+--- a/drivers/infiniband/core/addr.c
++++ b/drivers/infiniband/core/addr.c
+@@ -761,27 +761,23 @@ static void resolve_cb(int status, struc
+
+ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
+ const union ib_gid *dgid,
+- u8 *dmac, u16 *vlan_id, int *if_index,
++ u8 *dmac, const struct net_device *ndev,
+ int *hoplimit)
+ {
+- int ret = 0;
+ struct rdma_dev_addr dev_addr;
+ struct resolve_cb_context ctx;
+- struct net_device *dev;
+-
+ union {
+ struct sockaddr _sockaddr;
+ struct sockaddr_in _sockaddr_in;
+ struct sockaddr_in6 _sockaddr_in6;
+ } sgid_addr, dgid_addr;
+-
++ int ret;
+
+ rdma_gid2ip(&sgid_addr._sockaddr, sgid);
+ rdma_gid2ip(&dgid_addr._sockaddr, dgid);
+
+ memset(&dev_addr, 0, sizeof(dev_addr));
+- if (if_index)
+- dev_addr.bound_dev_if = *if_index;
++ dev_addr.bound_dev_if = ndev->ifindex;
+ dev_addr.net = &init_net;
+
+ ctx.addr = &dev_addr;
+@@ -798,19 +794,9 @@ int rdma_addr_find_l2_eth_by_grh(const u
+ return ret;
+
+ memcpy(dmac, dev_addr.dst_dev_addr, ETH_ALEN);
+- dev = dev_get_by_index(&init_net, dev_addr.bound_dev_if);
+- if (!dev)
+- return -ENODEV;
+- if (if_index)
+- *if_index = dev_addr.bound_dev_if;
+- if (vlan_id)
+- *vlan_id = rdma_vlan_dev_vlan_id(dev);
+- if (hoplimit)
+- *hoplimit = dev_addr.hoplimit;
+- dev_put(dev);
+- return ret;
++ *hoplimit = dev_addr.hoplimit;
++ return 0;
+ }
+-EXPORT_SYMBOL(rdma_addr_find_l2_eth_by_grh);
+
+ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id)
+ {
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -481,6 +481,40 @@ int ib_get_gids_from_rdma_hdr(const unio
+ }
+ EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr);
+
++/* Resolve destination mac address and hop limit for unicast destination
++ * GID entry, considering the source GID entry as well.
++ * ah_attribute must have have valid port_num, sgid_index.
++ */
++static int ib_resolve_unicast_gid_dmac(struct ib_device *device,
++ struct rdma_ah_attr *ah_attr)
++{
++ struct ib_gid_attr sgid_attr;
++ struct ib_global_route *grh;
++ int hop_limit = 0xff;
++ union ib_gid sgid;
++ int ret;
++
++ grh = rdma_ah_retrieve_grh(ah_attr);
++
++ ret = ib_query_gid(device,
++ rdma_ah_get_port_num(ah_attr),
++ grh->sgid_index,
++ &sgid, &sgid_attr);
++ if (ret || !sgid_attr.ndev) {
++ if (!ret)
++ ret = -ENXIO;
++ return ret;
++ }
++
++ ret = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
++ ah_attr->roce.dmac,
++ sgid_attr.ndev, &hop_limit);
++ dev_put(sgid_attr.ndev);
++
++ grh->hop_limit = hop_limit;
++ return ret;
++}
++
+ /*
+ * This function creates ah from the incoming packet.
+ * Incoming packet has dgid of the receiver node on which this code is
+@@ -490,9 +524,6 @@ EXPORT_SYMBOL(ib_get_gids_from_rdma_hdr)
+ * as sgid and, sgid is used as dgid because sgid contains destinations
+ * GID whom to respond to.
+ *
+- * This is why when calling rdma_addr_find_l2_eth_by_grh() function, the
+- * position of arguments dgid and sgid do not match the order of the
+- * parameters.
+ */
+ int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
+ const struct ib_wc *wc, const struct ib_grh *grh,
+@@ -523,57 +554,33 @@ int ib_init_ah_from_wc(struct ib_device
+ if (ret)
+ return ret;
+
++ rdma_ah_set_sl(ah_attr, wc->sl);
++ rdma_ah_set_port_num(ah_attr, port_num);
++
+ if (rdma_protocol_roce(device, port_num)) {
+- int if_index = 0;
+ u16 vlan_id = wc->wc_flags & IB_WC_WITH_VLAN ?
+ wc->vlan_id : 0xffff;
+- struct net_device *idev;
+- struct net_device *resolved_dev;
+
+ if (!(wc->wc_flags & IB_WC_GRH))
+ return -EPROTOTYPE;
+
+- if (!device->get_netdev)
+- return -EOPNOTSUPP;
+-
+- idev = device->get_netdev(device, port_num);
+- if (!idev)
+- return -ENODEV;
+-
+- ret = rdma_addr_find_l2_eth_by_grh(&dgid, &sgid,
+- ah_attr->roce.dmac,
+- wc->wc_flags & IB_WC_WITH_VLAN ?
+- NULL : &vlan_id,
+- &if_index, &hoplimit);
+- if (ret) {
+- dev_put(idev);
+- return ret;
+- }
+-
+- resolved_dev = dev_get_by_index(&init_net, if_index);
+- rcu_read_lock();
+- if (resolved_dev != idev && !rdma_is_upper_dev_rcu(idev,
+- resolved_dev))
+- ret = -EHOSTUNREACH;
+- rcu_read_unlock();
+- dev_put(idev);
+- dev_put(resolved_dev);
++ ret = get_sgid_index_from_eth(device, port_num,
++ vlan_id, &dgid,
++ gid_type, &gid_index);
+ if (ret)
+ return ret;
+
+- ret = get_sgid_index_from_eth(device, port_num, vlan_id,
+- &dgid, gid_type, &gid_index);
+- if (ret)
+- return ret;
+- }
+-
+- rdma_ah_set_dlid(ah_attr, wc->slid);
+- rdma_ah_set_sl(ah_attr, wc->sl);
+- rdma_ah_set_path_bits(ah_attr, wc->dlid_path_bits);
+- rdma_ah_set_port_num(ah_attr, port_num);
++ flow_class = be32_to_cpu(grh->version_tclass_flow);
++ rdma_ah_set_grh(ah_attr, &sgid,
++ flow_class & 0xFFFFF,
++ (u8)gid_index, hoplimit,
++ (flow_class >> 20) & 0xFF);
++ return ib_resolve_unicast_gid_dmac(device, ah_attr);
++ } else {
++ rdma_ah_set_dlid(ah_attr, wc->slid);
++ rdma_ah_set_path_bits(ah_attr, wc->dlid_path_bits);
+
+- if (wc->wc_flags & IB_WC_GRH) {
+- if (!rdma_cap_eth_ah(device, port_num)) {
++ if (wc->wc_flags & IB_WC_GRH) {
+ if (dgid.global.interface_id != cpu_to_be64(IB_SA_WELL_KNOWN_GUID)) {
+ ret = ib_find_cached_gid_by_port(device, &dgid,
+ IB_GID_TYPE_IB,
+@@ -584,16 +591,15 @@ int ib_init_ah_from_wc(struct ib_device
+ } else {
+ gid_index = 0;
+ }
+- }
+-
+- flow_class = be32_to_cpu(grh->version_tclass_flow);
+- rdma_ah_set_grh(ah_attr, &sgid,
+- flow_class & 0xFFFFF,
+- (u8)gid_index, hoplimit,
+- (flow_class >> 20) & 0xFF);
+
++ flow_class = be32_to_cpu(grh->version_tclass_flow);
++ rdma_ah_set_grh(ah_attr, &sgid,
++ flow_class & 0xFFFFF,
++ (u8)gid_index, hoplimit,
++ (flow_class >> 20) & 0xFF);
++ }
++ return 0;
+ }
+- return 0;
+ }
+ EXPORT_SYMBOL(ib_init_ah_from_wc);
+
+@@ -1291,34 +1297,8 @@ static int ib_resolve_eth_dmac(struct ib
+ (char *)ah_attr->roce.dmac);
+ }
+ } else {
+- union ib_gid sgid;
+- struct ib_gid_attr sgid_attr;
+- int ifindex;
+- int hop_limit;
+-
+- ret = ib_query_gid(device,
+- rdma_ah_get_port_num(ah_attr),
+- grh->sgid_index,
+- &sgid, &sgid_attr);
+-
+- if (ret || !sgid_attr.ndev) {
+- if (!ret)
+- ret = -ENXIO;
+- goto out;
+- }
+-
+- ifindex = sgid_attr.ndev->ifindex;
+-
+- ret =
+- rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
+- ah_attr->roce.dmac,
+- NULL, &ifindex, &hop_limit);
+-
+- dev_put(sgid_attr.ndev);
+-
+- grh->hop_limit = hop_limit;
++ ret = ib_resolve_unicast_gid_dmac(device, ah_attr);
+ }
+-out:
+ return ret;
+ }
+
+--- a/include/rdma/ib_addr.h
++++ b/include/rdma/ib_addr.h
+@@ -134,7 +134,7 @@ int rdma_addr_size(struct sockaddr *addr
+ int rdma_addr_find_smac_by_sgid(union ib_gid *sgid, u8 *smac, u16 *vlan_id);
+ int rdma_addr_find_l2_eth_by_grh(const union ib_gid *sgid,
+ const union ib_gid *dgid,
+- u8 *smac, u16 *vlan_id, int *if_index,
++ u8 *dmac, const struct net_device *ndev,
+ int *hoplimit);
+
+ static inline u16 ib_addr_get_pkey(struct rdma_dev_addr *dev_addr)
diff --git a/patches.drivers/IB-core-cm-cma-ipoib-Rename-ib_init_ah_from_path-to-.patch b/patches.drivers/IB-core-cm-cma-ipoib-Rename-ib_init_ah_from_path-to-.patch
new file mode 100644
index 0000000000..8a7a7914bd
--- /dev/null
+++ b/patches.drivers/IB-core-cm-cma-ipoib-Rename-ib_init_ah_from_path-to-.patch
@@ -0,0 +1,109 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:16 +0200
+Subject: IB/{core, cm, cma, ipoib}: Rename ib_init_ah_from_path to
+ ib_init_ah_attr_from_path
+Patch-mainline: v4.16-rc1
+Git-commit: 4ad6a0245ec818bc0e03910ea3f503824f25b0fc
+References: bsc#1103992 FATE#326009
+
+Since ib_init_ah_from_path initializes the address handle attribute, it is
+renamed to reflect so.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 4 ++--
+ drivers/infiniband/core/cma.c | 7 ++++---
+ drivers/infiniband/core/sa_query.c | 8 ++++----
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 ++-
+ include/rdma/ib_sa.h | 10 +++++-----
+ 5 files changed, 17 insertions(+), 15 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -494,8 +494,8 @@ static int cm_init_av_by_path(struct sa_
+ return ret;
+
+ av->port = port;
+- ret = ib_init_ah_from_path(cm_dev->ib_device, port->port_num, path,
+- &av->ah_attr);
++ ret = ib_init_ah_attr_from_path(cm_dev->ib_device, port->port_num, path,
++ &av->ah_attr);
+ if (ret)
+ return ret;
+
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -3397,9 +3397,10 @@ static int cma_sidr_rep_handler(struct i
+ event.status = ret;
+ break;
+ }
+- ib_init_ah_from_path(id_priv->id.device, id_priv->id.port_num,
+- id_priv->id.route.path_rec,
+- &event.param.ud.ah_attr);
++ ib_init_ah_attr_from_path(id_priv->id.device,
++ id_priv->id.port_num,
++ id_priv->id.route.path_rec,
++ &event.param.ud.ah_attr);
+ event.param.ud.qp_num = rep->qpn;
+ event.param.ud.qkey = rep->qkey;
+ event.event = RDMA_CM_EVENT_ESTABLISHED;
+--- a/drivers/infiniband/core/sa_query.c
++++ b/drivers/infiniband/core/sa_query.c
+@@ -1227,9 +1227,9 @@ static u8 get_src_path_mask(struct ib_de
+ return src_path_mask;
+ }
+
+-int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
+- struct sa_path_rec *rec,
+- struct rdma_ah_attr *ah_attr)
++int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
++ struct sa_path_rec *rec,
++ struct rdma_ah_attr *ah_attr)
+ {
+ int ret;
+ u16 gid_index;
+@@ -1341,7 +1341,7 @@ int ib_init_ah_from_path(struct ib_devic
+
+ return 0;
+ }
+-EXPORT_SYMBOL(ib_init_ah_from_path);
++EXPORT_SYMBOL(ib_init_ah_attr_from_path);
+
+ static int alloc_mad(struct ib_sa_query *query, gfp_t gfp_mask)
+ {
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -768,7 +768,8 @@ static void path_rec_completion(int stat
+ if (!status) {
+ struct rdma_ah_attr av;
+
+- if (!ib_init_ah_from_path(priv->ca, priv->port, pathrec, &av))
++ if (!ib_init_ah_attr_from_path(priv->ca, priv->port,
++ pathrec, &av))
+ ah = ipoib_create_ah(dev, priv->pd, &av);
+ }
+
+--- a/include/rdma/ib_sa.h
++++ b/include/rdma/ib_sa.h
+@@ -549,12 +549,12 @@ int ib_init_ah_from_mcmember(struct ib_d
+ struct rdma_ah_attr *ah_attr);
+
+ /**
+- * ib_init_ah_from_path - Initialize address handle attributes based on an SA
+- * path record.
++ * ib_init_ah_attr_from_path - Initialize address handle attributes based on
++ * an SA path record.
+ */
+-int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
+- struct sa_path_rec *rec,
+- struct rdma_ah_attr *ah_attr);
++int ib_init_ah_attr_from_path(struct ib_device *device, u8 port_num,
++ struct sa_path_rec *rec,
++ struct rdma_ah_attr *ah_attr);
+
+ /**
+ * ib_sa_pack_path - Conert a path record from struct ib_sa_path_rec
diff --git a/patches.drivers/IB-core-fix-spelling-mistake-aceess-access.patch b/patches.drivers/IB-core-fix-spelling-mistake-aceess-access.patch
new file mode 100644
index 0000000000..e8fae6651e
--- /dev/null
+++ b/patches.drivers/IB-core-fix-spelling-mistake-aceess-access.patch
@@ -0,0 +1,28 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Fri, 1 Sep 2017 09:22:14 +0100
+Subject: IB/core: fix spelling mistake: "aceess" -> "access"
+Patch-mainline: v4.15-rc1
+Git-commit: 8f63d4b1d557b037b597ba5da295a3eb70a6df72
+References: bsc#1103992 FATE#326009
+
+Trivial fix to spelling mistake in WARN message
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/uverbs_ioctl_merge.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/core/uverbs_ioctl_merge.c
++++ b/drivers/infiniband/core/uverbs_ioctl_merge.c
+@@ -376,7 +376,7 @@ static struct uverbs_method_spec *build_
+ min_id) ||
+ WARN(attr_obj_with_special_access &&
+ !(attr->flags & UVERBS_ATTR_SPEC_F_MANDATORY),
+- "ib_uverbs: Tried to merge attr (%d) but it's an object with new/destroy aceess but isn't mandatory\n",
++ "ib_uverbs: Tried to merge attr (%d) but it's an object with new/destroy access but isn't mandatory\n",
+ min_id) ||
+ WARN(IS_ATTR_OBJECT(attr) &&
+ attr->flags & UVERBS_ATTR_SPEC_F_MIN_SZ,
diff --git a/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-for-unused-ndev.patch b/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-for-unused-ndev.patch
new file mode 100644
index 0000000000..f8c5930f6a
--- /dev/null
+++ b/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-for-unused-ndev.patch
@@ -0,0 +1,63 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 13 Mar 2018 16:06:12 +0200
+Subject: IB/{core, ipoib}: Simplify ib_find_gid() for unused ndev
+Patch-mainline: v4.17-rc1
+Git-commit: b26c4a1138dff34cff507bafa4c87e365f4145a6
+References: bsc#1103992 FATE#326009
+
+ib_find_gid() is only used by IPoIB driver. For IB link layer, GID table
+entries are not based on netdevice. Netdevice parameter is unused here.
+Therefore, it is removed.
+
+Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
+Reviewed-by: Mark Bloch <markb@mellanox.com>
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/device.c | 3 +--
+ drivers/infiniband/ulp/ipoib/ipoib_ib.c | 2 +-
+ include/rdma/ib_verbs.h | 2 +-
+ 3 files changed, 3 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/core/device.c
++++ b/drivers/infiniband/core/device.c
+@@ -1049,13 +1049,12 @@ EXPORT_SYMBOL(ib_modify_port);
+ * a specified GID value occurs. Its searches only for IB link layer.
+ * @device: The device to query.
+ * @gid: The GID value to search for.
+- * @ndev: The ndev related to the GID to search for.
+ * @port_num: The port number of the device where the GID value was found.
+ * @index: The index into the GID table where the GID was found. This
+ * parameter may be NULL.
+ */
+ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
+- struct net_device *ndev, u8 *port_num, u16 *index)
++ u8 *port_num, u16 *index)
+ {
+ union ib_gid tmp_gid;
+ int ret, port, i;
+--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+@@ -1085,7 +1085,7 @@ static bool ipoib_dev_addr_changed_valid
+
+ netif_addr_unlock_bh(priv->dev);
+
+- err = ib_find_gid(priv->ca, &search_gid, priv->dev, &port, &index);
++ err = ib_find_gid(priv->ca, &search_gid, &port, &index);
+
+ netif_addr_lock_bh(priv->dev);
+
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -2853,7 +2853,7 @@ int ib_modify_port(struct ib_device *dev
+ struct ib_port_modify *port_modify);
+
+ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
+- struct net_device *ndev, u8 *port_num, u16 *index);
++ u8 *port_num, u16 *index);
+
+ int ib_find_pkey(struct ib_device *device,
+ u8 port_num, u16 pkey, u16 *index);
diff --git a/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-to-search-only-fo.patch b/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-to-search-only-fo.patch
new file mode 100644
index 0000000000..4bdaed8db5
--- /dev/null
+++ b/patches.drivers/IB-core-ipoib-Simplify-ib_find_gid-to-search-only-fo.patch
@@ -0,0 +1,86 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:12 +0200
+Subject: IB/{core, ipoib}: Simplify ib_find_gid to search only for IB link
+ layer
+Patch-mainline: v4.16-rc1
+Git-commit: dbb12562f7c2377c210ed6b2e79eda5bfe23c30c
+References: bsc#1103992 FATE#326009
+
+Currently there are no users of ib_find_gid for RoCE transport. It is
+only used by IPoIB.
+Therefore its simplified to ignore RoCE ports and GID type check which
+was previously done for every port.
+
+Signed-off-by: Parav Pandit <parav@mellanox.com>
+Reviewed-by: Eli Cohen <eli@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/device.c | 16 +++-------------
+ drivers/infiniband/ulp/ipoib/ipoib_ib.c | 3 +--
+ include/rdma/ib_verbs.h | 3 +--
+ 3 files changed, 5 insertions(+), 17 deletions(-)
+
+--- a/drivers/infiniband/core/device.c
++++ b/drivers/infiniband/core/device.c
+@@ -1033,32 +1033,22 @@ EXPORT_SYMBOL(ib_modify_port);
+
+ /**
+ * ib_find_gid - Returns the port number and GID table index where
+- * a specified GID value occurs.
++ * a specified GID value occurs. Its searches only for IB link layer.
+ * @device: The device to query.
+ * @gid: The GID value to search for.
+- * @gid_type: Type of GID.
+ * @ndev: The ndev related to the GID to search for.
+ * @port_num: The port number of the device where the GID value was found.
+ * @index: The index into the GID table where the GID was found. This
+ * parameter may be NULL.
+ */
+ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
+- enum ib_gid_type gid_type, struct net_device *ndev,
+- u8 *port_num, u16 *index)
++ struct net_device *ndev, u8 *port_num, u16 *index)
+ {
+ union ib_gid tmp_gid;
+ int ret, port, i;
+
+ for (port = rdma_start_port(device); port <= rdma_end_port(device); ++port) {
+- if (rdma_cap_roce_gid_table(device, port)) {
+- if (!ib_find_cached_gid_by_port(device, gid, gid_type, port,
+- ndev, index)) {
+- *port_num = port;
+- return 0;
+- }
+- }
+-
+- if (gid_type != IB_GID_TYPE_IB)
++ if (rdma_cap_roce_gid_table(device, port))
+ continue;
+
+ for (i = 0; i < device->port_immutable[port].gid_tbl_len; ++i) {
+--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+@@ -1085,8 +1085,7 @@ static bool ipoib_dev_addr_changed_valid
+
+ netif_addr_unlock_bh(priv->dev);
+
+- err = ib_find_gid(priv->ca, &search_gid, IB_GID_TYPE_IB,
+- priv->dev, &port, &index);
++ err = ib_find_gid(priv->ca, &search_gid, priv->dev, &port, &index);
+
+ netif_addr_lock_bh(priv->dev);
+
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -2836,8 +2836,7 @@ int ib_modify_port(struct ib_device *dev
+ struct ib_port_modify *port_modify);
+
+ int ib_find_gid(struct ib_device *device, union ib_gid *gid,
+- enum ib_gid_type gid_type, struct net_device *ndev,
+- u8 *port_num, u16 *index);
++ struct net_device *ndev, u8 *port_num, u16 *index);
+
+ int ib_find_pkey(struct ib_device *device,
+ u8 port_num, u16 pkey, u16 *index);
diff --git a/patches.drivers/IB-core-postpone-WR-initialization-during-queue-drai.patch b/patches.drivers/IB-core-postpone-WR-initialization-during-queue-drai.patch
new file mode 100644
index 0000000000..03fa548804
--- /dev/null
+++ b/patches.drivers/IB-core-postpone-WR-initialization-during-queue-drai.patch
@@ -0,0 +1,62 @@
+From: Max Gurtovoy <maxg@mellanox.com>
+Date: Sun, 14 Jan 2018 17:07:48 +0200
+Subject: IB/core: postpone WR initialization during queue drain
+Patch-mainline: v4.16-rc1
+Git-commit: aaebd377c0e9c75bc95217b924e4456a392c65ed
+References: bsc#1103992 FATE#326009
+
+No need to initialize completion and WR in case we fail
+during QP modification.
+
+Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
+Acked-by: Sagi Grimberg <sagi@grimberg.me>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/verbs.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -2192,16 +2192,16 @@ static void __ib_drain_sq(struct ib_qp *
+ struct ib_send_wr swr = {}, *bad_swr;
+ int ret;
+
+- swr.wr_cqe = &sdrain.cqe;
+- sdrain.cqe.done = ib_drain_qp_done;
+- init_completion(&sdrain.done);
+-
+ ret = ib_modify_qp(qp, &attr, IB_QP_STATE);
+ if (ret) {
+ WARN_ONCE(ret, "failed to drain send queue: %d\n", ret);
+ return;
+ }
+
++ swr.wr_cqe = &sdrain.cqe;
++ sdrain.cqe.done = ib_drain_qp_done;
++ init_completion(&sdrain.done);
++
+ ret = ib_post_send(qp, &swr, &bad_swr);
+ if (ret) {
+ WARN_ONCE(ret, "failed to drain send queue: %d\n", ret);
+@@ -2226,16 +2226,16 @@ static void __ib_drain_rq(struct ib_qp *
+ struct ib_recv_wr rwr = {}, *bad_rwr;
+ int ret;
+
+- rwr.wr_cqe = &rdrain.cqe;
+- rdrain.cqe.done = ib_drain_qp_done;
+- init_completion(&rdrain.done);
+-
+ ret = ib_modify_qp(qp, &attr, IB_QP_STATE);
+ if (ret) {
+ WARN_ONCE(ret, "failed to drain recv queue: %d\n", ret);
+ return;
+ }
+
++ rwr.wr_cqe = &rdrain.cqe;
++ rdrain.cqe.done = ib_drain_qp_done;
++ init_completion(&rdrain.done);
++
+ ret = ib_post_recv(qp, &rwr, &bad_rwr);
+ if (ret) {
+ WARN_ONCE(ret, "failed to drain recv queue: %d\n", ret);
diff --git a/patches.drivers/IB-core-remove-redundant-check-on-prot_sg_cnt.patch b/patches.drivers/IB-core-remove-redundant-check-on-prot_sg_cnt.patch
new file mode 100644
index 0000000000..4e0c5a9e97
--- /dev/null
+++ b/patches.drivers/IB-core-remove-redundant-check-on-prot_sg_cnt.patch
@@ -0,0 +1,55 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Mon, 9 Oct 2017 17:12:00 +0100
+Subject: IB/core: remove redundant check on prot_sg_cnt
+Patch-mainline: v4.15-rc1
+Git-commit: 318a8ab7e87887946084a7c0398ecc978c6aa71d
+References: bsc#1103992 FATE#326009
+
+prot_sg_cnt cannot be zero as a previous check on ret (from which
+prot_sg_cnt is assigned) returns -ENOMEM if is it zero. Since
+it cannot be zero we can simplify the code by removing the non
+-zero check on prot_sg_cnt and redundant else statement.
+
+Detected by CoverityScan, COD#1357188 ("Logically dead code")
+
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/rw.c | 24 ++++++++++--------------
+ 1 file changed, 10 insertions(+), 14 deletions(-)
+
+--- a/drivers/infiniband/core/rw.c
++++ b/drivers/infiniband/core/rw.c
+@@ -384,21 +384,17 @@ int rdma_rw_ctx_signature_init(struct rd
+ count += ret;
+ prev_wr = &ctx->sig->data.reg_wr.wr;
+
+- if (prot_sg_cnt) {
+- ret = rdma_rw_init_one_mr(qp, port_num, &ctx->sig->prot,
+- prot_sg, prot_sg_cnt, 0);
+- if (ret < 0)
+- goto out_destroy_data_mr;
+- count += ret;
++ ret = rdma_rw_init_one_mr(qp, port_num, &ctx->sig->prot,
++ prot_sg, prot_sg_cnt, 0);
++ if (ret < 0)
++ goto out_destroy_data_mr;
++ count += ret;
+
+- if (ctx->sig->prot.inv_wr.next)
+- prev_wr->next = &ctx->sig->prot.inv_wr;
+- else
+- prev_wr->next = &ctx->sig->prot.reg_wr.wr;
+- prev_wr = &ctx->sig->prot.reg_wr.wr;
+- } else {
+- ctx->sig->prot.mr = NULL;
+- }
++ if (ctx->sig->prot.inv_wr.next)
++ prev_wr->next = &ctx->sig->prot.inv_wr;
++ else
++ prev_wr->next = &ctx->sig->prot.reg_wr.wr;
++ prev_wr = &ctx->sig->prot.reg_wr.wr;
+
+ ctx->sig->sig_mr = ib_mr_pool_get(qp, &qp->sig_mrs);
+ if (!ctx->sig->sig_mr) {
diff --git a/patches.drivers/IB-core-umad-cm-Rename-ib_init_ah_from_wc-to-ib_init.patch b/patches.drivers/IB-core-umad-cm-Rename-ib_init_ah_from_wc-to-ib_init.patch
new file mode 100644
index 0000000000..e58e21e86a
--- /dev/null
+++ b/patches.drivers/IB-core-umad-cm-Rename-ib_init_ah_from_wc-to-ib_init.patch
@@ -0,0 +1,123 @@
+From: Parav Pandit <parav@mellanox.com>
+Date: Tue, 14 Nov 2017 14:52:17 +0200
+Subject: IB/{core, umad, cm}: Rename ib_init_ah_from_wc to
+ ib_init_ah_attr_from_wc
+Patch-mainline: v4.16-rc1
+Git-commit: f6bdb14267ba799296a49a3de9c2811636b768f9
+References: bsc#1103992 FATE#326009
+
+Currently ib_init_ah_from_wc initializes address handle attributes and
+not the address handle object itself.
+To avoid confusion between ah_attr vs ah, ib_init_ah_from_wc is
+renamed to ib_init_ah_attr_from_wc to reflect that its initialzes
+ah_attr.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/core/cm.c | 5 +++--
+ drivers/infiniband/core/user_mad.c | 8 ++++----
+ drivers/infiniband/core/verbs.c | 12 ++++++------
+ include/rdma/ib_verbs.h | 8 ++++----
+ 4 files changed, 17 insertions(+), 16 deletions(-)
+
+--- a/drivers/infiniband/core/cm.c
++++ b/drivers/infiniband/core/cm.c
+@@ -457,8 +457,9 @@ static int cm_init_av_for_response(struc
+ {
+ av->port = port;
+ av->pkey_index = wc->pkey_index;
+- return ib_init_ah_from_wc(port->cm_dev->ib_device, port->port_num, wc,
+- grh, &av->ah_attr);
++ return ib_init_ah_attr_from_wc(port->cm_dev->ib_device,
++ port->port_num, wc,
++ grh, &av->ah_attr);
+ }
+
+ static int cm_init_av_by_path(struct sa_path_rec *path, struct cm_av *av,
+--- a/drivers/infiniband/core/user_mad.c
++++ b/drivers/infiniband/core/user_mad.c
+@@ -248,10 +248,10 @@ static void recv_handler(struct ib_mad_a
+ const struct ib_global_route *grh;
+ int ret;
+
+- ret = ib_init_ah_from_wc(agent->device, agent->port_num,
+- mad_recv_wc->wc,
+- mad_recv_wc->recv_buf.grh,
+- &ah_attr);
++ ret = ib_init_ah_attr_from_wc(agent->device, agent->port_num,
++ mad_recv_wc->wc,
++ mad_recv_wc->recv_buf.grh,
++ &ah_attr);
+ if (ret)
+ goto err2;
+
+--- a/drivers/infiniband/core/verbs.c
++++ b/drivers/infiniband/core/verbs.c
+@@ -526,7 +526,7 @@ done:
+ }
+
+ /*
+- * This function creates ah from the incoming packet.
++ * This function initializes address handle attributes from the incoming packet.
+ * Incoming packet has dgid of the receiver node on which this code is
+ * getting executed and, sgid contains the GID of the sender.
+ *
+@@ -535,9 +535,9 @@ done:
+ * GID whom to respond to.
+ *
+ */
+-int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
+- const struct ib_wc *wc, const struct ib_grh *grh,
+- struct rdma_ah_attr *ah_attr)
++int ib_init_ah_attr_from_wc(struct ib_device *device, u8 port_num,
++ const struct ib_wc *wc, const struct ib_grh *grh,
++ struct rdma_ah_attr *ah_attr)
+ {
+ u32 flow_class;
+ u16 gid_index;
+@@ -611,7 +611,7 @@ int ib_init_ah_from_wc(struct ib_device
+ return 0;
+ }
+ }
+-EXPORT_SYMBOL(ib_init_ah_from_wc);
++EXPORT_SYMBOL(ib_init_ah_attr_from_wc);
+
+ struct ib_ah *ib_create_ah_from_wc(struct ib_pd *pd, const struct ib_wc *wc,
+ const struct ib_grh *grh, u8 port_num)
+@@ -619,7 +619,7 @@ struct ib_ah *ib_create_ah_from_wc(struc
+ struct rdma_ah_attr ah_attr;
+ int ret;
+
+- ret = ib_init_ah_from_wc(pd->device, port_num, wc, grh, &ah_attr);
++ ret = ib_init_ah_attr_from_wc(pd->device, port_num, wc, grh, &ah_attr);
+ if (ret)
+ return ERR_PTR(ret);
+
+--- a/include/rdma/ib_verbs.h
++++ b/include/rdma/ib_verbs.h
+@@ -2904,7 +2904,7 @@ int ib_get_gids_from_rdma_hdr(const unio
+ int ib_get_rdma_header_version(const union rdma_network_hdr *hdr);
+
+ /**
+- * ib_init_ah_from_wc - Initializes address handle attributes from a
++ * ib_init_ah_attr_from_wc - Initializes address handle attributes from a
+ * work completion.
+ * @device: Device on which the received message arrived.
+ * @port_num: Port on which the received message arrived.
+@@ -2914,9 +2914,9 @@ int ib_get_rdma_header_version(const uni
+ * @ah_attr: Returned attributes that can be used when creating an address
+ * handle for replying to the message.
+ */
+-int ib_init_ah_from_wc(struct ib_device *device, u8 port_num,
+- const struct ib_wc *wc, const struct ib_grh *grh,
+- struct rdma_ah_attr *ah_attr);
++int ib_init_ah_attr_from_wc(struct ib_device *device, u8 port_num,
++ const struct ib_wc *wc, const struct ib_grh *grh,
++ struct rdma_ah_attr *ah_attr);
+
+ /**
+ * ib_create_ah_from_wc - Creates an address handle associated with the
diff --git a/patches.drivers/IB-cxgb3-remove-cxio_dbg.c.patch b/patches.drivers/IB-cxgb3-remove-cxio_dbg.c.patch
new file mode 100644
index 0000000000..ac9b688e32
--- /dev/null
+++ b/patches.drivers/IB-cxgb3-remove-cxio_dbg.c.patch
@@ -0,0 +1,293 @@
+From: Corentin Labbe <clabbe@baylibre.com>
+Date: Tue, 6 Feb 2018 20:37:31 +0000
+Subject: IB/cxgb3: remove cxio_dbg.c
+Patch-mainline: v4.17-rc1
+Git-commit: fc968aee5e984c9cc2417147b9b5cd1da7ab43f3
+References: bsc#1103992 FATE#326009
+
+cxio_dbg.c is uncompiled since commit 2b540355cd2f ("RDMA/cxgb3: cleanups")
+10 years after, we could remove it.
+
+Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
+Acked-by: Steve Wise <swise@opengridcomputing.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/cxgb3/Kconfig | 9 -
+ drivers/infiniband/hw/cxgb3/Makefile | 2
+ drivers/infiniband/hw/cxgb3/cxio_dbg.c | 206 ---------------------------------
+ drivers/infiniband/hw/cxgb3/cxio_hal.h | 9 -
+ drivers/infiniband/hw/cxgb3/iwch_cq.c | 6
+ 5 files changed, 232 deletions(-)
+ delete mode 100644 drivers/infiniband/hw/cxgb3/cxio_dbg.c
+
+--- a/drivers/infiniband/hw/cxgb3/Kconfig
++++ b/drivers/infiniband/hw/cxgb3/Kconfig
+@@ -16,12 +16,3 @@ config INFINIBAND_CXGB3
+
+ To compile this driver as a module, choose M here: the module
+ will be called iw_cxgb3.
+-
+-config INFINIBAND_CXGB3_DEBUG
+- bool "Verbose debugging output"
+- depends on INFINIBAND_CXGB3
+- default n
+- ---help---
+- This option causes the Chelsio RDMA driver to produce copious
+- amounts of debug messages. Select this if you are developing
+- the driver or trying to diagnose a problem.
+--- a/drivers/infiniband/hw/cxgb3/Makefile
++++ b/drivers/infiniband/hw/cxgb3/Makefile
+@@ -4,5 +4,3 @@ obj-$(CONFIG_INFINIBAND_CXGB3) += iw_cxg
+
+ iw_cxgb3-y := iwch_cm.o iwch_ev.o iwch_cq.o iwch_qp.o iwch_mem.o \
+ iwch_provider.o iwch.o cxio_hal.o cxio_resource.o
+-
+-ccflags-$(CONFIG_INFINIBAND_CXGB3_DEBUG) += -DDEBUG
+--- a/drivers/infiniband/hw/cxgb3/cxio_dbg.c
++++ /dev/null
+@@ -1,206 +0,0 @@
+-/*
+- * Copyright (c) 2006 Chelsio, Inc. All rights reserved.
+- *
+- * This software is available to you under a choice of one of two
+- * licenses. You may choose to be licensed under the terms of the GNU
+- * General Public License (GPL) Version 2, available from the file
+- * COPYING in the main directory of this source tree, or the
+- * OpenIB.org BSD license below:
+- *
+- * Redistribution and use in source and binary forms, with or
+- * without modification, are permitted provided that the following
+- * conditions are met:
+- *
+- * - Redistributions of source code must retain the above
+- * copyright notice, this list of conditions and the following
+- * disclaimer.
+- *
+- * - Redistributions in binary form must reproduce the above
+- * copyright notice, this list of conditions and the following
+- * disclaimer in the documentation and/or other materials
+- * provided with the distribution.
+- *
+- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+- * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+- * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+- * SOFTWARE.
+- */
+-#ifdef DEBUG
+-#include <linux/types.h>
+-#include <linux/slab.h>
+-#include "common.h"
+-#include "cxgb3_ioctl.h"
+-#include "cxio_hal.h"
+-#include "cxio_wr.h"
+-
+-void cxio_dump_tpt(struct cxio_rdev *rdev, u32 stag)
+-{
+- struct ch_mem_range *m;
+- u64 *data;
+- int rc;
+- int size = 32;
+-
+- m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
+- if (!m)
+- return;
+-
+- m->mem_id = MEM_PMRX;
+- m->addr = (stag>>8) * 32 + rdev->rnic_info.tpt_base;
+- m->len = size;
+- pr_debug("%s TPT addr 0x%x len %d\n", __func__, m->addr, m->len);
+- rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
+- if (rc) {
+- pr_debug("%s toectl returned error %d\n", __func__, rc);
+- kfree(m);
+- return;
+- }
+-
+- data = (u64 *)m->buf;
+- while (size > 0) {
+- pr_debug("TPT %08x: %016llx\n",
+- m->addr, (unsigned long long)*data);
+- size -= 8;
+- data++;
+- m->addr += 8;
+- }
+- kfree(m);
+-}
+-
+-void cxio_dump_pbl(struct cxio_rdev *rdev, u32 pbl_addr, uint len, u8 shift)
+-{
+- struct ch_mem_range *m;
+- u64 *data;
+- int rc;
+- int size, npages;
+-
+- shift += 12;
+- npages = (len + (1ULL << shift) - 1) >> shift;
+- size = npages * sizeof(u64);
+-
+- m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
+- if (!m)
+- return;
+-
+- m->mem_id = MEM_PMRX;
+- m->addr = pbl_addr;
+- m->len = size;
+- pr_debug("%s PBL addr 0x%x len %d depth %d\n",
+- __func__, m->addr, m->len, npages);
+- rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
+- if (rc) {
+- pr_debug("%s toectl returned error %d\n", __func__, rc);
+- kfree(m);
+- return;
+- }
+-
+- data = (u64 *)m->buf;
+- while (size > 0) {
+- pr_debug("PBL %08x: %016llx\n",
+- m->addr, (unsigned long long)*data);
+- size -= 8;
+- data++;
+- m->addr += 8;
+- }
+- kfree(m);
+-}
+-
+-void cxio_dump_wqe(union t3_wr *wqe)
+-{
+- __be64 *data = (__be64 *)wqe;
+- uint size = (uint)(be64_to_cpu(*data) & 0xff);
+-
+- if (size == 0)
+- size = 8;
+- while (size > 0) {
+- pr_debug("WQE %p: %016llx\n",
+- data, (unsigned long long)be64_to_cpu(*data));
+- size--;
+- data++;
+- }
+-}
+-
+-void cxio_dump_wce(struct t3_cqe *wce)
+-{
+- __be64 *data = (__be64 *)wce;
+- int size = sizeof(*wce);
+-
+- while (size > 0) {
+- pr_debug("WCE %p: %016llx\n",
+- data, (unsigned long long)be64_to_cpu(*data));
+- size -= 8;
+- data++;
+- }
+-}
+-
+-void cxio_dump_rqt(struct cxio_rdev *rdev, u32 hwtid, int nents)
+-{
+- struct ch_mem_range *m;
+- int size = nents * 64;
+- u64 *data;
+- int rc;
+-
+- m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
+- if (!m)
+- return;
+-
+- m->mem_id = MEM_PMRX;
+- m->addr = ((hwtid)<<10) + rdev->rnic_info.rqt_base;
+- m->len = size;
+- pr_debug("%s RQT addr 0x%x len %d\n", __func__, m->addr, m->len);
+- rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
+- if (rc) {
+- pr_debug("%s toectl returned error %d\n", __func__, rc);
+- kfree(m);
+- return;
+- }
+-
+- data = (u64 *)m->buf;
+- while (size > 0) {
+- pr_debug("RQT %08x: %016llx\n",
+- m->addr, (unsigned long long)*data);
+- size -= 8;
+- data++;
+- m->addr += 8;
+- }
+- kfree(m);
+-}
+-
+-void cxio_dump_tcb(struct cxio_rdev *rdev, u32 hwtid)
+-{
+- struct ch_mem_range *m;
+- int size = TCB_SIZE;
+- u32 *data;
+- int rc;
+-
+- m = kmalloc(sizeof(*m) + size, GFP_ATOMIC);
+- if (!m)
+- return;
+-
+- m->mem_id = MEM_CM;
+- m->addr = hwtid * size;
+- m->len = size;
+- pr_debug("%s TCB %d len %d\n", __func__, m->addr, m->len);
+- rc = rdev->t3cdev_p->ctl(rdev->t3cdev_p, RDMA_GET_MEM, m);
+- if (rc) {
+- pr_debug("%s toectl returned error %d\n", __func__, rc);
+- kfree(m);
+- return;
+- }
+-
+- data = (u32 *)m->buf;
+- while (size > 0) {
+- printk("%2u: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+- m->addr,
+- *(data+2), *(data+3), *(data),*(data+1),
+- *(data+6), *(data+7), *(data+4), *(data+5));
+- size -= 32;
+- data += 8;
+- m->addr += 32;
+- }
+- kfree(m);
+-}
+-#endif
+--- a/drivers/infiniband/hw/cxgb3/cxio_hal.h
++++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h
+@@ -202,13 +202,4 @@ int iwch_cxgb3_ofld_send(struct t3cdev *
+
+ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+-#ifdef DEBUG
+-void cxio_dump_tpt(struct cxio_rdev *rev, u32 stag);
+-void cxio_dump_pbl(struct cxio_rdev *rev, u32 pbl_addr, uint len, u8 shift);
+-void cxio_dump_wqe(union t3_wr *wqe);
+-void cxio_dump_wce(struct t3_cqe *wce);
+-void cxio_dump_rqt(struct cxio_rdev *rdev, u32 hwtid, int nents);
+-void cxio_dump_tcb(struct cxio_rdev *rdev, u32 hwtid);
+-#endif
+-
+ #endif
+--- a/drivers/infiniband/hw/cxgb3/iwch_cq.c
++++ b/drivers/infiniband/hw/cxgb3/iwch_cq.c
+@@ -200,9 +200,6 @@ int iwch_poll_cq(struct ib_cq *ibcq, int
+
+ spin_lock_irqsave(&chp->lock, flags);
+ for (npolled = 0; npolled < num_entries; ++npolled) {
+-#ifdef DEBUG
+- int i=0;
+-#endif
+
+ /*
+ * Because T3 can post CQEs that are _not_ associated
+@@ -211,9 +208,6 @@ int iwch_poll_cq(struct ib_cq *ibcq, int
+ */
+ do {
+ err = iwch_poll_cq_one(rhp, chp, wc + npolled);
+-#ifdef DEBUG
+- BUG_ON(++i > 1000);
+-#endif
+ } while (err == -EAGAIN);
+ if (err <= 0)
+ break;
diff --git a/patches.drivers/IB-hfi1-Add-16B-rcvhdr-trace-support.patch b/patches.drivers/IB-hfi1-Add-16B-rcvhdr-trace-support.patch
new file mode 100644
index 0000000000..8d5854e04b
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Add-16B-rcvhdr-trace-support.patch
@@ -0,0 +1,63 @@
+From: Don Hiatt <don.hiatt@intel.com>
+Date: Thu, 1 Feb 2018 12:38:48 -0800
+Subject: IB/hfi1: Add 16B rcvhdr trace support
+Patch-mainline: v4.16-rc1
+Git-commit: 6197a815fe9c6e28523eede3d69fa5a8dd7052db
+References: bsc#1114685 FATE#325854
+
+Add trace_hfi1_rcvhdr support for bypass packets.
+While here, remove the etype argument as it is available
+in struct hfi1_packet.
+
+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: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/driver.c | 4 +++-
+ drivers/infiniband/hw/hfi1/trace_rx.h | 6 +++---
+ 2 files changed, 6 insertions(+), 4 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -1560,7 +1560,7 @@ int process_receive_ib(struct hfi1_packe
+ if (hfi1_setup_9B_packet(packet))
+ return RHF_RCV_CONTINUE;
+
+- trace_hfi1_rcvhdr(packet, RHF_RCV_TYPE_IB);
++ trace_hfi1_rcvhdr(packet);
+
+ if (unlikely(rhf_err_flags(packet->rhf))) {
+ handle_eflags(packet);
+@@ -1596,6 +1596,8 @@ int process_receive_bypass(struct hfi1_p
+ if (hfi1_setup_bypass_packet(packet))
+ return RHF_RCV_CONTINUE;
+
++ trace_hfi1_rcvhdr(packet);
++
+ if (unlikely(rhf_err_flags(packet->rhf))) {
+ handle_eflags(packet);
+ return RHF_RCV_CONTINUE;
+--- a/drivers/infiniband/hw/hfi1/trace_rx.h
++++ b/drivers/infiniband/hw/hfi1/trace_rx.h
+@@ -63,8 +63,8 @@ __print_symbolic(type,
+ #define TRACE_SYSTEM hfi1_rx
+
+ TRACE_EVENT(hfi1_rcvhdr,
+- TP_PROTO(struct hfi1_packet *packet, u32 etype),
+- TP_ARGS(packet, etype),
++ TP_PROTO(struct hfi1_packet *packet),
++ TP_ARGS(packet),
+ TP_STRUCT__entry(DD_DEV_ENTRY(packet->rcd->dd)
+ __field(u64, eflags)
+ __field(u32, ctxt)
+@@ -77,7 +77,7 @@ TRACE_EVENT(hfi1_rcvhdr,
+ TP_fast_assign(DD_DEV_ASSIGN(packet->rcd->dd);
+ __entry->eflags = rhf_err_flags(packet->rhf);
+ __entry->ctxt = packet->rcd->ctxt;
+- __entry->etype = etype;
++ __entry->etype = packet->etype;
+ __entry->hlen = packet->hlen;
+ __entry->tlen = packet->tlen;
+ __entry->updegr = packet->updegr;
diff --git a/patches.drivers/IB-hfi1-Add-a-missing-rcu_read_unlock.patch b/patches.drivers/IB-hfi1-Add-a-missing-rcu_read_unlock.patch
new file mode 100644
index 0000000000..38ca0e88a5
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Add-a-missing-rcu_read_unlock.patch
@@ -0,0 +1,30 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Mon, 5 Mar 2018 09:58:33 -0800
+Subject: IB/hfi1: Add a missing rcu_read_unlock()
+Patch-mainline: v4.17-rc1
+Git-commit: 41904439479e94dd61ac499312e8d8266b13f81d
+References: bsc#1114685 FATE#325854
+
+This patch avoids that sparse reports the following:
+
+drivers/infiniband/hw/hfi1/driver.c:251:13: warning: context imbalance in 'rcv_hdrerr' - different lock contexts for basic block
+
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/driver.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -390,6 +390,7 @@ static void rcv_hdrerr(struct hfi1_ctxtd
+ svc_type = IB_CC_SVCTYPE_UC;
+ break;
+ default:
++ rcu_read_unlock();
+ goto drop;
+ }
+
diff --git a/patches.drivers/IB-hfi1-Add-new-state-complete-decodes-for-LNI-failu.patch b/patches.drivers/IB-hfi1-Add-new-state-complete-decodes-for-LNI-failu.patch
new file mode 100644
index 0000000000..25a7e5ae8f
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Add-new-state-complete-decodes-for-LNI-failu.patch
@@ -0,0 +1,33 @@
+From: Jakub Byczkowski <jakub.byczkowski@intel.com>
+Date: Tue, 26 Sep 2017 07:00:04 -0700
+Subject: IB/hfi1: Add new state complete decodes for LNI failures
+Patch-mainline: v4.15-rc1
+Git-commit: e870b4a1f57afb7e913cb05609fd891aa00755a8
+References: bsc#1114685 FATE#325854
+
+Add state decodes for link width negotiation, verify cap time out
+and secure data resolution failures.
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/chip.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/infiniband/hw/hfi1/chip.c
++++ b/drivers/infiniband/hw/hfi1/chip.c
+@@ -10170,6 +10170,10 @@ static const char * const state_complete
+ [0x33] =
+ "Link partner completed the VerifyCap state, but the passing lanes do not meet the local link width policy",
+ [0x34] = tx_out_of_policy,
++ [0x35] = "Negotiated link width is mutually exclusive",
++ [0x36] =
++ "Timed out before receiving verifycap frames in VerifyCap.Exchange",
++ [0x37] = "Unable to resolve secure data exchange",
+ };
+
+ static const char *state_complete_reason_code_string(struct hfi1_pportdata *ppd,
diff --git a/patches.drivers/IB-hfi1-Change-slid-arg-in-ingress_pkey_table_fail-t.patch b/patches.drivers/IB-hfi1-Change-slid-arg-in-ingress_pkey_table_fail-t.patch
new file mode 100644
index 0000000000..2563dd6b9f
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Change-slid-arg-in-ingress_pkey_table_fail-t.patch
@@ -0,0 +1,47 @@
+From: Don Hiatt <don.hiatt@intel.com>
+Date: Fri, 22 Dec 2017 08:46:00 -0800
+Subject: IB/hfi1: Change slid arg in ingress_pkey_table_fail to 32bit
+Patch-mainline: v4.16-rc1
+Git-commit: 2e903b611b3e5b6ef1bf875a747368ec6b30f667
+References: bsc#1114685 FATE#325854
+
+Change the slid arg to ingress_pkey_table_fail() to a full
+32Bits and do not convert to 16Bits in caller. This is so we
+can keep everything 32bit in the kernel and only change to
+16bit at the uapi boundary.
+
+Signed-off-by: Don Hiatt <don.hiatt@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/hfi.h | 2 +-
+ drivers/infiniband/hw/hfi1/mad.c | 6 +-----
+ 2 files changed, 2 insertions(+), 6 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/hfi.h
++++ b/drivers/infiniband/hw/hfi1/hfi.h
+@@ -1623,7 +1623,7 @@ static int ingress_pkey_table_search(str
+ * the 'error info' for this failure.
+ */
+ static void ingress_pkey_table_fail(struct hfi1_pportdata *ppd, u16 pkey,
+- u16 slid)
++ u32 slid)
+ {
+ struct hfi1_devdata *dd = ppd->dd;
+
+--- a/drivers/infiniband/hw/hfi1/mad.c
++++ b/drivers/infiniband/hw/hfi1/mad.c
+@@ -4348,11 +4348,7 @@ static int opa_local_smp_check(struct hf
+ */
+ if (pkey == LIM_MGMT_P_KEY || pkey == FULL_MGMT_P_KEY)
+ return 0;
+- /*
+- * On OPA devices it is okay to lose the upper 16 bits of LID as this
+- * information is obtained elsewhere. Mask off the upper 16 bits.
+- */
+- ingress_pkey_table_fail(ppd, pkey, ib_lid_cpu16(0xFFFF & in_wc->slid));
++ ingress_pkey_table_fail(ppd, pkey, in_wc->slid);
+ return 1;
+ }
+
diff --git a/patches.drivers/IB-hfi1-Convert-PortXmitWait-PortVLXmitWait-counters.patch b/patches.drivers/IB-hfi1-Convert-PortXmitWait-PortVLXmitWait-counters.patch
index bb3645bd04..deffdfe668 100644
--- a/patches.drivers/IB-hfi1-Convert-PortXmitWait-PortVLXmitWait-counters.patch
+++ b/patches.drivers/IB-hfi1-Convert-PortXmitWait-PortVLXmitWait-counters.patch
@@ -155,7 +155,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
}
static char *dcc_err_string(char *buf, int buf_len, u64 flags)
-@@ -10594,6 +10638,14 @@ int set_link_state(struct hfi1_pportdata
+@@ -10598,6 +10642,14 @@ int set_link_state(struct hfi1_pportdata
add_rcvctrl(dd, RCV_CTRL_RCV_PORT_ENABLE_SMASK);
handle_linkup_change(dd, 1);
@@ -185,7 +185,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
int stop_drain_data_vls(struct hfi1_devdata *dd);
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
-@@ -858,6 +858,13 @@ struct hfi1_pportdata {
+@@ -860,6 +860,13 @@ struct hfi1_pportdata {
struct work_struct linkstate_active_work;
/* Does this port need to prescan for FECNs */
bool cc_prescan;
@@ -219,7 +219,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/mad.c
+++ b/drivers/infiniband/hw/hfi1/mad.c
-@@ -2648,6 +2648,79 @@ static void a0_portstatus(struct hfi1_pp
+@@ -2649,6 +2649,79 @@ static void a0_portstatus(struct hfi1_pp
}
}
@@ -299,7 +299,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
static int pma_get_opa_portstatus(struct opa_pma_mad *pmp,
struct ib_device *ibdev,
u8 port, u32 *resp_len)
-@@ -2667,6 +2740,8 @@ static int pma_get_opa_portstatus(struct
+@@ -2668,6 +2741,8 @@ static int pma_get_opa_portstatus(struct
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
int vfi;
u64 tmp, tmp2;
@@ -308,7 +308,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
response_data_size = sizeof(struct opa_port_status_rsp) +
num_vls * sizeof(struct _vls_pctrs);
-@@ -2710,8 +2785,16 @@ static int pma_get_opa_portstatus(struct
+@@ -2711,8 +2786,16 @@ static int pma_get_opa_portstatus(struct
rsp->port_multicast_rcv_pkts =
cpu_to_be64(read_dev_cntr(dd, C_DC_MC_RCV_PKTS,
CNTR_INVALID_VL));
@@ -326,7 +326,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rsp->port_rcv_fecn =
cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FCN, CNTR_INVALID_VL));
rsp->port_rcv_becn =
-@@ -2776,10 +2859,14 @@ static int pma_get_opa_portstatus(struct
+@@ -2777,10 +2860,14 @@ static int pma_get_opa_portstatus(struct
rsp->vls[vfi].port_vl_xmit_pkts =
cpu_to_be64(read_port_cntr(ppd, C_TX_PKT_VL,
idx_from_vl(vl)));
@@ -352,8 +352,8 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+ u16 link_speed;
num_ports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
- num_pslm = hweight64(be64_to_cpu(req->port_select_mask[3]));
-@@ -2960,8 +3049,16 @@ static int pma_get_opa_datacounters(stru
+ num_vls = hweight32(be32_to_cpu(req->vl_select_mask));
+@@ -2959,8 +3048,16 @@ static int pma_get_opa_datacounters(stru
rsp->link_quality_indicator = cpu_to_be32((u32)lq);
pma_get_opa_port_dctrs(ibdev, rsp);
@@ -371,7 +371,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rsp->port_rcv_fecn =
cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FCN, CNTR_INVALID_VL));
rsp->port_rcv_becn =
-@@ -2997,9 +3094,14 @@ static int pma_get_opa_datacounters(stru
+@@ -2996,9 +3093,14 @@ static int pma_get_opa_datacounters(stru
cpu_to_be64(read_dev_cntr(dd, C_DC_RX_PKT_VL,
idx_from_vl(vl)));
@@ -388,7 +388,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rsp->vls[vfi].port_vl_rcv_fecn =
cpu_to_be64(read_dev_cntr(dd, C_DC_RCV_FCN_VL,
-@@ -3417,9 +3519,11 @@ static int pma_set_opa_portstatus(struct
+@@ -3416,9 +3518,11 @@ static int pma_set_opa_portstatus(struct
if (counter_select & CS_PORT_MCAST_RCV_PKTS)
write_dev_cntr(dd, C_DC_MC_RCV_PKTS, CNTR_INVALID_VL, 0);
@@ -402,7 +402,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
/* ignore cs_sw_portCongestion for HFIs */
if (counter_select & CS_PORT_RCV_FECN)
-@@ -3492,8 +3596,11 @@ static int pma_set_opa_portstatus(struct
+@@ -3491,8 +3595,11 @@ static int pma_set_opa_portstatus(struct
if (counter_select & CS_PORT_RCV_PKTS)
write_dev_cntr(dd, C_DC_RX_PKT_VL, idx_from_vl(vl), 0);
diff --git a/patches.drivers/IB-hfi1-Convert-kzalloc_node-and-kcalloc-to-use-kcal.patch b/patches.drivers/IB-hfi1-Convert-kzalloc_node-and-kcalloc-to-use-kcal.patch
new file mode 100644
index 0000000000..e7e39bdbf0
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Convert-kzalloc_node-and-kcalloc-to-use-kcal.patch
@@ -0,0 +1,111 @@
+From: Kamenee Arumugam <kamenee.arumugam@intel.com>
+Date: Thu, 1 Feb 2018 12:37:30 -0800
+Subject: IB/hfi1: Convert kzalloc_node and kcalloc to use kcalloc_node
+Patch-mainline: v4.16-rc1
+Git-commit: 953a9cebeab43f33baed79d1a9ef643bfb249c4b
+References: bsc#1114685 FATE#325854
+
+Kzalloc_node API doesn't check for overflows in size multiplication.
+While kcalloc API check for overflows in size multiplication
+but these implementations are not NUMA-aware.
+
+This conversion allowed for correcting an allocation used in the hot
+path to be on the local NUMA and ensure us overflow free multiplication
+for the size of a memory allocation.
+
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Kamenee Arumugam <kamenee.arumugam@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/init.c | 17 +++++++++--------
+ drivers/infiniband/hw/hfi1/pio.c | 15 ++++++++-------
+ drivers/infiniband/hw/hfi1/sdma.c | 3 ++-
+ 3 files changed, 19 insertions(+), 16 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/init.c
++++ b/drivers/infiniband/hw/hfi1/init.c
+@@ -172,7 +172,7 @@ int hfi1_create_kctxts(struct hfi1_devda
+ u16 i;
+ int ret;
+
+- dd->rcd = kzalloc_node(dd->num_rcv_contexts * sizeof(*dd->rcd),
++ dd->rcd = kcalloc_node(dd->num_rcv_contexts, sizeof(*dd->rcd),
+ GFP_KERNEL, dd->node);
+ if (!dd->rcd)
+ return -ENOMEM;
+@@ -439,15 +439,16 @@ int hfi1_create_ctxtdata(struct hfi1_ppo
+ * The resulting value will be rounded down to the closest
+ * multiple of dd->rcv_entries.group_size.
+ */
+- rcd->egrbufs.buffers = kzalloc_node(
+- rcd->egrbufs.count * sizeof(*rcd->egrbufs.buffers),
+- GFP_KERNEL, numa);
++ rcd->egrbufs.buffers =
++ kcalloc_node(rcd->egrbufs.count,
++ sizeof(*rcd->egrbufs.buffers),
++ GFP_KERNEL, numa);
+ if (!rcd->egrbufs.buffers)
+ goto bail;
+- rcd->egrbufs.rcvtids = kzalloc_node(
+- rcd->egrbufs.count *
+- sizeof(*rcd->egrbufs.rcvtids),
+- GFP_KERNEL, numa);
++ rcd->egrbufs.rcvtids =
++ kcalloc_node(rcd->egrbufs.count,
++ sizeof(*rcd->egrbufs.rcvtids),
++ GFP_KERNEL, numa);
+ if (!rcd->egrbufs.rcvtids)
+ goto bail;
+ rcd->egrbufs.size = eager_buffer_size;
+--- a/drivers/infiniband/hw/hfi1/pio.c
++++ b/drivers/infiniband/hw/hfi1/pio.c
+@@ -455,8 +455,8 @@ int init_send_contexts(struct hfi1_devda
+ dd->hw_to_sw = kmalloc_array(TXE_NUM_CONTEXTS, sizeof(u8),
+ GFP_KERNEL);
+ dd->send_contexts = kcalloc(dd->num_send_contexts,
+- sizeof(struct send_context_info),
+- GFP_KERNEL);
++ sizeof(struct send_context_info),
++ GFP_KERNEL);
+ if (!dd->send_contexts || !dd->hw_to_sw) {
+ kfree(dd->hw_to_sw);
+ kfree(dd->send_contexts);
+@@ -856,8 +856,9 @@ struct send_context *sc_alloc(struct hfi
+ * so head == tail can mean empty.
+ */
+ sc->sr_size = sci->credits + 1;
+- sc->sr = kzalloc_node(sizeof(union pio_shadow_ring) *
+- sc->sr_size, GFP_KERNEL, numa);
++ sc->sr = kcalloc_node(sc->sr_size,
++ sizeof(union pio_shadow_ring),
++ GFP_KERNEL, numa);
+ if (!sc->sr) {
+ sc_free(sc);
+ return NULL;
+@@ -1958,9 +1959,9 @@ int init_pervl_scs(struct hfi1_devdata *
+ hfi1_init_ctxt(dd->vld[15].sc);
+ dd->vld[15].mtu = enum_to_mtu(OPA_MTU_2048);
+
+- dd->kernel_send_context = kzalloc_node(dd->num_send_contexts *
+- sizeof(struct send_context *),
+- GFP_KERNEL, dd->node);
++ dd->kernel_send_context = kcalloc_node(dd->num_send_contexts,
++ sizeof(struct send_context *),
++ GFP_KERNEL, dd->node);
+ if (!dd->kernel_send_context)
+ goto freesc15;
+
+--- a/drivers/infiniband/hw/hfi1/sdma.c
++++ b/drivers/infiniband/hw/hfi1/sdma.c
+@@ -1388,7 +1388,8 @@ int sdma_init(struct hfi1_devdata *dd, u
+ num_engines, descq_cnt);
+
+ /* alloc memory for array of send engines */
+- dd->per_sdma = kcalloc(num_engines, sizeof(*dd->per_sdma), GFP_KERNEL);
++ dd->per_sdma = kcalloc_node(num_engines, sizeof(*dd->per_sdma),
++ GFP_KERNEL, dd->node);
+ if (!dd->per_sdma)
+ return ret;
+
diff --git a/patches.drivers/IB-hfi1-Convert-the-macro-AHG_HEADER_SET-into-an-inl.patch b/patches.drivers/IB-hfi1-Convert-the-macro-AHG_HEADER_SET-into-an-inl.patch
new file mode 100644
index 0000000000..58e96a1e29
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Convert-the-macro-AHG_HEADER_SET-into-an-inl.patch
@@ -0,0 +1,168 @@
+From: Harish Chegondi <harish.chegondi@intel.com>
+Date: Tue, 26 Sep 2017 07:00:11 -0700
+Subject: IB/hfi1: Convert the macro AHG_HEADER_SET into an inline function
+Patch-mainline: v4.15-rc1
+Git-commit: d34ed562ac0af306037d0985fb1b7fad97f91f1e
+References: bsc#1114685 FATE#325854
+
+AHG_HEADER_SET macro doesn't conform to the coding standards as it can
+affect the control flow. Convert the macro AHG_HEADER_SET into an inline
+function ahg_header_set().
+
+Cc: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/user_sdma.c | 58 ++++++++++++++++++++++-----------
+ drivers/infiniband/hw/hfi1/user_sdma.h | 29 +++++++++++-----
+ 2 files changed, 59 insertions(+), 28 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/user_sdma.c
++++ b/drivers/infiniband/hw/hfi1/user_sdma.c
+@@ -1254,20 +1254,25 @@ static int set_txreq_header_ahg(struct u
+ struct user_sdma_txreq *tx, u32 datalen)
+ {
+ u32 ahg[AHG_KDETH_ARRAY_SIZE];
+- int diff = 0;
++ int idx = 0;
+ u8 omfactor; /* KDETH.OM */
+ struct hfi1_user_sdma_pkt_q *pq = req->pq;
+ struct hfi1_pkt_header *hdr = &req->hdr;
+ u16 pbclen = le16_to_cpu(hdr->pbc[0]);
+ u32 val32, tidval = 0, lrhlen = get_lrh_len(*hdr, pad_len(datalen));
++ size_t array_size = ARRAY_SIZE(ahg);
+
+ if (PBC2LRH(pbclen) != lrhlen) {
+ /* PBC.PbcLengthDWs */
+- AHG_HEADER_SET(ahg, diff, 0, 0, 12,
+- cpu_to_le16(LRH2PBC(lrhlen)));
++ idx = ahg_header_set(ahg, idx, array_size, 0, 0, 12,
++ (__force u16)cpu_to_le16(LRH2PBC(lrhlen)));
++ if (idx < 0)
++ return idx;
+ /* LRH.PktLen (we need the full 16 bits due to byte swap) */
+- AHG_HEADER_SET(ahg, diff, 3, 0, 16,
+- cpu_to_be16(lrhlen >> 2));
++ idx = ahg_header_set(ahg, idx, array_size, 3, 0, 16,
++ (__force u16)cpu_to_be16(lrhlen >> 2));
++ if (idx < 0)
++ return idx;
+ }
+
+ /*
+@@ -1278,12 +1283,23 @@ static int set_txreq_header_ahg(struct u
+ (HFI1_CAP_IS_KSET(EXTENDED_PSN) ? 0x7fffffff : 0xffffff);
+ if (unlikely(tx->flags & TXREQ_FLAGS_REQ_ACK))
+ val32 |= 1UL << 31;
+- AHG_HEADER_SET(ahg, diff, 6, 0, 16, cpu_to_be16(val32 >> 16));
+- AHG_HEADER_SET(ahg, diff, 6, 16, 16, cpu_to_be16(val32 & 0xffff));
++ idx = ahg_header_set(ahg, idx, array_size, 6, 0, 16,
++ (__force u16)cpu_to_be16(val32 >> 16));
++ if (idx < 0)
++ return idx;
++ idx = ahg_header_set(ahg, idx, array_size, 6, 16, 16,
++ (__force u16)cpu_to_be16(val32 & 0xffff));
++ if (idx < 0)
++ return idx;
+ /* KDETH.Offset */
+- AHG_HEADER_SET(ahg, diff, 15, 0, 16,
+- cpu_to_le16(req->koffset & 0xffff));
+- AHG_HEADER_SET(ahg, diff, 15, 16, 16, cpu_to_le16(req->koffset >> 16));
++ idx = ahg_header_set(ahg, idx, array_size, 15, 0, 16,
++ (__force u16)cpu_to_le16(req->koffset & 0xffff));
++ if (idx < 0)
++ return idx;
++ idx = ahg_header_set(ahg, idx, array_size, 15, 16, 16,
++ (__force u16)cpu_to_le16(req->koffset >> 16));
++ if (idx < 0)
++ return idx;
+ if (req_opcode(req->info.ctrl) == EXPECTED) {
+ __le16 val;
+
+@@ -1310,10 +1326,13 @@ static int set_txreq_header_ahg(struct u
+ KDETH_OM_MAX_SIZE) ? KDETH_OM_LARGE_SHIFT :
+ KDETH_OM_SMALL_SHIFT;
+ /* KDETH.OM and KDETH.OFFSET (TID) */
+- AHG_HEADER_SET(ahg, diff, 7, 0, 16,
+- ((!!(omfactor - KDETH_OM_SMALL_SHIFT)) << 15 |
++ idx = ahg_header_set(
++ ahg, idx, array_size, 7, 0, 16,
++ ((!!(omfactor - KDETH_OM_SMALL_SHIFT)) << 15 |
+ ((req->tidoffset >> omfactor)
+- & 0x7fff)));
++ & 0x7fff)));
++ if (idx < 0)
++ return idx;
+ /* KDETH.TIDCtrl, KDETH.TID, KDETH.Intr, KDETH.SH */
+ val = cpu_to_le16(((EXP_TID_GET(tidval, CTRL) & 0x3) << 10) |
+ (EXP_TID_GET(tidval, IDX) & 0x3ff));
+@@ -1330,21 +1349,22 @@ static int set_txreq_header_ahg(struct u
+ AHG_KDETH_INTR_SHIFT));
+ }
+
+- AHG_HEADER_SET(ahg, diff, 7, 16, 14, val);
++ idx = ahg_header_set(ahg, idx, array_size,
++ 7, 16, 14, (__force u16)val);
++ if (idx < 0)
++ return idx;
+ }
+- if (diff < 0)
+- return diff;
+
+ trace_hfi1_sdma_user_header_ahg(pq->dd, pq->ctxt, pq->subctxt,
+ req->info.comp_idx, req->sde->this_idx,
+- req->ahg_idx, ahg, diff, tidval);
++ req->ahg_idx, ahg, idx, tidval);
+ sdma_txinit_ahg(&tx->txreq,
+ SDMA_TXREQ_F_USE_AHG,
+- datalen, req->ahg_idx, diff,
++ datalen, req->ahg_idx, idx,
+ ahg, sizeof(req->hdr),
+ user_sdma_txreq_cb);
+
+- return diff;
++ return idx;
+ }
+
+ /*
+--- a/drivers/infiniband/hw/hfi1/user_sdma.h
++++ b/drivers/infiniband/hw/hfi1/user_sdma.h
+@@ -80,15 +80,26 @@
+ #define PBC2LRH(x) ((((x) & 0xfff) << 2) - 4)
+ #define LRH2PBC(x) ((((x) >> 2) + 1) & 0xfff)
+
+-#define AHG_HEADER_SET(arr, idx, dw, bit, width, value) \
+- do { \
+- if ((idx) < ARRAY_SIZE((arr))) \
+- (arr)[(idx++)] = sdma_build_ahg_descriptor( \
+- (__force u16)(value), (dw), (bit), \
+- (width)); \
+- else \
+- return -ERANGE; \
+- } while (0)
++/**
++ * Build an SDMA AHG header update descriptor and save it to an array.
++ * @arr - Array to save the descriptor to.
++ * @idx - Index of the array at which the descriptor will be saved.
++ * @array_size - Size of the array arr.
++ * @dw - Update index into the header in DWs.
++ * @bit - Start bit.
++ * @width - Field width.
++ * @value - 16 bits of immediate data to write into the field.
++ * Returns -ERANGE if idx is invalid. If successful, returns the next index
++ * (idx + 1) of the array to be used for the next descriptor.
++ */
++static inline int ahg_header_set(u32 *arr, int idx, size_t array_size,
++ u8 dw, u8 bit, u8 width, u16 value)
++{
++ if ((size_t)idx >= array_size)
++ return -ERANGE;
++ arr[idx++] = sdma_build_ahg_descriptor(value, dw, bit, width);
++ return idx;
++}
+
+ /* Tx request flag bits */
+ #define TXREQ_FLAGS_REQ_ACK BIT(0) /* Set the ACK bit in the header */
diff --git a/patches.drivers/IB-hfi1-Correct-unnecessary-acquisition-of-HW-mutex.patch b/patches.drivers/IB-hfi1-Correct-unnecessary-acquisition-of-HW-mutex.patch
new file mode 100644
index 0000000000..a8f6cbd4f2
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Correct-unnecessary-acquisition-of-HW-mutex.patch
@@ -0,0 +1,56 @@
+From: Grzegorz Morys <grzegorz.morys@intel.com>
+Date: Mon, 9 Oct 2017 12:38:04 -0700
+Subject: IB/hfi1: Correct unnecessary acquisition of HW mutex
+Patch-mainline: v4.15-rc1
+Git-commit: b65c2045cc5089bd3cfacc9fad63798fded64226
+References: bsc#1114685 FATE#325854
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/firmware.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/firmware.c
++++ b/drivers/infiniband/hw/hfi1/firmware.c
+@@ -1424,7 +1424,14 @@ int acquire_hw_mutex(struct hfi1_devdata
+ unsigned long timeout;
+ int try = 0;
+ u8 mask = 1 << dd->hfi1_id;
+- u8 user;
++ u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
++
++ if (user == mask) {
++ dd_dev_info(dd,
++ "Hardware mutex already acquired, mutex mask %u\n",
++ (u32)mask);
++ return 0;
++ }
+
+ retry:
+ timeout = msecs_to_jiffies(HM_TIMEOUT) + jiffies;
+@@ -1455,7 +1462,15 @@ retry:
+
+ void release_hw_mutex(struct hfi1_devdata *dd)
+ {
+- write_csr(dd, ASIC_CFG_MUTEX, 0);
++ u8 mask = 1 << dd->hfi1_id;
++ u8 user = (u8)read_csr(dd, ASIC_CFG_MUTEX);
++
++ if (user != mask)
++ dd_dev_warn(dd,
++ "Unable to release hardware mutex, mutex mask %u, my mask %u\n",
++ (u32)user, (u32)mask);
++ else
++ write_csr(dd, ASIC_CFG_MUTEX, 0);
+ }
+
+ /* return the given resource bit(s) as a mask for the given HFI */
diff --git a/patches.drivers/IB-hfi1-Define-hfi1_handle_cnp_tbl-once.patch b/patches.drivers/IB-hfi1-Define-hfi1_handle_cnp_tbl-once.patch
new file mode 100644
index 0000000000..8f1ebebc0a
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Define-hfi1_handle_cnp_tbl-once.patch
@@ -0,0 +1,50 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 11 Oct 2017 10:48:59 -0700
+Subject: IB/hfi1: Define hfi1_handle_cnp_tbl[] once
+Patch-mainline: v4.15-rc1
+Git-commit: e2fdbc23689258d9dd43450048707c953bab5f89
+References: bsc#1114685 FATE#325854
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/driver.c | 6 ++++++
+ drivers/infiniband/hw/hfi1/hfi.h | 5 -----
+ 2 files changed, 6 insertions(+), 5 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -433,6 +433,12 @@ static inline void init_packet(struct hf
+ packet->numpkt = 0;
+ }
+
++/* We support only two types - 9B and 16B for now */
++static const hfi1_handle_cnp hfi1_handle_cnp_tbl[2] = {
++ [HFI1_PKT_TYPE_9B] = &return_cnp,
++ [HFI1_PKT_TYPE_16B] = &return_cnp_16B
++};
++
+ void hfi1_process_ecn_slowpath(struct rvt_qp *qp, struct hfi1_packet *pkt,
+ bool do_cnp)
+ {
+--- a/drivers/infiniband/hw/hfi1/hfi.h
++++ b/drivers/infiniband/hw/hfi1/hfi.h
+@@ -1538,11 +1538,6 @@ typedef void (*hfi1_handle_cnp)(struct h
+ u32 remote_qpn, u32 pkey, u32 slid, u32 dlid,
+ u8 sc5, const struct ib_grh *old_grh);
+
+-/* We support only two types - 9B and 16B for now */
+-static const hfi1_handle_cnp hfi1_handle_cnp_tbl[2] = {
+- [HFI1_PKT_TYPE_9B] = &return_cnp,
+- [HFI1_PKT_TYPE_16B] = &return_cnp_16B
+-};
+ #define PKEY_CHECK_INVALID -1
+ int egress_pkey_check(struct hfi1_pportdata *ppd, u32 slid, u16 pkey,
+ u8 sc5, int8_t s_pkey_index);
diff --git a/patches.drivers/IB-hfi1-Eliminate-allocation-while-atomic.patch b/patches.drivers/IB-hfi1-Eliminate-allocation-while-atomic.patch
index 9c3000dc10..c6eaebb511 100644
--- a/patches.drivers/IB-hfi1-Eliminate-allocation-while-atomic.patch
+++ b/patches.drivers/IB-hfi1-Eliminate-allocation-while-atomic.patch
@@ -50,15 +50,15 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
static uint wss_threshold;
module_param(wss_threshold, uint, S_IRUGO);
MODULE_PARM_DESC(wss_threshold, "Percentage (1-100) of LLC to use as a threshold for a cacheless copy");
-@@ -814,7 +817,6 @@ static int build_verbs_tx_desc(
+@@ -813,7 +816,6 @@ static int build_verbs_tx_desc(
+ struct hfi1_sdma_header *phdr = &tx->phdr;
u16 hdrbytes = tx->hdr_dwords << 2;
- u32 *hdr;
u8 extra_bytes = 0;
- static char trail_buf[12]; /* CRC = 4, LT = 1, Pad = 0 to 7 bytes */
if (tx->phdr.hdr.hdr_type) {
/*
-@@ -869,9 +871,9 @@ static int build_verbs_tx_desc(
+@@ -865,9 +867,9 @@ static int build_verbs_tx_desc(
}
/* add icrc, lt byte, and padding to flit */
@@ -70,7 +70,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
bail_txadd:
return ret;
-@@ -1128,18 +1130,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
+@@ -1118,18 +1120,10 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
len -= slen;
}
}
diff --git a/patches.drivers/IB-hfi1-Fix-a-kernel-doc-warning.patch b/patches.drivers/IB-hfi1-Fix-a-kernel-doc-warning.patch
new file mode 100644
index 0000000000..d4a93be2c9
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Fix-a-kernel-doc-warning.patch
@@ -0,0 +1,30 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 7 Mar 2018 16:56:03 -0800
+Subject: IB/hfi1: Fix a kernel-doc warning
+Patch-mainline: v4.17-rc1
+Git-commit: 8932ff803d72804316ea85fe6705e0867f827d65
+References: bsc#1114685 FATE#325854
+
+Avoid that building with W=1 causes the following warning to appear:
+
+drivers/infiniband/hw/hfi1/qp.c:484: warning: Cannot understand * on line 484 - I thought it was a doc line
+
+Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
+Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/qp.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/infiniband/hw/hfi1/qp.c
++++ b/drivers/infiniband/hw/hfi1/qp.c
+@@ -481,7 +481,6 @@ static void iowait_sdma_drained(struct i
+ }
+
+ /**
+- *
+ * qp_to_sdma_engine - map a qp to a send engine
+ * @qp: the QP
+ * @sc5: the 5 bit sc
diff --git a/patches.drivers/IB-hfi1-Fix-handling-of-FECN-marked-multicast-packet.patch b/patches.drivers/IB-hfi1-Fix-handling-of-FECN-marked-multicast-packet.patch
index 1543a46694..ae730f0126 100644
--- a/patches.drivers/IB-hfi1-Fix-handling-of-FECN-marked-multicast-packet.patch
+++ b/patches.drivers/IB-hfi1-Fix-handling-of-FECN-marked-multicast-packet.patch
@@ -43,7 +43,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/driver.c
+++ b/drivers/infiniband/hw/hfi1/driver.c
-@@ -437,31 +437,43 @@ void hfi1_process_ecn_slowpath(struct rv
+@@ -443,31 +443,43 @@ void hfi1_process_ecn_slowpath(struct rv
bool do_cnp)
{
struct hfi1_ibport *ibp = to_iport(qp->ibqp.device, qp->port_num);
@@ -90,7 +90,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rqpn = ib_get_sqpn(pkt->ohdr);
svc_type = IB_CC_SVCTYPE_UD;
break;
-@@ -486,7 +498,6 @@ void hfi1_process_ecn_slowpath(struct rv
+@@ -492,7 +504,6 @@ void hfi1_process_ecn_slowpath(struct rv
dlid, rlid, sc, grh);
if (!is_mcast && (bth1 & IB_BECN_SMASK)) {
@@ -100,7 +100,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/hfi.h
+++ b/drivers/infiniband/hw/hfi1/hfi.h
-@@ -1527,13 +1527,13 @@ void set_link_ipg(struct hfi1_pportdata
+@@ -1540,13 +1540,13 @@ void set_link_ipg(struct hfi1_pportdata
void process_becn(struct hfi1_pportdata *ppd, u8 sl, u32 rlid, u32 lqpn,
u32 rqpn, u8 svc_type);
void return_cnp(struct hfi1_ibport *ibp, struct rvt_qp *qp, u32 remote_qpn,
@@ -116,8 +116,8 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+ u32 remote_qpn, u16 pkey, u32 slid, u32 dlid,
u8 sc5, const struct ib_grh *old_grh);
- /* We support only two types - 9B and 16B for now */
-@@ -2434,7 +2434,7 @@ static inline void hfi1_make_16b_hdr(str
+ #define PKEY_CHECK_INVALID -1
+@@ -2443,7 +2443,7 @@ static inline void hfi1_make_16b_hdr(str
((slid >> OPA_16B_SLID_SHIFT) << OPA_16B_SLID_HIGH_SHIFT);
lrh2 = (lrh2 & ~OPA_16B_DLID_MASK) |
((dlid >> OPA_16B_DLID_SHIFT) << OPA_16B_DLID_HIGH_SHIFT);
diff --git a/patches.drivers/IB-hfi1-Fix-infinite-loop-in-8051-command-error-path.patch b/patches.drivers/IB-hfi1-Fix-infinite-loop-in-8051-command-error-path.patch
index 1416afc2a2..2e4d750a6c 100644
--- a/patches.drivers/IB-hfi1-Fix-infinite-loop-in-8051-command-error-path.patch
+++ b/patches.drivers/IB-hfi1-Fix-infinite-loop-in-8051-command-error-path.patch
@@ -113,8 +113,8 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
return do_8051_command(dd, HCMD_CHANGE_PHY_STATE, state, NULL);
}
--int _load_8051_config(struct hfi1_devdata *dd, u8 field_id,
-- u8 lane_id, u32 config_data)
+-static int _load_8051_config(struct hfi1_devdata *dd, u8 field_id,
+- u8 lane_id, u32 config_data)
+int load_8051_config(struct hfi1_devdata *dd, u8 field_id,
+ u8 lane_id, u32 config_data)
{
@@ -130,7 +130,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
if (ret != HCMD_SUCCESS) {
dd_dev_err(dd,
"load 8051 config: field id %d, lane %d, err %d\n",
-@@ -8733,18 +8714,6 @@ int _load_8051_config(struct hfi1_devdat
+@@ -8733,18 +8714,6 @@ static int _load_8051_config(struct hfi1
return ret;
}
@@ -166,7 +166,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
}
void read_misc_status(struct hfi1_devdata *dd, u8 *ver_major, u8 *ver_minor,
-@@ -9292,6 +9260,14 @@ static int set_local_link_attributes(str
+@@ -9271,6 +9239,14 @@ static int set_local_link_attributes(str
if (ret != HCMD_SUCCESS)
goto set_local_link_attributes_fail;
@@ -191,7 +191,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
#define HOST_INTERFACE_VERSION_SHIFT 16
#define HOST_INTERFACE_VERSION_MASK 0xff
-@@ -710,7 +711,6 @@ void read_misc_status(struct hfi1_devdat
+@@ -713,7 +714,6 @@ void read_misc_status(struct hfi1_devdat
u8 *ver_patch);
int write_host_interface_version(struct hfi1_devdata *dd, u8 version);
void read_guid(struct hfi1_devdata *dd);
diff --git a/patches.drivers/IB-hfi1-Fix-loss-of-BECN-with-AHG.patch b/patches.drivers/IB-hfi1-Fix-loss-of-BECN-with-AHG.patch
index e481dbfd7d..0a33d16a2d 100644
--- a/patches.drivers/IB-hfi1-Fix-loss-of-BECN-with-AHG.patch
+++ b/patches.drivers/IB-hfi1-Fix-loss-of-BECN-with-AHG.patch
@@ -28,7 +28,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/ruc.c
+++ b/drivers/infiniband/hw/hfi1/ruc.c
-@@ -734,6 +734,20 @@ static inline void hfi1_make_ruc_bth(str
+@@ -733,6 +733,20 @@ static inline void hfi1_make_ruc_bth(str
ohdr->bth[2] = cpu_to_be32(bth2);
}
@@ -49,7 +49,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
static inline void hfi1_make_ruc_header_16B(struct rvt_qp *qp,
struct ib_other_headers *ohdr,
u32 bth0, u32 bth2, int middle,
-@@ -778,6 +792,12 @@ static inline void hfi1_make_ruc_header_
+@@ -777,6 +791,12 @@ static inline void hfi1_make_ruc_header_
else
middle = 0;
@@ -62,19 +62,19 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
if (middle)
build_ahg(qp, bth2);
else
-@@ -785,11 +805,6 @@ static inline void hfi1_make_ruc_header_
+@@ -784,11 +804,6 @@ static inline void hfi1_make_ruc_header_
bth0 |= pkey;
bth0 |= extra_bytes << 20;
- if (qp->s_flags & RVT_S_ECN) {
- qp->s_flags &= ~RVT_S_ECN;
- /* we recently received a FECN, so return a BECN */
-- becn = 1;
+- becn = true;
- }
hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
if (!ppd->lid)
-@@ -807,6 +822,20 @@ static inline void hfi1_make_ruc_header_
+@@ -806,6 +821,20 @@ static inline void hfi1_make_ruc_header_
pkey, becn, 0, l4, priv->s_sc);
}
@@ -95,7 +95,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
static inline void hfi1_make_ruc_header_9B(struct rvt_qp *qp,
struct ib_other_headers *ohdr,
u32 bth0, u32 bth2, int middle,
-@@ -842,6 +871,12 @@ static inline void hfi1_make_ruc_header_
+@@ -839,6 +868,12 @@ static inline void hfi1_make_ruc_header_
else
middle = 0;
@@ -108,7 +108,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
if (middle)
build_ahg(qp, bth2);
else
-@@ -849,11 +884,6 @@ static inline void hfi1_make_ruc_header_
+@@ -846,11 +881,6 @@ static inline void hfi1_make_ruc_header_
bth0 |= pkey;
bth0 |= extra_bytes << 20;
@@ -118,5 +118,5 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
- bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
- }
hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
-
- if (!ppd->lid)
+ hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh,
+ lrh0,
diff --git a/patches.drivers/IB-hfi1-Fix-parenthesis-alignment-issues.patch b/patches.drivers/IB-hfi1-Fix-parenthesis-alignment-issues.patch
new file mode 100644
index 0000000000..34a3885c7a
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Fix-parenthesis-alignment-issues.patch
@@ -0,0 +1,68 @@
+From: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
+Date: Tue, 26 Sep 2017 07:04:03 -0700
+Subject: IB/hfi1: Fix parenthesis alignment issues
+Patch-mainline: v4.15-rc1
+Git-commit: 033c16d71fdcd99a04eb670713124f88aa2a6922
+References: bsc#1114685 FATE#325854
+
+In preparation to refactoring get_base_info(), cleanup some
+checkpatch issues.
+
+Reviewed-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/file_ops.c | 24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/file_ops.c
++++ b/drivers/infiniband/hw/hfi1/file_ops.c
+@@ -1385,34 +1385,34 @@ static int get_base_info(struct hfi1_fil
+ fd->subctxt,
+ uctxt->egrbufs.rcvtids[0].dma);
+ binfo.sdma_comp_bufbase = HFI1_MMAP_TOKEN(SDMA_COMP, uctxt->ctxt,
+- fd->subctxt, 0);
++ fd->subctxt, 0);
+ /*
+ * user regs are at
+ * (RXE_PER_CONTEXT_USER + (ctxt * RXE_PER_CONTEXT_SIZE))
+ */
+ binfo.user_regbase = HFI1_MMAP_TOKEN(UREGS, uctxt->ctxt,
+- fd->subctxt, 0);
++ fd->subctxt, 0);
+ offset = offset_in_page((uctxt_offset(uctxt) + fd->subctxt) *
+ sizeof(*dd->events));
+ binfo.events_bufbase = HFI1_MMAP_TOKEN(EVENTS, uctxt->ctxt,
+- fd->subctxt,
+- offset);
++ fd->subctxt,
++ offset);
+ binfo.status_bufbase = HFI1_MMAP_TOKEN(STATUS, uctxt->ctxt,
+- fd->subctxt,
+- dd->status);
++ fd->subctxt,
++ dd->status);
+ if (HFI1_CAP_IS_USET(DMA_RTAIL))
+ binfo.rcvhdrtail_base = HFI1_MMAP_TOKEN(RTAIL, uctxt->ctxt,
+- fd->subctxt, 0);
++ fd->subctxt, 0);
+ if (uctxt->subctxt_cnt) {
+ binfo.subctxt_uregbase = HFI1_MMAP_TOKEN(SUBCTXT_UREGS,
+- uctxt->ctxt,
+- fd->subctxt, 0);
+- binfo.subctxt_rcvhdrbuf = HFI1_MMAP_TOKEN(SUBCTXT_RCV_HDRQ,
+ uctxt->ctxt,
+ fd->subctxt, 0);
++ binfo.subctxt_rcvhdrbuf = HFI1_MMAP_TOKEN(SUBCTXT_RCV_HDRQ,
++ uctxt->ctxt,
++ fd->subctxt, 0);
+ binfo.subctxt_rcvegrbuf = HFI1_MMAP_TOKEN(SUBCTXT_EGRBUF,
+- uctxt->ctxt,
+- fd->subctxt, 0);
++ uctxt->ctxt,
++ fd->subctxt, 0);
+ }
+ sz = (len < sizeof(binfo)) ? len : sizeof(binfo);
+ if (copy_to_user(ubase, &binfo, sz))
diff --git a/patches.drivers/IB-hfi1-Look-up-ibport-using-a-pointer-in-receive-pa.patch b/patches.drivers/IB-hfi1-Look-up-ibport-using-a-pointer-in-receive-pa.patch
index 3ba341220c..e571f988fb 100644
--- a/patches.drivers/IB-hfi1-Look-up-ibport-using-a-pointer-in-receive-pa.patch
+++ b/patches.drivers/IB-hfi1-Look-up-ibport-using-a-pointer-in-receive-pa.patch
@@ -22,7 +22,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/driver.c
+++ b/drivers/infiniband/hw/hfi1/driver.c
-@@ -636,9 +636,10 @@ next:
+@@ -650,9 +650,10 @@ next:
}
}
@@ -34,7 +34,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
/*
* Iterate over all QPs waiting to respond.
-@@ -648,7 +649,8 @@ static void process_rcv_qp_work(struct h
+@@ -662,7 +663,8 @@ static void process_rcv_qp_work(struct h
list_del_init(&qp->rspwait);
if (qp->r_flags & RVT_R_RSP_NAK) {
qp->r_flags &= ~RVT_R_RSP_NAK;
@@ -44,7 +44,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
}
if (qp->r_flags & RVT_R_RSP_SEND) {
unsigned long flags;
-@@ -669,7 +671,7 @@ static noinline int max_packet_exceeded(
+@@ -683,7 +685,7 @@ static noinline int max_packet_exceeded(
if (thread) {
if ((packet->numpkt & (MAX_PKT_RECV_THREAD - 1)) == 0)
/* allow defered processing */
@@ -53,7 +53,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
cond_resched();
return RCV_PKT_OK;
} else {
-@@ -811,7 +813,7 @@ int handle_receive_interrupt_nodma_rtail
+@@ -825,7 +827,7 @@ int handle_receive_interrupt_nodma_rtail
last = RCV_PKT_DONE;
process_rcv_update(last, &packet);
}
@@ -62,7 +62,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rcd->head = packet.rhqoff;
bail:
finish_packet(&packet);
-@@ -840,7 +842,7 @@ int handle_receive_interrupt_dma_rtail(s
+@@ -854,7 +856,7 @@ int handle_receive_interrupt_dma_rtail(s
last = RCV_PKT_DONE;
process_rcv_update(last, &packet);
}
@@ -71,7 +71,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rcd->head = packet.rhqoff;
bail:
finish_packet(&packet);
-@@ -1070,7 +1072,7 @@ int handle_receive_interrupt(struct hfi1
+@@ -1084,7 +1086,7 @@ int handle_receive_interrupt(struct hfi1
process_rcv_update(last, &packet);
}
@@ -82,7 +82,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
bail:
--- a/drivers/infiniband/hw/hfi1/rc.c
+++ b/drivers/infiniband/hw/hfi1/rc.c
-@@ -730,14 +730,16 @@ static inline void hfi1_make_bth_aeth(st
+@@ -728,14 +728,16 @@ static inline void hfi1_make_bth_aeth(st
ohdr->bth[2] = cpu_to_be32(mask_psn(qp->r_ack_psn));
}
@@ -101,7 +101,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
this_cpu_inc(*ibp->rvp.rc_qacks);
qp->s_flags |= RVT_S_ACK_PENDING | RVT_S_RESP_PENDING;
qp->s_nak_state = qp->r_nak_state;
-@@ -751,13 +753,14 @@ unlock:
+@@ -749,13 +751,14 @@ unlock:
spin_unlock_irqrestore(&qp->s_lock, flags);
}
@@ -118,7 +118,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
struct ib_header *hdr = &opa_hdr->ibh;
struct ib_other_headers *ohdr;
-@@ -798,13 +801,14 @@ static inline void hfi1_make_rc_ack_9B(s
+@@ -796,13 +799,14 @@ static inline void hfi1_make_rc_ack_9B(s
hfi1_make_bth_aeth(qp, ohdr, bth0, bth1);
}
@@ -135,7 +135,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
struct hfi1_16b_header *hdr = &opa_hdr->opah;
struct ib_other_headers *ohdr;
-@@ -850,7 +854,7 @@ static inline void hfi1_make_rc_ack_16B(
+@@ -848,7 +852,7 @@ static inline void hfi1_make_rc_ack_16B(
hfi1_make_bth_aeth(qp, ohdr, bth0, bth1);
}
@@ -144,7 +144,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct hfi1_opa_header *opa_hdr,
u8 sc5, bool is_fecn,
u64 *pbc_flags, u32 *hwords,
-@@ -870,9 +874,10 @@ static const hfi1_make_rc_ack hfi1_make_
+@@ -868,9 +872,10 @@ static const hfi1_make_rc_ack hfi1_make_
* Note that RDMA reads and atomics are handled in the
* send side QP state and send engine.
*/
@@ -157,7 +157,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct hfi1_ibport *ibp = rcd_to_iport(rcd);
struct hfi1_qp_priv *priv = qp->priv;
struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
-@@ -889,14 +894,14 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
+@@ -887,13 +892,13 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
/* Don't send ACK or NAK if a RDMA read or atomic is pending. */
if (qp->s_flags & RVT_S_RESP_PENDING) {
@@ -167,14 +167,13 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
}
/* Ensure s_rdma_ack_cnt changes are committed */
- smp_read_barrier_depends();
if (qp->s_rdma_ack_cnt) {
- hfi1_queue_rc_ack(qp, is_fecn);
+ hfi1_queue_rc_ack(packet, is_fecn);
return;
}
-@@ -905,7 +910,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
+@@ -902,7 +907,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
return;
/* Make the appropriate header */
@@ -183,7 +182,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
&pbc_flags, &hwords, &nwords);
plen = 2 /* PBC */ + hwords + nwords;
-@@ -919,7 +924,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
+@@ -916,7 +921,7 @@ void hfi1_send_rc_ack(struct hfi1_ctxtda
* so that when enough buffer space becomes available,
* the ACK is sent ahead of other outgoing packets.
*/
@@ -192,7 +191,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
return;
}
trace_ack_output_ibhdr(dd_from_ibdev(qp->ibqp.device),
-@@ -1537,7 +1542,7 @@ static void rc_rcv_resp(struct hfi1_pack
+@@ -1534,7 +1539,7 @@ static void rc_rcv_resp(struct hfi1_pack
void *data = packet->payload;
u32 tlen = packet->tlen;
struct rvt_qp *qp = packet->qp;
@@ -201,7 +200,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct ib_other_headers *ohdr = packet->ohdr;
struct rvt_swqe *wqe;
enum ib_wc_status status;
-@@ -1695,6 +1700,7 @@ ack_op_err:
+@@ -1691,6 +1696,7 @@ ack_op_err:
goto ack_err;
ack_seq_err:
@@ -209,7 +208,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
rdma_seq_err(qp, ibp, psn, rcd);
goto ack_done;
-@@ -2476,7 +2482,7 @@ nack_acc:
+@@ -2472,7 +2478,7 @@ nack_acc:
qp->r_nak_state = IB_NAK_REMOTE_ACCESS_ERROR;
qp->r_ack_psn = qp->r_psn;
send_ack:
diff --git a/patches.drivers/IB-hfi1-Optimize-process_receive_ib.patch b/patches.drivers/IB-hfi1-Optimize-process_receive_ib.patch
new file mode 100644
index 0000000000..538eaaec53
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Optimize-process_receive_ib.patch
@@ -0,0 +1,112 @@
+From: Sebastian Sanchez <sebastian.sanchez@intel.com>
+Date: Thu, 1 Feb 2018 10:46:46 -0800
+Subject: IB/hfi1: Optimize process_receive_ib()
+Patch-mainline: v4.16-rc1
+Git-commit: aca7f4fc320b5a507da4a41454582440f65cde4c
+References: bsc#1114685 FATE#325854
+
+The arguments for trace_hfi1_rcvhdr() get computed every
+time in the hot path regardless of the whether the trace
+is on or off. This is seen to be costly with a profile.
+The handling of fault inject isolates the verbs device for
+all packets regardless of the presence of a RHF_DC_ERR error.
+
+Fix the first by computing trace_hfi1_rcvhdr() arguments within
+the trace itself, so that when the trace is off, the argument
+data isn't computed. Fix the second by moving the error check to
+handle_eflags() when an RHF error occurs and by testing for
+RHF_DC_ERR before executing the reset of handle_eflags().
+
+Reviewed-by: Don Hiatt <don.hiatt@intel.com>
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/driver.c | 21 +++++++--------------
+ drivers/infiniband/hw/hfi1/trace_rx.h | 28 ++++++++++------------------
+ 2 files changed, 17 insertions(+), 32 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -256,7 +256,12 @@ static void rcv_hdrerr(struct hfi1_ctxtd
+ u32 mlid_base;
+ struct hfi1_ibport *ibp = rcd_to_iport(rcd);
+ struct hfi1_devdata *dd = ppd->dd;
+- struct rvt_dev_info *rdi = &dd->verbs_dev.rdi;
++ struct hfi1_ibdev *verbs_dev = &dd->verbs_dev;
++ struct rvt_dev_info *rdi = &verbs_dev->rdi;
++
++ if ((packet->rhf & RHF_DC_ERR) &&
++ hfi1_dbg_fault_suppress_err(verbs_dev))
++ return;
+
+ if (packet->rhf & (RHF_VCRC_ERR | RHF_ICRC_ERR))
+ return;
+@@ -1553,19 +1558,7 @@ int process_receive_ib(struct hfi1_packe
+ if (hfi1_setup_9B_packet(packet))
+ return RHF_RCV_CONTINUE;
+
+- trace_hfi1_rcvhdr(packet->rcd->ppd->dd,
+- packet->rcd->ctxt,
+- rhf_err_flags(packet->rhf),
+- RHF_RCV_TYPE_IB,
+- packet->hlen,
+- packet->tlen,
+- packet->updegr,
+- rhf_egr_index(packet->rhf));
+-
+- if (unlikely(
+- (hfi1_dbg_fault_suppress_err(&packet->rcd->dd->verbs_dev) &&
+- (packet->rhf & RHF_DC_ERR))))
+- return RHF_RCV_CONTINUE;
++ trace_hfi1_rcvhdr(packet, RHF_RCV_TYPE_IB);
+
+ if (unlikely(rhf_err_flags(packet->rhf))) {
+ handle_eflags(packet);
+--- a/drivers/infiniband/hw/hfi1/trace_rx.h
++++ b/drivers/infiniband/hw/hfi1/trace_rx.h
+@@ -63,17 +63,9 @@ __print_symbolic(type,
+ #define TRACE_SYSTEM hfi1_rx
+
+ TRACE_EVENT(hfi1_rcvhdr,
+- TP_PROTO(struct hfi1_devdata *dd,
+- u32 ctxt,
+- u64 eflags,
+- u32 etype,
+- u32 hlen,
+- u32 tlen,
+- u32 updegr,
+- u32 etail
+- ),
+- TP_ARGS(dd, ctxt, eflags, etype, hlen, tlen, updegr, etail),
+- TP_STRUCT__entry(DD_DEV_ENTRY(dd)
++ TP_PROTO(struct hfi1_packet *packet, u32 etype),
++ TP_ARGS(packet, etype),
++ TP_STRUCT__entry(DD_DEV_ENTRY(packet->rcd->dd)
+ __field(u64, eflags)
+ __field(u32, ctxt)
+ __field(u32, etype)
+@@ -82,14 +74,14 @@ TRACE_EVENT(hfi1_rcvhdr,
+ __field(u32, updegr)
+ __field(u32, etail)
+ ),
+- TP_fast_assign(DD_DEV_ASSIGN(dd);
+- __entry->eflags = eflags;
+- __entry->ctxt = ctxt;
++ TP_fast_assign(DD_DEV_ASSIGN(packet->rcd->dd);
++ __entry->eflags = rhf_err_flags(packet->rhf);
++ __entry->ctxt = packet->rcd->ctxt;
+ __entry->etype = etype;
+- __entry->hlen = hlen;
+- __entry->tlen = tlen;
+- __entry->updegr = updegr;
+- __entry->etail = etail;
++ __entry->hlen = packet->hlen;
++ __entry->tlen = packet->tlen;
++ __entry->updegr = packet->updegr;
++ __entry->etail = rhf_egr_index(packet->rhf);
+ ),
+ TP_printk(
+ "[%s] ctxt %d eflags 0x%llx etype %d,%s hlen %d tlen %d updegr %d etail %d",
diff --git a/patches.drivers/IB-hfi1-Reduce-8051-command-timeout.patch b/patches.drivers/IB-hfi1-Reduce-8051-command-timeout.patch
new file mode 100644
index 0000000000..8eaeb80287
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Reduce-8051-command-timeout.patch
@@ -0,0 +1,34 @@
+From: Jakub Byczkowski <jakub.byczkowski@intel.com>
+Date: Mon, 6 Nov 2017 06:38:23 -0800
+Subject: IB/hfi1: Reduce 8051 command timeout
+Patch-mainline: v4.15-rc1
+Git-commit: 22a3ffa78086e31223865c24aeb7d1c3970e2984
+References: bsc#1114685 FATE#325854
+
+Timeout of 20 seconds is too long for active wait performed
+for 8051 command completion. It was required for scenarios
+when transition to polling was requested before offline.quiet
+state was reached. Currently wait for offline.quiet is
+properly implemented and timeout can be reduced to 1 second.
+
+Reviewed-by: Dean Luick <dean.luick@intel.com>
+Reviewed-by: Duane McCrory <duane.mccrory@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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/chip.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/hw/hfi1/chip.h
++++ b/drivers/infiniband/hw/hfi1/chip.h
+@@ -560,7 +560,7 @@ enum {
+ /* timeouts */
+ #define LINK_RESTART_DELAY 1000 /* link restart delay, in ms */
+ #define TIMEOUT_8051_START 5000 /* 8051 start timeout, in ms */
+-#define DC8051_COMMAND_TIMEOUT 20000 /* DC8051 command timeout, in ms */
++#define DC8051_COMMAND_TIMEOUT 1000 /* DC8051 command timeout, in ms */
+ #define FREEZE_STATUS_TIMEOUT 20 /* wait for freeze indicators, in ms */
+ #define VL_STATUS_CLEAR_TIMEOUT 5000 /* per-VL status clear, in ms */
+ #define CCE_STATUS_TIMEOUT 10 /* time to clear CCE Status, in ms */
diff --git a/patches.drivers/IB-hfi1-Refactor-get_base_info.patch b/patches.drivers/IB-hfi1-Refactor-get_base_info.patch
index 7a349e712b..757ca1ccef 100644
--- a/patches.drivers/IB-hfi1-Refactor-get_base_info.patch
+++ b/patches.drivers/IB-hfi1-Refactor-get_base_info.patch
@@ -64,8 +64,8 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
binfo.hw_version = dd->revision;
binfo.sw_version = HFI1_KERN_SWVERSION;
@@ -1414,10 +1413,11 @@ static int get_base_info(struct hfi1_fil
- uctxt->ctxt,
- fd->subctxt, 0);
+ uctxt->ctxt,
+ fd->subctxt, 0);
}
- sz = (len < sizeof(binfo)) ? len : sizeof(binfo);
- if (copy_to_user(ubase, &binfo, sz))
diff --git a/patches.drivers/IB-hfi1-Refactor-reset_ctxt-IOCTL.patch b/patches.drivers/IB-hfi1-Refactor-reset_ctxt-IOCTL.patch
new file mode 100644
index 0000000000..b8103a9c93
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Refactor-reset_ctxt-IOCTL.patch
@@ -0,0 +1,165 @@
+From: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
+Date: Tue, 26 Sep 2017 07:04:42 -0700
+Subject: IB/hfi1: Refactor reset_ctxt() IOCTL
+Patch-mainline: v4.15-rc1
+Git-commit: ecf799852bde85ae9c1713b2a68dce4a03054f1b
+References: bsc#1114685 FATE#325854
+
+The IOCTL is a bit unwieldy. Refactor reset_ctxt() to be a bit more
+manageable.
+
+Reviewed-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/file_ops.c | 122 ++++++++++++++++++----------------
+ 1 file changed, 66 insertions(+), 56 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/file_ops.c
++++ b/drivers/infiniband/hw/hfi1/file_ops.c
+@@ -107,6 +107,7 @@ static unsigned int poll_next(struct fil
+ static int user_event_ack(struct hfi1_ctxtdata *uctxt, u16 subctxt,
+ unsigned long arg);
+ static int set_ctxt_pkey(struct hfi1_ctxtdata *uctxt, unsigned long arg);
++static int ctxt_reset(struct hfi1_ctxtdata *uctxt);
+ static int manage_rcvq(struct hfi1_ctxtdata *uctxt, u16 subctxt,
+ unsigned long arg);
+ static int vma_fault(struct vm_fault *vmf);
+@@ -282,63 +283,9 @@ static long hfi1_file_ioctl(struct file
+ ret = set_ctxt_pkey(uctxt, arg);
+ break;
+
+- case HFI1_IOCTL_CTXT_RESET: {
+- struct send_context *sc;
+- struct hfi1_devdata *dd;
+-
+- if (!uctxt || !uctxt->dd || !uctxt->sc)
+- return -EINVAL;
+-
+- /*
+- * There is no protection here. User level has to
+- * guarantee that no one will be writing to the send
+- * context while it is being re-initialized.
+- * If user level breaks that guarantee, it will break
+- * it's own context and no one else's.
+- */
+- dd = uctxt->dd;
+- sc = uctxt->sc;
+- /*
+- * Wait until the interrupt handler has marked the
+- * context as halted or frozen. Report error if we time
+- * out.
+- */
+- wait_event_interruptible_timeout(
+- sc->halt_wait, (sc->flags & SCF_HALTED),
+- msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT));
+- if (!(sc->flags & SCF_HALTED))
+- return -ENOLCK;
+-
+- /*
+- * If the send context was halted due to a Freeze,
+- * wait until the device has been "unfrozen" before
+- * resetting the context.
+- */
+- if (sc->flags & SCF_FROZEN) {
+- wait_event_interruptible_timeout(
+- dd->event_queue,
+- !(READ_ONCE(dd->flags) & HFI1_FROZEN),
+- msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT));
+- if (dd->flags & HFI1_FROZEN)
+- return -ENOLCK;
+-
+- if (dd->flags & HFI1_FORCED_FREEZE)
+- /*
+- * Don't allow context reset if we are into
+- * forced freeze
+- */
+- return -ENODEV;
+-
+- sc_disable(sc);
+- ret = sc_enable(sc);
+- hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB, uctxt);
+- } else {
+- ret = sc_restart(sc);
+- }
+- if (!ret)
+- sc_return_credits(sc);
++ case HFI1_IOCTL_CTXT_RESET:
++ ret = ctxt_reset(uctxt);
+ break;
+- }
+
+ case HFI1_IOCTL_GET_VERS:
+ uval = HFI1_USER_SWVERSION;
+@@ -1658,6 +1605,69 @@ static int set_ctxt_pkey(struct hfi1_ctx
+ return -ENOENT;
+ }
+
++/**
++ * ctxt_reset - Reset the user context
++ * @uctxt: valid user context
++ */
++static int ctxt_reset(struct hfi1_ctxtdata *uctxt)
++{
++ struct send_context *sc;
++ struct hfi1_devdata *dd;
++ int ret = 0;
++
++ if (!uctxt || !uctxt->dd || !uctxt->sc)
++ return -EINVAL;
++
++ /*
++ * There is no protection here. User level has to guarantee that
++ * no one will be writing to the send context while it is being
++ * re-initialized. If user level breaks that guarantee, it will
++ * break it's own context and no one else's.
++ */
++ dd = uctxt->dd;
++ sc = uctxt->sc;
++
++ /*
++ * Wait until the interrupt handler has marked the context as
++ * halted or frozen. Report error if we time out.
++ */
++ wait_event_interruptible_timeout(
++ sc->halt_wait, (sc->flags & SCF_HALTED),
++ msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT));
++ if (!(sc->flags & SCF_HALTED))
++ return -ENOLCK;
++
++ /*
++ * If the send context was halted due to a Freeze, wait until the
++ * device has been "unfrozen" before resetting the context.
++ */
++ if (sc->flags & SCF_FROZEN) {
++ wait_event_interruptible_timeout(
++ dd->event_queue,
++ !(READ_ONCE(dd->flags) & HFI1_FROZEN),
++ msecs_to_jiffies(SEND_CTXT_HALT_TIMEOUT));
++ if (dd->flags & HFI1_FROZEN)
++ return -ENOLCK;
++
++ if (dd->flags & HFI1_FORCED_FREEZE)
++ /*
++ * Don't allow context reset if we are into
++ * forced freeze
++ */
++ return -ENODEV;
++
++ sc_disable(sc);
++ ret = sc_enable(sc);
++ hfi1_rcvctrl(dd, HFI1_RCVCTRL_CTXT_ENB, uctxt);
++ } else {
++ ret = sc_restart(sc);
++ }
++ if (!ret)
++ sc_return_credits(sc);
++
++ return ret;
++}
++
+ static void user_remove(struct hfi1_devdata *dd)
+ {
+
diff --git a/patches.drivers/IB-hfi1-Remove-dependence-on-qp-s_hdrwords.patch b/patches.drivers/IB-hfi1-Remove-dependence-on-qp-s_hdrwords.patch
index a97c865391..a6c0e5fae8 100644
--- a/patches.drivers/IB-hfi1-Remove-dependence-on-qp-s_hdrwords.patch
+++ b/patches.drivers/IB-hfi1-Remove-dependence-on-qp-s_hdrwords.patch
@@ -201,7 +201,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
pkey, becn, 0, l4, priv->s_sc);
}
-@@ -836,10 +837,10 @@ static inline void hfi1_make_ruc_header_
+@@ -834,10 +835,10 @@ static inline void hfi1_make_ruc_header_
if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH)) {
struct ib_grh *grh = &ps->s_txreq->phdr.hdr.ibh.u.l.grh;
@@ -214,8 +214,8 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
hfi1_make_grh(ibp, grh,
rdma_ah_read_grh(&qp->remote_ah_attr),
hdrwords, nwords);
-@@ -875,7 +876,7 @@ static inline void hfi1_make_ruc_header_
- ((1 << ppd->lmc) - 1));
+@@ -866,7 +867,7 @@ static inline void hfi1_make_ruc_header_
+ hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh,
lrh0,
- qp->s_hdrwords + nwords,
@@ -223,7 +223,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
opa_get_lid(rdma_ah_get_dlid(&qp->remote_ah_attr), 9B),
ppd_from_ibp(ibp)->lid |
rdma_ah_get_path_bits(&qp->remote_ah_attr));
-@@ -1040,7 +1041,7 @@ void hfi1_do_send(struct rvt_qp *qp, boo
+@@ -1031,7 +1032,7 @@ void hfi1_do_send(struct rvt_qp *qp, boo
ps.s_txreq = get_waiting_verbs_txreq(qp);
do {
/* Check for a constructed packet to be sent. */
@@ -232,7 +232,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
spin_unlock_irqrestore(&qp->s_lock, ps.flags);
/*
* If the packet cannot be sent now, return and
-@@ -1048,8 +1049,6 @@ void hfi1_do_send(struct rvt_qp *qp, boo
+@@ -1039,8 +1040,6 @@ void hfi1_do_send(struct rvt_qp *qp, boo
*/
if (hfi1_verbs_send(qp, &ps))
return;
@@ -362,16 +362,16 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/hw/hfi1/verbs.c
+++ b/drivers/infiniband/hw/hfi1/verbs.c
-@@ -814,7 +814,7 @@ static int build_verbs_tx_desc(
+@@ -835,7 +835,7 @@ static int build_verbs_tx_desc(
{
int ret = 0;
struct hfi1_sdma_header *phdr = &tx->phdr;
- u16 hdrbytes = tx->hdr_dwords << 2;
+ u16 hdrbytes = (tx->hdr_dwords + sizeof(pbc) / 4) << 2;
- u32 *hdr;
u8 extra_bytes = 0;
-@@ -884,7 +884,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *q
+ if (tx->phdr.hdr.hdr_type) {
+@@ -901,7 +901,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *q
{
struct hfi1_qp_priv *priv = qp->priv;
struct hfi1_ahg_info *ahg_info = priv->s_ahg;
@@ -380,7 +380,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
u32 len = ps->s_txreq->s_cur_size;
u32 plen;
struct hfi1_ibdev *dev = ps->dev;
-@@ -904,7 +904,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *q
+@@ -919,7 +919,7 @@ int hfi1_verbs_send_dma(struct rvt_qp *q
} else {
dwords = (len + 3) >> 2;
}
@@ -389,7 +389,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
tx = ps->s_txreq;
if (!sdma_txreq_built(&tx->txreq)) {
-@@ -1021,7 +1021,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
+@@ -1038,7 +1038,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
u64 pbc)
{
struct hfi1_qp_priv *priv = qp->priv;
@@ -398,7 +398,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
struct rvt_sge_state *ss = ps->s_txreq->ss;
u32 len = ps->s_txreq->s_cur_size;
u32 dwords;
-@@ -1051,7 +1051,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
+@@ -1064,7 +1064,7 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
dwords = (len + 3) >> 2;
hdr = (u32 *)&ps->s_txreq->phdr.hdr.ibh;
}
diff --git a/patches.drivers/IB-hfi1-Remove-set-but-not-used-variables.patch b/patches.drivers/IB-hfi1-Remove-set-but-not-used-variables.patch
new file mode 100644
index 0000000000..8c248a714f
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-set-but-not-used-variables.patch
@@ -0,0 +1,176 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 11 Oct 2017 10:48:58 -0700
+Subject: IB/hfi1: Remove set-but-not-used variables
+Patch-mainline: v4.15-rc1
+Git-commit: 6d945a84c69d68a2c494b716642cab2c15d55b4c
+References: bsc#1114685 FATE#325854
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/file_ops.c | 4 +---
+ drivers/infiniband/hw/hfi1/mad.c | 2 --
+ drivers/infiniband/hw/hfi1/ruc.c | 9 ---------
+ drivers/infiniband/hw/hfi1/sdma.c | 2 --
+ drivers/infiniband/hw/hfi1/ud.c | 2 --
+ drivers/infiniband/hw/hfi1/verbs.c | 10 ----------
+ 6 files changed, 1 insertion(+), 28 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/file_ops.c
++++ b/drivers/infiniband/hw/hfi1/file_ops.c
+@@ -776,7 +776,7 @@ static int complete_subctxt(struct hfi1_
+ static int assign_ctxt(struct hfi1_filedata *fd, unsigned long arg, u32 len)
+ {
+ int ret;
+- unsigned int swmajor, swminor;
++ unsigned int swmajor;
+ struct hfi1_ctxtdata *uctxt = NULL;
+ struct hfi1_user_info uinfo;
+
+@@ -796,8 +796,6 @@ static int assign_ctxt(struct hfi1_filed
+ if (uinfo.subctxt_cnt > HFI1_MAX_SHARED_CTXTS)
+ return -EINVAL;
+
+- swminor = uinfo.userversion & 0xffff;
+-
+ /*
+ * Acquire the mutex to protect against multiple creations of what
+ * could be a shared base context.
+--- a/drivers/infiniband/hw/hfi1/mad.c
++++ b/drivers/infiniband/hw/hfi1/mad.c
+@@ -2889,7 +2889,6 @@ static int pma_get_opa_datacounters(stru
+ struct _vls_dctrs *vlinfo;
+ size_t response_data_size;
+ u32 num_ports;
+- u8 num_pslm;
+ u8 lq, num_vls;
+ u8 res_lli, res_ler;
+ u64 port_mask;
+@@ -2899,7 +2898,6 @@ static int pma_get_opa_datacounters(stru
+ int vfi;
+
+ num_ports = be32_to_cpu(pmp->mad_hdr.attr_mod) >> 24;
+- num_pslm = hweight64(be64_to_cpu(req->port_select_mask[3]));
+ num_vls = hweight32(be32_to_cpu(req->vl_select_mask));
+ vl_select_mask = be32_to_cpu(req->vl_select_mask);
+ res_lli = (u8)(be32_to_cpu(req->resolution) & MSK_LLI) >> MSK_LLI_SFT;
+--- a/drivers/infiniband/hw/hfi1/ruc.c
++++ b/drivers/infiniband/hw/hfi1/ruc.c
+@@ -825,11 +825,9 @@ static inline void hfi1_make_ruc_header_
+ {
+ struct hfi1_qp_priv *priv = qp->priv;
+ struct hfi1_ibport *ibp = ps->ibp;
+- struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
+ u32 bth1 = 0;
+ u16 pkey = hfi1_get_pkey(ibp, qp->s_pkey_index);
+ u16 lrh0 = HFI1_LRH_BTH;
+- u16 slid;
+ u8 extra_bytes = -ps->s_txreq->s_cur_size & 3;
+ u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size +
+ extra_bytes) >> 2);
+@@ -866,13 +864,6 @@ static inline void hfi1_make_ruc_header_
+ bth1 |= (IB_BECN_MASK << IB_BECN_SHIFT);
+ }
+ hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
+-
+- if (!ppd->lid)
+- slid = be16_to_cpu(IB_LID_PERMISSIVE);
+- else
+- slid = ppd->lid |
+- (rdma_ah_get_path_bits(&qp->remote_ah_attr) &
+- ((1 << ppd->lmc) - 1));
+ hfi1_make_ib_hdr(&ps->s_txreq->phdr.hdr.ibh,
+ lrh0,
+ qp->s_hdrwords + nwords,
+--- a/drivers/infiniband/hw/hfi1/sdma.c
++++ b/drivers/infiniband/hw/hfi1/sdma.c
+@@ -2144,7 +2144,6 @@ void sdma_dumpstate(struct sdma_engine *
+
+ static void dump_sdma_state(struct sdma_engine *sde)
+ {
+- struct hw_sdma_desc *descq;
+ struct hw_sdma_desc *descqp;
+ u64 desc[2];
+ u64 addr;
+@@ -2155,7 +2154,6 @@ static void dump_sdma_state(struct sdma_
+ head = sde->descq_head & sde->sdma_mask;
+ tail = sde->descq_tail & sde->sdma_mask;
+ cnt = sdma_descq_freecnt(sde);
+- descq = sde->descq;
+
+ dd_dev_err(sde->dd,
+ "SDMA (%u) descq_head: %u descq_tail: %u freecnt: %u FLE %d\n",
+--- a/drivers/infiniband/hw/hfi1/ud.c
++++ b/drivers/infiniband/hw/hfi1/ud.c
+@@ -854,7 +854,6 @@ void hfi1_ud_rcv(struct hfi1_packet *pac
+ int mgmt_pkey_idx = -1;
+ struct hfi1_ibport *ibp = rcd_to_iport(packet->rcd);
+ struct hfi1_pportdata *ppd = ppd_from_ibp(ibp);
+- struct ib_header *hdr = packet->hdr;
+ void *data = packet->payload;
+ u32 tlen = packet->tlen;
+ struct rvt_qp *qp = packet->qp;
+@@ -880,7 +879,6 @@ void hfi1_ud_rcv(struct hfi1_packet *pac
+ dlid_is_permissive = (dlid == permissive_lid);
+ slid_is_permissive = (slid == permissive_lid);
+ } else {
+- hdr = packet->hdr;
+ pkey = ib_bth_get_pkey(ohdr);
+ dlid_is_permissive = (dlid == be16_to_cpu(IB_LID_PERMISSIVE));
+ slid_is_permissive = (slid == be16_to_cpu(IB_LID_PERMISSIVE));
+--- a/drivers/infiniband/hw/hfi1/verbs.c
++++ b/drivers/infiniband/hw/hfi1/verbs.c
+@@ -812,7 +812,6 @@ static int build_verbs_tx_desc(
+ int ret = 0;
+ struct hfi1_sdma_header *phdr = &tx->phdr;
+ u16 hdrbytes = tx->hdr_dwords << 2;
+- u32 *hdr;
+ u8 extra_bytes = 0;
+ static char trail_buf[12]; /* CRC = 4, LT = 1, Pad = 0 to 7 bytes */
+
+@@ -823,9 +822,6 @@ static int build_verbs_tx_desc(
+ */
+ extra_bytes = hfi1_get_16b_padding(hdrbytes - 8, length) +
+ (SIZE_OF_CRC << 2) + SIZE_OF_LT;
+- hdr = (u32 *)&phdr->hdr.opah;
+- } else {
+- hdr = (u32 *)&phdr->hdr.ibh;
+ }
+ if (!ahg_info->ahgcount) {
+ ret = sdma_txinit_ahg(
+@@ -891,14 +887,12 @@ int hfi1_verbs_send_dma(struct rvt_qp *q
+ u8 sc5 = priv->s_sc;
+ int ret;
+ u32 dwords;
+- bool bypass = false;
+
+ if (ps->s_txreq->phdr.hdr.hdr_type) {
+ u8 extra_bytes = hfi1_get_16b_padding((hdrwords << 2), len);
+
+ dwords = (len + extra_bytes + (SIZE_OF_CRC << 2) +
+ SIZE_OF_LT) >> 2;
+- bypass = true;
+ } else {
+ dwords = (len + 3) >> 2;
+ }
+@@ -1033,8 +1027,6 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
+ int wc_status = IB_WC_SUCCESS;
+ int ret = 0;
+ pio_release_cb cb = NULL;
+- u32 lrh0_16b;
+- bool bypass = false;
+ u8 extra_bytes = 0;
+
+ if (ps->s_txreq->phdr.hdr.hdr_type) {
+@@ -1043,8 +1035,6 @@ int hfi1_verbs_send_pio(struct rvt_qp *q
+ extra_bytes = pad_size + (SIZE_OF_CRC << 2) + SIZE_OF_LT;
+ dwords = (len + extra_bytes) >> 2;
+ hdr = (u32 *)&ps->s_txreq->phdr.hdr.opah;
+- lrh0_16b = ps->s_txreq->phdr.hdr.opah.lrh[0];
+- bypass = true;
+ } else {
+ dwords = (len + 3) >> 2;
+ hdr = (u32 *)&ps->s_txreq->phdr.hdr.ibh;
diff --git a/patches.drivers/IB-hfi1-Remove-the-debug-trace-message-in-pin_sdma_p.patch b/patches.drivers/IB-hfi1-Remove-the-debug-trace-message-in-pin_sdma_p.patch
new file mode 100644
index 0000000000..c9532aa7d7
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-the-debug-trace-message-in-pin_sdma_p.patch
@@ -0,0 +1,37 @@
+From: Harish Chegondi <harish.chegondi@intel.com>
+Date: Tue, 26 Sep 2017 07:00:17 -0700
+Subject: IB/hfi1: Remove the debug trace message in pin_sdma_pages()
+Patch-mainline: v4.15-rc1
+Git-commit: 4029e2a313348a0a44f9d41b681763c69160dfd0
+References: bsc#1114685 FATE#325854
+
+Remove the debug trace statement in pin_sdma_pages() that
+gets executed when there is a memory allocation failure as
+the trace message doesn't help with debugging the memory
+allocation failure.
+
+Cc: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/user_sdma.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/user_sdma.c
++++ b/drivers/infiniband/hw/hfi1/user_sdma.c
+@@ -956,10 +956,8 @@ static int pin_sdma_pages(struct user_sd
+ struct hfi1_user_sdma_pkt_q *pq = req->pq;
+
+ pages = kcalloc(npages, sizeof(*pages), GFP_KERNEL);
+- if (!pages) {
+- SDMA_DBG(req, "Failed page array alloc");
++ if (!pages)
+ return -ENOMEM;
+- }
+ memcpy(pages, node->pages, node->npages * sizeof(*pages));
+
+ npages -= node->npages;
diff --git a/patches.drivers/IB-hfi1-Remove-unnecessary-error-messages-on-alloc-f.patch b/patches.drivers/IB-hfi1-Remove-unnecessary-error-messages-on-alloc-f.patch
new file mode 100644
index 0000000000..08aade51ee
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-unnecessary-error-messages-on-alloc-f.patch
@@ -0,0 +1,48 @@
+From: Jan Sokolowski <jan.sokolowski@intel.com>
+Date: Tue, 26 Sep 2017 07:00:50 -0700
+Subject: IB/hfi1: Remove unnecessary error messages on alloc failures
+Patch-mainline: v4.15-rc1
+Git-commit: 6fee036916f3efbd840631f2ea4ac88950c1592e
+References: bsc#1114685 FATE#325854
+
+Per-cpu variables int_counter, rcv_limit, and send_schedule
+print unnecessary error messages on failed allocations.
+Remove the error messages.
+
+Reviewed-by: Harish Chegondi <harish.chegondi@intel.com>
+Reviewed-by: Dennis Dalessandro <dennis.dalessandro@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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/init.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/init.c
++++ b/drivers/infiniband/hw/hfi1/init.c
+@@ -1272,24 +1272,18 @@ struct hfi1_devdata *hfi1_alloc_devdata(
+ dd->int_counter = alloc_percpu(u64);
+ if (!dd->int_counter) {
+ ret = -ENOMEM;
+- hfi1_early_err(&pdev->dev,
+- "Could not allocate per-cpu int_counter\n");
+ goto bail;
+ }
+
+ dd->rcv_limit = alloc_percpu(u64);
+ if (!dd->rcv_limit) {
+ ret = -ENOMEM;
+- hfi1_early_err(&pdev->dev,
+- "Could not allocate per-cpu rcv_limit\n");
+ goto bail;
+ }
+
+ dd->send_schedule = alloc_percpu(u64);
+ if (!dd->send_schedule) {
+ ret = -ENOMEM;
+- hfi1_early_err(&pdev->dev,
+- "Could not allocate per-cpu int_counter\n");
+ goto bail;
+ }
+
diff --git a/patches.drivers/IB-hfi1-Remove-unnecessary-fecn-and-becn-fields.patch b/patches.drivers/IB-hfi1-Remove-unnecessary-fecn-and-becn-fields.patch
new file mode 100644
index 0000000000..ace1d052ab
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-unnecessary-fecn-and-becn-fields.patch
@@ -0,0 +1,241 @@
+From: Sebastian Sanchez <sebastian.sanchez@intel.com>
+Date: Thu, 1 Feb 2018 10:46:38 -0800
+Subject: IB/hfi1: Remove unnecessary fecn and becn fields
+Patch-mainline: v4.16-rc1
+Git-commit: ca85bb1ca9948899682fe7170636e465599ea8e7
+References: bsc#1114685 FATE#325854
+
+packet->fecn and packet->becn are calculated in the hot path
+and are never used. Remove these fields as they show to be
+costly in a profile. Also, remove initialization for
+becn and fecn in process_ecn() as they're unconditionally
+assigned in the function and ensure fecn and becn variables
+use a boolean type.
+
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/driver.c | 4 ----
+ drivers/infiniband/hw/hfi1/hfi.h | 16 +++++-----------
+ drivers/infiniband/hw/hfi1/rc.c | 2 +-
+ drivers/infiniband/hw/hfi1/ruc.c | 4 ++--
+ drivers/infiniband/hw/hfi1/trace.c | 8 ++++----
+ drivers/infiniband/hw/hfi1/trace_ibhdrs.h | 16 ++++++++--------
+ include/rdma/ib_hdrs.h | 10 ++++------
+ 7 files changed, 24 insertions(+), 36 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -1441,8 +1441,6 @@ static int hfi1_setup_9B_packet(struct h
+ packet->sc = hfi1_9B_get_sc5(hdr, packet->rhf);
+ packet->pad = ib_bth_get_pad(packet->ohdr);
+ packet->extra_byte = 0;
+- packet->fecn = ib_bth_get_fecn(packet->ohdr);
+- packet->becn = ib_bth_get_becn(packet->ohdr);
+ packet->pkey = ib_bth_get_pkey(packet->ohdr);
+ packet->migrated = ib_bth_is_migration(packet->ohdr);
+
+@@ -1509,8 +1507,6 @@ static int hfi1_setup_bypass_packet(stru
+ packet->sl = ibp->sc_to_sl[packet->sc];
+ packet->pad = hfi1_16B_bth_get_pad(packet->ohdr);
+ packet->extra_byte = SIZE_OF_LT;
+- packet->fecn = hfi1_16B_get_fecn(packet->hdr);
+- packet->becn = hfi1_16B_get_becn(packet->hdr);
+ packet->pkey = hfi1_16B_get_pkey(packet->hdr);
+ packet->migrated = opa_bth_is_migration(packet->ohdr);
+
+--- a/drivers/infiniband/hw/hfi1/hfi.h
++++ b/drivers/infiniband/hw/hfi1/hfi.h
+@@ -352,8 +352,6 @@ struct hfi1_packet {
+ u8 sc;
+ u8 sl;
+ u8 opcode;
+- bool becn;
+- bool fecn;
+ bool migrated;
+ };
+
+@@ -1781,19 +1779,15 @@ void hfi1_process_ecn_slowpath(struct rv
+ static inline bool process_ecn(struct rvt_qp *qp, struct hfi1_packet *pkt,
+ bool do_cnp)
+ {
+- struct ib_other_headers *ohdr = pkt->ohdr;
+-
+- u32 bth1;
+- bool becn = false;
+- bool fecn = false;
++ bool becn;
++ bool fecn;
+
+ if (pkt->etype == RHF_RCV_TYPE_BYPASS) {
+ fecn = hfi1_16B_get_fecn(pkt->hdr);
+ becn = hfi1_16B_get_becn(pkt->hdr);
+ } else {
+- bth1 = be32_to_cpu(ohdr->bth[1]);
+- fecn = bth1 & IB_FECN_SMASK;
+- becn = bth1 & IB_BECN_SMASK;
++ fecn = ib_bth_get_fecn(pkt->ohdr);
++ becn = ib_bth_get_becn(pkt->ohdr);
+ }
+ if (unlikely(fecn || becn)) {
+ hfi1_process_ecn_slowpath(qp, pkt, do_cnp);
+@@ -2419,7 +2413,7 @@ static inline void hfi1_make_ib_hdr(stru
+ static inline void hfi1_make_16b_hdr(struct hfi1_16b_header *hdr,
+ u32 slid, u32 dlid,
+ u16 len, u16 pkey,
+- u8 becn, u8 fecn, u8 l4,
++ bool becn, bool fecn, u8 l4,
+ u8 sc)
+ {
+ u32 lrh0 = 0;
+--- a/drivers/infiniband/hw/hfi1/rc.c
++++ b/drivers/infiniband/hw/hfi1/rc.c
+@@ -812,7 +812,7 @@ static inline void hfi1_make_rc_ack_16B(
+ struct ib_other_headers *ohdr;
+ u32 bth0, bth1 = 0;
+ u16 len, pkey;
+- u8 becn = !!is_fecn;
++ bool becn = is_fecn;
+ u8 l4 = OPA_16B_L4_IB_LOCAL;
+ u8 extra_bytes;
+
+--- a/drivers/infiniband/hw/hfi1/ruc.c
++++ b/drivers/infiniband/hw/hfi1/ruc.c
+@@ -750,7 +750,7 @@ static inline void hfi1_make_ruc_header_
+ ps->s_txreq->s_cur_size);
+ u32 nwords = SIZE_OF_CRC + ((ps->s_txreq->s_cur_size +
+ extra_bytes + SIZE_OF_LT) >> 2);
+- u8 becn = 0;
++ bool becn = false;
+
+ if (unlikely(rdma_ah_get_ah_flags(&qp->remote_ah_attr) & IB_AH_GRH) &&
+ hfi1_check_mcast(rdma_ah_get_dlid(&qp->remote_ah_attr))) {
+@@ -788,7 +788,7 @@ static inline void hfi1_make_ruc_header_
+ if (qp->s_flags & RVT_S_ECN) {
+ qp->s_flags &= ~RVT_S_ECN;
+ /* we recently received a FECN, so return a BECN */
+- becn = 1;
++ becn = true;
+ }
+ hfi1_make_ruc_bth(qp, ohdr, bth0, bth1, bth2);
+
+--- a/drivers/infiniband/hw/hfi1/trace.c
++++ b/drivers/infiniband/hw/hfi1/trace.c
+@@ -138,7 +138,7 @@ static const char *parse_syndrome(u8 syn
+ }
+
+ void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
+- u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
++ u8 *ack, bool *becn, bool *fecn, u8 *mig,
+ u8 *se, u8 *pad, u8 *opcode, u8 *tver,
+ u16 *pkey, u32 *psn, u32 *qpn)
+ {
+@@ -184,7 +184,7 @@ void hfi1_trace_parse_9b_hdr(struct ib_h
+ }
+
+ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
+- u8 *age, u8 *becn, u8 *fecn,
++ u8 *age, bool *becn, bool *fecn,
+ u8 *l4, u8 *rc, u8 *sc,
+ u16 *entropy, u16 *len, u16 *pkey,
+ u32 *dlid, u32 *slid)
+@@ -207,7 +207,7 @@ void hfi1_trace_parse_16b_hdr(struct hfi
+ #define LRH_16B_PRN "age:%d becn:%d fecn:%d l4:%d " \
+ "rc:%d sc:%d pkey:0x%.4x entropy:0x%.4x"
+ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
+- u8 age, u8 becn, u8 fecn, u8 l4,
++ u8 age, bool becn, bool fecn, u8 l4,
+ u8 lnh, const char *lnh_name, u8 lver,
+ u8 rc, u8 sc, u8 sl, u16 entropy,
+ u16 len, u16 pkey, u32 dlid, u32 slid)
+@@ -235,7 +235,7 @@ const char *hfi1_trace_fmt_lrh(struct tr
+ "op:0x%.2x,%s se:%d m:%d pad:%d tver:%d " \
+ "qpn:0x%.6x a:%d psn:0x%.8x"
+ const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
+- u8 ack, u8 becn, u8 fecn, u8 mig,
++ u8 ack, bool becn, bool fecn, u8 mig,
+ u8 se, u8 pad, u8 opcode, const char *opname,
+ u8 tver, u16 pkey, u32 psn, u32 qpn)
+ {
+--- a/drivers/infiniband/hw/hfi1/trace_ibhdrs.h
++++ b/drivers/infiniband/hw/hfi1/trace_ibhdrs.h
+@@ -101,7 +101,7 @@ u8 hfi1_trace_opa_hdr_len(struct hfi1_op
+ u8 hfi1_trace_packet_hdr_len(struct hfi1_packet *packet);
+ const char *hfi1_trace_get_packet_l4_str(u8 l4);
+ void hfi1_trace_parse_9b_bth(struct ib_other_headers *ohdr,
+- u8 *ack, u8 *becn, u8 *fecn, u8 *mig,
++ u8 *ack, bool *becn, bool *fecn, u8 *mig,
+ u8 *se, u8 *pad, u8 *opcode, u8 *tver,
+ u16 *pkey, u32 *psn, u32 *qpn);
+ void hfi1_trace_parse_9b_hdr(struct ib_header *hdr, bool sc5,
+@@ -112,19 +112,19 @@ void hfi1_trace_parse_16b_bth(struct ib_
+ u8 *pad, u8 *se, u8 *tver,
+ u32 *psn, u32 *qpn);
+ void hfi1_trace_parse_16b_hdr(struct hfi1_16b_header *hdr,
+- u8 *age, u8 *becn, u8 *fecn,
++ u8 *age, bool *becn, bool *fecn,
+ u8 *l4, u8 *rc, u8 *sc,
+ u16 *entropy, u16 *len, u16 *pkey,
+ u32 *dlid, u32 *slid);
+
+ const char *hfi1_trace_fmt_lrh(struct trace_seq *p, bool bypass,
+- u8 age, u8 becn, u8 fecn, u8 l4,
++ u8 age, bool becn, bool fecn, u8 l4,
+ u8 lnh, const char *lnh_name, u8 lver,
+ u8 rc, u8 sc, u8 sl, u16 entropy,
+ u16 len, u16 pkey, u32 dlid, u32 slid);
+
+ const char *hfi1_trace_fmt_bth(struct trace_seq *p, bool bypass,
+- u8 ack, u8 becn, u8 fecn, u8 mig,
++ u8 ack, bool becn, bool fecn, u8 mig,
+ u8 se, u8 pad, u8 opcode, const char *opname,
+ u8 tver, u16 pkey, u32 psn, u32 qpn);
+
+@@ -148,8 +148,8 @@ DECLARE_EVENT_CLASS(hfi1_input_ibhdr_tem
+ __field(u8, etype)
+ __field(u8, ack)
+ __field(u8, age)
+- __field(u8, becn)
+- __field(u8, fecn)
++ __field(bool, becn)
++ __field(bool, fecn)
+ __field(u8, l2)
+ __field(u8, l4)
+ __field(u8, lnh)
+@@ -290,8 +290,8 @@ DECLARE_EVENT_CLASS(hfi1_output_ibhdr_te
+ __field(u8, hdr_type)
+ __field(u8, ack)
+ __field(u8, age)
+- __field(u8, becn)
+- __field(u8, fecn)
++ __field(bool, becn)
++ __field(bool, fecn)
+ __field(u8, l4)
+ __field(u8, lnh)
+ __field(u8, lver)
+--- a/include/rdma/ib_hdrs.h
++++ b/include/rdma/ib_hdrs.h
+@@ -313,16 +313,14 @@ static inline u32 ib_bth_get_qpn(struct
+ return (u32)((be32_to_cpu(ohdr->bth[1])) & IB_QPN_MASK);
+ }
+
+-static inline u8 ib_bth_get_becn(struct ib_other_headers *ohdr)
++static inline bool ib_bth_get_becn(struct ib_other_headers *ohdr)
+ {
+- return (u8)((be32_to_cpu(ohdr->bth[1]) >> IB_BECN_SHIFT) &
+- IB_BECN_MASK);
++ return (ohdr->bth[1]) & cpu_to_be32(IB_BECN_SMASK);
+ }
+
+-static inline u8 ib_bth_get_fecn(struct ib_other_headers *ohdr)
++static inline bool ib_bth_get_fecn(struct ib_other_headers *ohdr)
+ {
+- return (u8)((be32_to_cpu(ohdr->bth[1]) >> IB_FECN_SHIFT) &
+- IB_FECN_MASK);
++ return (ohdr->bth[1]) & cpu_to_be32(IB_FECN_SMASK);
+ }
+
+ static inline u8 ib_bth_get_tver(struct ib_other_headers *ohdr)
diff --git a/patches.drivers/IB-hfi1-Remove-unnecessary-if-check.patch b/patches.drivers/IB-hfi1-Remove-unnecessary-if-check.patch
new file mode 100644
index 0000000000..5eccebbbf3
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-unnecessary-if-check.patch
@@ -0,0 +1,68 @@
+From: Jan Sokolowski <jan.sokolowski@intel.com>
+Date: Mon, 6 Nov 2017 06:38:45 -0800
+Subject: IB/hfi1: Remove unnecessary if check
+Patch-mainline: v4.15-rc1
+Git-commit: e4c397eed9c93fc1cb34f7d8df96afeb320d535d
+References: bsc#1114685 FATE#325854
+
+A for loop condition of data_iovs in user_sdma_free_request
+is unnecessarily repeated before the loop as an if check.
+
+Remove the if enveloping the loop.
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/user_sdma.c | 30 +++++++++++++++---------------
+ 1 file changed, 15 insertions(+), 15 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/user_sdma.c
++++ b/drivers/infiniband/hw/hfi1/user_sdma.c
+@@ -1428,6 +1428,8 @@ static inline void pq_update(struct hfi1
+
+ static void user_sdma_free_request(struct user_sdma_request *req, bool unpin)
+ {
++ int i;
++
+ if (!list_empty(&req->txps)) {
+ struct sdma_txreq *t, *p;
+
+@@ -1439,22 +1441,20 @@ static void user_sdma_free_request(struc
+ kmem_cache_free(req->pq->txreq_cache, tx);
+ }
+ }
+- if (req->data_iovs) {
+- struct sdma_mmu_node *node;
+- int i;
+-
+- for (i = 0; i < req->data_iovs; i++) {
+- node = req->iovs[i].node;
+- if (!node)
+- continue;
+-
+- if (unpin)
+- hfi1_mmu_rb_remove(req->pq->handler,
+- &node->rb);
+- else
+- atomic_dec(&node->refcount);
+- }
++
++ for (i = 0; i < req->data_iovs; i++) {
++ struct sdma_mmu_node *node = req->iovs[i].node;
++
++ if (!node)
++ continue;
++
++ if (unpin)
++ hfi1_mmu_rb_remove(req->pq->handler,
++ &node->rb);
++ else
++ atomic_dec(&node->refcount);
+ }
++
+ kfree(req->tids);
+ clear_bit(req->info.comp_idx, req->pq->req_in_use);
+ }
diff --git a/patches.drivers/IB-hfi1-Remove-unused-link_default-variable.patch b/patches.drivers/IB-hfi1-Remove-unused-link_default-variable.patch
new file mode 100644
index 0000000000..719cc157f8
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Remove-unused-link_default-variable.patch
@@ -0,0 +1,79 @@
+From: Ira Weiny <ira.weiny@intel.com>
+Date: Tue, 26 Sep 2017 07:00:43 -0700
+Subject: IB/hfi1: Remove unused link_default variable
+Patch-mainline: v4.15-rc1
+Git-commit: 156d24d7001e9b451e2dfc4c5de410b753a8de0d
+References: bsc#1114685 FATE#325854
+
+devdata->link_default is no longer variable
+
+Maintain number of holes by moving dc_shutdown
+
+Reviewed-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
+Signed-off-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/chip.c | 6 ++----
+ drivers/infiniband/hw/hfi1/hfi.h | 6 +++---
+ 2 files changed, 5 insertions(+), 7 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/chip.c
++++ b/drivers/infiniband/hw/hfi1/chip.c
+@@ -9967,7 +9967,7 @@ int hfi1_get_ib_cfg(struct hfi1_pportdat
+ val = ppd->phy_error_threshold;
+ break;
+ case HFI1_IB_CFG_LINKDEFAULT: /* IB link default (sleep/poll) */
+- val = dd->link_default;
++ val = HLS_DEFAULT;
+ break;
+
+ case HFI1_IB_CFG_HRTBT: /* Heartbeat off/enable/auto */
+@@ -10573,7 +10573,7 @@ int set_link_state(struct hfi1_pportdata
+
+ orig_new_state = state;
+ if (state == HLS_DN_DOWNDEF)
+- state = dd->link_default;
++ state = HLS_DEFAULT;
+
+ /* interpret poll -> poll as a link bounce */
+ poll_bounce = ppd->host_link_state == HLS_DN_POLL &&
+@@ -14950,8 +14950,6 @@ struct hfi1_devdata *hfi1_init_dd(struct
+ init_vl_arb_caches(ppd);
+ }
+
+- dd->link_default = HLS_DN_POLL;
+-
+ /*
+ * Do remaining PCIe setup and save PCIe values in dd.
+ * Any error printing is already done by the init code.
+--- a/drivers/infiniband/hw/hfi1/hfi.h
++++ b/drivers/infiniband/hw/hfi1/hfi.h
+@@ -535,6 +535,8 @@ struct rvt_sge_state;
+ #define HLS_UP (HLS_UP_INIT | HLS_UP_ARMED | HLS_UP_ACTIVE)
+ #define HLS_DOWN ~(HLS_UP)
+
++#define HLS_DEFAULT HLS_DN_POLL
++
+ /* use this MTU size if none other is given */
+ #define HFI1_DEFAULT_ACTIVE_MTU 10240
+ /* use this MTU size as the default maximum */
+@@ -1108,8 +1110,7 @@ struct hfi1_devdata {
+ u16 rcvegrbufsize_shift;
+ /* both sides of the PCIe link are gen3 capable */
+ u8 link_gen3_capable;
+- /* default link down value (poll/sleep) */
+- u8 link_default;
++ u8 dc_shutdown;
+ /* localbus width (1, 2,4,8,16,32) from config space */
+ u32 lbus_width;
+ /* localbus speed in MHz */
+@@ -1293,7 +1294,6 @@ struct hfi1_devdata {
+ u8 oui1;
+ u8 oui2;
+ u8 oui3;
+- u8 dc_shutdown;
+
+ /* Timer and counter used to detect RcvBufOvflCnt changes */
+ struct timer_list rcverr_timer;
diff --git a/patches.drivers/IB-hfi1-Set-default_desc1-just-one-time.patch b/patches.drivers/IB-hfi1-Set-default_desc1-just-one-time.patch
new file mode 100644
index 0000000000..c5228af197
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Set-default_desc1-just-one-time.patch
@@ -0,0 +1,49 @@
+From: Ira Weiny <ira.weiny@intel.com>
+Date: Tue, 26 Sep 2017 07:00:37 -0700
+Subject: IB/hfi1: Set default_desc1 just one time
+Patch-mainline: v4.15-rc1
+Git-commit: aadd7020b5903e353c53b69090335e993b27d9d8
+References: bsc#1114685 FATE#325854
+
+There is no reason to set the default descriptor flag on every SDMA
+engine initialization.
+
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Ira Weiny <ira.weiny@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/sdma.c | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/sdma.c
++++ b/drivers/infiniband/hw/hfi1/sdma.c
+@@ -1392,6 +1392,13 @@ int sdma_init(struct hfi1_devdata *dd, u
+ return ret;
+
+ idle_cnt = ns_to_cclock(dd, idle_cnt);
++ if (idle_cnt)
++ dd->default_desc1 =
++ SDMA_DESC1_HEAD_TO_HOST_FLAG;
++ else
++ dd->default_desc1 =
++ SDMA_DESC1_INT_REQ_FLAG;
++
+ if (!sdma_desct_intr)
+ sdma_desct_intr = SDMA_DESC_INTR;
+
+@@ -1436,13 +1443,6 @@ int sdma_init(struct hfi1_devdata *dd, u
+ sde->tail_csr =
+ get_kctxt_csr_addr(dd, this_idx, SD(TAIL));
+
+- if (idle_cnt)
+- dd->default_desc1 =
+- SDMA_DESC1_HEAD_TO_HOST_FLAG;
+- else
+- dd->default_desc1 =
+- SDMA_DESC1_INT_REQ_FLAG;
+-
+ tasklet_init(&sde->sdma_hw_clean_up_task, sdma_hw_clean_up_task,
+ (unsigned long)sde);
+
diff --git a/patches.drivers/IB-hfi1-Suppress-gcc-7-fall-through-complaints.patch b/patches.drivers/IB-hfi1-Suppress-gcc-7-fall-through-complaints.patch
new file mode 100644
index 0000000000..9846f57917
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Suppress-gcc-7-fall-through-complaints.patch
@@ -0,0 +1,62 @@
+From: Bart Van Assche <bart.vanassche@wdc.com>
+Date: Wed, 11 Oct 2017 10:48:57 -0700
+Subject: IB/hfi1: Suppress gcc 7 fall-through complaints
+Patch-mainline: v4.15-rc1
+Git-commit: 6ffeb21f8e38c71146072fa0a099d976b0762a15
+References: bsc#1114685 FATE#325854
+
+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>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/mad.c | 1 +
+ drivers/infiniband/hw/hfi1/rc.c | 2 +-
+ drivers/infiniband/hw/hfi1/sdma.c | 3 ++-
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/mad.c
++++ b/drivers/infiniband/hw/hfi1/mad.c
+@@ -711,6 +711,7 @@ static int check_mkey(struct hfi1_ibport
+ /* Bad mkey not a violation below level 2 */
+ if (ibp->rvp.mkeyprot < 2)
+ break;
++ /* fall through */
+ case IB_MGMT_METHOD_SET:
+ case IB_MGMT_METHOD_TRAP_REPRESS:
+ if (ibp->rvp.mkey_violations != 0xFFFF)
+--- a/drivers/infiniband/hw/hfi1/rc.c
++++ b/drivers/infiniband/hw/hfi1/rc.c
+@@ -2175,7 +2175,7 @@ send_middle:
+ goto no_immediate_data;
+ if (opcode == OP(SEND_ONLY_WITH_INVALIDATE))
+ goto send_last_inv;
+- /* FALLTHROUGH for SEND_ONLY_WITH_IMMEDIATE */
++ /* FALLTHROUGH -- for SEND_ONLY_WITH_IMMEDIATE */
+ case OP(SEND_LAST_WITH_IMMEDIATE):
+ send_last_imm:
+ wc.ex.imm_data = ohdr->u.imm_data;
+--- a/drivers/infiniband/hw/hfi1/sdma.c
++++ b/drivers/infiniband/hw/hfi1/sdma.c
+@@ -2593,7 +2593,7 @@ static void __sdma_process_event(struct
+ * 7220, e.g.
+ */
+ ss->go_s99_running = 1;
+- /* fall through and start dma engine */
++ /* fall through -- and start dma engine */
+ case sdma_event_e10_go_hw_start:
+ /* This reference means the state machine is started */
+ sdma_get(&sde->state);
+@@ -3016,6 +3016,7 @@ static void __sdma_process_event(struct
+ case sdma_event_e60_hw_halted:
+ need_progress = 1;
+ sdma_err_progress_check_schedule(sde);
++ /* fall through */
+ case sdma_event_e90_sw_halted:
+ /*
+ * SW initiated halt does not perform engines
diff --git a/patches.drivers/IB-hfi1-Take-advantage-of-kvzalloc_node-in-sdma-init.patch b/patches.drivers/IB-hfi1-Take-advantage-of-kvzalloc_node-in-sdma-init.patch
new file mode 100644
index 0000000000..bef48079b2
--- /dev/null
+++ b/patches.drivers/IB-hfi1-Take-advantage-of-kvzalloc_node-in-sdma-init.patch
@@ -0,0 +1,41 @@
+From: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Date: Mon, 23 Oct 2017 06:06:32 -0700
+Subject: IB/hfi1: Take advantage of kvzalloc_node in sdma initialization
+Patch-mainline: v4.15-rc1
+Git-commit: 31acd18b61a48bf9225f106a6ff74774583ee375
+References: bsc#1114685 FATE#325854
+
+The code that allocates the tx ring in the sdma code fails to take
+advantage of kvzalloc variations.
+
+Fix by converting to use kvzalloc_node.
+
+Reported-by: Leon Romanovsky <leon@kernel.org>
+Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/sdma.c | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/sdma.c
++++ b/drivers/infiniband/hw/hfi1/sdma.c
+@@ -1465,13 +1465,8 @@ int sdma_init(struct hfi1_devdata *dd, u
+ if (!sde->descq)
+ goto bail;
+ sde->tx_ring =
+- kcalloc(descq_cnt, sizeof(struct sdma_txreq *),
+- GFP_KERNEL);
+- if (!sde->tx_ring)
+- sde->tx_ring =
+- vzalloc(
+- sizeof(struct sdma_txreq *) *
+- descq_cnt);
++ kvzalloc_node(sizeof(struct sdma_txreq *) * descq_cnt,
++ GFP_KERNEL, dd->node);
+ if (!sde->tx_ring)
+ goto bail;
+ }
diff --git a/patches.drivers/IB-hfi1-qib-Fix-a-concurrency-issue-with-device-name.patch b/patches.drivers/IB-hfi1-qib-Fix-a-concurrency-issue-with-device-name.patch
new file mode 100644
index 0000000000..5232e849a6
--- /dev/null
+++ b/patches.drivers/IB-hfi1-qib-Fix-a-concurrency-issue-with-device-name.patch
@@ -0,0 +1,197 @@
+From: "Michael J. Ruhl" <michael.j.ruhl@intel.com>
+Date: Mon, 18 Dec 2017 19:57:21 -0800
+Subject: IB/{hfi1, qib}: Fix a concurrency issue with device name in logging
+Patch-mainline: v4.16-rc1
+Git-commit: 11f0e89710ebea7d1086cbe9ab1270c96677f1dc
+References: bsc#1114685 FATE#325854
+
+The get_unit_name() function crafts a string based on the device name
+and the device unit number. It then stores this in a static variable.
+
+This has concurrency issues as can be seen with this log:
+
+hfi1 0000:02:00.0: hfi1_1: read_idle_message: read idle message 0x203
+hfi1 0000:01:00.0: hfi1_1: read_idle_message: read idle message 0x203
+
+The PCI device ID (0000:02:00.0 vs. 0000:01:00.0) is correct for the
+message, but the device string hfi1_1 is incorrect (it should be
+hfi1_0 for the second log message).
+
+Remove get_unit_name() function.
+
+Instead, use the rvt accessor rvt_get_ibdev_name() to get the IB name
+string.
+
+Clean up any hfi1_early_xx calls that can now use the new path.
+
+QIB has the same (qib_get_unit_name()) issue. Updating as necessary.
+
+Remove qib_get_unit_name() function.
+
+Update log message that has redundant device name.
+
+Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
+Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
+Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/hfi1/chip.c | 5 ++---
+ drivers/infiniband/hw/hfi1/driver.c | 8 --------
+ drivers/infiniband/hw/hfi1/hfi.h | 22 ++++++++++++----------
+ drivers/infiniband/hw/qib/qib.h | 7 +++----
+ drivers/infiniband/hw/qib/qib_driver.c | 8 --------
+ drivers/infiniband/hw/qib/qib_eeprom.c | 3 +--
+ 6 files changed, 18 insertions(+), 35 deletions(-)
+
+--- a/drivers/infiniband/hw/hfi1/chip.c
++++ b/drivers/infiniband/hw/hfi1/chip.c
+@@ -14923,9 +14923,8 @@ struct hfi1_devdata *hfi1_init_dd(struct
+
+ if (num_vls < HFI1_MIN_VLS_SUPPORTED ||
+ num_vls > HFI1_MAX_VLS_SUPPORTED) {
+- hfi1_early_err(&pdev->dev,
+- "Invalid num_vls %u, using %u VLs\n",
+- num_vls, HFI1_MAX_VLS_SUPPORTED);
++ dd_dev_err(dd, "Invalid num_vls %u, using %u VLs\n",
++ num_vls, HFI1_MAX_VLS_SUPPORTED);
+ num_vls = HFI1_MAX_VLS_SUPPORTED;
+ }
+ ppd->vls_supported = num_vls;
+--- a/drivers/infiniband/hw/hfi1/driver.c
++++ b/drivers/infiniband/hw/hfi1/driver.c
+@@ -159,14 +159,6 @@ static int hfi1_caps_get(char *buffer, c
+ return scnprintf(buffer, PAGE_SIZE, "0x%lx", cap_mask);
+ }
+
+-const char *get_unit_name(int unit)
+-{
+- static char iname[16];
+-
+- snprintf(iname, sizeof(iname), DRIVER_NAME "_%u", unit);
+- return iname;
+-}
+-
+ struct pci_dev *get_pci_dev(struct rvt_dev_info *rdi)
+ {
+ struct hfi1_ibdev *ibdev = container_of(rdi, struct hfi1_ibdev, rdi);
+--- a/drivers/infiniband/hw/hfi1/hfi.h
++++ b/drivers/infiniband/hw/hfi1/hfi.h
+@@ -1971,7 +1971,6 @@ int get_platform_config_field(struct hfi
+ table_type, int table_index, int field_index,
+ u32 *data, u32 len);
+
+-const char *get_unit_name(int unit);
+ struct pci_dev *get_pci_dev(struct rvt_dev_info *rdi);
+
+ /*
+@@ -2121,39 +2120,42 @@ static inline u64 hfi1_pkt_base_sdma_int
+
+ #define dd_dev_emerg(dd, fmt, ...) \
+ dev_emerg(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define dd_dev_err(dd, fmt, ...) \
+ dev_err(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define dd_dev_err_ratelimited(dd, fmt, ...) \
+ dev_err_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), \
++ ##__VA_ARGS__)
+
+ #define dd_dev_warn(dd, fmt, ...) \
+ dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define dd_dev_warn_ratelimited(dd, fmt, ...) \
+ dev_warn_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), \
++ ##__VA_ARGS__)
+
+ #define dd_dev_info(dd, fmt, ...) \
+ dev_info(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define dd_dev_info_ratelimited(dd, fmt, ...) \
+ dev_info_ratelimited(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), \
++ ##__VA_ARGS__)
+
+ #define dd_dev_dbg(dd, fmt, ...) \
+ dev_dbg(&(dd)->pcidev->dev, "%s: " fmt, \
+- get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define hfi1_dev_porterr(dd, port, fmt, ...) \
+ dev_err(&(dd)->pcidev->dev, "%s: port %u: " fmt, \
+- get_unit_name((dd)->unit), (port), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), (port), ##__VA_ARGS__)
+
+ /*
+ * this is used for formatting hw error messages...
+--- a/drivers/infiniband/hw/qib/qib.h
++++ b/drivers/infiniband/hw/qib/qib.h
+@@ -1428,7 +1428,6 @@ u64 qib_sps_ints(void);
+ */
+ dma_addr_t qib_map_page(struct pci_dev *, struct page *, unsigned long,
+ size_t, int);
+-const char *qib_get_unit_name(int unit);
+ struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi);
+
+ /*
+@@ -1487,15 +1486,15 @@ extern struct mutex qib_mutex;
+
+ #define qib_dev_err(dd, fmt, ...) \
+ dev_err(&(dd)->pcidev->dev, "%s: " fmt, \
+- qib_get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define qib_dev_warn(dd, fmt, ...) \
+ dev_warn(&(dd)->pcidev->dev, "%s: " fmt, \
+- qib_get_unit_name((dd)->unit), ##__VA_ARGS__)
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), ##__VA_ARGS__)
+
+ #define qib_dev_porterr(dd, port, fmt, ...) \
+ dev_err(&(dd)->pcidev->dev, "%s: IB%u:%u " fmt, \
+- qib_get_unit_name((dd)->unit), (dd)->unit, (port), \
++ rvt_get_ibdev_name(&(dd)->verbs_dev.rdi), (dd)->unit, (port), \
+ ##__VA_ARGS__)
+
+ #define qib_devinfo(pcidev, fmt, ...) \
+--- a/drivers/infiniband/hw/qib/qib_driver.c
++++ b/drivers/infiniband/hw/qib/qib_driver.c
+@@ -81,14 +81,6 @@ MODULE_DESCRIPTION("Intel IB driver");
+
+ struct qlogic_ib_stats qib_stats;
+
+-const char *qib_get_unit_name(int unit)
+-{
+- static char iname[16];
+-
+- snprintf(iname, sizeof(iname), "infinipath%u", unit);
+- return iname;
+-}
+-
+ struct pci_dev *qib_get_pci_dev(struct rvt_dev_info *rdi)
+ {
+ struct qib_ibdev *ibdev = container_of(rdi, struct qib_ibdev, rdi);
+--- a/drivers/infiniband/hw/qib/qib_eeprom.c
++++ b/drivers/infiniband/hw/qib/qib_eeprom.c
+@@ -163,8 +163,7 @@ void qib_get_eeprom_info(struct qib_devd
+ if (bguid[6] == 0xff) {
+ if (bguid[5] == 0xff) {
+ qib_dev_err(dd,
+- "Can't set %s GUID from base, wraps to OUI!\n",
+- qib_get_unit_name(t));
++ "Can't set GUID from base, wraps to OUI!\n");
+ dd->base_guid = 0;
+ goto bail;
+ }
diff --git a/patches.drivers/IB-ipoib-Delete-unused-struct.patch b/patches.drivers/IB-ipoib-Delete-unused-struct.patch
new file mode 100644
index 0000000000..598a06bd12
--- /dev/null
+++ b/patches.drivers/IB-ipoib-Delete-unused-struct.patch
@@ -0,0 +1,33 @@
+From: Yuval Shaia <yuval.shaia@oracle.com>
+Date: Sun, 1 Apr 2018 09:22:18 +0300
+Subject: IB/ipoib: Delete unused struct
+Patch-mainline: v4.17-rc1
+Git-commit: 12ed56bad92265c4430712afd8fa37090dd7888a
+References: bsc#1103992 FATE#326009
+
+This structure is not needed since the introduction of commit
+'c42687784b9a ("IB/ipoib: Scatter-Gather support in connected mode")'
+
+Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib.h | 5 -----
+ 1 file changed, 5 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib.h
++++ b/drivers/infiniband/ulp/ipoib/ipoib.h
+@@ -193,11 +193,6 @@ struct ipoib_tx_buf {
+ u64 mapping[MAX_SKB_FRAGS + 1];
+ };
+
+-struct ipoib_cm_tx_buf {
+- struct sk_buff *skb;
+- u64 mapping;
+-};
+-
+ struct ib_cm_id;
+
+ struct ipoib_cm_data {
diff --git a/patches.drivers/IB-ipoib-Fix-for-potential-no-carrier-state.patch b/patches.drivers/IB-ipoib-Fix-for-potential-no-carrier-state.patch
index 57daee293d..0bca98843a 100644
--- a/patches.drivers/IB-ipoib-Fix-for-potential-no-carrier-state.patch
+++ b/patches.drivers/IB-ipoib-Fix-for-potential-no-carrier-state.patch
@@ -31,7 +31,7 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
-@@ -2272,6 +2272,9 @@ static struct net_device *ipoib_add_port
+@@ -2284,6 +2284,9 @@ static struct net_device *ipoib_add_port
priv->ca, ipoib_event);
ib_register_event_handler(&priv->event_handler);
@@ -40,4 +40,4 @@ Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+
result = register_netdev(priv->dev);
if (result) {
- printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
+ pr_warn("%s: couldn't register ipoib port %d; error %d\n",
diff --git a/patches.drivers/IB-ipoib-Remove-device-when-one-port-fails-to-init.patch b/patches.drivers/IB-ipoib-Remove-device-when-one-port-fails-to-init.patch
new file mode 100644
index 0000000000..1bac60f101
--- /dev/null
+++ b/patches.drivers/IB-ipoib-Remove-device-when-one-port-fails-to-init.patch
@@ -0,0 +1,29 @@
+From: Yuval Shaia <yuval.shaia@oracle.com>
+Date: Mon, 25 Sep 2017 05:18:00 -0700
+Subject: IB/ipoib: Remove device when one port fails to init
+Patch-mainline: v4.15-rc1
+Git-commit: e4b2d06892c7f700f3d62dfef603add35269612e
+References: bsc#1103992 FATE#326009
+
+Call ipoib_remove_one when one of the IPoIB ports fails to initialize in
+order not to leave the module in unstable state.
+
+Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -2313,7 +2313,8 @@ static void ipoib_add_one(struct ib_devi
+ }
+
+ if (!count) {
+- kfree(dev_list);
++ pr_err("Failed to init port, removing it\n");
++ ipoib_remove_one(device, dev_list);
+ return;
+ }
+
diff --git a/patches.drivers/IB-ipoib-Replace-printk-with-pr_warn.patch b/patches.drivers/IB-ipoib-Replace-printk-with-pr_warn.patch
new file mode 100644
index 0000000000..993d5f4aa5
--- /dev/null
+++ b/patches.drivers/IB-ipoib-Replace-printk-with-pr_warn.patch
@@ -0,0 +1,149 @@
+From: Yuval Shaia <yuval.shaia@oracle.com>
+Date: Wed, 29 Nov 2017 11:24:29 +0200
+Subject: IB/ipoib: Replace printk with pr_warn
+Patch-mainline: v4.16-rc1
+Git-commit: c55359a23c23d0ea9af6c0d5d443810551d3b99b
+References: bsc#1103992 FATE#326009
+
+pr_* is the preferred way to print messages, replace all
+printk(KERN_WARN, ...) with pr_warn.
+
+Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
+Reviewed-by: Zhu Yanjun <yanjun.zhu@oracle.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Reviewed-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_cm.c | 8 ++++----
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 23 +++++++++++------------
+ drivers/infiniband/ulp/ipoib/ipoib_verbs.c | 6 +++---
+ 3 files changed, 18 insertions(+), 19 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+@@ -876,7 +876,7 @@ int ipoib_cm_dev_open(struct net_device
+
+ priv->cm.id = ib_create_cm_id(priv->ca, ipoib_cm_rx_handler, dev);
+ if (IS_ERR(priv->cm.id)) {
+- printk(KERN_WARNING "%s: failed to create CM ID\n", priv->ca->name);
++ pr_warn("%s: failed to create CM ID\n", priv->ca->name);
+ ret = PTR_ERR(priv->cm.id);
+ goto err_cm;
+ }
+@@ -884,8 +884,8 @@ int ipoib_cm_dev_open(struct net_device
+ ret = ib_cm_listen(priv->cm.id, cpu_to_be64(IPOIB_CM_IETF_ID | priv->qp->qp_num),
+ 0);
+ if (ret) {
+- printk(KERN_WARNING "%s: failed to listen on ID 0x%llx\n", priv->ca->name,
+- IPOIB_CM_IETF_ID | priv->qp->qp_num);
++ pr_warn("%s: failed to listen on ID 0x%llx\n", priv->ca->name,
++ IPOIB_CM_IETF_ID | priv->qp->qp_num);
+ goto err_listen;
+ }
+
+@@ -1563,7 +1563,7 @@ static void ipoib_cm_create_srq(struct n
+ priv->cm.srq = ib_create_srq(priv->pd, &srq_init_attr);
+ if (IS_ERR(priv->cm.srq)) {
+ if (PTR_ERR(priv->cm.srq) != -ENOSYS)
+- printk(KERN_WARNING "%s: failed to allocate SRQ, error %ld\n",
++ pr_warn("%s: failed to allocate SRQ, error %ld\n",
+ priv->ca->name, PTR_ERR(priv->cm.srq));
+ priv->cm.srq = NULL;
+ return;
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -1674,8 +1674,8 @@ static int ipoib_dev_init_default(struct
+
+ priv->tx_ring = vzalloc(ipoib_sendq_size * sizeof *priv->tx_ring);
+ if (!priv->tx_ring) {
+- printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
+- priv->ca->name, ipoib_sendq_size);
++ pr_warn("%s: failed to allocate TX ring (%d entries)\n",
++ priv->ca->name, ipoib_sendq_size);
+ goto out_rx_ring_cleanup;
+ }
+
+@@ -2215,8 +2215,7 @@ static struct net_device *ipoib_add_port
+
+ result = ib_query_port(hca, port, &attr);
+ if (result) {
+- printk(KERN_WARNING "%s: ib_query_port %d failed\n",
+- hca->name, port);
++ pr_warn("%s: ib_query_port %d failed\n", hca->name, port);
+ goto device_init_failed;
+ }
+
+@@ -2231,8 +2230,8 @@ static struct net_device *ipoib_add_port
+
+ result = ib_query_pkey(hca, port, 0, &priv->pkey);
+ if (result) {
+- printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
+- hca->name, port, result);
++ pr_warn("%s: ib_query_pkey port %d failed (ret = %d)\n",
++ hca->name, port, result);
+ goto device_init_failed;
+ }
+
+@@ -2249,8 +2248,8 @@ static struct net_device *ipoib_add_port
+
+ result = ib_query_gid(hca, port, 0, &priv->local_gid, NULL);
+ if (result) {
+- printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n",
+- hca->name, port, result);
++ pr_warn("%s: ib_query_gid port %d failed (ret = %d)\n",
++ hca->name, port, result);
+ goto device_init_failed;
+ }
+
+@@ -2260,8 +2259,8 @@ static struct net_device *ipoib_add_port
+
+ result = ipoib_dev_init(priv->dev, hca, port);
+ if (result) {
+- printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n",
+- hca->name, port, result);
++ pr_warn("%s: failed to initialize port %d (ret = %d)\n",
++ hca->name, port, result);
+ goto device_init_failed;
+ }
+
+@@ -2271,8 +2270,8 @@ static struct net_device *ipoib_add_port
+
+ result = register_netdev(priv->dev);
+ if (result) {
+- printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
+- hca->name, port, result);
++ pr_warn("%s: couldn't register ipoib port %d; error %d\n",
++ hca->name, port, result);
+ goto register_failed;
+ }
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+@@ -178,7 +178,7 @@ int ipoib_transport_dev_init(struct net_
+ priv->recv_cq = ib_create_cq(priv->ca, ipoib_ib_rx_completion, NULL,
+ priv, &cq_attr);
+ if (IS_ERR(priv->recv_cq)) {
+- printk(KERN_WARNING "%s: failed to create receive CQ\n", ca->name);
++ pr_warn("%s: failed to create receive CQ\n", ca->name);
+ goto out_cm_dev_cleanup;
+ }
+
+@@ -187,7 +187,7 @@ int ipoib_transport_dev_init(struct net_
+ priv->send_cq = ib_create_cq(priv->ca, ipoib_ib_tx_completion, NULL,
+ priv, &cq_attr);
+ if (IS_ERR(priv->send_cq)) {
+- printk(KERN_WARNING "%s: failed to create send CQ\n", ca->name);
++ pr_warn("%s: failed to create send CQ\n", ca->name);
+ goto out_free_recv_cq;
+ }
+
+@@ -208,7 +208,7 @@ int ipoib_transport_dev_init(struct net_
+
+ priv->qp = ib_create_qp(priv->pd, &init_attr);
+ if (IS_ERR(priv->qp)) {
+- printk(KERN_WARNING "%s: failed to create QP\n", ca->name);
++ pr_warn("%s: failed to create QP\n", ca->name);
+ goto out_free_send_cq;
+ }
+
diff --git a/patches.drivers/IB-ipoib-Update-pathrec-field-if-not-valid-record.patch b/patches.drivers/IB-ipoib-Update-pathrec-field-if-not-valid-record.patch
new file mode 100644
index 0000000000..c3b2c5b5ee
--- /dev/null
+++ b/patches.drivers/IB-ipoib-Update-pathrec-field-if-not-valid-record.patch
@@ -0,0 +1,124 @@
+From: Erez Shitrit <erezsh@mellanox.com>
+Date: Tue, 14 Nov 2017 14:51:54 +0200
+Subject: IB/ipoib: Update pathrec field if not valid record
+Patch-mainline: v4.16-rc1
+Git-commit: 98aebc550b88c6d0928e01652ffe76806a2b782e
+References: bsc#1103992 FATE#326009
+
+In case that the PathRecord is not valid (SM changed its network prefix)
+ipoib will continue issue PathQuery requests with the same parameters
+that are in its database, which are no longer valid anymore.
+
+Now the driver in that case will re-initialize the record from a valid
+place (the priv structure keeps the updated values), and a valid request
+will be issued.
+
+Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
+Reviewed-by: Alex Vesker <valex@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 49 ++++++++++++++++++++----------
+ 1 file changed, 34 insertions(+), 15 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -856,6 +856,23 @@ static void path_rec_completion(int stat
+ }
+ }
+
++static void init_path_rec(struct ipoib_dev_priv *priv, struct ipoib_path *path,
++ void *gid)
++{
++ path->dev = priv->dev;
++
++ if (rdma_cap_opa_ah(priv->ca, priv->port))
++ path->pathrec.rec_type = SA_PATH_REC_TYPE_OPA;
++ else
++ path->pathrec.rec_type = SA_PATH_REC_TYPE_IB;
++
++ memcpy(path->pathrec.dgid.raw, gid, sizeof(union ib_gid));
++ path->pathrec.sgid = priv->local_gid;
++ path->pathrec.pkey = cpu_to_be16(priv->pkey);
++ path->pathrec.numb_path = 1;
++ path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
++}
++
+ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
+ {
+ struct ipoib_dev_priv *priv = ipoib_priv(dev);
+@@ -868,21 +885,11 @@ static struct ipoib_path *path_rec_creat
+ if (!path)
+ return NULL;
+
+- path->dev = dev;
+-
+ skb_queue_head_init(&path->queue);
+
+ INIT_LIST_HEAD(&path->neigh_list);
+
+- if (rdma_cap_opa_ah(priv->ca, priv->port))
+- path->pathrec.rec_type = SA_PATH_REC_TYPE_OPA;
+- else
+- path->pathrec.rec_type = SA_PATH_REC_TYPE_IB;
+- memcpy(path->pathrec.dgid.raw, gid, sizeof (union ib_gid));
+- path->pathrec.sgid = priv->local_gid;
+- path->pathrec.pkey = cpu_to_be16(priv->pkey);
+- path->pathrec.numb_path = 1;
+- path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
++ init_path_rec(priv, path, gid);
+
+ return path;
+ }
+@@ -1021,6 +1028,10 @@ static void unicast_arp_send(struct sk_b
+
+ spin_lock_irqsave(&priv->lock, flags);
+
++ /* no broadcast means that all paths are (going to be) not valid */
++ if (!priv->broadcast)
++ goto drop_and_unlock;
++
+ path = __path_find(dev, phdr->hwaddr + 4);
+ if (!path || !path->valid) {
+ int new_path = 0;
+@@ -1030,6 +1041,10 @@ static void unicast_arp_send(struct sk_b
+ new_path = 1;
+ }
+ if (path) {
++ if (!new_path)
++ /* make sure there is no changes in the existing path record */
++ init_path_rec(priv, path, phdr->hwaddr + 4);
++
+ if (skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
+ push_pseudo_header(skb, phdr->hwaddr);
+ __skb_queue_tail(&path->queue, skb);
+@@ -1046,8 +1061,7 @@ static void unicast_arp_send(struct sk_b
+ } else
+ __path_add(dev, path);
+ } else {
+- ++dev->stats.tx_dropped;
+- dev_kfree_skb_any(skb);
++ goto drop_and_unlock;
+ }
+
+ spin_unlock_irqrestore(&priv->lock, flags);
+@@ -1067,11 +1081,16 @@ static void unicast_arp_send(struct sk_b
+ push_pseudo_header(skb, phdr->hwaddr);
+ __skb_queue_tail(&path->queue, skb);
+ } else {
+- ++dev->stats.tx_dropped;
+- dev_kfree_skb_any(skb);
++ goto drop_and_unlock;
+ }
+
+ spin_unlock_irqrestore(&priv->lock, flags);
++ return;
++
++drop_and_unlock:
++ ++dev->stats.tx_dropped;
++ dev_kfree_skb_any(skb);
++ spin_unlock_irqrestore(&priv->lock, flags);
+ }
+
+ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
diff --git a/patches.drivers/IB-ipoib-Warn-when-one-port-fails-to-initialize.patch b/patches.drivers/IB-ipoib-Warn-when-one-port-fails-to-initialize.patch
new file mode 100644
index 0000000000..c3cfcbbbb8
--- /dev/null
+++ b/patches.drivers/IB-ipoib-Warn-when-one-port-fails-to-initialize.patch
@@ -0,0 +1,43 @@
+From: Yuval Shaia <yuval.shaia@oracle.com>
+Date: Wed, 29 Nov 2017 08:34:02 +0200
+Subject: IB/ipoib: Warn when one port fails to initialize
+Patch-mainline: v4.16-rc1
+Git-commit: ac6dbf7fa4707c75a247b540cc0b5c881f3d0ba8
+References: bsc#1103992 FATE#326009
+
+If one port fails to initialize an error message should indicate the
+reason and driver should continue serving the working port(s) and other
+HCA(s).
+
+Fixes: e4b2d06892c7 ("IB/ipoib: Remove device when one port fails to init").
+Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -2207,8 +2207,10 @@ static struct net_device *ipoib_add_port
+ int result = -ENOMEM;
+
+ priv = ipoib_intf_alloc(hca, port, format);
+- if (!priv)
++ if (!priv) {
++ pr_warn("%s, %d: ipoib_intf_alloc failed\n", hca->name, port);
+ goto alloc_mem_failed;
++ }
+
+ SET_NETDEV_DEV(priv->dev, hca->dev.parent);
+ priv->dev->dev_id = port - 1;
+@@ -2336,8 +2338,7 @@ static void ipoib_add_one(struct ib_devi
+ }
+
+ if (!count) {
+- pr_err("Failed to init port, removing it\n");
+- ipoib_remove_one(device, dev_list);
++ kfree(dev_list);
+ return;
+ }
+
diff --git a/patches.drivers/IB-ipoib-fix-ipoib_start_xmit-s-return-type.patch b/patches.drivers/IB-ipoib-fix-ipoib_start_xmit-s-return-type.patch
new file mode 100644
index 0000000000..4263171bb0
--- /dev/null
+++ b/patches.drivers/IB-ipoib-fix-ipoib_start_xmit-s-return-type.patch
@@ -0,0 +1,33 @@
+From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
+Date: Tue, 24 Apr 2018 15:15:47 +0200
+Subject: IB/ipoib: fix ipoib_start_xmit()'s return type
+Patch-mainline: v4.17-rc4
+Git-commit: 47a3968a985e1686f41a55b4099fd1b5e16a5969
+References: bsc#1103992 FATE#326009
+
+The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
+which is a typedef for an enum type, but the implementation in this
+driver returns an 'int'.
+
+Fix this by returning 'netdev_tx_t' in this driver too.
+
+Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
+@@ -1094,7 +1094,7 @@ drop_and_unlock:
+ spin_unlock_irqrestore(&priv->lock, flags);
+ }
+
+-static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
++static netdev_tx_t ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
+ {
+ struct ipoib_dev_priv *priv = ipoib_priv(dev);
+ struct rdma_netdev *rn = netdev_priv(dev);
diff --git a/patches.drivers/IB-ipoib-iser-Consistent-print-format-of-vendor-erro.patch b/patches.drivers/IB-ipoib-iser-Consistent-print-format-of-vendor-erro.patch
new file mode 100644
index 0000000000..99b95ddc00
--- /dev/null
+++ b/patches.drivers/IB-ipoib-iser-Consistent-print-format-of-vendor-erro.patch
@@ -0,0 +1,91 @@
+From: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
+Date: Wed, 27 Sep 2017 21:26:08 +0300
+Subject: IB/{ipoib, iser}: Consistent print format of vendor error
+Patch-mainline: v4.15-rc1
+Git-commit: b04dc1999073250b7d9919eb266da61283ba3db0
+References: bsc#1103992 FATE#326009
+
+Vendor error print should be consistent across protocols to avoid any
+confusion.
+This patch corrects that.
+
+Suggested-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
+Signed-off-by: Ajaykumar Hotchandani <ajaykumar.hotchandani@oracle.com>
+Reviewed-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
+Acked-by: Wengang Wang <wen.gang.wang@oracle.com>
+Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
+Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
+Acked-by: Sagi Grimberg <sagi@grimberg.me>
+Acked-by: Roi Dayan <roid@mellanox.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/ipoib/ipoib_cm.c | 10 +++++-----
+ drivers/infiniband/ulp/ipoib/ipoib_ib.c | 8 ++++----
+ drivers/infiniband/ulp/iser/iser_verbs.c | 2 +-
+ 3 files changed, 10 insertions(+), 10 deletions(-)
+
+--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+@@ -594,9 +594,9 @@ void ipoib_cm_handle_rx_wc(struct net_de
+ skb = rx_ring[wr_id].skb;
+
+ if (unlikely(wc->status != IB_WC_SUCCESS)) {
+- ipoib_dbg(priv, "cm recv error "
+- "(status=%d, wrid=%d vend_err %x)\n",
+- wc->status, wr_id, wc->vendor_err);
++ ipoib_dbg(priv,
++ "cm recv error (status=%d, wrid=%d vend_err %#x)\n",
++ wc->status, wr_id, wc->vendor_err);
+ ++dev->stats.rx_dropped;
+ if (has_srq)
+ goto repost;
+@@ -829,11 +829,11 @@ void ipoib_cm_handle_tx_wc(struct net_de
+ if (wc->status == IB_WC_RNR_RETRY_EXC_ERR ||
+ wc->status == IB_WC_RETRY_EXC_ERR)
+ ipoib_dbg(priv,
+- "%s: failed cm send event (status=%d, wrid=%d vend_err 0x%x)\n",
++ "%s: failed cm send event (status=%d, wrid=%d vend_err %#x)\n",
+ __func__, wc->status, wr_id, wc->vendor_err);
+ else
+ ipoib_warn(priv,
+- "%s: failed cm send event (status=%d, wrid=%d vend_err 0x%x)\n",
++ "%s: failed cm send event (status=%d, wrid=%d vend_err %#x)\n",
+ __func__, wc->status, wr_id, wc->vendor_err);
+
+ spin_lock_irqsave(&priv->lock, flags);
+--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
++++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+@@ -192,8 +192,8 @@ static void ipoib_ib_handle_rx_wc(struct
+
+ if (unlikely(wc->status != IB_WC_SUCCESS)) {
+ if (wc->status != IB_WC_WR_FLUSH_ERR)
+- ipoib_warn(priv, "failed recv event "
+- "(status=%d, wrid=%d vend_err %x)\n",
++ ipoib_warn(priv,
++ "failed recv event (status=%d, wrid=%d vend_err %#x)\n",
+ wc->status, wr_id, wc->vendor_err);
+ ipoib_ud_dma_unmap_rx(priv, priv->rx_ring[wr_id].mapping);
+ dev_kfree_skb_any(skb);
+@@ -414,8 +414,8 @@ static void ipoib_ib_handle_tx_wc(struct
+ if (wc->status != IB_WC_SUCCESS &&
+ wc->status != IB_WC_WR_FLUSH_ERR) {
+ struct ipoib_qp_state_validate *qp_work;
+- ipoib_warn(priv, "failed send event "
+- "(status=%d, wrid=%d vend_err %x)\n",
++ ipoib_warn(priv,
++ "failed send event (status=%d, wrid=%d vend_err %#x)\n",
+ wc->status, wr_id, wc->vendor_err);
+ qp_work = kzalloc(sizeof(*qp_work), GFP_ATOMIC);
+ if (!qp_work)
+--- a/drivers/infiniband/ulp/iser/iser_verbs.c
++++ b/drivers/infiniband/ulp/iser/iser_verbs.c
+@@ -1146,7 +1146,7 @@ void iser_err_comp(struct ib_wc *wc, con
+ if (wc->status != IB_WC_WR_FLUSH_ERR) {
+ struct iser_conn *iser_conn = to_iser_conn(wc->qp->qp_context);
+
+- iser_err("%s failure: %s (%d) vend_err %x\n", type,
++ iser_err("%s failure: %s (%d) vend_err %#x\n", type,
+ ib_wc_status_msg(wc->status), wc->status,
+ wc->vendor_err);
+
diff --git a/patches.drivers/IB-iser-Combine-substrings-for-three-messages.patch b/patches.drivers/IB-iser-Combine-substrings-for-three-messages.patch
new file mode 100644
index 0000000000..1c532a1733
--- /dev/null
+++ b/patches.drivers/IB-iser-Combine-substrings-for-three-messages.patch
@@ -0,0 +1,54 @@
+From: Markus Elfring <elfring@users.sourceforge.net>
+Date: Sat, 27 Jan 2018 18:25:37 +0100
+Subject: IB/iser: Combine substrings for three messages
+Patch-mainline: v4.16-rc1
+Git-commit: 4cb24c550f1105f4a91b9ec9f98a1502c7af5cbb
+References: bsc#1103992 FATE#326009
+
+The script "checkpatch.pl" pointed information out like the following.
+
+WARNING: quoted string split across lines
+
+Thus fix the affected source code places.
+
+Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
+Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/iser/iser_initiator.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -142,8 +142,7 @@ iser_prepare_write_cmd(struct iscsi_task
+ hdr->write_va = cpu_to_be64(mem_reg->sge.addr + unsol_sz);
+ }
+
+- iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X "
+- "VA:%#llX + unsol:%d\n",
++ iser_dbg("Cmd itt:%d, WRITE tags, RKEY:%#.4X VA:%#llX + unsol:%d\n",
+ task->itt, mem_reg->rkey,
+ (unsigned long long)mem_reg->sge.addr, unsol_sz);
+ }
+@@ -473,8 +472,7 @@ int iser_send_data_out(struct iscsi_conn
+ tx_desc->num_sge = 2;
+
+ if (buf_offset + data_seg_len > iser_task->data[ISER_DIR_OUT].data_len) {
+- iser_err("Offset:%ld & DSL:%ld in Data-Out "
+- "inconsistent with total len:%ld, itt:%d\n",
++ iser_err("Offset:%ld & DSL:%ld in Data-Out inconsistent with total len:%ld, itt:%d\n",
+ buf_offset, data_seg_len,
+ iser_task->data[ISER_DIR_OUT].data_len, itt);
+ err = -EINVAL;
+@@ -612,8 +610,8 @@ iser_check_remote_inv(struct iser_conn *
+ iser_conn, rkey);
+
+ if (unlikely(!iser_conn->snd_w_inv)) {
+- iser_err("conn %p: unexpected remote invalidation, "
+- "terminating connection\n", iser_conn);
++ iser_err("conn %p: unexpected remote invalidation, terminating connection\n",
++ iser_conn);
+ return -EPROTO;
+ }
+
diff --git a/patches.drivers/IB-iser-Delete-an-error-message-for-a-failed-memory-.patch b/patches.drivers/IB-iser-Delete-an-error-message-for-a-failed-memory-.patch
new file mode 100644
index 0000000000..ad004379d9
--- /dev/null
+++ b/patches.drivers/IB-iser-Delete-an-error-message-for-a-failed-memory-.patch
@@ -0,0 +1,34 @@
+From: Markus Elfring <elfring@users.sourceforge.net>
+Date: Sat, 27 Jan 2018 17:48:47 +0100
+Subject: IB/iser: Delete an error message for a failed memory allocation in
+ iser_send_data_out()
+Patch-mainline: v4.16-rc1
+Git-commit: cac5141199cdd2cdc188a55576966a9d4a766518
+References: bsc#1103992 FATE#326009
+
+Omit an extra message for a memory allocation failure in this function.
+
+This issue was detected by using the Coccinelle software.
+
+Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
+Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/iser/iser_initiator.c | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -452,10 +452,8 @@ int iser_send_data_out(struct iscsi_conn
+ __func__,(int)itt,(int)data_seg_len,(int)buf_offset);
+
+ tx_desc = kmem_cache_zalloc(ig.desc_cache, GFP_ATOMIC);
+- if (tx_desc == NULL) {
+- iser_err("Failed to alloc desc for post dataout\n");
++ if (!tx_desc)
+ return -ENOMEM;
+- }
+
+ tx_desc->type = ISCSI_TX_DATAOUT;
+ tx_desc->cqe.done = iser_dataout_comp;
diff --git a/patches.drivers/IB-iser-Delete-an-unnecessary-variable-initialisatio.patch b/patches.drivers/IB-iser-Delete-an-unnecessary-variable-initialisatio.patch
new file mode 100644
index 0000000000..13c70fb538
--- /dev/null
+++ b/patches.drivers/IB-iser-Delete-an-unnecessary-variable-initialisatio.patch
@@ -0,0 +1,30 @@
+From: Markus Elfring <elfring@users.sourceforge.net>
+Date: Sat, 27 Jan 2018 17:55:13 +0100
+Subject: IB/iser: Delete an unnecessary variable initialisation in
+ iser_send_data_out()
+Patch-mainline: v4.16-rc1
+Git-commit: d769e6be246cd811b4d467b77d5ff81a09450678
+References: bsc#1103992 FATE#326009
+
+The variable "tx_desc" will be set to an appropriate pointer a bit later.
+Thus omit the explicit initialisation at the beginning.
+
+Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
+Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/ulp/iser/iser_initiator.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/infiniband/ulp/iser/iser_initiator.c
++++ b/drivers/infiniband/ulp/iser/iser_initiator.c
+@@ -436,7 +436,7 @@ int iser_send_data_out(struct iscsi_conn
+ {
+ struct iser_conn *iser_conn = conn->dd_data;
+ struct iscsi_iser_task *iser_task = task->dd_data;
+- struct iser_tx_desc *tx_desc = NULL;
++ struct iser_tx_desc *tx_desc;
+ struct iser_mem_reg *mem_reg;
+ unsigned long buf_offset;
+ unsigned long data_seg_len;
diff --git a/patches.drivers/IB-make-INFINIBAND_ADDR_TRANS-configurable.patch b/patches.drivers/IB-make-INFINIBAND_ADDR_TRANS-configurable.patch
new file mode 100644
index 0000000000..a35563d5d6
--- /dev/null
+++ b/patches.drivers/IB-make-INFINIBAND_ADDR_TRANS-configurable.patch
@@ -0,0 +1,35 @@
+From: Greg Thelen <gthelen@google.com>
+Date: Thu, 26 Apr 2018 11:19:35 -0700
+Subject: IB: make INFINIBAND_ADDR_TRANS configurable
+Patch-mainline: v4.17-rc4
+Git-commit: f7cb7b85be55a4906b4b4b30596db1043dae6335
+References: bsc#1103992 FATE#326009
+
+Allow INFINIBAND without INFINIBAND_ADDR_TRANS because fuzzing has been
+finding fair number of CM bugs. So provide option to disable it.
+
+Signed-off-by: Greg Thelen <gthelen@google.com>
+Cc: Tarick Bedeir <tarick@google.com>
+Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/Kconfig | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/infiniband/Kconfig
++++ b/drivers/infiniband/Kconfig
+@@ -61,9 +61,12 @@ config INFINIBAND_ON_DEMAND_PAGING
+ pages on demand instead.
+
+ config INFINIBAND_ADDR_TRANS
+- bool
++ bool "RDMA/CM"
+ depends on INFINIBAND
+ default y
++ ---help---
++ Support for RDMA communication manager (CM).
++ This allows for a generic connection abstraction over RDMA.
+
+ config INFINIBAND_ADDR_TRANS_CONFIGFS
+ bool
diff --git a/patches.drivers/IB-mlx4-Add-CQ-moderation-capability-to-query_device.patch b/patches.drivers/IB-mlx4-Add-CQ-moderation-capability-to-query_device.patch
new file mode 100644
index 0000000000..9e97cc2d85
--- /dev/null
+++ b/patches.drivers/IB-mlx4-Add-CQ-moderation-capability-to-query_device.patch
@@ -0,0 +1,31 @@
+From: Yonatan Cohen <yonatanc@mellanox.com>
+Date: Mon, 13 Nov 2017 10:51:17 +0200
+Subject: IB/mlx4: Add CQ moderation capability to query_device
+Patch-mainline: v4.15-rc1
+Git-commit: 0fd586de65ae6a249433e1b496f5ed9ce199be73
+References: bsc#1103988 FATE#326003
+
+query_device can now obtain the maximum values for
+cq_max_count and cq_period, needed for cq moderation.
+
+Signed-off-by: Yonatan Cohen <yonatanc@mellanox.com>
+Reviewed-by: Majd Dibbiny <majd@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Doug Ledford <dledford@redhat.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/mlx4/main.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/infiniband/hw/mlx4/main.c
++++ b/drivers/infiniband/hw/mlx4/main.c
+@@ -563,6 +563,9 @@ static int mlx4_ib_query_device(struct i
+ props->max_wq_type_rq = props->max_qp;
+ }
+
++ props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT;
++ props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD;
++
+ if (!mlx4_is_slave(dev->dev))
+ err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
+
diff --git a/patches.drivers/IB-mlx4-Add-Scatter-FCS-support-over-WQ-creation.patch b/patches.drivers/IB-mlx4-Add-Scatter-FCS-support-over-WQ-creation.patch
new file mode 100644
index 0000000000..13eecb43a6
--- /dev/null
+++ b/patches.drivers/IB-mlx4-Add-Scatter-FCS-support-over-WQ-creation.patch
@@ -0,0 +1,112 @@
+From: Guy Levi <guyle@mellanox.com>
+Date: Thu, 15 Mar 2018 16:56:40 +0200
+Subject: IB/mlx4: Add Scatter FCS support over WQ creation
+Patch-mainline: v4.17-rc1
+Git-commit: 6d06c9aa3816c26144f54d18c5b63ba9ff026fb9
+References: bsc#1103988 FATE#326003
+
+As a default, for Ethernet packets, the device scatters only the payload
+of ingress packets. The scatter FCS feature lets the user to get the FCS
+(Ethernet's frame check sequence) in the received WR's buffer as a 4
+Bytes trailer following the packet's payload.
+
+Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
+Signed-off-by: Guy Levi <guyle@mellanox.com>
+Signed-off-by: Leon Romanovsky <leon@kernel.org>
+Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
+Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
+---
+ drivers/infiniband/hw/mlx4/main.c | 21 +++++++++++++--------
+ drivers/infiniband/hw/mlx4/mlx4_ib.h | 1 +
+ drivers/infiniband/hw/mlx4/qp.c | 19 ++++++++++++++++++-
+ 3 files changed, 32 insertions(+), 9 deletions(-)
+
+--- a/drivers/infiniband/hw/mlx4/main.c
++++ b/drivers/infiniband/hw/mlx4/main.c
+@@ -559,14 +559,19 @@ static int mlx4_ib_query_device(struct i
+ props->timestamp_mask = 0xFFFFFFFFFFFFULL;
+ props->max_ah = INT_MAX;
+
+- if ((dev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) &&
+- (mlx4_ib_port_link_layer(ibdev, 1) == IB_LINK_LAYER_ETHERNET ||
+- mlx4_ib_port_link_layer(ibdev, 2) == IB_LINK_LAYER_ETHERNET)) {
+- props->rss_caps.max_rwq_indirection_tables = props->max_qp;
+- props->rss_caps.max_rwq_indirection_table_size =
+- dev->dev->caps.max_rss_tbl_sz;
+- props->rss_caps.supported_qpts = 1 << IB_QPT_RAW_PACKET;
+- props->max_wq_type_rq = props->max_qp;
++ if (mlx4_ib_port_link_layer(ibdev, 1) == IB_LINK_LAYER_ETHERNET ||
++ mlx4_ib_port_link_layer(ibdev, 2) == IB_LINK_LAYER_ETHERNET) {
++ if (dev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) {
++ props->rss_caps.max_rwq_indirection_tables =
++ props->max_qp;
++ props->rss_caps.max_rwq_indirection_table_size =
++ dev->dev->caps.max_rss_tbl_sz;
++ props->rss_caps.supported_qpts = 1 << IB_QPT_RAW_PACKET;
++ props->max_wq_type_rq = props->max_qp;
++ }
++
++ if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_FCS_KEEP)
++ props->raw_packet_caps |= IB_RAW_PACKET_CAP_SCATTER_FCS;
+ }
+
+ props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT;
+--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
++++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
+@@ -189,6 +189,7 @@ enum mlx4_ib_qp_flags {
+ MLX4_IB_QP_LSO = IB_QP_CREATE_IPOIB_UD_LSO,
+ MLX4_IB_QP_BLOCK_MULTICAST_LOOPBACK = IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK,
+ MLX4_IB_QP_NETIF = IB_QP_CREATE_NETIF_QP,
++ MLX4_IB_QP_SCATTER_FCS = IB_QP_CREATE_SCATTER_FCS,
+
+ /* Mellanox specific flags start from IB_QP_CREATE_RESERVED_START */
+ MLX4_IB_ROCE_V2_GSI_QP = MLX4_IB_QP_CREATE_ROCE_V2_GSI,
+--- a/drivers/infiniband/hw/mlx4/qp.c
++++ b/drivers/infiniband/hw/mlx4/qp.c
+@@ -1096,6 +1096,17 @@ static int create_qp_common(struct mlx4_
+ qp->inl_recv_sz = ucmd.qp.inl_recv_sz;
+ }
+
++ if (init_attr->create_flags & IB_QP_CREATE_SCATTER_FCS) {
++ if (!(dev->dev->caps.flags &
++ MLX4_DEV_CAP_FLAG_FCS_KEEP)) {
++ pr_debug("scatter FCS is unsupported\n");
++ err = -EOPNOTSUPP;
++ goto err;
++ }
++
++ qp->flags |= MLX4_IB_QP_SCATTER_FCS;
++ }
++
+ err = set_rq_size(dev, &init_attr->cap, !!pd->uobject,
+ qp_has_rq(init_attr), qp, qp->inl_recv_sz);
+ if (err)
+@@ -2234,6 +2245,9 @@ static int __mlx4_ib_modify_qp(void *src
+ if (qp->inl_recv_sz)
+ context->param3 |= cpu_to_be32(1 << 25);
+
++ if (qp->flags & MLX4_IB_QP_SCATTER_FCS)
++ context->param3 |= cpu_to_be32(1 << 29);
++
+ if (qp_type == IB_QPT_GSI || qp_type == IB_QPT_SMI)
+ context->mtu_msgmax = (IB_MTU_4096 << 5) | 11;
+ else if (qp_type == IB_QPT_RAW_PACKET)
+@@ -4204,7 +4218,7 @@ struct ib_wq *mlx4_ib_create_wq(struct i
+ return ERR_PTR(-EOPNOTSUPP);
+