IB/srp: allow lockless work posting

Only one CPU at a time will own an RX IU, so using the address of the IU
as the work request cookie allows us to avoid taking a lock. We can
similarly prepare the TX path for lockless posting by moving the free TX
IUs to a list. This also removes the requirement that the queue sizes be
a power of 2.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
[ broken out, small cleanups, and modified to avoid needing an extra field
  in the IU by David Dillow]
Signed-off-by: David Dillow <dillowda@ornl.gov>
This commit is contained in:
Bart Van Assche
2010-11-26 13:22:48 -05:00
committed by David Dillow
parent 9709f0e05b
commit dcb4cb85f4
2 changed files with 28 additions and 44 deletions

View File

@@ -59,10 +59,8 @@ enum {
SRP_RQ_SHIFT = 6,
SRP_RQ_SIZE = 1 << SRP_RQ_SHIFT,
SRP_RQ_MASK = SRP_RQ_SIZE - 1,
SRP_SQ_SIZE = SRP_RQ_SIZE,
SRP_SQ_MASK = SRP_SQ_SIZE - 1,
SRP_RSP_SQ_SIZE = 1,
SRP_REQ_SQ_SIZE = SRP_SQ_SIZE - SRP_RSP_SQ_SIZE,
SRP_TSK_MGMT_SQ_SIZE = 1,
@@ -144,11 +142,9 @@ struct srp_target_port {
int zero_req_lim;
unsigned rx_head;
struct srp_iu *rx_ring[SRP_RQ_SIZE];
unsigned tx_head;
unsigned tx_tail;
struct list_head free_tx;
struct srp_iu *tx_ring[SRP_SQ_SIZE];
struct list_head free_reqs;
@@ -168,6 +164,7 @@ struct srp_target_port {
};
struct srp_iu {
struct list_head list;
u64 dma;
void *buf;
size_t size;