IB/qib: Optimize pio ack buffer allocation
authorMike Marciniszyn <mike.marciniszyn@intel.com>
Mon, 7 May 2012 18:02:42 +0000 (14:02 -0400)
committerRoland Dreier <roland@purestorage.com>
Mon, 14 May 2012 19:37:03 +0000 (12:37 -0700)
commitbb77a077232e78476d7bc39c080f9e6685cbfd3c
treed6b07dec8a7a7aa8fbbd752c2fd4b3b0c36088f9
parentcca195a168ac062967fd1fa75c75546167b1e213
IB/qib: Optimize pio ack buffer allocation

This patch optimizes pio buffer allocation in the kernel.

For qib, kernel pio buffers are used for sending acks.  The code to
allocate the buffer would always start at 0 until it found a buffer.

This means that an average of 64 comparisions were done on each
allocate, since the busy bit won't be cleared until the bits are
refreshed when buffers are exhausted.

This patch adds two new fields in the devdata struct, last_pio and
min_kernel_pio.  last_pio is the last buffer that was allocated.
min_kernel_pio is the lowest potential available buffer.

min_kernel_pio is modifed as contexts are allocated and deallocted.

Reviewed-by: Ramkrishna Vepa <ramkrishna.vepa@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib.h
drivers/infiniband/hw/qib/qib_iba6120.c
drivers/infiniband/hw/qib/qib_iba7220.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/hw/qib/qib_tx.c