@@ -954,7 +954,7 @@ int ib_post_send_mad(struct ib_mad_agent *mad_agent,
954954 /* Timeout will be updated after send completes */
955955 mad_send_wr -> timeout = msecs_to_jiffies (send_wr -> wr .
956956 ud .timeout_ms );
957- mad_send_wr -> retry = 0 ;
957+ mad_send_wr -> retries = mad_send_wr -> send_wr . wr . ud . retries ;
958958 /* One reference for each work request to QP + response */
959959 mad_send_wr -> refcount = 1 + (mad_send_wr -> timeout > 0 );
960960 mad_send_wr -> status = IB_WC_SUCCESS ;
@@ -2174,6 +2174,27 @@ static void local_completions(void *data)
21742174 spin_unlock_irqrestore (& mad_agent_priv -> lock , flags );
21752175}
21762176
2177+ static int retry_send (struct ib_mad_send_wr_private * mad_send_wr )
2178+ {
2179+ int ret ;
2180+
2181+ if (!mad_send_wr -> retries -- )
2182+ return - ETIMEDOUT ;
2183+
2184+ mad_send_wr -> timeout = msecs_to_jiffies (mad_send_wr -> send_wr .
2185+ wr .ud .timeout_ms );
2186+
2187+ ret = ib_send_mad (mad_send_wr );
2188+
2189+ if (!ret ) {
2190+ mad_send_wr -> refcount ++ ;
2191+ list_del (& mad_send_wr -> agent_list );
2192+ list_add_tail (& mad_send_wr -> agent_list ,
2193+ & mad_send_wr -> mad_agent_priv -> send_list );
2194+ }
2195+ return ret ;
2196+ }
2197+
21772198static void timeout_sends (void * data )
21782199{
21792200 struct ib_mad_agent_private * mad_agent_priv ;
@@ -2202,6 +2223,9 @@ static void timeout_sends(void *data)
22022223 break ;
22032224 }
22042225
2226+ if (!retry_send (mad_send_wr ))
2227+ continue ;
2228+
22052229 list_del (& mad_send_wr -> agent_list );
22062230 spin_unlock_irqrestore (& mad_agent_priv -> lock , flags );
22072231
0 commit comments