aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2007-11-27 03:11:04 -0500
committerRoland Dreier <rolandd@cisco.com>2008-01-25 17:15:30 -0500
commit4fc8cd4919428f9b86f0b65e2f3245a1c186737f (patch)
tree07bca41da2be7504e6d17745fb86264e59a4958e
parent547af76521b3fd4b9ec5c9a9975a17eadb95e6f6 (diff)
IB/mad: Report number of times a mad was retried
To allow ULPs to tune timeout values and capture retry statistics, report the number of times that a mad send operation was retried. For RMPP mads, report the total number of times that the any portion (send window) of the send operation was retried. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--drivers/infiniband/core/mad.c9
-rw-r--r--drivers/infiniband/core/mad_priv.h3
-rw-r--r--drivers/infiniband/core/mad_rmpp.c2
-rw-r--r--include/rdma/ib_mad.h4
4 files changed, 13 insertions, 5 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 649335a03312..5eace995836d 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -1100,7 +1100,9 @@ int ib_post_send_mad(struct ib_mad_send_buf *send_buf,
1100 mad_send_wr->tid = ((struct ib_mad_hdr *) send_buf->mad)->tid; 1100 mad_send_wr->tid = ((struct ib_mad_hdr *) send_buf->mad)->tid;
1101 /* Timeout will be updated after send completes */ 1101 /* Timeout will be updated after send completes */
1102 mad_send_wr->timeout = msecs_to_jiffies(send_buf->timeout_ms); 1102 mad_send_wr->timeout = msecs_to_jiffies(send_buf->timeout_ms);
1103 mad_send_wr->retries = send_buf->retries; 1103 mad_send_wr->max_retries = send_buf->retries;
1104 mad_send_wr->retries_left = send_buf->retries;
1105 send_buf->retries = 0;
1104 /* Reference for work request to QP + response */ 1106 /* Reference for work request to QP + response */
1105 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0); 1107 mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0);
1106 mad_send_wr->status = IB_WC_SUCCESS; 1108 mad_send_wr->status = IB_WC_SUCCESS;
@@ -2436,9 +2438,12 @@ static int retry_send(struct ib_mad_send_wr_private *mad_send_wr)
2436{ 2438{
2437 int ret; 2439 int ret;
2438 2440
2439 if (!mad_send_wr->retries--) 2441 if (!mad_send_wr->retries_left)
2440 return -ETIMEDOUT; 2442 return -ETIMEDOUT;
2441 2443
2444 mad_send_wr->retries_left--;
2445 mad_send_wr->send_buf.retries++;
2446
2442 mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_buf.timeout_ms); 2447 mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_buf.timeout_ms);
2443 2448
2444 if (mad_send_wr->mad_agent_priv->agent.rmpp_version) { 2449 if (mad_send_wr->mad_agent_priv->agent.rmpp_version) {
diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h
index 9be5cc00a3a9..8b75010016ec 100644
--- a/drivers/infiniband/core/mad_priv.h
+++ b/drivers/infiniband/core/mad_priv.h
@@ -131,7 +131,8 @@ struct ib_mad_send_wr_private {
131 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG]; 131 struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
132 __be64 tid; 132 __be64 tid;
133 unsigned long timeout; 133 unsigned long timeout;
134 int retries; 134 int max_retries;
135 int retries_left;
135 int retry; 136 int retry;
136 int refcount; 137 int refcount;
137 enum ib_wc_status status; 138 enum ib_wc_status status;
diff --git a/drivers/infiniband/core/mad_rmpp.c b/drivers/infiniband/core/mad_rmpp.c
index d43bc62005b3..a5e2a310f312 100644
--- a/drivers/infiniband/core/mad_rmpp.c
+++ b/drivers/infiniband/core/mad_rmpp.c
@@ -684,7 +684,7 @@ static void process_rmpp_ack(struct ib_mad_agent_private *agent,
684 684
685 if (seg_num > mad_send_wr->last_ack) { 685 if (seg_num > mad_send_wr->last_ack) {
686 adjust_last_ack(mad_send_wr, seg_num); 686 adjust_last_ack(mad_send_wr, seg_num);
687 mad_send_wr->retries = mad_send_wr->send_buf.retries; 687 mad_send_wr->retries_left = mad_send_wr->max_retries;
688 } 688 }
689 mad_send_wr->newwin = newwin; 689 mad_send_wr->newwin = newwin;
690 if (mad_send_wr->last_ack == mad_send_wr->send_buf.seg_count) { 690 if (mad_send_wr->last_ack == mad_send_wr->send_buf.seg_count) {
diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h
index 8ec3799e42e1..7228c056b9e9 100644
--- a/include/rdma/ib_mad.h
+++ b/include/rdma/ib_mad.h
@@ -230,7 +230,9 @@ struct ib_class_port_info
230 * @seg_count: The number of RMPP segments allocated for this send. 230 * @seg_count: The number of RMPP segments allocated for this send.
231 * @seg_size: Size of each RMPP segment. 231 * @seg_size: Size of each RMPP segment.
232 * @timeout_ms: Time to wait for a response. 232 * @timeout_ms: Time to wait for a response.
233 * @retries: Number of times to retry a request for a response. 233 * @retries: Number of times to retry a request for a response. For MADs
234 * using RMPP, this applies per window. On completion, returns the number
235 * of retries needed to complete the transfer.
234 * 236 *
235 * Users are responsible for initializing the MAD buffer itself, with the 237 * Users are responsible for initializing the MAD buffer itself, with the
236 * exception of any RMPP header. Additional segment buffer space allocated 238 * exception of any RMPP header. Additional segment buffer space allocated