• Jack Morgenstein's avatar
    mlx4: Fix mlx4 reg/unreg mac to work properly with 0-mac addresses · f4fd40b2
    Jack Morgenstein authored
    There is a chance that the VF mlx4 RoCE driver (mlx4_ib) may see a 0-mac
    as the current default MAC address when a RoCE interface first comes up.
    
    In this case, the RoCE driver registers the 0-mac to get its MAC index --
    used in the INIT2RTR transition when it creates its proxy Q1 qp's.
    
    If we do not allow QP1 to be created, the RoCE driver will not come up.
    If we do not register the 0-mac, but simply use a random mac-index,
    QP1 will attempt to send packets with an someone's else source MAC which
    will get the system into more troubled.
    
    Since a 0-mac was previously used to indicate a free slot, this leads to
    errors, both when the 0-mac is registered and when it is unregistered.
    
    The required fix is to check in addition that the slot containing the
    0-mac has a reference count of zero.
    
    Additionally, when comparing MAC addresses, need to mask out the 2 MSBs
    of the u64 mac on both sides of the comparison.
    
    Note that when the EN driver (mlx4_en) comes up, it set itself a proper
    mac --> the RoCE driver gets to be notified on that and further handing
    is done with the update qp command, as was added by commit 9433c188
    ("IB/mlx4: Invoke UPDATE_QP for proxy QP1 on MAC changes").
    Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
    Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
    f4fd40b2
port.c 36.1 KB