"Alex Aizman <itn780@yahoo.com>");
MODULE_DESCRIPTION("iSCSI/TCP data-path");
MODULE_LICENSE("GPL");
-
+MODULE_VERSION("0:4.409");
/* #define DEBUG_TCP */
/* #define DEBUG_SCSI */
#define DEBUG_ASSERT
conn->data_copied = 0;
/* read AHS */
- conn->in.ahslen = hdr->hlength*(4*sizeof(__u16));
+ conn->in.ahslen = hdr->hlength * 4;
conn->in.offset += conn->in.ahslen;
conn->in.copy -= conn->in.ahslen;
if (conn->in.copy < 0) {
else
rc = ISCSI_ERR_PROTO;
break;
- case ISCSI_OP_NOOP_IN:
- case ISCSI_OP_TEXT_RSP:
- case ISCSI_OP_LOGOUT_RSP:
- case ISCSI_OP_ASYNC_EVENT:
- case ISCSI_OP_REJECT:
- rc = iscsi_check_assign_cmdsn(session,
- (struct iscsi_nopin*)hdr);
- if (rc)
- break;
-
- /* update ExpStatSN */
- conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
- if (!conn->in.datalen) {
- struct iscsi_mgmt_task *mtask;
-
- rc = iscsi_recv_pdu(iscsi_handle(conn), hdr,
- NULL, 0);
- mtask = (struct iscsi_mgmt_task *)
- session->mgmt_cmds[conn->in.itt -
- ISCSI_MGMT_ITT_OFFSET];
- if (conn->login_mtask != mtask) {
- spin_lock(&session->lock);
- __kfifo_put(session->mgmtpool.queue,
- (void*)&mtask, sizeof(void*));
- spin_unlock(&session->lock);
- }
- }
- break;
default:
rc = ISCSI_ERR_BAD_OPCODE;
break;
switch(conn->in.opcode) {
case ISCSI_OP_LOGIN_RSP:
case ISCSI_OP_TEXT_RSP:
+ case ISCSI_OP_LOGOUT_RSP:
rc = iscsi_check_assign_cmdsn(session,
(struct iscsi_nopin*)hdr);
if (rc)
(void*)&mtask, sizeof(void*));
conn->tmabort_state =
((struct iscsi_tm_rsp *)hdr)->
- response == SCSI_TCP_TM_RESP_COMPLETE ?
+ response == ISCSI_TMF_RSP_COMPLETE ?
TMABORT_SUCCESS:TMABORT_FAILED;
/* unblock eh_abort() */
wake_up(&conn->ehwait);
}
spin_unlock(&session->lock);
break;
+ case ISCSI_OP_NOOP_IN:
+ if (hdr->ttt != ISCSI_RESERVED_TAG) {
+ rc = ISCSI_ERR_PROTO;
+ break;
+ }
+ rc = iscsi_check_assign_cmdsn(session,
+ (struct iscsi_nopin*)hdr);
+ if (rc)
+ break;
+ conn->exp_statsn = be32_to_cpu(hdr->statsn) + 1;
+
+ if (!conn->in.datalen) {
+ struct iscsi_mgmt_task *mtask;
+
+ rc = iscsi_recv_pdu(iscsi_handle(conn), hdr,
+ NULL, 0);
+ mtask = (struct iscsi_mgmt_task *)
+ session->mgmt_cmds[conn->in.itt -
+ ISCSI_MGMT_ITT_OFFSET];
+ if (conn->login_mtask != mtask) {
+ spin_lock(&session->lock);
+ __kfifo_put(session->mgmtpool.queue,
+ (void*)&mtask, sizeof(void*));
+ spin_unlock(&session->lock);
+ }
+ }
+ break;
default:
rc = ISCSI_ERR_BAD_OPCODE;
break;
}
} else if (conn->in.itt == ISCSI_RESERVED_TAG) {
- if (conn->in.opcode == ISCSI_OP_NOOP_IN && !conn->in.datalen) {
- rc = iscsi_check_assign_cmdsn(session,
+ switch(conn->in.opcode) {
+ case ISCSI_OP_NOOP_IN:
+ if (!conn->in.datalen) {
+ rc = iscsi_check_assign_cmdsn(session,
(struct iscsi_nopin*)hdr);
- if (!rc)
- rc = iscsi_recv_pdu(iscsi_handle(conn),
- hdr, NULL, 0);
- }
- else
+ if (!rc && hdr->ttt != ISCSI_RESERVED_TAG)
+ rc = iscsi_recv_pdu(iscsi_handle(conn),
+ hdr, NULL, 0);
+ } else
+ rc = ISCSI_ERR_PROTO;
+ break;
+ case ISCSI_OP_REJECT:
+ /* we need sth like iscsi_reject_rsp()*/
+ case ISCSI_OP_ASYNC_EVENT:
+ /* we need sth like iscsi_async_event_rsp() */
+ rc = ISCSI_ERR_BAD_OPCODE;
+ break;
+ default:
rc = ISCSI_ERR_BAD_OPCODE;
+ break;
+ }
} else
rc = ISCSI_ERR_BAD_ITT;
{
int rc;
struct iscsi_conn *conn = rd_desc->arg.data;
- int start = skb_headlen(skb);
int processed;
char pad[ISCSI_PAD_LEN];
struct scatterlist sg;
* Save current SKB and its offset in the corresponding
* connection context.
*/
- conn->in.copy = start - offset;
+ conn->in.copy = skb->len - offset;
conn->in.offset = offset;
conn->in.skb = skb;
conn->in.len = conn->in.copy;