diff options
author | Manish Rangankar <mrangankar@marvell.com> | 2020-04-07 23:43:28 -0700 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2020-04-13 21:44:19 -0400 |
commit | 2e612fab05112d9e40add3c3cb75a0e86967d53c (patch) | |
tree | 17a1282ebe5c5764910b9c6e55587c684e9a5be0 | |
parent | 2f1ea39870c95aa9fff6a0b48757625a0b22f551 (diff) | |
download | linux-2e612fab05112d9e40add3c3cb75a0e86967d53c.tar.bz2 |
scsi: qedi: Avoid unnecessary endpoint allocation on link down
No need to allocate and deallocate endpoint memory if the physical link is
down.
Link: https://lore.kernel.org/r/20200408064332.19377-3-mrangankar@marvell.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Manish Rangankar <mrangankar@marvell.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/qedi/qedi_iscsi.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/scsi/qedi/qedi_iscsi.c b/drivers/scsi/qedi/qedi_iscsi.c index 1f4a5fb00a05..26b11515f43e 100644 --- a/drivers/scsi/qedi/qedi_iscsi.c +++ b/drivers/scsi/qedi/qedi_iscsi.c @@ -836,6 +836,11 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, return ERR_PTR(ret); } + if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) { + QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n"); + return ERR_PTR(-ENXIO); + } + ep = iscsi_create_endpoint(sizeof(struct qedi_endpoint)); if (!ep) { QEDI_ERR(&qedi->dbg_ctx, "endpoint create fail\n"); @@ -870,12 +875,6 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, QEDI_ERR(&qedi->dbg_ctx, "Invalid endpoint\n"); } - if (atomic_read(&qedi->link_state) != QEDI_LINK_UP) { - QEDI_WARN(&qedi->dbg_ctx, "qedi link down\n"); - ret = -ENXIO; - goto ep_conn_exit; - } - ret = qedi_alloc_sq(qedi, qedi_ep); if (ret) goto ep_conn_exit; |