Re: [PATCH v2 06/11] IB/cm, cma: Move RDMA IP CM private-data parsing code from ib_cma to ib_cm

ira.weiny
2015-04-20T23:29:05Z

On Mon, Apr 20, 2015 at 12:03:37PM +0300, Haggai Eran wrote:
> From: Guy Shapiro <guysh-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> When receiving a connection request, ib_cm needs to associate the request with
> a network namespace. To do this, it needs to know the request's destination
> IP. For this the RDMA IP CM packet formatting functionality needs to be
> exposed to ib_cm.
>

[snip]

> +
> +int cm_save_net_info(struct sockaddr *src_addr,
> + struct sockaddr *dst_addr,
> + struct ib_cm_event *ib_event)
> +{
> + struct cm_work *work = container_of(ib_event, struct cm_work, cm_event);
> +
> + if ((rdma_port_get_link_layer(work->port->cm_dev->ib_device,
> + work->port->port_num) ==
> + IB_LINK_LAYER_INFINIBAND) &&
> + (ib_event->event == IB_CM_REQ_RECEIVED)) {

The original code in the RDMA CM had a check for AF_IB. Isn't that needed here
as well?

Ira

> + cm_save_ib_info(src_addr, dst_addr,
> + ib_event->param.req_rcvd.primary_path);
> + return 0;
> + }
> +
> + return cm_save_ip_info(src_addr, dst_addr, work);
> +}
> +EXPORT_SYMBOL(cm_save_net_info);
> +
> struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
> ib_cm_handler cm_handler,
> void *context)