• Parav Pandit's avatar
    RDMA/core: Introduce and use rdma_set_src_addr() between IPv4 and IPv6 · a362ea1d
    Parav Pandit authored
    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: default avatarParav Pandit <parav@mellanox.com>
    Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    a362ea1d
addr.c 18.8 KB