Discussion:
rdma_cm UD sendto without connect
Kelly Burkhart
2011-11-03 15:20:08 UTC
Permalink
Is it possible to send/recv datagrams with no previous connection
similar to UDP sendto/recvfrom? UD examples I've seen are connection
oriented and listen/connect/accept, establishing a connection prior to
conversing.
It appears that in order to do what I want, I need an ibv_ah to put in
the send wr. But how do I create one of these from an IP address/port
without doing an rdma_connect and waiting for
RDMA_CM_EVENT_ESTABLISHED?
From the receiving side, it looks like I can construct an ah from the
wc. Is that a low-cost operation?
Thanks,
-Kelly
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hefty, Sean
2011-11-03 15:44:23 UTC
Permalink
Post by Kelly Burkhart
Is it possible to send/recv datagrams with no previous connection
similar to UDP sendto/recvfrom? UD examples I've seen are connection
oriented and listen/connect/accept, establishing a connection prior to
conversing.
To send a datagram, you need the QP number, qkey, and addressing information of the remote side. The UD examples that use listen/connect are still connectionless, but require the use of those calls mainly to resolve the remote QP number.
We may be able to add a sendto operation to the rdma_cm, but it would need to resolve the QPN and ibv_ah under the API for the first send to each destination.
Post by Kelly Burkhart
It appears that in order to do what I want, I need an ibv_ah to put in
the send wr. But how do I create one of these from an IP address/port
without doing an rdma_connect and waiting for
RDMA_CM_EVENT_ESTABLISHED?
You still need to convert the IP address into an RDMA address (i.e. LID) and discover the QPN.
Post by Kelly Burkhart
From the receiving side, it looks like I can construct an ah from the
wc. Is that a low-cost operation?
This probably depends on the implementation, but in general I wouldn't consider it a fast path operation. Someone from Mellanox should know the real cost.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Kelly Burkhart
2011-11-03 19:41:26 UTC
Permalink
Post by Kelly Burkhart
Is it possible to send/recv datagrams with no previous connection
similar to UDP sendto/recvfrom? =A0UD examples I've seen are connect=
ion
Post by Kelly Burkhart
oriented and listen/connect/accept, establishing a connection prior =
to
Post by Kelly Burkhart
conversing.
To send a datagram, you need the QP number, qkey, and addressing info=
rmation of the remote side. =A0The UD examples that use listen/connect =
are still connectionless, but require the use of those calls mainly to =
resolve the remote QP number.
We may be able to add a sendto operation to the rdma_cm, but it would=
need to resolve the QPN and ibv_ah under the API for the first send to=
each destination.
Post by Kelly Burkhart
It appears that in order to do what I want, I need an ibv_ah to put =
in
Post by Kelly Burkhart
the send wr. =A0But how do I create one of these from an IP address/=
port
Post by Kelly Burkhart
without doing an rdma_connect and waiting for
RDMA_CM_EVENT_ESTABLISHED?
You still need to convert the IP address into an RDMA address (i.e. L=
ID) and discover the QPN.
Are there calls in rdma_cm that allow me to do this? For the life of
me I can't figure out how, for instance, I would write an app that has
a single QP that recieves UD datagrams from anyone. How do potential
clients find the QP number, qkey and ah without using listen/accept
which will create a brand new QP every time?
-K
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" i=
n
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hefty, Sean
2011-11-03 21:05:53 UTC
Permalink
Post by Kelly Burkhart
Are there calls in rdma_cm that allow me to do this? For the life of
me I can't figure out how, for instance, I would write an app that has
a single QP that recieves UD datagrams from anyone. How do potential
clients find the QP number, qkey and ah without using listen/accept
which will create a brand new QP every time?
Yeah, the UD sample was based on an RC sample and isn't all that instructive... When you call rdma_accept(), you can specify the qp_num as part of the conn_param. So, once you call rdma_create_qp(), you can just reference that QPN for other lookup requests. The code could look something like this in the thread that listens:
/* create QP */
rdma_create_id(&qp_id)
rdma_bind_addr()
rdma_create_qp()
/* listen for QPN lookup */
rdma_getaddrinfo(... use RAI_PASSIVE flag)
rdma_create_ep(&listen_id) /* or rdma_create_id + rdma_bind_addr */
rdma_listen()
/* get lookup requests, reply, then discard */
conn_param.qp_num = qp_id->qp->qp_num;
while (1) {
rdma_get_request(listen_id, new_id)
rdma_accept(new_id)
rdma_destroy_id(new_id)
}
If you use async operation, it requires a little more work to retrieve the events from the kernel, but this is the basic idea. You can also create the QP on the first request that you receive, as long as you don't destroy that id until you're done with the QP. I think you can even call rdma_create_qp() on the listen_id as long as it's been bound to a device first.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-***@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
3 Replies
3 Views
Permalink to this page
Disable enhanced parsing
Thread Navigation
Kelly Burkhart2011-11-03 15:20:08 UTC