Skip to content
  • Parav Pandit's avatar
    IB/{core/cm}: Fix generating a return AH for RoCEE · 1060f865
    Parav Pandit authored
    When computing a UD reverse path (return AH) from a WC the code was not
    doing a route lookup anchored in a specific netdevice. This caused several
    bugs, including broken IPv6 link-local address support in RoCEv2. [1]
    
    This fixes the lookup by determining the GID table entry that the HW
    matched to the SGID for the WC and then using the netdevice from that
    entry to perform the route and ND lookup for the 'DGID' to build a return
    AH.
    
    RoCE GID table management ensures that right upper netdevices of the
    physical netdevices are added. Therefore init_ah_from_wc doesn't need to
    perform such check.
    
    Now that route lookup is done based on the netdevice of the GID entry,
    simplify code to not have ifindex and vlan pointers.  As part of that,
    refactor to have netdevice as input parameter.  This is already discussed
    at [2].
    
    Finally ib_init_ah_from_wc resolves dmac for unicast GID in similar way as
    what ib_resolve_eth_dmac() does. So ib_resolve_eth_dmac is refactored to
    split for unicast and non unicast GIDs, so that it can be reused by
    ib_init_ah_from_wc.
    
    While we are at refactoring ib_resolve_eth_dmac(), it is further
    simplified
    
    (a) to avoid hoplimit as optional parameter, as there is only one
        user who always queries hoplimit.
    (b) for empty line.
    (c) avoided zero initialization of ret.
    (d) removed as exported symbol as only ib core uses it.
    
    For IPv6, this is tested using simple rping test as below.
     rping -sv -a ::0
     rping -c -a fe80::268a:7ff:fe55:4661%ens2f1 -C 1 -v -d
    
    [1] https://www.spinics.net/lists/linux-rdma/msg45690.html
    [2] https://www.spinics.net/lists/linux-rdma/msg45710.html
    
    
    
    Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
    Reviewed-by: default avatarMatan Barak <matanb@mellanox.com>
    Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
    Reported-by: default avatarRoland Dreier <roland@purestorage.com>
    Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    1060f865