Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757884Ab1CBDeU (ORCPT ); Tue, 1 Mar 2011 22:34:20 -0500 Received: from nm26-vm0.bullet.mail.ac4.yahoo.com ([98.139.52.242]:40477 "HELO nm26-vm0.bullet.mail.ac4.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757871Ab1CBDeS (ORCPT ); Tue, 1 Mar 2011 22:34:18 -0500 X-Yahoo-Newman-Id: 861005.53358.bm@omp1020.mail.ac4.yahoo.com X-Yahoo-SMTP: fzDSGlOswBCWnIOrNw7KwwK1j9PqyNbe5PtLKiS4dDU.UNl_t6bdEZu9tTLW X-YMail-OSG: 5L7AOVUVM1mLSBLKLIP6Zpln_9RgsJVnjf.4PcJMfrX.bHL h13yA0DbPnLrUriCXuDCfthfzPLk8eewfpEtN2LCU9VThmCQ0vNRmJvqNwEy 75Vzj2kOsxgcyv2TzjtbW7oED4brxEK9.UlrbRvst8K9FYw4kzFDc2TTvp8g f.HtAnlBOyUxFRyZ2g5Pe2Ef9A1ZN50j_0I9uEci18opp5PDX6QiGb1v7Jp6 ogJImXPcgVAcJvrrNFCrggpToHZkR3uFPsb75y_fVVbznrmAQaddeoDTGXCc KBsjrMfAPHjB4oyoN2QEvFz3XN3ABgiOXV766oDyMZ7Sx1aofESG1sdUbUvu FA2FW1jZ8 X-Yahoo-Newman-Property: ymail-3 From: "Nicholas A. Bellinger" To: linux-scsi , linux-kernel Cc: Christoph Hellwig , Mike Christie , Hannes Reinecke , FUJITA Tomonori , James Bottomley , Boaz Harrosh , Stephen Rothwell , Douglas Gilbert , Nicholas Bellinger Subject: [RFC 01/12] iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi Date: Tue, 1 Mar 2011 19:33:50 -0800 Message-Id: <1299036841-23677-2-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1299036841-23677-1-git-send-email-nab@linux-iscsi.org> References: <1299036841-23677-1-git-send-email-nab@linux-iscsi.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7781 Lines: 226 From: Nicholas Bellinger This patch renames the following iscsi_proto.h structures to avoid namespace issues with drivers/target/iscsi/iscsi_target_core.h: *) struct iscsi_cmd -> struct iscsi_scsi_cmd *) struct iscsi_cmd_rsp -> struct iscsi_scsi_rsp *) struct iscsi_login -> struct iscsi_login_req This patch includes useful ISCSI_FLAG_LOGIN_[CURRENT,NEXT]_STAGE*, and ISCSI_FLAG_SNACK_TYPE_* definitions used by iscsi_target_mod, and fixes the incorrect definition of struct iscsi_snack to following RFC-3720 Section 10.16. SNACK Request. Also, this patch updates libiscsi, iSER, be2iscsi, and bn2xi to use the updated structure definitions in a handful of locations. Signed-off-by: Nicholas A. Bellinger --- drivers/infiniband/ulp/iser/iser_initiator.c | 2 +- drivers/scsi/be2iscsi/be_main.h | 4 +- drivers/scsi/bnx2i/bnx2i_hwi.c | 8 +++--- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/libiscsi.c | 6 ++-- include/scsi/iscsi_proto.h | 30 +++++++++++++++++++------- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 95a08a8..dd28367 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -271,7 +271,7 @@ int iser_send_command(struct iscsi_conn *conn, unsigned long edtl; int err; struct iser_data_buf *data_buf; - struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr; + struct iscsi_scsi_cmd *hdr = (struct iscsi_scsi_cmd *)task->hdr; struct scsi_cmnd *sc = task->sc; struct iser_tx_desc *tx_desc = &iser_task->desc; diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 90eb74f..f05ada1 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h @@ -398,7 +398,7 @@ struct amap_pdu_data_out { }; struct be_cmd_bhs { - struct iscsi_cmd iscsi_hdr; + struct iscsi_scsi_cmd iscsi_hdr; unsigned char pad1[16]; struct pdu_data_out iscsi_data_pdu; unsigned char pad2[BE_SENSE_INFO_SIZE - @@ -429,7 +429,7 @@ struct be_nonio_bhs { }; struct be_status_bhs { - struct iscsi_cmd iscsi_hdr; + struct iscsi_scsi_cmd iscsi_hdr; unsigned char pad1[16]; /** * The plus 2 below is to hold the sense info length that gets diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 96505e3..f947c80 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c @@ -326,11 +326,11 @@ int bnx2i_send_iscsi_login(struct bnx2i_conn *bnx2i_conn, { struct bnx2i_cmd *bnx2i_cmd; struct bnx2i_login_request *login_wqe; - struct iscsi_login *login_hdr; + struct iscsi_login_req *login_hdr; u32 dword; bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data; - login_hdr = (struct iscsi_login *)task->hdr; + login_hdr = (struct iscsi_login_req *)task->hdr; login_wqe = (struct bnx2i_login_request *) bnx2i_conn->ep->qp.sq_prod_qe; @@ -1288,7 +1288,7 @@ static int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session, struct bnx2i_cmd_response *resp_cqe; struct bnx2i_cmd *bnx2i_cmd; struct iscsi_task *task; - struct iscsi_cmd_rsp *hdr; + struct iscsi_scsi_rsp *hdr; u32 datalen = 0; resp_cqe = (struct bnx2i_cmd_response *)cqe; @@ -1315,7 +1315,7 @@ static int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session, } bnx2i_iscsi_unmap_sg_list(bnx2i_cmd); - hdr = (struct iscsi_cmd_rsp *)task->hdr; + hdr = (struct iscsi_scsi_rsp *)task->hdr; resp_cqe = (struct bnx2i_cmd_response *)cqe; hdr->opcode = resp_cqe->op_code; hdr->max_cmdsn = cpu_to_be32(resp_cqe->max_cmd_sn); diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index f0dce26..8f047ba 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -1203,7 +1203,7 @@ static int bnx2i_task_xmit(struct iscsi_task *task) struct bnx2i_conn *bnx2i_conn = conn->dd_data; struct scsi_cmnd *sc = task->sc; struct bnx2i_cmd *cmd = task->dd_data; - struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; + struct iscsi_scsi_cmd *hdr = (struct iscsi_scsi_cmd *) task->hdr; /* * If there is no scsi_cmnd this must be a mgmt task diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index da8b615..61d6420 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -360,7 +360,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) struct iscsi_conn *conn = task->conn; struct iscsi_session *session = conn->session; struct scsi_cmnd *sc = task->sc; - struct iscsi_cmd *hdr; + struct iscsi_scsi_cmd *hdr; unsigned hdrlength, cmd_len; itt_t itt; int rc; @@ -374,7 +374,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task) if (rc) return rc; } - hdr = (struct iscsi_cmd *) task->hdr; + hdr = (struct iscsi_scsi_cmd *) task->hdr; itt = hdr->itt; memset(hdr, 0, sizeof(*hdr)); @@ -830,7 +830,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr, struct iscsi_task *task, char *data, int datalen) { - struct iscsi_cmd_rsp *rhdr = (struct iscsi_cmd_rsp *)hdr; + struct iscsi_scsi_rsp *rhdr = (struct iscsi_scsi_rsp *)hdr; struct iscsi_session *session = conn->session; struct scsi_cmnd *sc = task->sc; diff --git a/include/scsi/iscsi_proto.h b/include/scsi/iscsi_proto.h index dd0a52c..c3e6d4f 100644 --- a/include/scsi/iscsi_proto.h +++ b/include/scsi/iscsi_proto.h @@ -116,7 +116,7 @@ struct iscsi_ahs_hdr { #define ISCSI_CDB_SIZE 16 /* iSCSI PDU Header */ -struct iscsi_cmd { +struct iscsi_scsi_cmd { uint8_t opcode; uint8_t flags; __be16 rsvd2; @@ -161,7 +161,7 @@ struct iscsi_ecdb_ahdr { }; /* SCSI Response Header */ -struct iscsi_cmd_rsp { +struct iscsi_scsi_rsp { uint8_t opcode; uint8_t flags; uint8_t response; @@ -406,7 +406,7 @@ struct iscsi_text_rsp { }; /* Login Header */ -struct iscsi_login { +struct iscsi_login_req { uint8_t opcode; uint8_t flags; uint8_t max_version; /* Max. version supported */ @@ -427,7 +427,13 @@ struct iscsi_login { #define ISCSI_FLAG_LOGIN_TRANSIT 0x80 #define ISCSI_FLAG_LOGIN_CONTINUE 0x40 #define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */ +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE1 0x04 +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE2 0x08 +#define ISCSI_FLAG_LOGIN_CURRENT_STAGE3 0x0C #define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */ +#define ISCSI_FLAG_LOGIN_NEXT_STAGE1 0x01 +#define ISCSI_FLAG_LOGIN_NEXT_STAGE2 0x02 +#define ISCSI_FLAG_LOGIN_NEXT_STAGE3 0x03 #define ISCSI_LOGIN_CURRENT_STAGE(flags) \ ((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2) @@ -550,17 +556,25 @@ struct iscsi_logout_rsp { struct iscsi_snack { uint8_t opcode; uint8_t flags; - uint8_t rsvd2[14]; + uint8_t rsvd2[2]; + uint8_t hlength; + uint8_t dlength[3]; + uint8_t lun[8]; itt_t itt; + __be32 ttt; + uint8_t rsvd3[4]; + __be32 exp_statsn; + uint8_t rsvd4[8]; __be32 begrun; __be32 runlength; - __be32 exp_statsn; - __be32 rsvd3; - __be32 exp_datasn; - uint8_t rsvd6[8]; }; /* SNACK PDU flags */ +#define ISCSI_FLAG_SNACK_TYPE_DATA 0 +#define ISCSI_FLAG_SNACK_TYPE_R2T 0 +#define ISCSI_FLAG_SNACK_TYPE_STATUS 1 +#define ISCSI_FLAG_SNACK_TYPE_DATA_ACK 2 +#define ISCSI_FLAG_SNACK_TYPE_RDATA 3 #define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */ /* Reject Message Header */ -- 1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/