Skip to content

Commit 1235218

Browse files
author
Nicholas Bellinger
committed
iscsi: Resolve iscsi_proto.h naming conflicts with drivers/target/iscsi
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_req *) 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: Mike Christie <[email protected]> Signed-off-by: Nicholas A. Bellinger <[email protected]>
1 parent bbd9d6f commit 1235218

File tree

6 files changed

+33
-19
lines changed

6 files changed

+33
-19
lines changed

drivers/infiniband/ulp/iser/iser_initiator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ int iser_send_command(struct iscsi_conn *conn,
271271
unsigned long edtl;
272272
int err;
273273
struct iser_data_buf *data_buf;
274-
struct iscsi_cmd *hdr = (struct iscsi_cmd *)task->hdr;
274+
struct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)task->hdr;
275275
struct scsi_cmnd *sc = task->sc;
276276
struct iser_tx_desc *tx_desc = &iser_task->desc;
277277

drivers/scsi/be2iscsi/be_main.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ struct amap_pdu_data_out {
397397
};
398398

399399
struct be_cmd_bhs {
400-
struct iscsi_cmd iscsi_hdr;
400+
struct iscsi_scsi_req iscsi_hdr;
401401
unsigned char pad1[16];
402402
struct pdu_data_out iscsi_data_pdu;
403403
unsigned char pad2[BE_SENSE_INFO_SIZE -
@@ -428,7 +428,7 @@ struct be_nonio_bhs {
428428
};
429429

430430
struct be_status_bhs {
431-
struct iscsi_cmd iscsi_hdr;
431+
struct iscsi_scsi_req iscsi_hdr;
432432
unsigned char pad1[16];
433433
/**
434434
* The plus 2 below is to hold the sense info length that gets

drivers/scsi/bnx2i/bnx2i_hwi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,11 @@ int bnx2i_send_iscsi_login(struct bnx2i_conn *bnx2i_conn,
328328
{
329329
struct bnx2i_cmd *bnx2i_cmd;
330330
struct bnx2i_login_request *login_wqe;
331-
struct iscsi_login *login_hdr;
331+
struct iscsi_login_req *login_hdr;
332332
u32 dword;
333333

334334
bnx2i_cmd = (struct bnx2i_cmd *)task->dd_data;
335-
login_hdr = (struct iscsi_login *)task->hdr;
335+
login_hdr = (struct iscsi_login_req *)task->hdr;
336336
login_wqe = (struct bnx2i_login_request *)
337337
bnx2i_conn->ep->qp.sq_prod_qe;
338338

@@ -1344,7 +1344,7 @@ static int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session,
13441344
struct bnx2i_cmd_response *resp_cqe;
13451345
struct bnx2i_cmd *bnx2i_cmd;
13461346
struct iscsi_task *task;
1347-
struct iscsi_cmd_rsp *hdr;
1347+
struct iscsi_scsi_rsp *hdr;
13481348
u32 datalen = 0;
13491349

13501350
resp_cqe = (struct bnx2i_cmd_response *)cqe;
@@ -1371,7 +1371,7 @@ static int bnx2i_process_scsi_cmd_resp(struct iscsi_session *session,
13711371
}
13721372
bnx2i_iscsi_unmap_sg_list(bnx2i_cmd);
13731373

1374-
hdr = (struct iscsi_cmd_rsp *)task->hdr;
1374+
hdr = (struct iscsi_scsi_rsp *)task->hdr;
13751375
resp_cqe = (struct bnx2i_cmd_response *)cqe;
13761376
hdr->opcode = resp_cqe->op_code;
13771377
hdr->max_cmdsn = cpu_to_be32(resp_cqe->max_cmd_sn);

drivers/scsi/bnx2i/bnx2i_iscsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ static int bnx2i_task_xmit(struct iscsi_task *task)
12121212
struct bnx2i_conn *bnx2i_conn = conn->dd_data;
12131213
struct scsi_cmnd *sc = task->sc;
12141214
struct bnx2i_cmd *cmd = task->dd_data;
1215-
struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr;
1215+
struct iscsi_scsi_req *hdr = (struct iscsi_scsi_req *)task->hdr;
12161216

12171217
if (bnx2i_conn->ep->num_active_cmds + 1 > hba->max_sqes)
12181218
return -ENOMEM;

drivers/scsi/libiscsi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
360360
struct iscsi_conn *conn = task->conn;
361361
struct iscsi_session *session = conn->session;
362362
struct scsi_cmnd *sc = task->sc;
363-
struct iscsi_cmd *hdr;
363+
struct iscsi_scsi_req *hdr;
364364
unsigned hdrlength, cmd_len;
365365
itt_t itt;
366366
int rc;
@@ -374,7 +374,7 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
374374
if (rc)
375375
return rc;
376376
}
377-
hdr = (struct iscsi_cmd *) task->hdr;
377+
hdr = (struct iscsi_scsi_req *)task->hdr;
378378
itt = hdr->itt;
379379
memset(hdr, 0, sizeof(*hdr));
380380

@@ -830,7 +830,7 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
830830
struct iscsi_task *task, char *data,
831831
int datalen)
832832
{
833-
struct iscsi_cmd_rsp *rhdr = (struct iscsi_cmd_rsp *)hdr;
833+
struct iscsi_scsi_rsp *rhdr = (struct iscsi_scsi_rsp *)hdr;
834834
struct iscsi_session *session = conn->session;
835835
struct scsi_cmnd *sc = task->sc;
836836

include/scsi/iscsi_proto.h

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct iscsi_ahs_hdr {
116116
#define ISCSI_CDB_SIZE 16
117117

118118
/* iSCSI PDU Header */
119-
struct iscsi_cmd {
119+
struct iscsi_scsi_req {
120120
uint8_t opcode;
121121
uint8_t flags;
122122
__be16 rsvd2;
@@ -161,7 +161,7 @@ struct iscsi_ecdb_ahdr {
161161
};
162162

163163
/* SCSI Response Header */
164-
struct iscsi_cmd_rsp {
164+
struct iscsi_scsi_rsp {
165165
uint8_t opcode;
166166
uint8_t flags;
167167
uint8_t response;
@@ -406,7 +406,7 @@ struct iscsi_text_rsp {
406406
};
407407

408408
/* Login Header */
409-
struct iscsi_login {
409+
struct iscsi_login_req {
410410
uint8_t opcode;
411411
uint8_t flags;
412412
uint8_t max_version; /* Max. version supported */
@@ -427,7 +427,13 @@ struct iscsi_login {
427427
#define ISCSI_FLAG_LOGIN_TRANSIT 0x80
428428
#define ISCSI_FLAG_LOGIN_CONTINUE 0x40
429429
#define ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK 0x0C /* 2 bits */
430+
#define ISCSI_FLAG_LOGIN_CURRENT_STAGE1 0x04
431+
#define ISCSI_FLAG_LOGIN_CURRENT_STAGE2 0x08
432+
#define ISCSI_FLAG_LOGIN_CURRENT_STAGE3 0x0C
430433
#define ISCSI_FLAG_LOGIN_NEXT_STAGE_MASK 0x03 /* 2 bits */
434+
#define ISCSI_FLAG_LOGIN_NEXT_STAGE1 0x01
435+
#define ISCSI_FLAG_LOGIN_NEXT_STAGE2 0x02
436+
#define ISCSI_FLAG_LOGIN_NEXT_STAGE3 0x03
431437

432438
#define ISCSI_LOGIN_CURRENT_STAGE(flags) \
433439
((flags & ISCSI_FLAG_LOGIN_CURRENT_STAGE_MASK) >> 2)
@@ -550,17 +556,25 @@ struct iscsi_logout_rsp {
550556
struct iscsi_snack {
551557
uint8_t opcode;
552558
uint8_t flags;
553-
uint8_t rsvd2[14];
559+
uint8_t rsvd2[2];
560+
uint8_t hlength;
561+
uint8_t dlength[3];
562+
uint8_t lun[8];
554563
itt_t itt;
564+
__be32 ttt;
565+
uint8_t rsvd3[4];
566+
__be32 exp_statsn;
567+
uint8_t rsvd4[8];
555568
__be32 begrun;
556569
__be32 runlength;
557-
__be32 exp_statsn;
558-
__be32 rsvd3;
559-
__be32 exp_datasn;
560-
uint8_t rsvd6[8];
561570
};
562571

563572
/* SNACK PDU flags */
573+
#define ISCSI_FLAG_SNACK_TYPE_DATA 0
574+
#define ISCSI_FLAG_SNACK_TYPE_R2T 0
575+
#define ISCSI_FLAG_SNACK_TYPE_STATUS 1
576+
#define ISCSI_FLAG_SNACK_TYPE_DATA_ACK 2
577+
#define ISCSI_FLAG_SNACK_TYPE_RDATA 3
564578
#define ISCSI_FLAG_SNACK_TYPE_MASK 0x0F /* 4 bits */
565579

566580
/* Reject Message Header */

0 commit comments

Comments
 (0)