From patchwork Tue Oct 26 18:33:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Heinz X-Patchwork-Id: 283242 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9QIXkno016038 for ; Tue, 26 Oct 2010 18:33:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759945Ab0JZSdp (ORCPT ); Tue, 26 Oct 2010 14:33:45 -0400 Received: from avexcashub1.qlogic.com ([198.70.193.61]:54000 "EHLO avexcashub1.qlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759944Ab0JZSdp convert rfc822-to-8bit (ORCPT ); Tue, 26 Oct 2010 14:33:45 -0400 Received: from MNEXCASHUB2.qlogic.org (10.33.2.104) by avexcashub1.qlogic.org (10.1.4.161) with Microsoft SMTP Server (TLS) id 8.1.436.0; Tue, 26 Oct 2010 11:33:44 -0700 Received: from MNEXMB1.qlogic.org ([fe80::8516:7839:9549:6996]) by MNEXCASHUB2.qlogic.org ([::1]) with mapi; Tue, 26 Oct 2010 13:33:43 -0500 From: Mike Heinz To: "linux-rdma@vger.kernel.org" Date: Tue, 26 Oct 2010 13:33:43 -0500 Subject: [PATCH] Handling BUSY responses from the SM. Thread-Topic: [PATCH] Handling BUSY responses from the SM. Thread-Index: ActpaRIX1vZqjDHaQ6W5q0nxH1feTgL0zDqA Message-ID: <4C2744E8AD2982428C5BFE523DF8CDCB49D4675DED@MNEXMB1.qlogic.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 26 Oct 2010 18:33:46 +0000 (UTC) diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 3b03f1c..9e5e566 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -60,6 +60,10 @@ MODULE_PARM_DESC(send_queue_size, "Size of send queue in number of work requests module_param_named(recv_queue_size, mad_recvq_size, int, 0444); MODULE_PARM_DESC(recv_queue_size, "Size of receive queue in number of work requests"); +int mad_wait_on_busy = 0; +module_param_named(treat_busy_as_timeout, mad_wait_on_busy, int, 0444); +MODULE_PARM_DESC(treat_busy_as_timeout, "When true, treat BUSY responses as if they were timeouts."); + int mad_randomized_wait = 0; module_param_named(randomized_wait, mad_randomized_wait, int, 0444); MODULE_PARM_DESC(randomized_wait, "When true, use a randomized backoff algorithm to control retries for timeouts."); @@ -1120,6 +1124,7 @@ int ib_post_send_mad(struct ib_mad_send_buf *send_buf, mad_send_wr->max_retries = send_buf->retries; mad_send_wr->retries_left = send_buf->retries; + mad_send_wr->wait_on_busy = send_buf->wait_on_busy || mad_wait_on_busy; send_buf->retries = 0; @@ -1819,6 +1824,8 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, /* Complete corresponding request */ if (ib_response_mad(mad_recv_wc->recv_buf.mad)) { + u16 busy = __be16_to_cpu(mad_recv_wc->recv_buf.mad->mad_hdr.status) & + IB_MGMT_MAD_STATUS_BUSY; spin_lock_irqsave(&mad_agent_priv->lock, flags); mad_send_wr = ib_find_send_mad(mad_agent_priv, mad_recv_wc); @@ -1829,6 +1836,17 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, return; } + printk(KERN_DEBUG PFX "Completing recv %p: busy = %d, retries_left = %d, wait_on_busy = %d\n", + mad_send_wr, busy, mad_send_wr->retries_left, mad_send_wr->wait_on_busy); + if (busy && mad_send_wr->retries_left && mad_send_wr->wait_on_busy) { + /* Just let the query timeout and have it requeued later */ + spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + ib_free_recv_mad(mad_recv_wc); + deref_mad_agent(mad_agent_priv); + printk(KERN_INFO PFX "SA/SM responded MAD_STATUS_BUSY. Allowing request to time out.\n"); + return; + } + ib_mark_mad_done(mad_send_wr); spin_unlock_irqrestore(&mad_agent_priv->lock, flags); diff --git a/drivers/infiniband/core/mad_priv.h b/drivers/infiniband/core/mad_priv.h index 01fb7ed..1d0629e 100644 --- a/drivers/infiniband/core/mad_priv.h +++ b/drivers/infiniband/core/mad_priv.h @@ -135,6 +135,7 @@ struct ib_mad_send_wr_private { unsigned long total_timeout; int max_retries; int retries_left; + int wait_on_busy; int randomized_wait; int retry; int refcount; diff --git a/include/rdma/ib_mad.h b/include/rdma/ib_mad.h index c3d6efb..3da55c3 100644 --- a/include/rdma/ib_mad.h +++ b/include/rdma/ib_mad.h @@ -255,6 +255,7 @@ struct ib_mad_send_buf { int seg_count; int seg_size; int timeout_ms; + int wait_on_busy; int randomized_wait; int retries; };