libiscsi.c (1669b049db50fc7f1d4e694fb115a0f408c63fce) | libiscsi.c (b8b9e1b8128d8854cf55740f9ceba3010143520d) |
---|---|
1/* 2 * iSCSI lib functions 3 * 4 * Copyright (C) 2006 Red Hat, Inc. All rights reserved. 5 * Copyright (C) 2004 - 2006 Mike Christie 6 * Copyright (C) 2004 - 2005 Dmitry Yusupov 7 * Copyright (C) 2004 - 2005 Alex Aizman 8 * maintained by open-iscsi@googlegroups.com --- 2422 unchanged lines hidden (view full) --- 2431 * a session per scsi host. 2432 * 2433 * Callers should set cmds_max to the largest total numer (mgmt + scsi) of 2434 * tasks they support. The iscsi layer reserves ISCSI_MGMT_CMDS_MAX tasks 2435 * for nop handling and login/logout requests. 2436 */ 2437struct iscsi_cls_session * 2438iscsi_session_setup(struct iscsi_transport *iscsit, struct Scsi_Host *shost, | 1/* 2 * iSCSI lib functions 3 * 4 * Copyright (C) 2006 Red Hat, Inc. All rights reserved. 5 * Copyright (C) 2004 - 2006 Mike Christie 6 * Copyright (C) 2004 - 2005 Dmitry Yusupov 7 * Copyright (C) 2004 - 2005 Alex Aizman 8 * maintained by open-iscsi@googlegroups.com --- 2422 unchanged lines hidden (view full) --- 2431 * a session per scsi host. 2432 * 2433 * Callers should set cmds_max to the largest total numer (mgmt + scsi) of 2434 * tasks they support. The iscsi layer reserves ISCSI_MGMT_CMDS_MAX tasks 2435 * for nop handling and login/logout requests. 2436 */ 2437struct iscsi_cls_session * 2438iscsi_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) 2441{ 2442 struct iscsi_host *ihost = shost_priv(shost); 2443 struct iscsi_session *session; 2444 struct iscsi_cls_session *cls_session; 2445 int cmd_i, scsi_cmds, total_cmds = cmds_max; 2446 unsigned long flags; 2447 --- 33 unchanged lines hidden (view full) --- 2481 if (total_cmds < ISCSI_TOTAL_CMDS_MIN) 2482 return NULL; 2483 printk(KERN_INFO "iscsi: Rounding can_queue to %d.\n", 2484 total_cmds); 2485 } 2486 scsi_cmds = total_cmds - ISCSI_MGMT_CMDS_MAX; 2487 2488 cls_session = iscsi_alloc_session(shost, iscsit, | 2440 uint32_t initial_cmdsn, unsigned int id) 2441{ 2442 struct iscsi_host *ihost = shost_priv(shost); 2443 struct iscsi_session *session; 2444 struct iscsi_cls_session *cls_session; 2445 int cmd_i, scsi_cmds, total_cmds = cmds_max; 2446 unsigned long flags; 2447 --- 33 unchanged lines hidden (view full) --- 2481 if (total_cmds < ISCSI_TOTAL_CMDS_MIN) 2482 return NULL; 2483 printk(KERN_INFO "iscsi: Rounding can_queue to %d.\n", 2484 total_cmds); 2485 } 2486 scsi_cmds = total_cmds - ISCSI_MGMT_CMDS_MAX; 2487 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 goto dec_session_count; 2492 session = cls_session->dd_data; 2493 session->cls_session = cls_session; 2494 session->host = shost; 2495 session->state = ISCSI_STATE_FREE; 2496 session->fast_abort = 1; 2497 session->lu_reset_timeout = 15; 2498 session->abort_timeout = 10; 2499 session->scsi_cmds_max = scsi_cmds; 2500 session->cmds_max = total_cmds; 2501 session->queued_cmdsn = session->cmdsn = initial_cmdsn; 2502 session->exp_cmdsn = initial_cmdsn + 1; 2503 session->max_cmdsn = initial_cmdsn + 1; 2504 session->max_r2t = 1; 2505 session->tt = iscsit; | 2491 if (!cls_session) 2492 goto dec_session_count; 2493 session = cls_session->dd_data; 2494 session->cls_session = cls_session; 2495 session->host = shost; 2496 session->state = ISCSI_STATE_FREE; 2497 session->fast_abort = 1; 2498 session->lu_reset_timeout = 15; 2499 session->abort_timeout = 10; 2500 session->scsi_cmds_max = scsi_cmds; 2501 session->cmds_max = total_cmds; 2502 session->queued_cmdsn = session->cmdsn = initial_cmdsn; 2503 session->exp_cmdsn = initial_cmdsn + 1; 2504 session->max_cmdsn = initial_cmdsn + 1; 2505 session->max_r2t = 1; 2506 session->tt = iscsit; |
2507 session->dd_data = cls_session->dd_data + sizeof(*session); |
|
2506 mutex_init(&session->eh_mutex); 2507 spin_lock_init(&session->lock); 2508 2509 /* initialize SCSI PDU commands pool */ 2510 if (iscsi_pool_init(&session->cmdpool, session->cmds_max, 2511 (void***)&session->cmds, 2512 cmd_task_size + sizeof(struct iscsi_task))) 2513 goto cmdpool_alloc_fail; --- 672 unchanged lines hidden --- | 2508 mutex_init(&session->eh_mutex); 2509 spin_lock_init(&session->lock); 2510 2511 /* initialize SCSI PDU commands pool */ 2512 if (iscsi_pool_init(&session->cmdpool, session->cmds_max, 2513 (void***)&session->cmds, 2514 cmd_task_size + sizeof(struct iscsi_task))) 2515 goto cmdpool_alloc_fail; --- 672 unchanged lines hidden --- |