linux-stable/drivers/infiniband
Michael J. Ruhl 8737ce95c4 IB/hfi1: Fix an assign/ordering issue with shared context IDs
The current algorithm for generating sub-context IDs is FILO.  If the
contexts are not closed in that order, the uniqueness of the ID will be
compromised. I.e. logging the creation/deletion of context IDs with an
application that assigns and closes in a FIFO order reveals:

cache_id: assign: uctxt: 3    sub_ctxt: 0
cache_id: assign: uctxt: 3    sub_ctxt: 1
cache_id: assign: uctxt: 3    sub_ctxt: 2
cache_id: close:  uctxt: 3    sub_ctxt: 0
cache_id: assign: uctxt: 3    sub_ctxt: 2 <<<

The sub_ctxt ID 2 is reused incorrectly.

Update the sub-context ID assign algorithm to use a bitmask of in_use
contexts.  The new algorithm will allow the contexts to be closed in any
order, and will only re-use unused contexts.

Size subctxt and subctxt_cnt to match the user API size.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2017-05-04 19:31:46 -04:00
..
core infiniband: avoid dereferencing uninitialized dst on error path 2017-05-02 10:45:45 -04:00
hw IB/hfi1: Fix an assign/ordering issue with shared context IDs 2017-05-04 19:31:46 -04:00
sw IB/rxe: Don't clamp residual length to mtu 2017-05-01 14:42:58 -04:00
ulp IB/ipoib: add get_link_ksettings in ethtool 2017-05-04 19:31:46 -04:00
Kconfig IB/opa-vnic: Virtual Network Interface Controller (VNIC) netdev 2017-04-20 12:01:38 -04:00
Makefile IB/rdmavt: Create module framework and handle driver registration 2016-03-10 20:37:04 -05:00