aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/be2iscsi/be_iscsi.c
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohank@serverengines.com>2009-09-21 22:52:26 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-10-02 15:01:55 -0400
commit2afc95bf546a961d2936d886c3802e159f1bae6b (patch)
treeb898db3b79c260dac3f050955fc512c118f97efe /drivers/scsi/be2iscsi/be_iscsi.c
parentb8b9e1b8128d8854cf55740f9ceba3010143520d (diff)
[SCSI] be2iscsi: Moving to pci_pools v3
This patch contains changes to use pci_pools for iscsi hdr instead of pci_alloc_consistent. Here we alloc and free to pool for every IO v3: - Remove cleanup loop in beiscsi_session_destroy - Fixup for allocation failure handling in beiscsi_alloc_pdu - Removed unused variable in beiscsi_session_destroy. [jejb: fix up pci_pool_alloc address sizing problem] Signed-off-by: Jayamohan Kallickal <jayamohank@serverengines.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/be2iscsi/be_iscsi.c')
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c46
1 files changed, 18 insertions, 28 deletions
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index f18e643f3589..2fd25442cfaf 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -45,14 +45,9 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
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 beiscsi_hba *phba; 47 struct beiscsi_hba *phba;
48 struct iscsi_task *task;
49 struct iscsi_session *sess; 48 struct iscsi_session *sess;
50 struct beiscsi_session *beiscsi_sess; 49 struct beiscsi_session *beiscsi_sess;
51 struct beiscsi_io_task *io_task; 50 struct beiscsi_io_task *io_task;
52 unsigned int max_size, num_cmd;
53 dma_addr_t bus_add;
54 u64 pa_addr;
55 void *vaddr;
56 51
57 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n"); 52 SE_DEBUG(DBG_LVL_8, "In beiscsi_session_create\n");
58 53
@@ -80,20 +75,18 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
80 if (!cls_session) 75 if (!cls_session)
81 return NULL; 76 return NULL;
82 sess = cls_session->dd_data; 77 sess = cls_session->dd_data;
83 max_size = ALIGN(sizeof(struct be_cmd_bhs), 64) * sess->cmds_max; 78 beiscsi_sess = sess->dd_data;
84 vaddr = pci_alloc_consistent(phba->pcidev, max_size, &bus_add); 79 beiscsi_sess->bhs_pool = pci_pool_create("beiscsi_bhs_pool",
85 pa_addr = (__u64) bus_add; 80 phba->pcidev,
86 81 sizeof(struct be_cmd_bhs),
87 for (num_cmd = 0; num_cmd < sess->cmds_max; num_cmd++) { 82 64, 0);
88 task = sess->cmds[num_cmd]; 83 if (!beiscsi_sess->bhs_pool)
89 io_task = task->dd_data; 84 goto destroy_sess;
90 io_task->cmd_bhs = vaddr; 85
91 io_task->bhs_pa.u.a64.address = pa_addr;
92 io_task->alloc_size = max_size;
93 vaddr += ALIGN(sizeof(struct be_cmd_bhs), 64);
94 pa_addr += ALIGN(sizeof(struct be_cmd_bhs), 64);
95 }
96 return cls_session; 86 return cls_session;
87destroy_sess:
88 iscsi_session_teardown(cls_session);
89 return NULL;
97} 90}
98 91
99/** 92/**
@@ -105,18 +98,10 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,
105 */ 98 */
106void beiscsi_session_destroy(struct iscsi_cls_session *cls_session) 99void beiscsi_session_destroy(struct iscsi_cls_session *cls_session)
107{ 100{
108 struct iscsi_task *task;
109 struct beiscsi_io_task *io_task;
110 struct iscsi_session *sess = cls_session->dd_data; 101 struct iscsi_session *sess = cls_session->dd_data;
111 struct Scsi_Host *shost = iscsi_session_to_shost(cls_session); 102 struct beiscsi_session *beiscsi_sess = sess->dd_data;
112 struct beiscsi_hba *phba = iscsi_host_priv(shost);
113 103
114 task = sess->cmds[0]; 104 pci_pool_destroy(beiscsi_sess->bhs_pool);
115 io_task = task->dd_data;
116 pci_free_consistent(phba->pcidev,
117 io_task->alloc_size,
118 io_task->cmd_bhs,
119 io_task->bhs_pa.u.a64.address);
120 iscsi_session_teardown(cls_session); 105 iscsi_session_teardown(cls_session);
121} 106}
122 107
@@ -133,6 +118,8 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
133 struct iscsi_cls_conn *cls_conn; 118 struct iscsi_cls_conn *cls_conn;
134 struct beiscsi_conn *beiscsi_conn; 119 struct beiscsi_conn *beiscsi_conn;
135 struct iscsi_conn *conn; 120 struct iscsi_conn *conn;
121 struct iscsi_session *sess;
122 struct beiscsi_session *beiscsi_sess;
136 123
137 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid" 124 SE_DEBUG(DBG_LVL_8, "In beiscsi_conn_create ,cid"
138 "from iscsi layer=%d\n", cid); 125 "from iscsi layer=%d\n", cid);
@@ -148,6 +135,9 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)
148 beiscsi_conn->ep = NULL; 135 beiscsi_conn->ep = NULL;
149 beiscsi_conn->phba = phba; 136 beiscsi_conn->phba = phba;
150 beiscsi_conn->conn = conn; 137 beiscsi_conn->conn = conn;
138 sess = cls_session->dd_data;
139 beiscsi_sess = sess->dd_data;
140 beiscsi_conn->beiscsi_sess = beiscsi_sess;
151 return cls_conn; 141 return cls_conn;
152} 142}
153 143