Skip to content

Commit 4fc8cd4

Browse files
Sean HeftyRoland Dreier
authored andcommitted
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 547af76 commit 4fc8cd4

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

drivers/infiniband/core/mad.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,9 @@ int ib_post_send_mad(struct ib_mad_send_buf *send_buf,
11001100
mad_send_wr->tid = ((struct ib_mad_hdr *) send_buf->mad)->tid;
11011101
/* Timeout will be updated after send completes */
11021102
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;
11041106
/* Reference for work request to QP + response */
11051107
mad_send_wr->refcount = 1 + (mad_send_wr->timeout > 0);
11061108
mad_send_wr->status = IB_WC_SUCCESS;
@@ -2436,9 +2438,12 @@ static int retry_send(struct ib_mad_send_wr_private *mad_send_wr)
24362438
{
24372439
int ret;
24382440

2439-
if (!mad_send_wr->retries--)
2441+
if (!mad_send_wr->retries_left)
24402442
return -ETIMEDOUT;
24412443

2444+
mad_send_wr->retries_left--;
2445+
mad_send_wr->send_buf.retries++;
2446+
24422447
mad_send_wr->timeout = msecs_to_jiffies(mad_send_wr->send_buf.timeout_ms);
24432448

24442449
if (mad_send_wr->mad_agent_priv->agent.rmpp_version) {

drivers/infiniband/core/mad_priv.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ struct ib_mad_send_wr_private {
131131
struct ib_sge sg_list[IB_MAD_SEND_REQ_MAX_SG];
132132
__be64 tid;
133133
unsigned long timeout;
134-
int retries;
134+
int max_retries;
135+
int retries_left;
135136
int retry;
136137
int refcount;
137138
enum ib_wc_status status;

drivers/infiniband/core/mad_rmpp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ static void process_rmpp_ack(struct ib_mad_agent_private *agent,
684684

685685
if (seg_num > mad_send_wr->last_ack) {
686686
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;
688688
}
689689
mad_send_wr->newwin = newwin;
690690
if (mad_send_wr->last_ack == mad_send_wr->send_buf.seg_count) {

include/rdma/ib_mad.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ struct ib_class_port_info
230230
* @seg_count: The number of RMPP segments allocated for this send.
231231
* @seg_size: Size of each RMPP segment.
232232
* @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.
234236
*
235237
* Users are responsible for initializing the MAD buffer itself, with the
236238
* exception of any RMPP header. Additional segment buffer space allocated

0 commit comments

Comments
 (0)