]> git.baikalelectronics.ru Git - kernel.git/commit
IB/cm: Improve local id allocation
authorMichael S. Tsirkin <mst@dev.mellanox.co.il>
Mon, 21 May 2007 16:06:54 +0000 (19:06 +0300)
committerRoland Dreier <rolandd@cisco.com>
Mon, 21 May 2007 20:41:29 +0000 (13:41 -0700)
commite5bffe552c399e04762a7d922b96439c28f7f500
treeab0eacf7aa4a78bce8aa96073678244d01c8175d
parent712ec13280e815b48ef07ae505dd1685d98983d5
IB/cm: Improve local id allocation

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: Michael S. Tsirkin <mst@dev.mellanox.co.il>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/cm.c