aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 15:03:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-15 15:03:32 -0500
commit4d5b57e05a67c3cfd8e2b2a64ca356245a15b1c6 (patch)
treed8f3ea3bc3ccfe289f414bbe9a4bdd1e935d9228 /drivers/infiniband/hw/mlx4
parent6df8b74b1720db1133ace0861cb6721bfe57819a (diff)
parent6f94ba20799b98c8badf047b184fb4cd7bc45e44 (diff)
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma
Pull rdma updates from Doug Ledford: "This is the complete update for the rdma stack for this release cycle. Most of it is typical driver and core updates, but there is the entirely new VMWare pvrdma driver. You may have noticed that there were changes in DaveM's pull request to the bnxt Ethernet driver to support a RoCE RDMA driver. The bnxt_re driver was tentatively set to be pulled in this release cycle, but it simply wasn't ready in time and was dropped (a few review comments still to address, and some multi-arch build issues like prefetch() not working across all arches). Summary: - shared mlx5 updates with net stack (will drop out on merge if Dave's tree has already been merged) - driver updates: cxgb4, hfi1, hns-roce, i40iw, mlx4, mlx5, qedr, rxe - debug cleanups - new connection rejection helpers - SRP updates - various misc fixes - new paravirt driver from vmware" * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma: (210 commits) IB: Add vmw_pvrdma driver IB/mlx4: fix improper return value IB/ocrdma: fix bad initialization infiniband: nes: return value of skb_linearize should be handled MAINTAINERS: Update Intel RDMA RNIC driver maintainers MAINTAINERS: Remove Mitesh Ahuja from emulex maintainers IB/core: fix unmap_sg argument qede: fix general protection fault may occur on probe IB/mthca: Replace pci_pool_alloc by pci_pool_zalloc mlx5, calc_sq_size(): Make a debug message more informative mlx5: Remove a set-but-not-used variable mlx5: Use { } instead of { 0 } to init struct IB/srp: Make writing the add_target sysfs attr interruptible IB/srp: Make mapping failures easier to debug IB/srp: Make login failures easier to debug IB/srp: Introduce a local variable in srp_add_one() IB/srp: Fix CONFIG_DYNAMIC_DEBUG=n build IB/multicast: Check ib_find_pkey() return value IPoIB: Avoid reading an uninitialized member variable IB/mad: Fix an array index check ...
Diffstat (limited to 'drivers/infiniband/hw/mlx4')
-rw-r--r--drivers/infiniband/hw/mlx4/ah.c10
-rw-r--r--drivers/infiniband/hw/mlx4/alias_GUID.c4
-rw-r--r--drivers/infiniband/hw/mlx4/cm.c4
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c58
-rw-r--r--drivers/infiniband/hw/mlx4/main.c49
-rw-r--r--drivers/infiniband/hw/mlx4/mcg.c5
-rw-r--r--drivers/infiniband/hw/mlx4/mlx4_ib.h3
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c13
8 files changed, 88 insertions, 58 deletions
diff --git a/drivers/infiniband/hw/mlx4/ah.c b/drivers/infiniband/hw/mlx4/ah.c
index b9bf0759f10a..077c33d2dc75 100644
--- a/drivers/infiniband/hw/mlx4/ah.c
+++ b/drivers/infiniband/hw/mlx4/ah.c
@@ -114,7 +114,9 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
114 !(1 << ah->av.eth.stat_rate & dev->caps.stat_rate_support)) 114 !(1 << ah->av.eth.stat_rate & dev->caps.stat_rate_support))
115 --ah->av.eth.stat_rate; 115 --ah->av.eth.stat_rate;
116 } 116 }
117 117 ah->av.eth.sl_tclass_flowlabel |=
118 cpu_to_be32((ah_attr->grh.traffic_class << 20) |
119 ah_attr->grh.flow_label);
118 /* 120 /*
119 * HW requires multicast LID so we just choose one. 121 * HW requires multicast LID so we just choose one.
120 */ 122 */
@@ -122,12 +124,14 @@ static struct ib_ah *create_iboe_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr
122 ah->av.ib.dlid = cpu_to_be16(0xc000); 124 ah->av.ib.dlid = cpu_to_be16(0xc000);
123 125
124 memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16); 126 memcpy(ah->av.eth.dgid, ah_attr->grh.dgid.raw, 16);
125 ah->av.eth.sl_tclass_flowlabel = cpu_to_be32(ah_attr->sl << 29); 127 ah->av.eth.sl_tclass_flowlabel |= cpu_to_be32(ah_attr->sl << 29);
126 128
127 return &ah->ibah; 129 return &ah->ibah;
128} 130}
129 131
130struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr) 132struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
133 struct ib_udata *udata)
134
131{ 135{
132 struct mlx4_ib_ah *ah; 136 struct mlx4_ib_ah *ah;
133 struct ib_ah *ret; 137 struct ib_ah *ret;
diff --git a/drivers/infiniband/hw/mlx4/alias_GUID.c b/drivers/infiniband/hw/mlx4/alias_GUID.c
index 5e9939045852..06020c54db20 100644
--- a/drivers/infiniband/hw/mlx4/alias_GUID.c
+++ b/drivers/infiniband/hw/mlx4/alias_GUID.c
@@ -755,10 +755,8 @@ static void alias_guid_work(struct work_struct *work)
755 struct mlx4_ib_dev *dev = container_of(ib_sriov, struct mlx4_ib_dev, sriov); 755 struct mlx4_ib_dev *dev = container_of(ib_sriov, struct mlx4_ib_dev, sriov);
756 756
757 rec = kzalloc(sizeof *rec, GFP_KERNEL); 757 rec = kzalloc(sizeof *rec, GFP_KERNEL);
758 if (!rec) { 758 if (!rec)
759 pr_err("alias_guid_work: No Memory\n");
760 return; 759 return;
761 }
762 760
763 pr_debug("starting [port: %d]...\n", sriov_alias_port->port + 1); 761 pr_debug("starting [port: %d]...\n", sriov_alias_port->port + 1);
764 ret = get_next_record_to_update(dev, sriov_alias_port->port, rec); 762 ret = get_next_record_to_update(dev, sriov_alias_port->port, rec);
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c
index 39a488889fc7..d64845335e87 100644
--- a/drivers/infiniband/hw/mlx4/cm.c
+++ b/drivers/infiniband/hw/mlx4/cm.c
@@ -247,10 +247,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
247 struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov; 247 struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov;
248 248
249 ent = kmalloc(sizeof (struct id_map_entry), GFP_KERNEL); 249 ent = kmalloc(sizeof (struct id_map_entry), GFP_KERNEL);
250 if (!ent) { 250 if (!ent)
251 mlx4_ib_warn(ibdev, "Couldn't allocate id cache entry - out of memory\n");
252 return ERR_PTR(-ENOMEM); 251 return ERR_PTR(-ENOMEM);
253 }
254 252
255 ent->sl_cm_id = sl_cm_id; 253 ent->sl_cm_id = sl_cm_id;
256 ent->slave_id = slave_id; 254 ent->slave_id = slave_id;
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 1672907ff219..db564ccc0f92 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -39,6 +39,8 @@
39#include <linux/mlx4/cmd.h> 39#include <linux/mlx4/cmd.h>
40#include <linux/gfp.h> 40#include <linux/gfp.h>
41#include <rdma/ib_pma.h> 41#include <rdma/ib_pma.h>
42#include <linux/ip.h>
43#include <net/ipv6.h>
42 44
43#include <linux/mlx4/driver.h> 45#include <linux/mlx4/driver.h>
44#include "mlx4_ib.h" 46#include "mlx4_ib.h"
@@ -480,6 +482,23 @@ static int find_slave_port_pkey_ix(struct mlx4_ib_dev *dev, int slave,
480 return -EINVAL; 482 return -EINVAL;
481} 483}
482 484
485static int get_gids_from_l3_hdr(struct ib_grh *grh, union ib_gid *sgid,
486 union ib_gid *dgid)
487{
488 int version = ib_get_rdma_header_version((const union rdma_network_hdr *)grh);
489 enum rdma_network_type net_type;
490
491 if (version == 4)
492 net_type = RDMA_NETWORK_IPV4;
493 else if (version == 6)
494 net_type = RDMA_NETWORK_IPV6;
495 else
496 return -EINVAL;
497
498 return ib_get_gids_from_rdma_hdr((union rdma_network_hdr *)grh, net_type,
499 sgid, dgid);
500}
501
483int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port, 502int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
484 enum ib_qp_type dest_qpt, struct ib_wc *wc, 503 enum ib_qp_type dest_qpt, struct ib_wc *wc,
485 struct ib_grh *grh, struct ib_mad *mad) 504 struct ib_grh *grh, struct ib_mad *mad)
@@ -538,7 +557,10 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,
538 memset(&attr, 0, sizeof attr); 557 memset(&attr, 0, sizeof attr);
539 attr.port_num = port; 558 attr.port_num = port;
540 if (is_eth) { 559 if (is_eth) {
541 memcpy(&attr.grh.dgid.raw[0], &grh->dgid.raw[0], 16); 560 union ib_gid sgid;
561
562 if (get_gids_from_l3_hdr(grh, &sgid, &attr.grh.dgid))
563 return -EINVAL;
542 attr.ah_flags = IB_AH_GRH; 564 attr.ah_flags = IB_AH_GRH;
543 } 565 }
544 ah = ib_create_ah(tun_ctx->pd, &attr); 566 ah = ib_create_ah(tun_ctx->pd, &attr);
@@ -651,6 +673,11 @@ static int mlx4_ib_demux_mad(struct ib_device *ibdev, u8 port,
651 is_eth = 1; 673 is_eth = 1;
652 674
653 if (is_eth) { 675 if (is_eth) {
676 union ib_gid dgid;
677 union ib_gid sgid;
678
679 if (get_gids_from_l3_hdr(grh, &sgid, &dgid))
680 return -EINVAL;
654 if (!(wc->wc_flags & IB_WC_GRH)) { 681 if (!(wc->wc_flags & IB_WC_GRH)) {
655 mlx4_ib_warn(ibdev, "RoCE grh not present.\n"); 682 mlx4_ib_warn(ibdev, "RoCE grh not present.\n");
656 return -EINVAL; 683 return -EINVAL;
@@ -659,10 +686,10 @@ static int mlx4_ib_demux_mad(struct ib_device *ibdev, u8 port,
659 mlx4_ib_warn(ibdev, "RoCE mgmt class is not CM\n"); 686 mlx4_ib_warn(ibdev, "RoCE mgmt class is not CM\n");
660 return -EINVAL; 687 return -EINVAL;
661 } 688 }
662 err = mlx4_get_slave_from_roce_gid(dev->dev, port, grh->dgid.raw, &slave); 689 err = mlx4_get_slave_from_roce_gid(dev->dev, port, dgid.raw, &slave);
663 if (err && mlx4_is_mf_bonded(dev->dev)) { 690 if (err && mlx4_is_mf_bonded(dev->dev)) {
664 other_port = (port == 1) ? 2 : 1; 691 other_port = (port == 1) ? 2 : 1;
665 err = mlx4_get_slave_from_roce_gid(dev->dev, other_port, grh->dgid.raw, &slave); 692 err = mlx4_get_slave_from_roce_gid(dev->dev, other_port, dgid.raw, &slave);
666 if (!err) { 693 if (!err) {
667 port = other_port; 694 port = other_port;
668 pr_debug("resolved slave %d from gid %pI6 wire port %d other %d\n", 695 pr_debug("resolved slave %d from gid %pI6 wire port %d other %d\n",
@@ -702,10 +729,18 @@ static int mlx4_ib_demux_mad(struct ib_device *ibdev, u8 port,
702 729
703 /* If a grh is present, we demux according to it */ 730 /* If a grh is present, we demux according to it */
704 if (wc->wc_flags & IB_WC_GRH) { 731 if (wc->wc_flags & IB_WC_GRH) {
705 slave = mlx4_ib_find_real_gid(ibdev, port, grh->dgid.global.interface_id); 732 if (grh->dgid.global.interface_id ==
706 if (slave < 0) { 733 cpu_to_be64(IB_SA_WELL_KNOWN_GUID) &&
707 mlx4_ib_warn(ibdev, "failed matching grh\n"); 734 grh->dgid.global.subnet_prefix == cpu_to_be64(
708 return -ENOENT; 735 atomic64_read(&dev->sriov.demux[port - 1].subnet_prefix))) {
736 slave = 0;
737 } else {
738 slave = mlx4_ib_find_real_gid(ibdev, port,
739 grh->dgid.global.interface_id);
740 if (slave < 0) {
741 mlx4_ib_warn(ibdev, "failed matching grh\n");
742 return -ENOENT;
743 }
709 } 744 }
710 } 745 }
711 /* Class-specific handling */ 746 /* Class-specific handling */
@@ -1102,10 +1137,8 @@ static void handle_slaves_guid_change(struct mlx4_ib_dev *dev, u8 port_num,
1102 1137
1103 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL); 1138 in_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
1104 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 1139 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
1105 if (!in_mad || !out_mad) { 1140 if (!in_mad || !out_mad)
1106 mlx4_ib_warn(&dev->ib_dev, "failed to allocate memory for guid info mads\n");
1107 goto out; 1141 goto out;
1108 }
1109 1142
1110 guid_tbl_blk_num *= 4; 1143 guid_tbl_blk_num *= 4;
1111 1144
@@ -1916,11 +1949,8 @@ static int alloc_pv_object(struct mlx4_ib_dev *dev, int slave, int port,
1916 1949
1917 *ret_ctx = NULL; 1950 *ret_ctx = NULL;
1918 ctx = kzalloc(sizeof (struct mlx4_ib_demux_pv_ctx), GFP_KERNEL); 1951 ctx = kzalloc(sizeof (struct mlx4_ib_demux_pv_ctx), GFP_KERNEL);
1919 if (!ctx) { 1952 if (!ctx)
1920 pr_err("failed allocating pv resource context "
1921 "for port %d, slave %d\n", port, slave);
1922 return -ENOMEM; 1953 return -ENOMEM;
1923 }
1924 1954
1925 ctx->ib_dev = &dev->ib_dev; 1955 ctx->ib_dev = &dev->ib_dev;
1926 ctx->port = port; 1956 ctx->port = port;
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index b597e8227591..c8413fc120e6 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -430,7 +430,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
430 struct mlx4_ib_dev *dev = to_mdev(ibdev); 430 struct mlx4_ib_dev *dev = to_mdev(ibdev);
431 struct ib_smp *in_mad = NULL; 431 struct ib_smp *in_mad = NULL;
432 struct ib_smp *out_mad = NULL; 432 struct ib_smp *out_mad = NULL;
433 int err = -ENOMEM; 433 int err;
434 int have_ib_ports; 434 int have_ib_ports;
435 struct mlx4_uverbs_ex_query_device cmd; 435 struct mlx4_uverbs_ex_query_device cmd;
436 struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0}; 436 struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0};
@@ -455,6 +455,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
455 sizeof(resp.response_length); 455 sizeof(resp.response_length);
456 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); 456 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
457 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); 457 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
458 err = -ENOMEM;
458 if (!in_mad || !out_mad) 459 if (!in_mad || !out_mad)
459 goto out; 460 goto out;
460 461
@@ -547,6 +548,7 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
547 props->max_map_per_fmr = dev->dev->caps.max_fmr_maps; 548 props->max_map_per_fmr = dev->dev->caps.max_fmr_maps;
548 props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL; 549 props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL;
549 props->timestamp_mask = 0xFFFFFFFFFFFFULL; 550 props->timestamp_mask = 0xFFFFFFFFFFFFULL;
551 props->max_ah = INT_MAX;
550 552
551 if (!mlx4_is_slave(dev->dev)) 553 if (!mlx4_is_slave(dev->dev))
552 err = mlx4_get_internal_clock_params(dev->dev, &clock_params); 554 err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
@@ -697,9 +699,11 @@ static int eth_link_query_port(struct ib_device *ibdev, u8 port,
697 if (err) 699 if (err)
698 goto out; 700 goto out;
699 701
700 props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ? 702 props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ||
701 IB_WIDTH_4X : IB_WIDTH_1X; 703 (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
702 props->active_speed = IB_SPEED_QDR; 704 IB_WIDTH_4X : IB_WIDTH_1X;
705 props->active_speed = (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
706 IB_SPEED_FDR : IB_SPEED_QDR;
703 props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS; 707 props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
704 props->gid_tbl_len = mdev->dev->caps.gid_table_len[port]; 708 props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
705 props->max_msg_sz = mdev->dev->caps.max_msg_sz; 709 props->max_msg_sz = mdev->dev->caps.max_msg_sz;
@@ -2814,20 +2818,22 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
2814 kmalloc(BITS_TO_LONGS(ibdev->steer_qpn_count) * 2818 kmalloc(BITS_TO_LONGS(ibdev->steer_qpn_count) *
2815 sizeof(long), 2819 sizeof(long),
2816 GFP_KERNEL); 2820 GFP_KERNEL);
2817 if (!ibdev->ib_uc_qpns_bitmap) { 2821 if (!ibdev->ib_uc_qpns_bitmap)
2818 dev_err(&dev->persist->pdev->dev,
2819 "bit map alloc failed\n");
2820 goto err_steer_qp_release; 2822 goto err_steer_qp_release;
2821 }
2822 2823
2823 bitmap_zero(ibdev->ib_uc_qpns_bitmap, ibdev->steer_qpn_count); 2824 if (dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_DMFS_IPOIB) {
2824 2825 bitmap_zero(ibdev->ib_uc_qpns_bitmap,
2825 err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE( 2826 ibdev->steer_qpn_count);
2826 dev, ibdev->steer_qpn_base, 2827 err = mlx4_FLOW_STEERING_IB_UC_QP_RANGE(
2827 ibdev->steer_qpn_base + 2828 dev, ibdev->steer_qpn_base,
2828 ibdev->steer_qpn_count - 1); 2829 ibdev->steer_qpn_base +
2829 if (err) 2830 ibdev->steer_qpn_count - 1);
2830 goto err_steer_free_bitmap; 2831 if (err)
2832 goto err_steer_free_bitmap;
2833 } else {
2834 bitmap_fill(ibdev->ib_uc_qpns_bitmap,
2835 ibdev->steer_qpn_count);
2836 }
2831 } 2837 }
2832 2838
2833 for (j = 1; j <= ibdev->dev->caps.num_ports; j++) 2839 for (j = 1; j <= ibdev->dev->caps.num_ports; j++)
@@ -3055,15 +3061,12 @@ static void do_slave_init(struct mlx4_ib_dev *ibdev, int slave, int do_init)
3055 first_port = find_first_bit(actv_ports.ports, dev->caps.num_ports); 3061 first_port = find_first_bit(actv_ports.ports, dev->caps.num_ports);
3056 3062
3057 dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC); 3063 dm = kcalloc(ports, sizeof(*dm), GFP_ATOMIC);
3058 if (!dm) { 3064 if (!dm)
3059 pr_err("failed to allocate memory for tunneling qp update\n");
3060 return; 3065 return;
3061 }
3062 3066
3063 for (i = 0; i < ports; i++) { 3067 for (i = 0; i < ports; i++) {
3064 dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC); 3068 dm[i] = kmalloc(sizeof (struct mlx4_ib_demux_work), GFP_ATOMIC);
3065 if (!dm[i]) { 3069 if (!dm[i]) {
3066 pr_err("failed to allocate memory for tunneling qp update work struct\n");
3067 while (--i >= 0) 3070 while (--i >= 0)
3068 kfree(dm[i]); 3071 kfree(dm[i]);
3069 goto out; 3072 goto out;
@@ -3223,8 +3226,6 @@ void mlx4_sched_ib_sl2vl_update_work(struct mlx4_ib_dev *ibdev,
3223 ew->port = port; 3226 ew->port = port;
3224 ew->ib_dev = ibdev; 3227 ew->ib_dev = ibdev;
3225 queue_work(wq, &ew->work); 3228 queue_work(wq, &ew->work);
3226 } else {
3227 pr_err("failed to allocate memory for sl2vl update work\n");
3228 } 3229 }
3229} 3230}
3230 3231
@@ -3284,10 +3285,8 @@ static void mlx4_ib_event(struct mlx4_dev *dev, void *ibdev_ptr,
3284 3285
3285 case MLX4_DEV_EVENT_PORT_MGMT_CHANGE: 3286 case MLX4_DEV_EVENT_PORT_MGMT_CHANGE:
3286 ew = kmalloc(sizeof *ew, GFP_ATOMIC); 3287 ew = kmalloc(sizeof *ew, GFP_ATOMIC);
3287 if (!ew) { 3288 if (!ew)
3288 pr_err("failed to allocate memory for events work\n");
3289 break; 3289 break;
3290 }
3291 3290
3292 INIT_WORK(&ew->work, handle_port_mgmt_change_event); 3291 INIT_WORK(&ew->work, handle_port_mgmt_change_event);
3293 memcpy(&ew->ib_eqe, eqe, sizeof *eqe); 3292 memcpy(&ew->ib_eqe, eqe, sizeof *eqe);
diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index a21d37f02f35..e010fe459e67 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -1142,7 +1142,6 @@ void mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroy_wq)
1142 work = kmalloc(sizeof *work, GFP_KERNEL); 1142 work = kmalloc(sizeof *work, GFP_KERNEL);
1143 if (!work) { 1143 if (!work) {
1144 ctx->flushing = 0; 1144 ctx->flushing = 0;
1145 mcg_warn("failed allocating work for cleanup\n");
1146 return; 1145 return;
1147 } 1146 }
1148 1147
@@ -1202,10 +1201,8 @@ static int push_deleteing_req(struct mcast_group *group, int slave)
1202 return 0; 1201 return 0;
1203 1202
1204 req = kzalloc(sizeof *req, GFP_KERNEL); 1203 req = kzalloc(sizeof *req, GFP_KERNEL);
1205 if (!req) { 1204 if (!req)
1206 mcg_warn_group(group, "failed allocation - may leave stall groups\n");
1207 return -ENOMEM; 1205 return -ENOMEM;
1208 }
1209 1206
1210 if (!list_empty(&group->func[slave].pending)) { 1207 if (!list_empty(&group->func[slave].pending)) {
1211 pend_req = list_entry(group->func[slave].pending.prev, struct mcast_req, group_list); 1208 pend_req = list_entry(group->func[slave].pending.prev, struct mcast_req, group_list);
diff --git a/drivers/infiniband/hw/mlx4/mlx4_ib.h b/drivers/infiniband/hw/mlx4/mlx4_ib.h
index 35141f451e5c..7f3d976d81ed 100644
--- a/drivers/infiniband/hw/mlx4/mlx4_ib.h
+++ b/drivers/infiniband/hw/mlx4/mlx4_ib.h
@@ -742,7 +742,8 @@ int mlx4_ib_arm_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
742void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq); 742void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq);
743void mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq); 743void mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, struct mlx4_ib_srq *srq);
744 744
745struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); 745struct ib_ah *mlx4_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr,
746 struct ib_udata *udata);
746int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr); 747int mlx4_ib_query_ah(struct ib_ah *ibah, struct ib_ah_attr *ah_attr);
747int mlx4_ib_destroy_ah(struct ib_ah *ah); 748int mlx4_ib_destroy_ah(struct ib_ah *ah);
748 749
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 570bc866b1d6..c068add8838b 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -644,7 +644,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
644 int qpn; 644 int qpn;
645 int err; 645 int err;
646 struct ib_qp_cap backup_cap; 646 struct ib_qp_cap backup_cap;
647 struct mlx4_ib_sqp *sqp; 647 struct mlx4_ib_sqp *sqp = NULL;
648 struct mlx4_ib_qp *qp; 648 struct mlx4_ib_qp *qp;
649 enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) init_attr->qp_type; 649 enum mlx4_ib_qp_type qp_type = (enum mlx4_ib_qp_type) init_attr->qp_type;
650 struct mlx4_ib_cq *mcq; 650 struct mlx4_ib_cq *mcq;
@@ -933,7 +933,9 @@ err_db:
933 mlx4_db_free(dev->dev, &qp->db); 933 mlx4_db_free(dev->dev, &qp->db);
934 934
935err: 935err:
936 if (!*caller_qp) 936 if (sqp)
937 kfree(sqp);
938 else if (!*caller_qp)
937 kfree(qp); 939 kfree(qp);
938 return err; 940 return err;
939} 941}
@@ -1280,7 +1282,8 @@ static int _mlx4_ib_destroy_qp(struct ib_qp *qp)
1280 if (is_qp0(dev, mqp)) 1282 if (is_qp0(dev, mqp))
1281 mlx4_CLOSE_PORT(dev->dev, mqp->port); 1283 mlx4_CLOSE_PORT(dev->dev, mqp->port);
1282 1284
1283 if (dev->qp1_proxy[mqp->port - 1] == mqp) { 1285 if (mqp->mlx4_ib_qp_type == MLX4_IB_QPT_PROXY_GSI &&
1286 dev->qp1_proxy[mqp->port - 1] == mqp) {
1284 mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]); 1287 mutex_lock(&dev->qp1_proxy_lock[mqp->port - 1]);
1285 dev->qp1_proxy[mqp->port - 1] = NULL; 1288 dev->qp1_proxy[mqp->port - 1] = NULL;
1286 mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]); 1289 mutex_unlock(&dev->qp1_proxy_lock[mqp->port - 1]);
@@ -1764,14 +1767,14 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
1764 u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 : 1767 u8 port_num = mlx4_is_bonded(to_mdev(ibqp->device)->dev) ? 1 :
1765 attr_mask & IB_QP_PORT ? attr->port_num : qp->port; 1768 attr_mask & IB_QP_PORT ? attr->port_num : qp->port;
1766 union ib_gid gid; 1769 union ib_gid gid;
1767 struct ib_gid_attr gid_attr; 1770 struct ib_gid_attr gid_attr = {.gid_type = IB_GID_TYPE_IB};
1768 u16 vlan = 0xffff; 1771 u16 vlan = 0xffff;
1769 u8 smac[ETH_ALEN]; 1772 u8 smac[ETH_ALEN];
1770 int status = 0; 1773 int status = 0;
1771 int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) && 1774 int is_eth = rdma_cap_eth_ah(&dev->ib_dev, port_num) &&
1772 attr->ah_attr.ah_flags & IB_AH_GRH; 1775 attr->ah_attr.ah_flags & IB_AH_GRH;
1773 1776
1774 if (is_eth) { 1777 if (is_eth && attr->ah_attr.ah_flags & IB_AH_GRH) {
1775 int index = attr->ah_attr.grh.sgid_index; 1778 int index = attr->ah_attr.grh.sgid_index;
1776 1779
1777 status = ib_get_cached_gid(ibqp->device, port_num, 1780 status = ib_get_cached_gid(ibqp->device, port_num,