• Jack Morgenstein's avatar
    mlx4: Add ref counting to port MAC table for RoCE · 2f5bb473
    Jack Morgenstein authored
    The IB side of RoCE requires the MAC table index of the
    MAC address used by its QPs.
    
    To obtain the real MAC index, the IB side registers the
    MAC (increasing its ref count, and also returning the
    real MAC index) during the modify-qp sequence.
    
    This protects against the ETH side deleting or modifying
    that MAC table entry while the QP is active.
    
    Note that until the modify-qp command returns success,
    the MAC and VLAN information only has "candidate" status.
    If the modify-qp succeeds, the "candidate" info is promoted
    to the operational MAC/VLAN info for the qp. If the modify fails,
    the candidate MAC/VLAN is unregistered, and the old qp info
    is preserved.
    
    The patch is a bit complex, because there are multiple qp
    transitions where the primary-path information may be
    modified:  INIT-to-RTR, and SQD-to-SQD.
    
    Similarly for the alternate path information.
    
    Therefore the code must handle cases where path information
    has already been entered into the QP context by previous
    qp transitions.
    
    For the MAC address, the success logic is as follows:
    1. If there was no previous MAC, simply move the candidate
       MAC information to the operational information, and reset
       the candidate MAC info.
    2. If there was a previous MAC, unregister it.  Then move
       the MAC information from candidate to operational, and
       reset the candidate info (as in 1. above).
    
    The MAC address failure logic is the same for all cases:
     - Unregister the candidate MAC, and reset the candidate MAC info.
    
    For Vlan registration, the logic is similar.
    Signed-off-by: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
    Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2f5bb473
resource_tracker.c 112 KB