Commit 0b15fb1f authored by Xiangliang Yu's avatar Xiangliang Yu Committed by James Bottomley

[SCSI] mvsas: add support for Task collector mode and fixed relative bugs

1. Add support for Task collector mode.
2. Fixed relative collector mode bug:
   - I/O failed when disks is on two ports
   - system hang when hotplug disk
   - system hang when unplug disk during run IO
3. Unlock ap->lock within .lldd_execute_task for direct mode to
   improve performance
Signed-off-by: default avatarXiangliang Yu <yuxiangl@marvell.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 82140283
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
# Copyright 2007 Red Hat, Inc. # Copyright 2007 Red Hat, Inc.
# Copyright 2008 Marvell. <kewei@marvell.com> # Copyright 2008 Marvell. <kewei@marvell.com>
# Copyright 2009-20011 Marvell. <yuxiangl@marvell.com>
# #
# This file is licensed under GPLv2. # This file is licensed under GPLv2.
# #
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# #
# Copyright 2007 Red Hat, Inc. # Copyright 2007 Red Hat, Inc.
# Copyright 2008 Marvell. <kewei@marvell.com> # Copyright 2008 Marvell. <kewei@marvell.com>
# Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
# #
# This file is licensed under GPLv2. # This file is licensed under GPLv2.
# #
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
...@@ -25,7 +26,16 @@ ...@@ -25,7 +26,16 @@
#include "mv_sas.h" #include "mv_sas.h"
static int lldd_max_execute_num = 1;
module_param_named(collector, lldd_max_execute_num, int, S_IRUGO);
MODULE_PARM_DESC(collector, "\n"
"\tIf greater than one, tells the SAS Layer to run in Task Collector\n"
"\tMode. If 1 or 0, tells the SAS Layer to run in Direct Mode.\n"
"\tThe mvsas SAS LLDD supports both modes.\n"
"\tDefault: 1 (Direct Mode).\n");
static struct scsi_transport_template *mvs_stt; static struct scsi_transport_template *mvs_stt;
struct kmem_cache *mvs_task_list_cache;
static const struct mvs_chip_info mvs_chips[] = { static const struct mvs_chip_info mvs_chips[] = {
[chip_6320] = { 1, 2, 0x400, 17, 16, 9, &mvs_64xx_dispatch, }, [chip_6320] = { 1, 2, 0x400, 17, 16, 9, &mvs_64xx_dispatch, },
[chip_6440] = { 1, 4, 0x400, 17, 16, 9, &mvs_64xx_dispatch, }, [chip_6440] = { 1, 4, 0x400, 17, 16, 9, &mvs_64xx_dispatch, },
...@@ -109,7 +119,6 @@ static void __devinit mvs_phy_init(struct mvs_info *mvi, int phy_id) ...@@ -109,7 +119,6 @@ static void __devinit mvs_phy_init(struct mvs_info *mvi, int phy_id)
static void mvs_free(struct mvs_info *mvi) static void mvs_free(struct mvs_info *mvi)
{ {
int i;
struct mvs_wq *mwq; struct mvs_wq *mwq;
int slot_nr; int slot_nr;
...@@ -121,12 +130,8 @@ static void mvs_free(struct mvs_info *mvi) ...@@ -121,12 +130,8 @@ static void mvs_free(struct mvs_info *mvi)
else else
slot_nr = MVS_SLOTS; slot_nr = MVS_SLOTS;
for (i = 0; i < mvi->tags_num; i++) { if (mvi->dma_pool)
struct mvs_slot_info *slot = &mvi->slot_info[i]; pci_pool_destroy(mvi->dma_pool);
if (slot->buf)
dma_free_coherent(mvi->dev, MVS_SLOT_BUF_SZ,
slot->buf, slot->buf_dma);
}
if (mvi->tx) if (mvi->tx)
dma_free_coherent(mvi->dev, dma_free_coherent(mvi->dev,
...@@ -215,6 +220,7 @@ static irqreturn_t mvs_interrupt(int irq, void *opaque) ...@@ -215,6 +220,7 @@ static irqreturn_t mvs_interrupt(int irq, void *opaque)
static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
{ {
int i = 0, slot_nr; int i = 0, slot_nr;
char pool_name[32];
if (mvi->flags & MVF_FLAG_SOC) if (mvi->flags & MVF_FLAG_SOC)
slot_nr = MVS_SOC_SLOTS; slot_nr = MVS_SOC_SLOTS;
...@@ -274,18 +280,14 @@ static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost) ...@@ -274,18 +280,14 @@ static int __devinit mvs_alloc(struct mvs_info *mvi, struct Scsi_Host *shost)
if (!mvi->bulk_buffer) if (!mvi->bulk_buffer)
goto err_out; goto err_out;
#endif #endif
for (i = 0; i < slot_nr; i++) { sprintf(pool_name, "%s%d", "mvs_dma_pool", mvi->id);
struct mvs_slot_info *slot = &mvi->slot_info[i]; mvi->dma_pool = pci_pool_create(pool_name, mvi->pdev, MVS_SLOT_BUF_SZ, 16, 0);
if (!mvi->dma_pool) {
slot->buf = dma_alloc_coherent(mvi->dev, MVS_SLOT_BUF_SZ, printk(KERN_DEBUG "failed to create dma pool %s.\n", pool_name);
&slot->buf_dma, GFP_KERNEL);
if (!slot->buf) {
printk(KERN_DEBUG"failed to allocate slot->buf.\n");
goto err_out; goto err_out;
} }
memset(slot->buf, 0, MVS_SLOT_BUF_SZ); mvi->tags_num = slot_nr;
++mvi->tags_num;
}
/* Initialize tags */ /* Initialize tags */
mvs_tag_init(mvi); mvs_tag_init(mvi);
return 0; return 0;
...@@ -486,7 +488,7 @@ static void __devinit mvs_post_sas_ha_init(struct Scsi_Host *shost, ...@@ -486,7 +488,7 @@ static void __devinit mvs_post_sas_ha_init(struct Scsi_Host *shost,
sha->num_phys = nr_core * chip_info->n_phy; sha->num_phys = nr_core * chip_info->n_phy;
sha->lldd_max_execute_num = 1; sha->lldd_max_execute_num = lldd_max_execute_num;
if (mvi->flags & MVF_FLAG_SOC) if (mvi->flags & MVF_FLAG_SOC)
can_queue = MVS_SOC_CAN_QUEUE; can_queue = MVS_SOC_CAN_QUEUE;
...@@ -710,6 +712,14 @@ static int __init mvs_init(void) ...@@ -710,6 +712,14 @@ static int __init mvs_init(void)
if (!mvs_stt) if (!mvs_stt)
return -ENOMEM; return -ENOMEM;
mvs_task_list_cache = kmem_cache_create("mvs_task_list", sizeof(struct mvs_task_list),
0, SLAB_HWCACHE_ALIGN, NULL);
if (!mvs_task_list_cache) {
rc = -ENOMEM;
mv_printk("%s: mvs_task_list_cache alloc failed! \n", __func__);
goto err_out;
}
rc = pci_register_driver(&mvs_pci_driver); rc = pci_register_driver(&mvs_pci_driver);
if (rc) if (rc)
...@@ -726,6 +736,7 @@ static void __exit mvs_exit(void) ...@@ -726,6 +736,7 @@ static void __exit mvs_exit(void)
{ {
pci_unregister_driver(&mvs_pci_driver); pci_unregister_driver(&mvs_pci_driver);
sas_release_transport(mvs_stt); sas_release_transport(mvs_stt);
kmem_cache_destroy(mvs_task_list_cache);
} }
module_init(mvs_init); module_init(mvs_init);
......
This diff is collapsed.
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright 2007 Red Hat, Inc. * Copyright 2007 Red Hat, Inc.
* Copyright 2008 Marvell. <kewei@marvell.com> * Copyright 2008 Marvell. <kewei@marvell.com>
* Copyright 2009-2011 Marvell. <yuxiangl@marvell.com>
* *
* This file is licensed under GPLv2. * This file is licensed under GPLv2.
* *
...@@ -67,6 +68,7 @@ extern struct mvs_tgt_initiator mvs_tgt; ...@@ -67,6 +68,7 @@ extern struct mvs_tgt_initiator mvs_tgt;
extern struct mvs_info *tgt_mvi; extern struct mvs_info *tgt_mvi;
extern const struct mvs_dispatch mvs_64xx_dispatch; extern const struct mvs_dispatch mvs_64xx_dispatch;
extern const struct mvs_dispatch mvs_94xx_dispatch; extern const struct mvs_dispatch mvs_94xx_dispatch;
extern struct kmem_cache *mvs_task_list_cache;
#define DEV_IS_EXPANDER(type) \ #define DEV_IS_EXPANDER(type) \
((type == EDGE_DEV) || (type == FANOUT_DEV)) ((type == EDGE_DEV) || (type == FANOUT_DEV))
...@@ -341,6 +343,7 @@ struct mvs_info { ...@@ -341,6 +343,7 @@ struct mvs_info {
dma_addr_t bulk_buffer_dma; dma_addr_t bulk_buffer_dma;
#define TRASH_BUCKET_SIZE 0x20000 #define TRASH_BUCKET_SIZE 0x20000
#endif #endif
void *dma_pool;
struct mvs_slot_info slot_info[0]; struct mvs_slot_info slot_info[0];
}; };
...@@ -367,6 +370,11 @@ struct mvs_task_exec_info { ...@@ -367,6 +370,11 @@ struct mvs_task_exec_info {
int n_elem; int n_elem;
}; };
struct mvs_task_list {
struct sas_task *task;
struct list_head list;
};
/******************** function prototype *********************/ /******************** function prototype *********************/
void mvs_get_sas_addr(void *buf, u32 buflen); void mvs_get_sas_addr(void *buf, u32 buflen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment