cxgbe/iw_cxgbe: Pull in some updates to c4iw_wait_for_reply from the
iw_cxgb4 Linux driver. Obtained from: Chelsio Communications MFC after: 3 days Sponsored by: Chelsio Communications
This commit is contained in:
parent
f97074045b
commit
034b4dcfa8
@ -157,49 +157,70 @@ static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
|
||||
return (int)(rdev->adap->vres.stag.size >> 5);
|
||||
}
|
||||
|
||||
#define C4IW_WR_TO (10*HZ)
|
||||
#define C4IW_WR_TO (60*HZ)
|
||||
|
||||
struct c4iw_wr_wait {
|
||||
int ret;
|
||||
atomic_t completion;
|
||||
struct completion completion;
|
||||
};
|
||||
|
||||
static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp)
|
||||
{
|
||||
wr_waitp->ret = 0;
|
||||
atomic_set(&wr_waitp->completion, 0);
|
||||
init_completion(&wr_waitp->completion);
|
||||
}
|
||||
|
||||
static inline void c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret)
|
||||
{
|
||||
wr_waitp->ret = ret;
|
||||
atomic_set(&wr_waitp->completion, 1);
|
||||
wakeup(wr_waitp);
|
||||
complete(&wr_waitp->completion);
|
||||
}
|
||||
|
||||
static inline int
|
||||
c4iw_wait_for_reply(struct c4iw_rdev *rdev, struct c4iw_wr_wait *wr_waitp,
|
||||
u32 hwtid, u32 qpid, const char *func)
|
||||
u32 hwtid, u32 qpid, const char *func)
|
||||
{
|
||||
struct adapter *sc = rdev->adap;
|
||||
unsigned to = C4IW_WR_TO;
|
||||
int ret;
|
||||
int timedout = 0;
|
||||
struct timeval t1, t2;
|
||||
|
||||
while (!atomic_read(&wr_waitp->completion)) {
|
||||
tsleep(wr_waitp, 0, "c4iw_wait", to);
|
||||
if (SIGPENDING(curthread)) {
|
||||
printf("%s - Device %s not responding - "
|
||||
"tid %u qpid %u\n", func,
|
||||
device_get_nameunit(sc->dev), hwtid, qpid);
|
||||
if (c4iw_fatal_error(rdev)) {
|
||||
wr_waitp->ret = -EIO;
|
||||
break;
|
||||
}
|
||||
to = to << 2;
|
||||
}
|
||||
}
|
||||
if (c4iw_fatal_error(rdev)) {
|
||||
wr_waitp->ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
|
||||
getmicrotime(&t1);
|
||||
do {
|
||||
ret = wait_for_completion_timeout(&wr_waitp->completion, to);
|
||||
if (!ret) {
|
||||
getmicrotime(&t2);
|
||||
timevalsub(&t2, &t1);
|
||||
printf("%s - Device %s not responding after %ld.%06ld "
|
||||
"seconds - tid %u qpid %u\n", func,
|
||||
device_get_nameunit(sc->dev), t2.tv_sec, t2.tv_usec,
|
||||
hwtid, qpid);
|
||||
if (c4iw_fatal_error(rdev)) {
|
||||
wr_waitp->ret = -EIO;
|
||||
break;
|
||||
}
|
||||
to = to << 2;
|
||||
timedout = 1;
|
||||
}
|
||||
} while (!ret);
|
||||
|
||||
out:
|
||||
if (timedout) {
|
||||
getmicrotime(&t2);
|
||||
timevalsub(&t2, &t1);
|
||||
printf("%s - Device %s reply after %ld.%06ld seconds - "
|
||||
"tid %u qpid %u\n", func, device_get_nameunit(sc->dev),
|
||||
t2.tv_sec, t2.tv_usec, hwtid, qpid);
|
||||
}
|
||||
if (wr_waitp->ret)
|
||||
CTR4(KTR_IW_CXGBE, "%s: FW reply %d tid %u qpid %u",
|
||||
device_get_nameunit(sc->dev), wr_waitp->ret, hwtid, qpid);
|
||||
CTR4(KTR_IW_CXGBE, "%p: FW reply %d tid %u qpid %u", sc,
|
||||
wr_waitp->ret, hwtid, qpid);
|
||||
return (wr_waitp->ret);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user