[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>
This commit is contained in:
Родитель
7bb66fc06e
Коммит
0c79c74272
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define DRV_NAME "fnic"
|
#define DRV_NAME "fnic"
|
||||||
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
|
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
|
||||||
#define DRV_VERSION "1.5.0.1"
|
#define DRV_VERSION "1.5.0.2"
|
||||||
#define PFX DRV_NAME ": "
|
#define PFX DRV_NAME ": "
|
||||||
#define DFX DRV_NAME "%d: "
|
#define DFX DRV_NAME "%d: "
|
||||||
|
|
||||||
|
|
|
@ -388,17 +388,6 @@ static void fnic_iounmap(struct fnic *fnic)
|
||||||
iounmap(fnic->bar0.vaddr);
|
iounmap(fnic->bar0.vaddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate element for mempools requiring GFP_DMA flag.
|
|
||||||
* Otherwise, checks in kmem_flagcheck() hit BUG_ON().
|
|
||||||
*/
|
|
||||||
static void *fnic_alloc_slab_dma(gfp_t gfp_mask, void *pool_data)
|
|
||||||
{
|
|
||||||
struct kmem_cache *mem = pool_data;
|
|
||||||
|
|
||||||
return kmem_cache_alloc(mem, gfp_mask | GFP_ATOMIC | GFP_DMA);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fnic_get_mac() - get assigned data MAC address for FIP code.
|
* fnic_get_mac() - get assigned data MAC address for FIP code.
|
||||||
* @lport: local port.
|
* @lport: local port.
|
||||||
|
@ -603,14 +592,12 @@ static int __devinit fnic_probe(struct pci_dev *pdev,
|
||||||
if (!fnic->io_req_pool)
|
if (!fnic->io_req_pool)
|
||||||
goto err_out_free_resources;
|
goto err_out_free_resources;
|
||||||
|
|
||||||
pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab,
|
pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
|
||||||
fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]);
|
|
||||||
if (!pool)
|
if (!pool)
|
||||||
goto err_out_free_ioreq_pool;
|
goto err_out_free_ioreq_pool;
|
||||||
fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool;
|
fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool;
|
||||||
|
|
||||||
pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab,
|
pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
|
||||||
fnic_sgl_cache[FNIC_SGL_CACHE_MAX]);
|
|
||||||
if (!pool)
|
if (!pool)
|
||||||
goto err_out_free_dflt_pool;
|
goto err_out_free_dflt_pool;
|
||||||
fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool;
|
fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool;
|
||||||
|
@ -876,7 +863,7 @@ static int __init fnic_init_module(void)
|
||||||
len = sizeof(struct fnic_dflt_sgl_list);
|
len = sizeof(struct fnic_dflt_sgl_list);
|
||||||
fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create
|
fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create
|
||||||
("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN,
|
("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN,
|
||||||
SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA,
|
SLAB_HWCACHE_ALIGN,
|
||||||
NULL);
|
NULL);
|
||||||
if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) {
|
if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) {
|
||||||
printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n");
|
printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n");
|
||||||
|
@ -888,7 +875,7 @@ static int __init fnic_init_module(void)
|
||||||
len = sizeof(struct fnic_sgl_list);
|
len = sizeof(struct fnic_sgl_list);
|
||||||
fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create
|
fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create
|
||||||
("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN,
|
("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN,
|
||||||
SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA,
|
SLAB_HWCACHE_ALIGN,
|
||||||
NULL);
|
NULL);
|
||||||
if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) {
|
if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) {
|
||||||
printk(KERN_ERR PFX "failed to create fnic max sgl slab\n");
|
printk(KERN_ERR PFX "failed to create fnic max sgl slab\n");
|
||||||
|
|
|
@ -406,7 +406,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc, void (*done)(struct scsi_
|
||||||
if (sg_count) {
|
if (sg_count) {
|
||||||
io_req->sgl_list =
|
io_req->sgl_list =
|
||||||
mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type],
|
mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type],
|
||||||
GFP_ATOMIC | GFP_DMA);
|
GFP_ATOMIC);
|
||||||
if (!io_req->sgl_list) {
|
if (!io_req->sgl_list) {
|
||||||
ret = SCSI_MLQUEUE_HOST_BUSY;
|
ret = SCSI_MLQUEUE_HOST_BUSY;
|
||||||
scsi_dma_unmap(sc);
|
scsi_dma_unmap(sc);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче