diff options
author | Jayamohan Kallickal <jayamohank@serverengines.com> | 2009-09-21 22:51:22 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-10-02 15:01:39 -0400 |
commit | b8b9e1b8128d8854cf55740f9ceba3010143520d (patch) | |
tree | b4043ea1ac0d8bd8602628fcb48ffac7ffe8bdbf | |
parent | 6733b39a1301b0b020bbcbf3295852e93e624cb1 (diff) |
[SCSI] libiscsi: iscsi_session_setup to allow for private space
This patch contains changes that allow iscsi_session_setup
to allocate private space for LLD's
Signed-off-by: Jayamohan Kallickal <jayamohank@serverengines.com>
Acked-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/infiniband/ulp/iser/iscsi_iser.c | 2 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_iscsi.c | 6 | ||||
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.h | 5 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 2 | ||||
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 2 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 6 | ||||
-rw-r--r-- | include/scsi/libiscsi.h | 3 |
8 files changed, 19 insertions, 9 deletions
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c index 0ba6ec876296..add9188663ff 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c | |||
@@ -426,7 +426,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, | |||
426 | * because we preallocate so many resources | 426 | * because we preallocate so many resources |
427 | */ | 427 | */ |
428 | cls_session = iscsi_session_setup(&iscsi_iser_transport, shost, | 428 | cls_session = iscsi_session_setup(&iscsi_iser_transport, shost, |
429 | ISCSI_DEF_XMIT_CMDS_MAX, | 429 | ISCSI_DEF_XMIT_CMDS_MAX, 0, |
430 | sizeof(struct iscsi_iser_task), | 430 | sizeof(struct iscsi_iser_task), |
431 | initial_cmdsn, 0); | 431 | initial_cmdsn, 0); |
432 | if (!cls_session) | 432 | if (!cls_session) |
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c index b23526cb39d7..f18e643f3589 100644 --- a/drivers/scsi/be2iscsi/be_iscsi.c +++ b/drivers/scsi/be2iscsi/be_iscsi.c | |||
@@ -44,9 +44,10 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, | |||
44 | struct Scsi_Host *shost; | 44 | struct Scsi_Host *shost; |
45 | struct beiscsi_endpoint *beiscsi_ep; | 45 | struct beiscsi_endpoint *beiscsi_ep; |
46 | struct iscsi_cls_session *cls_session; | 46 | struct iscsi_cls_session *cls_session; |
47 | struct iscsi_session *sess; | ||
48 | struct beiscsi_hba *phba; | 47 | struct beiscsi_hba *phba; |
49 | struct iscsi_task *task; | 48 | struct iscsi_task *task; |
49 | struct iscsi_session *sess; | ||
50 | struct beiscsi_session *beiscsi_sess; | ||
50 | struct beiscsi_io_task *io_task; | 51 | struct beiscsi_io_task *io_task; |
51 | unsigned int max_size, num_cmd; | 52 | unsigned int max_size, num_cmd; |
52 | dma_addr_t bus_add; | 53 | dma_addr_t bus_add; |
@@ -73,7 +74,8 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep, | |||
73 | 74 | ||
74 | cls_session = iscsi_session_setup(&beiscsi_iscsi_transport, | 75 | cls_session = iscsi_session_setup(&beiscsi_iscsi_transport, |
75 | shost, cmds_max, | 76 | shost, cmds_max, |
76 | sizeof(struct beiscsi_io_task), | 77 | sizeof(*beiscsi_sess), |
78 | sizeof(*io_task), | ||
77 | initial_cmdsn, ISCSI_MAX_TARGET); | 79 | initial_cmdsn, ISCSI_MAX_TARGET); |
78 | if (!cls_session) | 80 | if (!cls_session) |
79 | return NULL; | 81 | return NULL; |
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h index 2520c39c594d..387e363b0ec7 100644 --- a/drivers/scsi/be2iscsi/be_main.h +++ b/drivers/scsi/be2iscsi/be_main.h | |||
@@ -327,6 +327,10 @@ struct beiscsi_hba { | |||
327 | struct be_ctrl_info ctrl; | 327 | struct be_ctrl_info ctrl; |
328 | }; | 328 | }; |
329 | 329 | ||
330 | struct beiscsi_session { | ||
331 | struct pci_pool *bhs_pool; | ||
332 | }; | ||
333 | |||
330 | /** | 334 | /** |
331 | * struct beiscsi_conn - iscsi connection structure | 335 | * struct beiscsi_conn - iscsi connection structure |
332 | */ | 336 | */ |
@@ -338,6 +342,7 @@ struct beiscsi_conn { | |||
338 | struct beiscsi_endpoint *ep; | 342 | struct beiscsi_endpoint *ep; |
339 | unsigned short login_in_progress; | 343 | unsigned short login_in_progress; |
340 | struct sgl_handle *plogin_sgl_handle; | 344 | struct sgl_handle *plogin_sgl_handle; |
345 | struct beiscsi_session *beiscsi_sess; | ||
341 | }; | 346 | }; |
342 | 347 | ||
343 | /* This structure is used by the chip */ | 348 | /* This structure is used by the chip */ |
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index 9a7ba71f1af4..cafb888c2376 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -1243,7 +1243,7 @@ bnx2i_session_create(struct iscsi_endpoint *ep, | |||
1243 | cmds_max = BNX2I_SQ_WQES_MIN; | 1243 | cmds_max = BNX2I_SQ_WQES_MIN; |
1244 | 1244 | ||
1245 | cls_session = iscsi_session_setup(&bnx2i_iscsi_transport, shost, | 1245 | cls_session = iscsi_session_setup(&bnx2i_iscsi_transport, shost, |
1246 | cmds_max, sizeof(struct bnx2i_cmd), | 1246 | cmds_max, 0, sizeof(struct bnx2i_cmd), |
1247 | initial_cmdsn, ISCSI_MAX_TARGET); | 1247 | initial_cmdsn, ISCSI_MAX_TARGET); |
1248 | if (!cls_session) | 1248 | if (!cls_session) |
1249 | return NULL; | 1249 | return NULL; |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c index c399f485aa7d..2631bddd255e 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c +++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |||
@@ -422,7 +422,7 @@ cxgb3i_session_create(struct iscsi_endpoint *ep, u16 cmds_max, u16 qdepth, | |||
422 | BUG_ON(hba != iscsi_host_priv(shost)); | 422 | BUG_ON(hba != iscsi_host_priv(shost)); |
423 | 423 | ||
424 | cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost, | 424 | cls_session = iscsi_session_setup(&cxgb3i_iscsi_transport, shost, |
425 | cmds_max, | 425 | cmds_max, 0, |
426 | sizeof(struct iscsi_tcp_task) + | 426 | sizeof(struct iscsi_tcp_task) + |
427 | sizeof(struct cxgb3i_task_data), | 427 | sizeof(struct cxgb3i_task_data), |
428 | initial_cmdsn, ISCSI_MAX_TARGET); | 428 | initial_cmdsn, ISCSI_MAX_TARGET); |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 2b1b834a098b..edc49ca49cea 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -811,7 +811,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max, | |||
811 | goto free_host; | 811 | goto free_host; |
812 | 812 | ||
813 | cls_session = iscsi_session_setup(&iscsi_sw_tcp_transport, shost, | 813 | cls_session = iscsi_session_setup(&iscsi_sw_tcp_transport, shost, |
814 | cmds_max, | 814 | cmds_max, 0, |
815 | sizeof(struct iscsi_tcp_task) + | 815 | sizeof(struct iscsi_tcp_task) + |
816 | sizeof(struct iscsi_sw_tcp_hdrbuf), | 816 | sizeof(struct iscsi_sw_tcp_hdrbuf), |
817 | initial_cmdsn, 0); | 817 | initial_cmdsn, 0); |
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 8dc73c489a17..f1a4246f890c 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -2436,7 +2436,7 @@ static void iscsi_host_dec_session_cnt(struct Scsi_Host *shost) | |||
2436 | */ | 2436 | */ |
2437 | struct iscsi_cls_session * | 2437 | struct iscsi_cls_session * |
2438 | iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, | 2438 | iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, |
2439 | uint16_t cmds_max, int cmd_task_size, | 2439 | uint16_t cmds_max, int dd_size, int cmd_task_size, |
2440 | uint32_t initial_cmdsn, unsigned int id) | 2440 | uint32_t initial_cmdsn, unsigned int id) |
2441 | { | 2441 | { |
2442 | struct iscsi_host *ihost = shost_priv(shost); | 2442 | struct iscsi_host *ihost = shost_priv(shost); |
@@ -2486,7 +2486,8 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, | |||
2486 | scsi_cmds = total_cmds - ISCSI_MGMT_CMDS_MAX; | 2486 | scsi_cmds = total_cmds - ISCSI_MGMT_CMDS_MAX; |
2487 | 2487 | ||
2488 | cls_session = iscsi_alloc_session(shost, iscsit, | 2488 | cls_session = iscsi_alloc_session(shost, iscsit, |
2489 | sizeof(struct iscsi_session)); | 2489 | sizeof(struct iscsi_session) + |
2490 | dd_size); | ||
2490 | if (!cls_session) | 2491 | if (!cls_session) |
2491 | goto dec_session_count; | 2492 | goto dec_session_count; |
2492 | session = cls_session->dd_data; | 2493 | session = cls_session->dd_data; |
@@ -2503,6 +2504,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, | |||
2503 | session->max_cmdsn = initial_cmdsn + 1; | 2504 | session->max_cmdsn = initial_cmdsn + 1; |
2504 | session->max_r2t = 1; | 2505 | session->max_r2t = 1; |
2505 | session->tt = iscsit; | 2506 | session->tt = iscsit; |
2507 | session->dd_data = cls_session->dd_data + sizeof(*session); | ||
2506 | mutex_init(&session->eh_mutex); | 2508 | mutex_init(&session->eh_mutex); |
2507 | spin_lock_init(&session->lock); | 2509 | spin_lock_init(&session->lock); |
2508 | 2510 | ||
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 887e57e3e223..a72edd4eceec 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
@@ -303,6 +303,7 @@ struct iscsi_session { | |||
303 | int cmds_max; /* size of cmds array */ | 303 | int cmds_max; /* size of cmds array */ |
304 | struct iscsi_task **cmds; /* Original Cmds arr */ | 304 | struct iscsi_task **cmds; /* Original Cmds arr */ |
305 | struct iscsi_pool cmdpool; /* PDU's pool */ | 305 | struct iscsi_pool cmdpool; /* PDU's pool */ |
306 | void *dd_data; /* LLD private data */ | ||
306 | }; | 307 | }; |
307 | 308 | ||
308 | enum { | 309 | enum { |
@@ -363,7 +364,7 @@ extern int iscsi_target_alloc(struct scsi_target *starget); | |||
363 | */ | 364 | */ |
364 | extern struct iscsi_cls_session * | 365 | extern struct iscsi_cls_session * |
365 | iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost, | 366 | iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost, |
366 | uint16_t, int, uint32_t, unsigned int); | 367 | uint16_t, int, int, uint32_t, unsigned int); |
367 | extern void iscsi_session_teardown(struct iscsi_cls_session *); | 368 | extern void iscsi_session_teardown(struct iscsi_cls_session *); |
368 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); | 369 | extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *); |
369 | extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, | 370 | extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn, |