diff options
author | Abhijeet Joglekar <abjoglek@cisco.com> | 2011-06-14 00:21:01 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-06-29 17:05:41 -0400 |
commit | 0c79c74272b25bbcfb0149d5a4627ed768795d2d (patch) | |
tree | d9684dfd8a26ecc7192d7ee4a99cfb023d186468 /drivers/scsi | |
parent | 7bb66fc06eb8ac1b823f8221ff1eb574ec3bacb1 (diff) |
[SCSI] fnic: fix incorrect use of SLAB_CACHE_DMA flag
Driver was incorrectly using the SLAB_CACHE_DMA flag when creating a cache
for SGLs. fnic device does not have 24-bit DMA restrictions. Remove the flag
and allocations from ZONE_DMA.
Thanks to Roland Dreier and David Rientjes for pointing out the bug.
Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/fnic/fnic.h | 2 | ||||
-rw-r--r-- | drivers/scsi/fnic/fnic_main.c | 21 | ||||
-rw-r--r-- | drivers/scsi/fnic/fnic_scsi.c | 2 |
3 files changed, 6 insertions, 19 deletions
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h index 671cde9d4060..95a5ba29320d 100644 --- a/drivers/scsi/fnic/fnic.h +++ b/drivers/scsi/fnic/fnic.h | |||
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | #define DRV_NAME "fnic" | 38 | #define DRV_NAME "fnic" |
39 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | 39 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" |
40 | #define DRV_VERSION "1.5.0.1" | 40 | #define DRV_VERSION "1.5.0.2" |
41 | #define PFX DRV_NAME ": " | 41 | #define PFX DRV_NAME ": " |
42 | #define DFX DRV_NAME "%d: " | 42 | #define DFX DRV_NAME "%d: " |
43 | 43 | ||
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c index bb63f1a1f808..fc98eb61e760 100644 --- a/drivers/scsi/fnic/fnic_main.c +++ b/drivers/scsi/fnic/fnic_main.c | |||
@@ -388,17 +388,6 @@ static void fnic_iounmap(struct fnic *fnic) | |||
388 | iounmap(fnic->bar0.vaddr); | 388 | iounmap(fnic->bar0.vaddr); |
389 | } | 389 | } |
390 | 390 | ||
391 | /* | ||
392 | * Allocate element for mempools requiring GFP_DMA flag. | ||
393 | * Otherwise, checks in kmem_flagcheck() hit BUG_ON(). | ||
394 | */ | ||
395 | static void *fnic_alloc_slab_dma(gfp_t gfp_mask, void *pool_data) | ||
396 | { | ||
397 | struct kmem_cache *mem = pool_data; | ||
398 | |||
399 | return kmem_cache_alloc(mem, gfp_mask | GFP_ATOMIC | GFP_DMA); | ||
400 | } | ||
401 | |||
402 | /** | 391 | /** |
403 | * fnic_get_mac() - get assigned data MAC address for FIP code. | 392 | * fnic_get_mac() - get assigned data MAC address for FIP code. |
404 | * @lport: local port. | 393 | * @lport: local port. |
@@ -603,14 +592,12 @@ static int __devinit fnic_probe(struct pci_dev *pdev, | |||
603 | if (!fnic->io_req_pool) | 592 | if (!fnic->io_req_pool) |
604 | goto err_out_free_resources; | 593 | goto err_out_free_resources; |
605 | 594 | ||
606 | pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab, | 595 | pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); |
607 | fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); | ||
608 | if (!pool) | 596 | if (!pool) |
609 | goto err_out_free_ioreq_pool; | 597 | goto err_out_free_ioreq_pool; |
610 | fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; | 598 | fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; |
611 | 599 | ||
612 | pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab, | 600 | pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); |
613 | fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); | ||
614 | if (!pool) | 601 | if (!pool) |
615 | goto err_out_free_dflt_pool; | 602 | goto err_out_free_dflt_pool; |
616 | fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; | 603 | fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; |
@@ -876,7 +863,7 @@ static int __init fnic_init_module(void) | |||
876 | len = sizeof(struct fnic_dflt_sgl_list); | 863 | len = sizeof(struct fnic_dflt_sgl_list); |
877 | fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create | 864 | fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create |
878 | ("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, | 865 | ("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, |
879 | SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA, | 866 | SLAB_HWCACHE_ALIGN, |
880 | NULL); | 867 | NULL); |
881 | if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) { | 868 | if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) { |
882 | printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n"); | 869 | printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n"); |
@@ -888,7 +875,7 @@ static int __init fnic_init_module(void) | |||
888 | len = sizeof(struct fnic_sgl_list); | 875 | len = sizeof(struct fnic_sgl_list); |
889 | fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create | 876 | fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create |
890 | ("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, | 877 | ("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, |
891 | SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA, | 878 | SLAB_HWCACHE_ALIGN, |
892 | NULL); | 879 | NULL); |
893 | if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) { | 880 | if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) { |
894 | printk(KERN_ERR PFX "failed to create fnic max sgl slab\n"); | 881 | printk(KERN_ERR PFX "failed to create fnic max sgl slab\n"); |
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c index 538b31c2cf58..c40ce52ed7c6 100644 --- a/drivers/scsi/fnic/fnic_scsi.c +++ b/drivers/scsi/fnic/fnic_scsi.c | |||
@@ -406,7 +406,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_ | |||
406 | if (sg_count) { | 406 | if (sg_count) { |
407 | io_req->sgl_list = | 407 | io_req->sgl_list = |
408 | mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type], | 408 | mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type], |
409 | GFP_ATOMIC | GFP_DMA); | 409 | GFP_ATOMIC); |
410 | if (!io_req->sgl_list) { | 410 | if (!io_req->sgl_list) { |
411 | ret = SCSI_MLQUEUE_HOST_BUSY; | 411 | ret = SCSI_MLQUEUE_HOST_BUSY; |
412 | scsi_dma_unmap(sc); | 412 | scsi_dma_unmap(sc); |