RDMA/core: Introduce and use rdma_set_src_addr() between IPv4 and IPv6
authorParav Pandit <parav@mellanox.com>
Wed, 5 Sep 2018 09:54:19 +0000 (12:54 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 12 Sep 2018 21:48:08 +0000 (15:48 -0600)
commita362ea1d9e1acf674094614518f4245d17cfc01e
tree6028e9f072db863e6e8733092c2977d3c61e0f4e
parent89c5691cdd95ab39f43bd102ec3f0ff39716ae85
RDMA/core: Introduce and use rdma_set_src_addr() between IPv4 and IPv6

rdma_translate_ip() is done while resolving address for the loopback
addresses. The current flow is convoluted with resolve neighbor being
optional.

This patch simplifies the code in following ways.

(a) Use common code between IPv4 and IPv6 for address translation,
    loopback checks and acquiring netdevice.
(b) During neigh resolve in addr_resolve_neigh(), only copy destination
    address.
(c) Always resolve the source address before the destination address,
    because it doesn't depend on resolving neigh being requested or not.

This helps to reduce 3 calls of rdma_copy_addr and rdma_translate_ip to
one and makes it easier to follow the code flow.

Now that ib_nl_fetch_ha() doesn't depend on dst, drop dst argument from
ib_nl_fetch_ha().

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/addr.c