Skip to content

Commit 5bd8562

Browse files
mikechristiemartinkpetersen
authored andcommitted
scsi: iscsi: Merge suspend fields
Move the tx and rx suspend fields into one flags field. Link: https://lore.kernel.org/r/20220408001314.5014-8-michael.christie@oracle.com Tested-by: Manish Rangankar <mrangankar@marvell.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Reviewed-by: Chris Leech <cleech@redhat.com> Signed-off-by: Mike Christie <michael.christie@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 03690d8 commit 5bd8562

File tree

6 files changed

+21
-20
lines changed

6 files changed

+21
-20
lines changed

drivers/scsi/bnx2i/bnx2i_hwi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ static int bnx2i_process_new_cqes(struct bnx2i_conn *bnx2i_conn)
19771977
if (nopin->cq_req_sn != qp->cqe_exp_seq_sn)
19781978
break;
19791979

1980-
if (unlikely(test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx))) {
1980+
if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
19811981
if (nopin->op_code == ISCSI_OP_NOOP_IN &&
19821982
nopin->itt == (u16) RESERVED_ITT) {
19831983
printk(KERN_ALERT "bnx2i: Unsolicited "

drivers/scsi/bnx2i/bnx2i_iscsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ static int bnx2i_tear_down_conn(struct bnx2i_hba *hba,
17211721
struct iscsi_conn *conn = ep->conn->cls_conn->dd_data;
17221722

17231723
/* Must suspend all rx queue activity for this ep */
1724-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
1724+
set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
17251725
}
17261726
/* CONN_DISCONNECT timeout may or may not be an issue depending
17271727
* on what transcribed in TCP layer, different targets behave

drivers/scsi/cxgbi/libcxgbi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,11 +1634,11 @@ void cxgbi_conn_pdu_ready(struct cxgbi_sock *csk)
16341634
log_debug(1 << CXGBI_DBG_PDU_RX,
16351635
"csk 0x%p, conn 0x%p.\n", csk, conn);
16361636

1637-
if (unlikely(!conn || conn->suspend_rx)) {
1637+
if (unlikely(!conn || test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
16381638
log_debug(1 << CXGBI_DBG_PDU_RX,
1639-
"csk 0x%p, conn 0x%p, id %d, suspend_rx %lu!\n",
1639+
"csk 0x%p, conn 0x%p, id %d, conn flags 0x%lx!\n",
16401640
csk, conn, conn ? conn->id : 0xFF,
1641-
conn ? conn->suspend_rx : 0xFF);
1641+
conn ? conn->flags : 0xFF);
16421642
return;
16431643
}
16441644

drivers/scsi/libiscsi.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,8 @@ static bool iscsi_set_conn_failed(struct iscsi_conn *conn)
13921392
if (conn->stop_stage == 0)
13931393
session->state = ISCSI_STATE_FAILED;
13941394

1395-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1396-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
1395+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
1396+
set_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
13971397
return true;
13981398
}
13991399

@@ -1454,7 +1454,7 @@ static int iscsi_xmit_task(struct iscsi_conn *conn, struct iscsi_task *task,
14541454
* Do this after dropping the extra ref because if this was a requeue
14551455
* it's removed from that list and cleanup_queued_task would miss it.
14561456
*/
1457-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1457+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
14581458
/*
14591459
* Save the task and ref in case we weren't cleaning up this
14601460
* task and get woken up again.
@@ -1532,7 +1532,7 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
15321532
int rc = 0;
15331533

15341534
spin_lock_bh(&conn->session->frwd_lock);
1535-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1535+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
15361536
ISCSI_DBG_SESSION(conn->session, "Tx suspended!\n");
15371537
spin_unlock_bh(&conn->session->frwd_lock);
15381538
return -ENODATA;
@@ -1746,7 +1746,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)
17461746
goto fault;
17471747
}
17481748

1749-
if (test_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx)) {
1749+
if (test_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags)) {
17501750
reason = FAILURE_SESSION_IN_RECOVERY;
17511751
sc->result = DID_REQUEUE << 16;
17521752
goto fault;
@@ -1935,7 +1935,7 @@ static void fail_scsi_tasks(struct iscsi_conn *conn, u64 lun, int error)
19351935
void iscsi_suspend_queue(struct iscsi_conn *conn)
19361936
{
19371937
spin_lock_bh(&conn->session->frwd_lock);
1938-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1938+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19391939
spin_unlock_bh(&conn->session->frwd_lock);
19401940
}
19411941
EXPORT_SYMBOL_GPL(iscsi_suspend_queue);
@@ -1953,15 +1953,15 @@ void iscsi_suspend_tx(struct iscsi_conn *conn)
19531953
struct Scsi_Host *shost = conn->session->host;
19541954
struct iscsi_host *ihost = shost_priv(shost);
19551955

1956-
set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1956+
set_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19571957
if (ihost->workq)
19581958
flush_workqueue(ihost->workq);
19591959
}
19601960
EXPORT_SYMBOL_GPL(iscsi_suspend_tx);
19611961

19621962
static void iscsi_start_tx(struct iscsi_conn *conn)
19631963
{
1964-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
1964+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
19651965
iscsi_conn_queue_work(conn);
19661966
}
19671967

@@ -3329,8 +3329,8 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
33293329
/*
33303330
* Unblock xmitworker(), Login Phase will pass through.
33313331
*/
3332-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_rx);
3333-
clear_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx);
3332+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags);
3333+
clear_bit(ISCSI_CONN_FLAG_SUSPEND_TX, &conn->flags);
33343334
return 0;
33353335
}
33363336
EXPORT_SYMBOL_GPL(iscsi_conn_bind);

drivers/scsi/libiscsi_tcp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ int iscsi_tcp_recv_skb(struct iscsi_conn *conn, struct sk_buff *skb,
927927
*/
928928
conn->last_recv = jiffies;
929929

930-
if (unlikely(conn->suspend_rx)) {
930+
if (unlikely(test_bit(ISCSI_CONN_FLAG_SUSPEND_RX, &conn->flags))) {
931931
ISCSI_DBG_TCP(conn, "Rx suspended!\n");
932932
*status = ISCSI_TCP_SUSPENDED;
933933
return 0;

include/scsi/libiscsi.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ enum {
5353

5454
#define ISID_SIZE 6
5555

56-
/* Connection suspend "bit" */
57-
#define ISCSI_SUSPEND_BIT 1
56+
/* Connection flags */
57+
#define ISCSI_CONN_FLAG_SUSPEND_TX BIT(0)
58+
#define ISCSI_CONN_FLAG_SUSPEND_RX BIT(1)
59+
5860

5961
#define ISCSI_ITT_MASK 0x1fff
6062
#define ISCSI_TOTAL_CMDS_MAX 4096
@@ -211,8 +213,7 @@ struct iscsi_conn {
211213
struct list_head cmdqueue; /* data-path cmd queue */
212214
struct list_head requeue; /* tasks needing another run */
213215
struct work_struct xmitwork; /* per-conn. xmit workqueue */
214-
unsigned long suspend_tx; /* suspend Tx */
215-
unsigned long suspend_rx; /* suspend Rx */
216+
unsigned long flags; /* ISCSI_CONN_FLAGs */
216217

217218
/* negotiated params */
218219
unsigned max_recv_dlength; /* initiator_max_recv_dsl*/

0 commit comments

Comments
 (0)