RDMA/cm: fix loopback address support
authorSean Hefty <sean.hefty@intel.com>
Thu, 19 Nov 2009 21:26:06 +0000 (13:26 -0800)
committerRoland Dreier <rolandd@cisco.com>
Thu, 19 Nov 2009 21:26:06 +0000 (13:26 -0800)
commit6f8372b69c3198e06cecb1df2cb9682d0c55e657
tree4cd9a39fd782bc973b0394f779572ca72737f55c
parentc4315d85f9b76834289fd503796c01b8311c4b84
RDMA/cm: fix loopback address support

The RDMA CM is intended to support the use of a loopback address
when establishing a connection; however, the behavior of the CM
when loopback addresses are used is confusing and does not always
work, depending on whether loopback was specified by the server,
the client, or both.

The defined behavior of rdma_bind_addr is to associate an RDMA
device with an rdma_cm_id, as long as the user specified a non-
zero address.  (ie they weren't just trying to reserve a port)
Currently, if the loopback address is passed to rdam_bind_addr,
no device is associated with the rdma_cm_id.  Fix this.

If a loopback address is specified by the client as the destination
address for a connection, it will fail to establish a connection.
This is true even if the server is listing across all addresses or
on the loopback address itself.  The issue is that the server tries
to translate the IP address carried in the REQ message to a local
net_device address, which fails.  The translation is not needed in
this case, since the REQ carries the actual HW address that should
be used.

Finally, cleanup loopback support to be more transport neutral.
Replace separate calls to get/set the sgid and dgid from the
device address to a single call that behaves correctly depending
on the format of the device address.  And support both IPv4 and
IPv6 address formats.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
[ Fixed RDS build by s/ib_addr_get/rdma_addr_get/  - Roland ]

Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/cma.c
drivers/infiniband/core/ucma.c
include/rdma/ib_addr.h
net/rds/ib.c
net/rds/iw.c