staging/rdma/hfi1: use new RNR timer

Use the new RNR timer for hfi1.

For qib, this timer doesn't exist, so exploit driver
callbacks to use the new timer as appropriate.

Reviewed-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Mike Marciniszyn 2016-02-04 10:59:36 -08:00 committed by Doug Ledford
parent 3c9d149bdc
commit 08279d5c94
5 changed files with 19 additions and 10 deletions

View File

@ -412,6 +412,7 @@ void stop_send_queue(struct rvt_qp *qp)
struct qib_qp_priv *priv = qp->priv; struct qib_qp_priv *priv = qp->priv;
cancel_work_sync(&priv->s_work); cancel_work_sync(&priv->s_work);
del_timer_sync(&qp->s_timer);
} }
void quiesce_qp(struct rvt_qp *qp) void quiesce_qp(struct rvt_qp *qp)

View File

@ -405,7 +405,6 @@ void rvt_reset_qp(struct rvt_dev_info *rdi, struct rvt_qp *qp,
/* Stop the send queue and the retry timer */ /* Stop the send queue and the retry timer */
rdi->driver_f.stop_send_queue(qp); rdi->driver_f.stop_send_queue(qp);
del_timer_sync(&qp->s_timer);
/* Wait for things to stop */ /* Wait for things to stop */
rdi->driver_f.quiesce_qp(qp); rdi->driver_f.quiesce_qp(qp);

View File

@ -608,6 +608,7 @@ void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp,
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
setup_timer(&priv->s_rnr_timer, hfi1_rc_rnr_retry, (unsigned long)qp); setup_timer(&priv->s_rnr_timer, hfi1_rc_rnr_retry, (unsigned long)qp);
qp->s_timer.function = hfi1_rc_timeout;
return priv; return priv;
} }
@ -647,6 +648,7 @@ unsigned free_all_qps(struct rvt_dev_info *rdi)
void flush_qp_waiters(struct rvt_qp *qp) void flush_qp_waiters(struct rvt_qp *qp)
{ {
flush_iowait(qp); flush_iowait(qp);
hfi1_stop_rc_timers(qp);
} }
void stop_send_queue(struct rvt_qp *qp) void stop_send_queue(struct rvt_qp *qp)
@ -654,6 +656,7 @@ void stop_send_queue(struct rvt_qp *qp)
struct hfi1_qp_priv *priv = qp->priv; struct hfi1_qp_priv *priv = qp->priv;
cancel_work_sync(&priv->s_iowait.iowork); cancel_work_sync(&priv->s_iowait.iowork);
hfi1_del_timers_sync(qp);
} }
void quiesce_qp(struct rvt_qp *qp) void quiesce_qp(struct rvt_qp *qp)

View File

@ -60,8 +60,6 @@
/* cut down ridiculously long IB macro names */ /* cut down ridiculously long IB macro names */
#define OP(x) IB_OPCODE_RC_##x #define OP(x) IB_OPCODE_RC_##x
static void rc_timeout(unsigned long arg);
/** /**
* hfi1_add_retry_timer - add/start a retry timer * hfi1_add_retry_timer - add/start a retry timer
* @qp - the QP * @qp - the QP
@ -71,7 +69,6 @@ static void rc_timeout(unsigned long arg);
static inline void hfi1_add_retry_timer(struct rvt_qp *qp) static inline void hfi1_add_retry_timer(struct rvt_qp *qp)
{ {
qp->s_flags |= RVT_S_TIMER; qp->s_flags |= RVT_S_TIMER;
qp->s_timer.function = rc_timeout;
/* 4.096 usec. * (1 << qp->timeout) */ /* 4.096 usec. * (1 << qp->timeout) */
qp->s_timer.expires = jiffies + qp->timeout_jiffies; qp->s_timer.expires = jiffies + qp->timeout_jiffies;
add_timer(&qp->s_timer); add_timer(&qp->s_timer);
@ -86,10 +83,11 @@ static inline void hfi1_add_retry_timer(struct rvt_qp *qp)
*/ */
static inline void hfi1_add_rnr_timer(struct rvt_qp *qp, u32 to) static inline void hfi1_add_rnr_timer(struct rvt_qp *qp, u32 to)
{ {
struct hfi1_qp_priv *priv = qp->priv;
qp->s_flags |= RVT_S_WAIT_RNR; qp->s_flags |= RVT_S_WAIT_RNR;
qp->s_timer.function = hfi1_rc_rnr_retry;
qp->s_timer.expires = jiffies + usecs_to_jiffies(to); qp->s_timer.expires = jiffies + usecs_to_jiffies(to);
add_timer(&qp->s_timer); add_timer(&priv->s_rnr_timer);
} }
/** /**
@ -102,7 +100,6 @@ static inline void hfi1_add_rnr_timer(struct rvt_qp *qp, u32 to)
static inline void hfi1_mod_retry_timer(struct rvt_qp *qp) static inline void hfi1_mod_retry_timer(struct rvt_qp *qp)
{ {
qp->s_flags |= RVT_S_TIMER; qp->s_flags |= RVT_S_TIMER;
qp->s_timer.function = rc_timeout;
/* 4.096 usec. * (1 << qp->timeout) */ /* 4.096 usec. * (1 << qp->timeout) */
mod_timer(&qp->s_timer, jiffies + qp->timeout_jiffies); mod_timer(&qp->s_timer, jiffies + qp->timeout_jiffies);
} }
@ -132,12 +129,15 @@ static inline int hfi1_stop_retry_timer(struct rvt_qp *qp)
* *
* stop any pending timers * stop any pending timers
*/ */
static inline void hfi1_stop_rc_timers(struct rvt_qp *qp) void hfi1_stop_rc_timers(struct rvt_qp *qp)
{ {
struct hfi1_qp_priv *priv = qp->priv;
/* Remove QP from all timers */ /* Remove QP from all timers */
if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) { if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) {
qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR); qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR);
del_timer(&qp->s_timer); del_timer(&qp->s_timer);
del_timer(&priv->s_rnr_timer);
} }
} }
@ -151,11 +151,12 @@ static inline void hfi1_stop_rc_timers(struct rvt_qp *qp)
static inline int hfi1_stop_rnr_timer(struct rvt_qp *qp) static inline int hfi1_stop_rnr_timer(struct rvt_qp *qp)
{ {
int rval = 0; int rval = 0;
struct hfi1_qp_priv *priv = qp->priv;
/* Remove QP from rnr timer */ /* Remove QP from rnr timer */
if (qp->s_flags & RVT_S_WAIT_RNR) { if (qp->s_flags & RVT_S_WAIT_RNR) {
qp->s_flags &= ~RVT_S_WAIT_RNR; qp->s_flags &= ~RVT_S_WAIT_RNR;
rval = del_timer(&qp->s_timer); rval = del_timer(&priv->s_rnr_timer);
} }
return rval; return rval;
} }
@ -166,7 +167,10 @@ static inline int hfi1_stop_rnr_timer(struct rvt_qp *qp)
*/ */
void hfi1_del_timers_sync(struct rvt_qp *qp) void hfi1_del_timers_sync(struct rvt_qp *qp)
{ {
struct hfi1_qp_priv *priv = qp->priv;
del_timer_sync(&qp->s_timer); del_timer_sync(&qp->s_timer);
del_timer_sync(&priv->s_rnr_timer);
} }
static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe, static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe,
@ -1015,7 +1019,7 @@ static void restart_rc(struct rvt_qp *qp, u32 psn, int wait)
/* /*
* This is called from s_timer for missing responses. * This is called from s_timer for missing responses.
*/ */
static void rc_timeout(unsigned long arg) void hfi1_rc_timeout(unsigned long arg)
{ {
struct rvt_qp *qp = (struct rvt_qp *)arg; struct rvt_qp *qp = (struct rvt_qp *)arg;
struct hfi1_ibport *ibp; struct hfi1_ibport *ibp;

View File

@ -404,7 +404,9 @@ u8 ah_to_sc(struct ib_device *ibdev, struct ib_ah_attr *ah_attr);
struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid); struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid);
void hfi1_rc_rnr_retry(unsigned long arg); void hfi1_rc_rnr_retry(unsigned long arg);
void hfi1_rc_timeout(unsigned long arg);
void hfi1_del_timers_sync(struct rvt_qp *qp); void hfi1_del_timers_sync(struct rvt_qp *qp);
void hfi1_stop_rc_timers(struct rvt_qp *qp);
void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr); void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr);