• Michael S. Tsirkin's avatar
    IB/cm: Improve local id allocation · 9f81036c
    Michael S. Tsirkin authored
    The IB CM uses an idr for local id allocations, with a running counter
    as start_id.  This fails to generate distinct ids if
    
    1. An id is constantly created and destroyed
    2. A chunk of ids just beyond the current next_id value is occupied
    
    This in turn leads to an increased chance of connection request being
    mis-detected as a duplicate, sometimes for several retries, until
    next_id gets past the block of allocated ids. This has been observed
    in practice.
    
    As a fix, remember the last id allocated and start immediately above it.
    This also fixes a problem with the old code, where next_id might
    overflow and become negative.
    Signed-off-by: default avatarMichael S. Tsirkin <mst@dev.mellanox.co.il>
    Acked-by: default avatarSean Hefty <sean.hefty@intel.com>
    Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
    9f81036c
cm.c 98.1 KB