Inline SET_CCB_TIMEOUT and SET_CONN_TIMEOUT

This commit is contained in:
joerg 2015-05-30 18:09:31 +00:00
parent 8adffa949a
commit b869fee6c4
4 changed files with 20 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_globals.h,v 1.10 2015/05/30 18:00:09 joerg Exp $ */
/* $NetBSD: iscsi_globals.h,v 1.11 2015/05/30 18:09:31 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -628,12 +628,6 @@ sn_a_le_b(uint32_t a, uint32_t b)
(a >= b && ((a - b) & 0x80000000));
}
/* Version dependencies */
/* XXX */
#define SET_CCB_TIMEOUT(conn, ccb, tout) callout_schedule(&ccb->timeout, tout)
#define SET_CONN_TIMEOUT(conn, tout) callout_schedule(&conn->timeout, tout)
/* in iscsi_ioctl.c */
/* Parameter for logout is reason code in logout PDU, -1 for don't send logout */

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_ioctl.c,v 1.10 2015/05/30 18:00:09 joerg Exp $ */
/* $NetBSD: iscsi_ioctl.c,v 1.11 2015/05/30 18:09:31 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -477,7 +477,7 @@ kill_connection(connection_t *conn, uint32_t status, int logout, bool recover)
/* of logging in */
if (logout >= 0) {
conn->state = ST_WINDING_DOWN;
SET_CONN_TIMEOUT(conn, CONNECTION_TIMEOUT);
callout_schedule(&conn->timeout, CONNECTION_TIMEOUT);
if (sess->ErrorRecoveryLevel < 2 &&
logout == RECOVER_CONNECTION) {
@ -850,7 +850,7 @@ recreate_connection(iscsi_login_parameters_t *par, session_t *session,
}
resend_pdu(ccb);
} else {
SET_CCB_TIMEOUT(connection, ccb, COMMAND_TIMEOUT);
callout_schedule(&ccb->timeout, COMMAND_TIMEOUT);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_rcv.c,v 1.9 2015/05/30 18:00:09 joerg Exp $ */
/* $NetBSD: iscsi_rcv.c,v 1.10 2015/05/30 18:09:31 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -468,7 +468,7 @@ receive_text_response_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
}
if (req_ccb->pdu_waiting != NULL) {
SET_CCB_TIMEOUT(conn, req_ccb, COMMAND_TIMEOUT);
callout_schedule(&req_ccb->timeout, COMMAND_TIMEOUT);
req_ccb->num_timeouts = 0;
}
@ -575,7 +575,7 @@ receive_data_in_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
req_ccb->flags |= CCBF_GOT_RSP;
if (req_ccb->pdu_waiting != NULL) {
SET_CCB_TIMEOUT(conn, req_ccb, COMMAND_TIMEOUT);
callout_schedule(&req_ccb->timeout, COMMAND_TIMEOUT);
req_ccb->num_timeouts = 0;
}
@ -656,7 +656,7 @@ receive_r2t_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
if (req_ccb != NULL) {
if (req_ccb->pdu_waiting != NULL) {
SET_CCB_TIMEOUT(conn, req_ccb, COMMAND_TIMEOUT);
callout_schedule(&req_ccb->timeout, COMMAND_TIMEOUT);
req_ccb->num_timeouts = 0;
}
send_data_out(conn, pdu, req_ccb, CCBDISP_NOWAIT, TRUE);
@ -699,7 +699,7 @@ receive_command_response_pdu(connection_t *conn, pdu_t *pdu, ccb_t *req_ccb)
}
if (req_ccb->pdu_waiting != NULL) {
SET_CCB_TIMEOUT(conn, req_ccb, COMMAND_TIMEOUT);
callout_schedule(&req_ccb->timeout, COMMAND_TIMEOUT);
req_ccb->num_timeouts = 0;
}
@ -1090,11 +1090,11 @@ receive_pdu(connection_t *conn, pdu_t *pdu)
MaxCmdSN = ntohl(pdu->pdu.p.nop_in.MaxCmdSN);
/* received a valid frame, reset timeout */
SET_CONN_TIMEOUT(conn,
(((pdu->pdu.Opcode & OPCODE_MASK) == TOP_NOP_In) &&
(TAILQ_FIRST(&conn->ccbs_waiting) == NULL)) ?
conn->idle_timeout_val : CONNECTION_TIMEOUT);
if ((pdu->pdu.Opcode & OPCODE_MASK) == TOP_NOP_In &&
TAILQ_EMPTY(&conn->ccbs_waiting))
callout_schedule(&conn->timeout, conn->idle_timeout_val);
else
callout_schedule(&conn->timeout, CONNECTION_TIMEOUT);
conn->num_timeouts = 0;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: iscsi_send.c,v 1.13 2015/05/30 18:00:09 joerg Exp $ */
/* $NetBSD: iscsi_send.c,v 1.14 2015/05/30 18:09:31 joerg Exp $ */
/*-
* Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@ -260,7 +260,7 @@ reassign_tasks(connection_t *oldconn)
}
resend_pdu(ccb);
} else {
SET_CCB_TIMEOUT(conn, ccb, COMMAND_TIMEOUT);
callout_schedule(&ccb->timeout, COMMAND_TIMEOUT);
}
DEBC(conn, 1, ("Reassign ccb %p, no_tm=%d, rc=%d\n",
ccb, no_tm, rc));
@ -482,7 +482,7 @@ send_pdu(ccb_t *ccb, pdu_t *pdu, ccb_disp_t cdisp, pdu_disp_t pdisp)
wakeup(&conn->pdus_to_send);
if (cdisp != CCBDISP_NOWAIT) {
SET_CCB_TIMEOUT(conn, ccb, COMMAND_TIMEOUT);
callout_schedule(&ccb->timeout, COMMAND_TIMEOUT);
if (prev_cdisp <= CCBDISP_NOWAIT)
suspend_ccb(ccb, TRUE);
@ -533,7 +533,7 @@ resend_pdu(ccb_t *ccb)
} else {
TAILQ_INSERT_TAIL(&conn->pdus_to_send, pdu, send_chain);
}
SET_CCB_TIMEOUT(conn, ccb, COMMAND_TIMEOUT);
callout_schedule(&ccb->timeout, COMMAND_TIMEOUT);
splx (s);
wakeup(&conn->pdus_to_send);
@ -1591,7 +1591,7 @@ connection_timeout(void *par)
if (conn->state == ST_FULL_FEATURE)
send_nop_out(conn, NULL);
SET_CONN_TIMEOUT(conn, CONNECTION_TIMEOUT);
callout_schedule(&conn->timeout, CONNECTION_TIMEOUT);
}
}
@ -1626,6 +1626,6 @@ ccb_timeout(void *par)
/* request resend of all missing status */
snack_missing(conn, NULL, SNACK_STATUS_NAK, 0, 0);
}
SET_CCB_TIMEOUT(conn, ccb, COMMAND_TIMEOUT);
callout_schedule(&ccb->timeout, COMMAND_TIMEOUT);
}
}