From ef81e89bc7c690f3fc36cb772f1b579b920f49dc Mon Sep 17 00:00:00 2001 From: Ira Weiny Date: Thu, 19 May 2011 18:19:28 -0700 Subject: [PATCH] --- yaml --- r: 251887 b: refs/heads/master c: c8367c4cd9de512d296fc557f121be62a43987f3 h: refs/heads/master i: 251885: 8b654349615b0374dd1caf5016f65d40ef5af5c2 251883: f9290d54066151c33ea0df4738224a48e889e969 251879: 245225e498132c52047ad032ca987b65c2c3f8d1 251871: d85578facedf4dde877bb6149b99eb5b50d3a1e2 v: v3 --- [refs] | 2 +- trunk/drivers/infiniband/core/mad.c | 7 +++++++ trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h | 18 +++++++++++++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index 0cc4c3476331..76bf002c0498 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c337374bf23b88620bcc66a7a09f141cc640f548 +refs/heads/master: c8367c4cd9de512d296fc557f121be62a43987f3 diff --git a/trunk/drivers/infiniband/core/mad.c b/trunk/drivers/infiniband/core/mad.c index 822cfdcd9f78..b4d8672a3e4e 100644 --- a/trunk/drivers/infiniband/core/mad.c +++ b/trunk/drivers/infiniband/core/mad.c @@ -276,6 +276,13 @@ struct ib_mad_agent *ib_register_mad_agent(struct ib_device *device, goto error1; } + /* Verify the QP requested is supported. For example, Ethernet devices + * will not have QP0 */ + if (!port_priv->qp_info[qpn].qp) { + ret = ERR_PTR(-EPROTONOSUPPORT); + goto error1; + } + /* Allocate structures */ mad_agent_priv = kzalloc(sizeof *mad_agent_priv, GFP_KERNEL); if (!mad_agent_priv) { diff --git a/trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h index 4f045375c8e2..35d2a5dd9bb4 100644 --- a/trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h +++ b/trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include #include @@ -131,21 +131,28 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev) #define C4IW_WR_TO (10*HZ) +enum { + REPLY_READY = 0, +}; + struct c4iw_wr_wait { - struct completion completion; + wait_queue_head_t wait; + unsigned long status; int ret; }; static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp) { wr_waitp->ret = 0; - init_completion(&wr_waitp->completion); + wr_waitp->status = 0; + init_waitqueue_head(&wr_waitp->wait); } static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret) { wr_waitp->ret = ret; - complete(&wr_waitp->completion); + set_bit(REPLY_READY, &wr_waitp->status); + wake_up(&wr_waitp->wait); } static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev, @@ -157,7 +164,8 @@ static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev, int ret; do { - ret = wait_for_completion_timeout(&wr_waitp->completion, to); + ret = wait_event_timeout(wr_waitp->wait, + test_and_clear_bit(REPLY_READY, &wr_waitp->status), to); if (!ret) { printk(KERN_ERR MOD "%s - Device %s not responding - " "tid %u qpid %u\n", func,