public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs
@ 2012-04-23 15:20 Or Gerlitz
       [not found] ` <1335194413-27436-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2012-04-23 15:20 UTC (permalink / raw)
  To: roland-DgEjT+Ai2ygdnm+yROfE0A
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Or Gerlitz, Swapna Thete,
	Jack Morgenstein

From: Jack Morgenstein <jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

Commit 0b307043049f34211affdde46f82e7abbe8c4590 "IB/mad: Return 
error response for unsupported MADs" introduced two problems:

1. If the "unsupported" MAD is a Directed-route get/set, it fails
   to set the "D" bit in the response MAD status field. This is
   a problem for SM_INFO MADs when the receiver does not have
   an SM running.

2. It sends out automatic error responses for failed get/set MADs
   (e.g., for MADs which return IB_MAD_RETURN_FAILURE).
   These MADs should be silently discarded. (We should not force
   the lower-layer drivers to return SUCCESS | CONSUMED in this
   case, since the MAD is NOT successful).
   Note that unsupported MADs are not failures -- they return
   SUCCESS, but with an "unsupported error" status value inside
   the response MAD.

This patch fixes these two problems.

CC: Swapna Thete <swapna.thete-h88ZbnxC6KDQT0dZR+AlfA@public.gmane.org>
Found-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Reviewed-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Signed-off-by: Jack Morgenstein <jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
 drivers/infiniband/core/mad.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 426bb76..d4b1ba7 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -1854,6 +1854,8 @@ static bool generate_unmatched_resp(struct ib_mad_private *recv,
 		response->mad.mad.mad_hdr.method = IB_MGMT_METHOD_GET_RESP;
 		response->mad.mad.mad_hdr.status =
 			cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB);
+		if (recv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
+			response->mad.mad.mad_hdr.status |= IB_SMP_DIRECTION;
 
 		return true;
 	} else {
@@ -1869,6 +1871,7 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
 	struct ib_mad_list_head *mad_list;
 	struct ib_mad_agent_private *mad_agent;
 	int port_num;
+	int ret = IB_MAD_RESULT_SUCCESS;
 
 	mad_list = (struct ib_mad_list_head *)(unsigned long)wc->wr_id;
 	qp_info = mad_list->mad_queue->qp_info;
@@ -1952,7 +1955,6 @@ static void ib_mad_recv_done_handler(struct ib_mad_port_private *port_priv,
 local:
 	/* Give driver "right of first refusal" on incoming MAD */
 	if (port_priv->device->process_mad) {
-		int ret;
 
 		ret = port_priv->device->process_mad(port_priv->device, 0,
 						     port_priv->port_num,
@@ -1981,7 +1983,8 @@ local:
 		 * or via recv_handler in ib_mad_complete_recv()
 		 */
 		recv = NULL;
-	} else if (generate_unmatched_resp(recv, response)) {
+	} else if ((ret & IB_MAD_RESULT_SUCCESS) &&
+		   generate_unmatched_resp(recv, response)) {
 		agent_send_response(&response->mad.mad, &recv->grh, wc,
 				    port_priv->device, port_num, qp_info->qp->qp_num);
 	}
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs
       [not found] ` <1335194413-27436-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2012-04-24 23:13   ` Roland Dreier
       [not found]     ` <CAL1RGDWSAt_+QJnR2zVYoM6w53Z4reN6nppg=LcaTxC5O_=wxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2012-04-24 23:13 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Swapna Thete, Jack Morgenstein

> Commit 0b307043049f34211affdde46f82e7abbe8c4590 "IB/mad: Return
> error response for unsupported MADs" introduced two problems:

Thanks, applied as two patches, since AFAICT the two fixes are
not tied to each other.

 - R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs
       [not found]     ` <CAL1RGDWSAt_+QJnR2zVYoM6w53Z4reN6nppg=LcaTxC5O_=wxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-04-29  5:40       ` Or Gerlitz
       [not found]         ` <4F9CD43A.4010201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Or Gerlitz @ 2012-04-29  5:40 UTC (permalink / raw)
  To: Roland Dreier
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Swapna Thete, Jack Morgenstein

On 4/25/2012 2:13 AM, Roland Dreier wrote:
> Thanks, applied as two patches, since AFAICT the two fixes are not 
> tied to each other.

yep, makes sense, so what's in CT - is it "consider that"?

Or.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs
       [not found]         ` <4F9CD43A.4010201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2012-04-30 20:46           ` Roland Dreier
       [not found]             ` <CAL1RGDUdq8zm5CRYQhX5Up0Xeic36bxuyXVOQVGmm7=cC7+S1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Roland Dreier @ 2012-04-30 20:46 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Swapna Thete, Jack Morgenstein

On Sat, Apr 28, 2012 at 10:40 PM, Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> wrote:
> yep, makes sense, so what's in CT - is it "consider that"?

I'm tempted to send a lmgtfy.com link, but afaict == as far as I can tell.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs
       [not found]             ` <CAL1RGDUdq8zm5CRYQhX5Up0Xeic36bxuyXVOQVGmm7=cC7+S1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-05-01 18:47               ` Or Gerlitz
  0 siblings, 0 replies; 5+ messages in thread
From: Or Gerlitz @ 2012-05-01 18:47 UTC (permalink / raw)
  To: Roland Dreier; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Mon, Apr 30, 2012 at 11:46 PM, Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> I'm tempted to send a lmgtfy.com link, but afaict == as far as I can tell.

Oh, sure, will go there next time... thanks for the quick response on
the uverbs lockdep thing, any chance you'll be able to look soon on
the batch of patches I sent Sunday?

Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-01 18:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-23 15:20 [PATCH fixes] IB/core: fix generation of unmatched responses for unhandled MADs Or Gerlitz
     [not found] ` <1335194413-27436-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-24 23:13   ` Roland Dreier
     [not found]     ` <CAL1RGDWSAt_+QJnR2zVYoM6w53Z4reN6nppg=LcaTxC5O_=wxg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-29  5:40       ` Or Gerlitz
     [not found]         ` <4F9CD43A.4010201-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-30 20:46           ` Roland Dreier
     [not found]             ` <CAL1RGDUdq8zm5CRYQhX5Up0Xeic36bxuyXVOQVGmm7=cC7+S1w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-01 18:47               ` Or Gerlitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox