[openib-general] Re: [PATCH][RFC] CMA automatic port number assignment
Sean Hefty
mshefty at ichips.intel.com
Fri Feb 24 11:26:17 PST 2006
James Lentini wrote:
> +static u16 cma_generate_ephemeral_port(void)
> +{
> + u16 port;
> +
> + get_random_bytes(&port, sizeof port);
> + return cpu_to_be16(port | 1024U);
> +}
As you mentioned, we should verify that the port number is not in use.
> static void cma_format_hdr(void *hdr, enum rdma_port_space ps,
> struct rdma_route *route)
> {
> @@ -1371,6 +1379,9 @@ static void cma_format_hdr(void *hdr, en
> src4 = (struct sockaddr_in *) &route->addr.src_addr;
> dst4 = (struct sockaddr_in *) &route->addr.dst_addr;
>
> + if (!src4->sin_port)
> + src4->sin_port = cma_generate_ephemeral_port();
This only sets the port number in the header. It would make more sense to save
the port number in the rdma_cm_id's src_addr.
- Sean
More information about the general
mailing list