Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/iser: Return error code when PDUs may not be sent

iSER limits the number of outstanding PDUs to send. When this threshold
is reached, it should return an error code (-ENOBUFS) instead of setting
the suspend_tx bit (which should be used only by libiscsi).

Signed-off-by: Erez Zilber <erezz@voltaire.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>

authored by

Erez Zilber and committed by
Roland Dreier
f0938401 46707e96

+14 -16
+2 -2
drivers/infiniband/ulp/iser/iscsi_iser.c
··· 177 177 * - if yes, the mtask is recycled at iscsi_complete_pdu 178 178 * - if no, the mtask is recycled at iser_snd_completion 179 179 */ 180 - if (error && error != -EAGAIN) 180 + if (error && error != -ENOBUFS) 181 181 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); 182 182 183 183 return error; ··· 241 241 error = iscsi_iser_ctask_xmit_unsol_data(conn, ctask); 242 242 243 243 iscsi_iser_ctask_xmit_exit: 244 - if (error && error != -EAGAIN) 244 + if (error && error != -ENOBUFS) 245 245 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); 246 246 return error; 247 247 }
+12 -14
drivers/infiniband/ulp/iser/iser_initiator.c
··· 304 304 static int 305 305 iser_check_xmit(struct iscsi_conn *conn, void *task) 306 306 { 307 - int rc = 0; 308 307 struct iscsi_iser_conn *iser_conn = conn->dd_data; 309 308 310 - write_lock_bh(conn->recv_lock); 311 309 if (atomic_read(&iser_conn->ib_conn->post_send_buf_count) == 312 310 ISER_QP_MAX_REQ_DTOS) { 313 - iser_dbg("%ld can't xmit task %p, suspending tx\n",jiffies,task); 314 - set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); 315 - rc = -EAGAIN; 311 + iser_dbg("%ld can't xmit task %p\n",jiffies,task); 312 + return -ENOBUFS; 316 313 } 317 - write_unlock_bh(conn->recv_lock); 318 - return rc; 314 + return 0; 319 315 } 320 316 321 317 ··· 336 340 return -EPERM; 337 341 } 338 342 if (iser_check_xmit(conn, ctask)) 339 - return -EAGAIN; 343 + return -ENOBUFS; 340 344 341 345 edtl = ntohl(hdr->data_length); 342 346 ··· 422 426 } 423 427 424 428 if (iser_check_xmit(conn, ctask)) 425 - return -EAGAIN; 429 + return -ENOBUFS; 426 430 427 431 itt = ntohl(hdr->itt); 428 432 data_seg_len = ntoh24(hdr->dlength); ··· 494 498 } 495 499 496 500 if (iser_check_xmit(conn,mtask)) 497 - return -EAGAIN; 501 + return -ENOBUFS; 498 502 499 503 /* build the tx desc regd header and add it to the tx desc dto */ 500 504 mdesc->type = ISCSI_TX_CONTROL; ··· 601 605 struct iscsi_iser_conn *iser_conn = ib_conn->iser_conn; 602 606 struct iscsi_conn *conn = iser_conn->iscsi_conn; 603 607 struct iscsi_mgmt_task *mtask; 608 + int resume_tx = 0; 604 609 605 610 iser_dbg("Initiator, Data sent dto=0x%p\n", dto); 606 611 ··· 610 613 if (tx_desc->type == ISCSI_TX_DATAOUT) 611 614 kmem_cache_free(ig.desc_cache, tx_desc); 612 615 616 + if (atomic_read(&iser_conn->ib_conn->post_send_buf_count) == 617 + ISER_QP_MAX_REQ_DTOS) 618 + resume_tx = 1; 619 + 613 620 atomic_dec(&ib_conn->post_send_buf_count); 614 621 615 - write_lock(conn->recv_lock); 616 - if (conn->suspend_tx) { 622 + if (resume_tx) { 617 623 iser_dbg("%ld resuming tx\n",jiffies); 618 - clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); 619 624 scsi_queue_work(conn->session->host, &conn->xmitwork); 620 625 } 621 - write_unlock(conn->recv_lock); 622 626 623 627 if (tx_desc->type == ISCSI_TX_CONTROL) { 624 628 /* this arithmetic is legal by libiscsi dd_data allocation */