summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Marciniszyn <mike.marciniszyn@intel.com>2016-02-04 10:59:36 -0800
committerDoug Ledford <dledford@redhat.com>2016-03-10 20:38:03 -0500
commit08279d5c9424afd710c90d0b6df95612d2bb5a3f (patch)
tree6c92f773d77a6570e395cb47b5f98ddbae506f2d
parent3c9d149bdc797a7dfb48bcf327f9ceeb6060a512 (diff)
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>
-rw-r--r--drivers/infiniband/hw/qib/qib_qp.c1
-rw-r--r--drivers/infiniband/sw/rdmavt/qp.c1
-rw-r--r--drivers/staging/rdma/hfi1/qp.c3
-rw-r--r--drivers/staging/rdma/hfi1/rc.c22
-rw-r--r--drivers/staging/rdma/hfi1/verbs.h2
5 files changed, 19 insertions, 10 deletions
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c
index 45bed5f2bba4..787116f59395 100644
--- a/drivers/infiniband/hw/qib/qib_qp.c
+++ b/drivers/infiniband/hw/qib/qib_qp.c
@@ -412,6 +412,7 @@ void stop_send_queue(struct rvt_qp *qp)
struct qib_qp_priv *priv = qp->priv;
cancel_work_sync(&priv->s_work);
+ del_timer_sync(&qp->s_timer);
}
void quiesce_qp(struct rvt_qp *qp)
diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 322de64164f7..439213c37537 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -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 */
rdi->driver_f.stop_send_queue(qp);
- del_timer_sync(&qp->s_timer);
/* Wait for things to stop */
rdi->driver_f.quiesce_qp(qp);
diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index a5f0e2e41eb1..b96d5ee397de 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -608,6 +608,7 @@ void *qp_priv_alloc(struct rvt_dev_info *rdi, struct rvt_qp *qp,
return ERR_PTR(-ENOMEM);
}
setup_timer(&priv->s_rnr_timer, hfi1_rc_rnr_retry, (unsigned long)qp);
+ qp->s_timer.function = hfi1_rc_timeout;
return priv;
}
@@ -647,6 +648,7 @@ unsigned free_all_qps(struct rvt_dev_info *rdi)
void flush_qp_waiters(struct rvt_qp *qp)
{
flush_iowait(qp);
+ hfi1_stop_rc_timers(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;
cancel_work_sync(&priv->s_iowait.iowork);
+ hfi1_del_timers_sync(qp);
}
void quiesce_qp(struct rvt_qp *qp)
diff --git a/drivers/staging/rdma/hfi1/rc.c b/drivers/staging/rdma/hfi1/rc.c
index 1ff19aa41ef4..2c46491746bb 100644
--- a/drivers/staging/rdma/hfi1/rc.c
+++ b/drivers/staging/rdma/hfi1/rc.c
@@ -60,8 +60,6 @@
/* cut down ridiculously long IB macro names */
#define OP(x) IB_OPCODE_RC_##x
-static void rc_timeout(unsigned long arg);
-
/**
* hfi1_add_retry_timer - add/start a retry timer
* @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)
{
qp->s_flags |= RVT_S_TIMER;
- qp->s_timer.function = rc_timeout;
/* 4.096 usec. * (1 << qp->timeout) */
qp->s_timer.expires = jiffies + qp->timeout_jiffies;
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)
{
+ struct hfi1_qp_priv *priv = qp->priv;
+
qp->s_flags |= RVT_S_WAIT_RNR;
- qp->s_timer.function = hfi1_rc_rnr_retry;
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)
{
qp->s_flags |= RVT_S_TIMER;
- qp->s_timer.function = rc_timeout;
/* 4.096 usec. * (1 << qp->timeout) */
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
*/
-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 */
if (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(&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)
{
int rval = 0;
+ struct hfi1_qp_priv *priv = qp->priv;
/* Remove QP from rnr timer */
if (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;
}
@@ -166,7 +167,10 @@ static inline int hfi1_stop_rnr_timer(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(&priv->s_rnr_timer);
}
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.
*/
-static void rc_timeout(unsigned long arg)
+void hfi1_rc_timeout(unsigned long arg)
{
struct rvt_qp *qp = (struct rvt_qp *)arg;
struct hfi1_ibport *ibp;
diff --git a/drivers/staging/rdma/hfi1/verbs.h b/drivers/staging/rdma/hfi1/verbs.h
index 6294fa81c20b..26eda8a3e55e 100644
--- a/drivers/staging/rdma/hfi1/verbs.h
+++ b/drivers/staging/rdma/hfi1/verbs.h
@@ -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);
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_stop_rc_timers(struct rvt_qp *qp);
void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr);