nvmf: remove nvmf_recv() SQ overflow handling

The overflow condition can't happen unless there is a programming error
in the nvmf_tgt library; we can only possibly receive command capsules
(sq entries from the point of view of the host) if we have posted a RDMA
Recv for the command capsule memory region.

This means that we also don't need to track sq_tail in the NVMf library.

Change-Id: I101509080c744528871e72fa46d188e2850c928a
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-06-24 18:32:42 -07:00
parent d9709895fa
commit d5cf9030ac
2 changed files with 1 additions and 46 deletions

View File

@ -177,7 +177,7 @@ spdk_nvmf_allocate_conn(void)
conn->sess = NULL;
conn->state = CONN_STATE_INVALID;
conn->sq_head = conn->sq_tail = 0;
conn->sq_head = 0;
return conn;
@ -436,42 +436,6 @@ static int nvmf_recv(struct spdk_nvmf_conn *conn, struct ibv_wc *wc)
rx_desc = (struct nvme_qp_rx_desc *)wc->wr_id;
cap_hdr = &rx_desc->cmd.nvmf_cmd;
/* Update Connection SQ Tracking, increment
the SQ tail consuming a free RX recv slot.
Check for exceeding queue full - should
never happen.
*/
conn->sq_tail < (conn->sq_depth - 1) ? (conn->sq_tail++) : (conn->sq_tail = 0);
SPDK_TRACELOG(SPDK_TRACE_DEBUG, "sq_head %x, sq_tail %x, sq_depth %x\n",
conn->sq_head, conn->sq_tail, conn->sq_depth);
/* trap if initiator exceeds qdepth */
if (conn->sq_head == conn->sq_tail) {
SPDK_ERRLOG(" *** SQ Overflow !! ***\n");
/* controller fatal status condition:
set the cfs flag in controller status
and stop processing this and any I/O
on this queue.
*/
if (conn->sess) {
conn->sess->vcprop.csts.bits.cfs = 1;
conn->state = CONN_STATE_OVERFLOW;
}
if (conn->type == CONN_TYPE_IOQ) {
/* if overflow on the I/O queue
stop processing, allow for
remote host to query failure
via admin queue
*/
return 0;
} else {
/* if overflow on the admin queue
there is no recovery, error out
to trigger disconnect
*/
return -1;
}
}
if (wc->byte_len < sizeof(*cap_hdr)) {
SPDK_ERRLOG("recv length less than capsule header\n");
return -1;
@ -534,13 +498,6 @@ static int nvmf_check_rdma_completions(struct spdk_nvmf_conn *conn)
for (i = 0; i < conn->sq_depth; i++) {
tx_desc = NULL;
/* if an overflow condition was hit
we want to stop all processing, but
do not disconnect.
*/
if (conn->state == CONN_STATE_OVERFLOW)
break;
rc = ibv_poll_cq(conn->rdma.cq, 1, &wc);
if (rc == 0) // No completions at this time
break;

View File

@ -46,7 +46,6 @@ enum conn_state {
CONN_STATE_INVALID = 0,
CONN_STATE_RUNNING = 1,
CONN_STATE_FABRIC_DISCONNECT = 2,
CONN_STATE_OVERFLOW = 3,
CONN_STATE_EXITING = 4,
};
@ -75,7 +74,6 @@ struct spdk_nvmf_conn {
volatile enum conn_state state;
uint16_t sq_head;
uint16_t sq_tail;
struct spdk_nvmf_rdma_conn rdma;