[openib-general] Re: [PATCH] CMA: allow/require bind before connect

Michael S. Tsirkin mst at mellanox.co.il
Wed Mar 29 00:01:17 PST 2006


Quoting r. Sean Hefty <mshefty at ichips.intel.com>:
> >>>Tom, I have a connection bind on a local port to control which local port
> >>>to use when connecting to a remove peer.
> 
> Couldn't you specify the local port when calling rdma_resolve_addr()?

I'm fine with not requiring bind before connect.
However, CMA must *allow* bind before connect and it does not currently.

        struct rdma_id_private *id_priv;
        enum cma_state expected_state;
        int ret;

        id_priv = container_of(id, struct rdma_id_private, id);
        if (id_priv->cma_dev) {
                expected_state = CMA_ADDR_BOUND;
                src_addr = &id->route.addr.src_addr;
        } else
                expected_state = CMA_IDLE;

        if (!cma_comp_exch(id_priv, expected_state, CMA_ADDR_QUERY))
                return -EINVAL;

So if I bind to a local port with ANY or loopback IP address,
connect fails with -EINVAL. Could you fix this please?

> TCP doesn't require calling bind before connect, so I'd like to avoid
> requiring that here.

Small correction: TCP always binds before connect - it does autobind for you if
you don't.

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies



More information about the general mailing list