be2iscsi: Moving to pci_pools v3
Subsystems (2)
PATCH 2/2 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.
--- drivers/scsi/be2iscsi/be_iscsi.c | 44 +++++++++--------------- drivers/scsi/be2iscsi/be_main.c | 67 +++++++++++++++++-------------------- drivers/scsi/be2iscsi/be_main.h | 1 - 3 files changed, 48 insertions(+), 64 deletions(-)
drivers/scsi/be2iscsi/be_iscsi.c +18 -28
@@ -45,14 +45,9 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,struct beiscsi_endpoint *beiscsi_ep;struct iscsi_cls_session *cls_session;struct beiscsi_hba *phba; -struct iscsi_task *task;struct iscsi_session *sess;struct beiscsi_session *beiscsi_sess;struct beiscsi_io_task *io_task; -unsigned int max_size, num_cmd; -dma_addr_t bus_add; -u64 pa_addr; -void *vaddr;SE_DEBUG (DBG_LVL_8 ,"In beiscsi_session_create\n" );
@@ -80,20 +75,18 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,if (!cls_session)return NULL ; sess = cls_session->dd_data; - max_size =ALIGN (sizeof (struct be_cmd_bhs ),64 ) * sess->cmds_max; - vaddr =pci_alloc_consistent (phba->pcidev, max_size, &bus_add); - pa_addr = (__u64 ) bus_add; - -for (num_cmd =0 ; num_cmd < sess->cmds_max; num_cmd++) { - task = sess->cmds[num_cmd]; - io_task = task->dd_data; - io_task->cmd_bhs = vaddr; - io_task->bhs_pa.u.a64.address = pa_addr; - io_task->alloc_size = max_size; - vaddr +=ALIGN (sizeof (struct be_cmd_bhs ),64 ); - pa_addr +=ALIGN (sizeof (struct be_cmd_bhs ),64 ); - } + beiscsi_sess = sess->dd_data; + beiscsi_sess->bhs_pool =pci_pool_create ("beiscsi_bhs_pool" , + phba->pcidev, +sizeof (struct be_cmd_bhs ), +64 ,0 ); +if (!beiscsi_sess->bhs_pool) + goto destroy_sess; +return cls_session; +destroy_sess: +iscsi_session_teardown (cls_session); +return NULL ; }/**
@@ -105,18 +98,10 @@ struct iscsi_cls_session *beiscsi_session_create(struct iscsi_endpoint *ep,*/ void beiscsi_session_destroy (struct iscsi_cls_session *cls_session) { -struct iscsi_task *task; -struct beiscsi_io_task *io_task;struct iscsi_session *sess = cls_session->dd_data; -struct Scsi_Host *shost =iscsi_session_to_shost (cls_session); -struct beiscsi_hba *phba =iscsi_host_priv (shost); +struct beiscsi_session *beiscsi_sess = sess->dd_data; - task = sess->cmds[0 ]; - io_task = task->dd_data; -pci_free_consistent (phba->pcidev, - io_task->alloc_size, - io_task->cmd_bhs, - io_task->bhs_pa.u.a64.address); +pci_pool_destroy (beiscsi_sess->bhs_pool);iscsi_session_teardown (cls_session); }
@@ -133,6 +118,8 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid)struct iscsi_cls_conn *cls_conn;struct beiscsi_conn *beiscsi_conn;struct iscsi_conn *conn; +struct iscsi_session *sess; +struct beiscsi_session *beiscsi_sess;SE_DEBUG (DBG_LVL_8 ,"In beiscsi_conn_create ,cid" "from iscsi layer=%d\n" , cid);
@@ -148,6 +135,9 @@ beiscsi_conn_create(struct iscsi_cls_session *cls_session, u32 cid) beiscsi_conn->ep =NULL ; beiscsi_conn->phba = phba; beiscsi_conn->conn = conn; + sess = cls_session->dd_data; + beiscsi_sess = sess->dd_data; + beiscsi_conn->beiscsi_sess = beiscsi_sess;return cls_conn; }
drivers/scsi/be2iscsi/be_main.c +31 -36
121 lines not on this page · raw message
drivers/scsi/be2iscsi/be_main.h +0 -1
@@ -391,7 +391,6 @@ struct beiscsi_io_task {unsigned short cid;unsigned short header_len; -unsigned int alloc_size;struct be_cmd_bhs *cmd_bhs;struct be_bus_address bhs_pa;unsigned short bhs_len;
Signature · 1 line
1.6.4
Quoted 10 lines · Jayamohan Kallickal
This patch contains changes to use
pci_poolsfor iscsi hdr
instead ofpci_alloc_consistent. Here we alloc and free to pool for every IOv3:
- Remove cleanup loop inbeiscsi_session_destroy
- Fixup for allocation failure handling inbeiscsi_alloc_pdu
- Removed unused variable inbeiscsi_session_destroy.Signed-off-by Jayamohan Kallickal<[email protected]>
Thanks for fixing those issues.
Quoted 10 lines · Mike Christie
Quoted 9 lines · Jayamohan Kallickal
This patch contains changes to use
pci_poolsfor iscsi hdr
instead ofpci_alloc_consistent. Here we alloc and free to pool for every IOv3:
- Remove cleanup loop inbeiscsi_session_destroy
- Fixup for allocation failure handling inbeiscsi_alloc_pdu
- Removed unused variable inbeiscsi_session_destroy.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jayamohan Kallickal<[email protected]>Thanks for fixing those issues.
Reviewed-by Mike Christie <[email protected]>
Actually, this isn't building correctly for me in my 32 bit environment:
drivers/scsi/be2iscsi/be_main.c: In function ‘beiscsi_alloc_pdu’:drivers/scsi/be2iscsi/be_main.c:2885: warning: passing argument 3 of ‘dma_pool_alloc’ from incompatible pointer type
The problem is this unsigned long long definition of a64: dma_addr_t is only a long (32 bits) on this platform.
This patch fixes the problem for me ... I'll just fold it in if everyone's OK with it.
James
---
drivers/scsi/be2iscsi/be_main.c +4 -2
@@ -2881,13 +2881,15 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)struct hwi_controller *phwi_ctrlr;itt_t itt;struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; +dma_addr_t paddr; io_task->cmd_bhs =pci_pool_alloc (beiscsi_sess->bhs_pool, -GFP_KERNEL , - &io_task->bhs_pa.u.a64.address); +GFP_KERNEL , &paddr); +if (!io_task->cmd_bhs)return -ENOMEM ; + io_task->bhs_pa.u.a64.address = paddr; io_task->pwrb_handle =alloc_wrb_handle (phba, beiscsi_conn->beiscsi_conn_cid, task->itt);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 46 lines · James Bottomley
Quoted 10 lines · Mike Christie
Quoted 9 lines · Jayamohan Kallickal
This patch contains changes to use
pci_poolsfor iscsi hdr
instead ofpci_alloc_consistent. Here we alloc and free to pool for every IOv3:
- Remove cleanup loop inbeiscsi_session_destroy
- Fixup for allocation failure handling inbeiscsi_alloc_pdu
- Removed unused variable inbeiscsi_session_destroy.Quoted 4 lines
Quoted 1 line
Signed-off-by Jayamohan Kallickal<[email protected]>Thanks for fixing those issues.
Reviewed-by Mike Christie<[email protected]>Actually, this isn't building correctly for me in my 32 bit environment:
drivers/scsi/be2iscsi/be_main.c: In function ‘beiscsi_alloc_pdu’:drivers/scsi/be2iscsi/be_main.c:2885: warning: passing argument 3 of ‘dma_pool_alloc’ from incompatible pointer typeThe problem is this unsigned long long definition of a64:
dma_addr_tis only a long (32 bits) on this platform.This patch fixes the problem for me ... I'll just fold it in if everyone's OK with it.
James
---
drivers/scsi/be2iscsi/be_main.c +1
-1@@ -2881,13 +2881,15 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)struct hwi_controller *phwi_ctrlr;itt_t itt;struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; +dma_addr_t paddr; io_task->cmd_bhs = pci_pool_alloc(beiscsi_sess->bhs_pool, - GFP_KERNEL,
drivers/scsi/be2iscsi/be_main.c static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) · line 2895
Quoted 10 lines
drivers/scsi/be2iscsi/be_main.c +3
-1- &io_task->bhs_pa.u.a64.address); + GFP_KERNEL,&paddr); +if (!io_task->cmd_bhs)return -ENOMEM ; + io_task->bhs_pa.u.a64.address = paddr; io_task->pwrb_handle =alloc_wrb_handle (phba, beiscsi_conn->beiscsi_conn_cid, task->itt);
Looks ok to me.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Looks OK to me
-Jay
_____
From: James Bottomley [mailto:[email protected]]
To: Mike Christie [mailto:[email protected]]
Cc: Jayamohan Kalickal [mailto:[email protected]], [email protected]
Sent: Sat, 26 Sep 2009 09:30:22 -0700
Subject: Re: [PATCH 2/2] be2iscsi: Moving to pci_pools v3
Quoted 10 lines · Mike Christie
Quoted 9 lines · Jayamohan Kallickal
This patch contains changes to use
pci_poolsfor iscsi hdr
instead ofpci_alloc_consistent. Here we alloc and free to pool for every IOv3:
- Remove cleanup loop inbeiscsi_session_destroy
- Fixup for allocation failure handling inbeiscsi_alloc_pdu
- Removed unused variable inbeiscsi_session_destroy.
Quoted 5 lines
Quoted 1 line
Signed-off-by Jayamohan Kallickal<[email protected]>Thanks for fixing those issues.
Reviewed-by Mike Christie <[email protected]>
Actually, this isn't building correctly for me in my 32 bit environment:
drivers/scsi/be2iscsi/be_main.c: In function ‘beiscsi_alloc_pdu’:drivers/scsi/be2iscsi/be_main.c:2885: warning: passing argument 3 of ‘dma_pool_alloc’ from incompatible pointer type
The problem is this unsigned long long definition of a64: dma_addr_t is only a long (32 bits) on this platform.
This patch fixes the problem for me ... I'll just fold it in if everyone's OK with it.
James
---
drivers/scsi/be2iscsi/be_main.c +4 -2
@@ -2881,13 +2881,15 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode)struct hwi_controller *phwi_ctrlr;itt_t itt;struct beiscsi_session *beiscsi_sess = beiscsi_conn->beiscsi_sess; +dma_addr_t paddr; io_task->cmd_bhs =pci_pool_alloc (beiscsi_sess->bhs_pool, -GFP_KERNEL , - &io_task->bhs_pa.u.a64.address); +GFP_KERNEL , &paddr); +if (!io_task->cmd_bhs)return -ENOMEM ; + io_task->bhs_pa.u.a64.address = paddr; io_task->pwrb_handle =alloc_wrb_handle (phba, beiscsi_conn->beiscsi_conn_cid, task->itt);
___________________________________________________________________________________
This message, together with any attachment(s), contains confidential and proprietary information of ServerEngines Corporation and is intended only for the designated recipient(s) named above. Any unauthorized review, printing, retention, copying, disclosure or distribution is strictly prohibited. If you are not the intended recipient of this message, please immediately advise the sender by reply email message and delete all copies of this message and any attachment(s). Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html