Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251887
b: refs/heads/master
c: c8367c4
h: refs/heads/master
i:
  251885: 8b65434
  251883: f9290d5
  251879: 245225e
  251871: d85578f
v: v3
  • Loading branch information
Ira Weiny authored and Roland Dreier committed May 23, 2011
1 parent 6197a67 commit ef81e89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c337374bf23b88620bcc66a7a09f141cc640f548
refs/heads/master: c8367c4cd9de512d296fc557f121be62a43987f3
7 changes: 7 additions & 0 deletions trunk/drivers/infiniband/core/mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 13 additions & 5 deletions trunk/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/idr.h>
#include <linux/completion.h>
#include <linux/workqueue.h>
#include <linux/netdevice.h>
#include <linux/sched.h>
#include <linux/pci.h>
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit ef81e89

Please sign in to comment.