public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][RESEND] IB/cma: Resolve AF_IB UD support
@ 2015-05-19  7:11 Matthew Finlay
       [not found] ` <1432019508-95824-1-git-send-email-matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Finlay @ 2015-05-19  7:11 UTC (permalink / raw)
  To: Doug Ledford, Sean Hefty
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Hari Shankar, Matt Finlay

Resent due to mailer issues

Support for using UD and AF_IB is currently broken.  The IB_CM_SIDR_REQ_RECEIVED
message is not handled properly in cma_save_net_info() and we end up falling
into code that will try and process the request as ipv4/ipv6, which will end
up failing.

The resolution is to add a check for the SIDR_REQ and call cma_save_ib_info()
with a NULL path record.  Change cma_save_ib_info() to copy the src sib info 
from the listen_id when the path record is NULL.

Reported-by: Hari Shankar <Hari.Shankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Matt Finlay <matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
drivers/infiniband/core/cma.c | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 06441a4..38ffe09 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -845,18 +845,26 @@ static void cma_save_ib_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id
 	listen_ib = (struct sockaddr_ib *) &listen_id->route.addr.src_addr;
 	ib = (struct sockaddr_ib *) &id->route.addr.src_addr;
 	ib->sib_family = listen_ib->sib_family;
-	ib->sib_pkey = path->pkey;
-	ib->sib_flowinfo = path->flow_label;
-	memcpy(&ib->sib_addr, &path->sgid, 16);
+	if (path) {
+		ib->sib_pkey = path->pkey;
+		ib->sib_flowinfo = path->flow_label;
+		memcpy(&ib->sib_addr, &path->sgid, 16);
+	} else {
+		ib->sib_pkey = listen_ib->sib_pkey;
+		ib->sib_flowinfo = listen_ib->sib_flowinfo;
+		ib->sib_addr = listen_ib->sib_addr;
+	}
 	ib->sib_sid = listen_ib->sib_sid;
 	ib->sib_sid_mask = cpu_to_be64(0xffffffffffffffffULL);
 	ib->sib_scope_id = listen_ib->sib_scope_id;
 
-	ib = (struct sockaddr_ib *) &id->route.addr.dst_addr;
-	ib->sib_family = listen_ib->sib_family;
-	ib->sib_pkey = path->pkey;
-	ib->sib_flowinfo = path->flow_label;
-	memcpy(&ib->sib_addr, &path->dgid, 16);
+	if (path) {
+		ib = (struct sockaddr_ib *) &id->route.addr.dst_addr;
+		ib->sib_family = listen_ib->sib_family;
+		ib->sib_pkey = path->pkey;
+		ib->sib_flowinfo = path->flow_label;
+		memcpy(&ib->sib_addr, &path->dgid, 16);
+	}
 }
 
 static __be16 ss_get_port(const struct sockaddr_storage *ss)
@@ -905,9 +913,11 @@ static int cma_save_net_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id
 {
 	struct cma_hdr *hdr;
 
-	if ((listen_id->route.addr.src_addr.ss_family == AF_IB) &&
-	    (ib_event->event == IB_CM_REQ_RECEIVED)) {
-		cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path);
+	if (listen_id->route.addr.src_addr.ss_family == AF_IB) {
+		if (ib_event->event == IB_CM_REQ_RECEIVED)
+			cma_save_ib_info(id, listen_id, ib_event->param.req_rcvd.primary_path);
+		else if (ib_event->event == IB_CM_SIDR_REQ_RECEIVED)
+			cma_save_ib_info(id, listen_id, NULL);
 		return 0;
 	}
 
--
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] 4+ messages in thread

* RE: [PATCH][RESEND] IB/cma: Resolve AF_IB UD support
       [not found] ` <1432019508-95824-1-git-send-email-matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-05-19 17:06   ` Hefty, Sean
       [not found]     ` <1828884A29C6694DAF28B7E6B8A82373A8FDCFC6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Hefty, Sean @ 2015-05-19 17:06 UTC (permalink / raw)
  To: Matthew Finlay, Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Hari Shankar

> Resent due to mailer issues

Next time, please put this comment under the '---', so that it doesn't end up in the patch description.

> Support for using UD and AF_IB is currently broken.  The
> IB_CM_SIDR_REQ_RECEIVED
> message is not handled properly in cma_save_net_info() and we end up
> falling
> into code that will try and process the request as ipv4/ipv6, which will
> end
> up failing.
> 
> The resolution is to add a check for the SIDR_REQ and call
> cma_save_ib_info()
> with a NULL path record.  Change cma_save_ib_info() to copy the src sib
> info
> from the listen_id when the path record is NULL.
> 
> Reported-by: Hari Shankar <Hari.Shankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Matt Finlay <matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Acked-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
--
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] 4+ messages in thread

* Re: [PATCH][RESEND] IB/cma: Resolve AF_IB UD support
       [not found]     ` <1828884A29C6694DAF28B7E6B8A82373A8FDCFC6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2015-05-19 18:23       ` Or Gerlitz
       [not found]         ` <CAJ3xEMifqWM1fgS1yKVqgvOnmRhFFSRvhpP_OFVRDOokUdsxDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Or Gerlitz @ 2015-05-19 18:23 UTC (permalink / raw)
  To: Hefty, Sean, Doug Ledford
  Cc: Matthew Finlay,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, May 19, 2015 at 8:06 PM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>> Resent due to mailer issues
>
> Next time, please put this comment under the '---', so that it doesn't end up in the patch description.

As long as Doug is OK to remove this manually before applying the
patch... Doug? if not, Matt, please re-send again.
--
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] 4+ messages in thread

* Re: [PATCH][RESEND] IB/cma: Resolve AF_IB UD support
       [not found]         ` <CAJ3xEMifqWM1fgS1yKVqgvOnmRhFFSRvhpP_OFVRDOokUdsxDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-05-19 18:29           ` Doug Ledford
  0 siblings, 0 replies; 4+ messages in thread
From: Doug Ledford @ 2015-05-19 18:29 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: Hefty, Sean, Matthew Finlay,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

[-- Attachment #1: Type: text/plain, Size: 745 bytes --]

On Tue, 2015-05-19 at 21:23 +0300, Or Gerlitz wrote:
> On Tue, May 19, 2015 at 8:06 PM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
> >> Resent due to mailer issues
> >
> > Next time, please put this comment under the '---', so that it doesn't end up in the patch description.
> 
> As long as Doug is OK to remove this manually before applying the
> patch... Doug? if not, Matt, please re-send again.

No, I don't need a resend for something little like that.  It takes more
time to grab the new patch and then copy over Sean's Acked-by: than it
does to remove that line from the commit message.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2015-05-19 18:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-19  7:11 [PATCH][RESEND] IB/cma: Resolve AF_IB UD support Matthew Finlay
     [not found] ` <1432019508-95824-1-git-send-email-matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-05-19 17:06   ` Hefty, Sean
     [not found]     ` <1828884A29C6694DAF28B7E6B8A82373A8FDCFC6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2015-05-19 18:23       ` Or Gerlitz
     [not found]         ` <CAJ3xEMifqWM1fgS1yKVqgvOnmRhFFSRvhpP_OFVRDOokUdsxDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-19 18:29           ` Doug Ledford

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