aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas/mpt2sas_base.h
diff options
context:
space:
mode:
authornagalakshmi.nandigama@lsi.com <nagalakshmi.nandigama@lsi.com>2011-09-07 20:48:50 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-09-22 07:08:35 -0400
commit911ae9434f83e7355d343f6c2be3ef5b00ea7aed (patch)
tree3129ff0724f0ae65a7e23ab1addba47fb5c4b634 /drivers/scsi/mpt2sas/mpt2sas_base.h
parent66195fc9fad98e00abf2cd1a141bbcf0994daaf7 (diff)
[SCSI] mpt2sas: Added NUNA IO support in driver which uses multi-reply queue support of the HBA
Support added for controllers capable of multi reply queues. The following are the modifications to the driver to support NUMA. 1) Create the new structure adapter_reply_queue to contain the reply queue info for every msix vector. This object will contain a reply_post_host_index, reply_post_free for each instance, msix_index, among other parameters. We will track all the reply queues on a link list called ioc->reply_queue_list. Each reply queue is aligned with each IRQ, and is passed to the interrupt via the bus_id parameter. (2) The driver will figure out the msix_vector_count from the PCIe MSIX capabilities register instead of the IOC Facts->MaxMSIxVectors. This is because the firmware is not filling in this field until the driver has already registered MSIX support. (3) If the ioc_facts reports that the controller is MSIX compatible in the capabilities, then the driver will request for multiple irqs. This count is calculated based on the minimum between the online cpus available and the ioc->msix_vector_count. This count is reported to firmware in the ioc_init request. (4) New routines were added _base_free_irq and _base_request_irq, so registering and freeing msix vectors were done thru simple function API. (5) The new routine _base_assign_reply_queues was added to align the msix indexes across cpus. This will initialize the array called ioc->cpu_msix_table. This array is looked up on every MPI request so the MSIxIndex is set appropriately. (6) A new shost sysfs attribute was added to report the reply_queue_count. (7) User needs to set the affinity cpu mask, so the interrupts occur on the same cpu that sent the original request. Signed-off-by: Nagalakshmi Nandigama <nagalakshmi.nandigama@lsi.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/mpt2sas/mpt2sas_base.h')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.h42
1 files changed, 34 insertions, 8 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.h b/drivers/scsi/mpt2sas/mpt2sas_base.h
index 8d5be2120c63..051da4989d84 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.h
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.h
@@ -544,6 +544,28 @@ struct _tr_list {
544 544
545typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr); 545typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
546 546
547/**
548 * struct adapter_reply_queue - the reply queue struct
549 * @ioc: per adapter object
550 * @msix_index: msix index into vector table
551 * @vector: irq vector
552 * @reply_post_host_index: head index in the pool where FW completes IO
553 * @reply_post_free: reply post base virt address
554 * @name: the name registered to request_irq()
555 * @busy: isr is actively processing replies on another cpu
556 * @list: this list
557*/
558struct adapter_reply_queue {
559 struct MPT2SAS_ADAPTER *ioc;
560 u8 msix_index;
561 unsigned int vector;
562 u32 reply_post_host_index;
563 Mpi2ReplyDescriptorsUnion_t *reply_post_free;
564 char name[MPT_NAME_LENGTH];
565 atomic_t busy;
566 struct list_head list;
567};
568
547/* IOC Facts and Port Facts converted from little endian to cpu */ 569/* IOC Facts and Port Facts converted from little endian to cpu */
548union mpi2_version_union { 570union mpi2_version_union {
549 MPI2_VERSION_STRUCT Struct; 571 MPI2_VERSION_STRUCT Struct;
@@ -606,7 +628,7 @@ enum mutex_type {
606 * @list: ioc_list 628 * @list: ioc_list
607 * @shost: shost object 629 * @shost: shost object
608 * @id: unique adapter id 630 * @id: unique adapter id
609 * @pci_irq: irq number 631 * @cpu_count: number online cpus
610 * @name: generic ioc string 632 * @name: generic ioc string
611 * @tmp_string: tmp string used for logging 633 * @tmp_string: tmp string used for logging
612 * @pdev: pci pdev object 634 * @pdev: pci pdev object
@@ -636,8 +658,8 @@ enum mutex_type {
636 * @wait_for_port_enable_to_complete: 658 * @wait_for_port_enable_to_complete:
637 * @msix_enable: flag indicating msix is enabled 659 * @msix_enable: flag indicating msix is enabled
638 * @msix_vector_count: number msix vectors 660 * @msix_vector_count: number msix vectors
639 * @msix_table: virt address to the msix table 661 * @cpu_msix_table: table for mapping cpus to msix index
640 * @msix_table_backup: backup msix table 662 * @cpu_msix_table_sz: table size
641 * @scsi_io_cb_idx: shost generated commands 663 * @scsi_io_cb_idx: shost generated commands
642 * @tm_cb_idx: task management commands 664 * @tm_cb_idx: task management commands
643 * @scsih_cb_idx: scsih internal commands 665 * @scsih_cb_idx: scsih internal commands
@@ -728,7 +750,8 @@ enum mutex_type {
728 * @reply_post_queue_depth: reply post queue depth 750 * @reply_post_queue_depth: reply post queue depth
729 * @reply_post_free: pool for reply post (64bit descriptor) 751 * @reply_post_free: pool for reply post (64bit descriptor)
730 * @reply_post_free_dma: 752 * @reply_post_free_dma:
731 * @reply_post_free_dma_pool: 753 * @reply_queue_count: number of reply queue's
754 * @reply_queue_list: link list contaning the reply queue info
732 * @reply_post_host_index: head index in the pool where FW completes IO 755 * @reply_post_host_index: head index in the pool where FW completes IO
733 * @delayed_tr_list: target reset link list 756 * @delayed_tr_list: target reset link list
734 * @delayed_tr_volume_list: volume target reset link list 757 * @delayed_tr_volume_list: volume target reset link list
@@ -737,7 +760,7 @@ struct MPT2SAS_ADAPTER {
737 struct list_head list; 760 struct list_head list;
738 struct Scsi_Host *shost; 761 struct Scsi_Host *shost;
739 u8 id; 762 u8 id;
740 u32 pci_irq; 763 int cpu_count;
741 char name[MPT_NAME_LENGTH]; 764 char name[MPT_NAME_LENGTH];
742 char tmp_string[MPT_STRING_LENGTH]; 765 char tmp_string[MPT_STRING_LENGTH];
743 struct pci_dev *pdev; 766 struct pci_dev *pdev;
@@ -779,8 +802,9 @@ struct MPT2SAS_ADAPTER {
779 802
780 u8 msix_enable; 803 u8 msix_enable;
781 u16 msix_vector_count; 804 u16 msix_vector_count;
782 u32 *msix_table; 805 u8 *cpu_msix_table;
783 u32 *msix_table_backup; 806 resource_size_t **reply_post_host_index;
807 u16 cpu_msix_table_sz;
784 u32 ioc_reset_count; 808 u32 ioc_reset_count;
785 809
786 /* internal commands, callback index */ 810 /* internal commands, callback index */
@@ -911,7 +935,8 @@ struct MPT2SAS_ADAPTER {
911 Mpi2ReplyDescriptorsUnion_t *reply_post_free; 935 Mpi2ReplyDescriptorsUnion_t *reply_post_free;
912 dma_addr_t reply_post_free_dma; 936 dma_addr_t reply_post_free_dma;
913 struct dma_pool *reply_post_free_dma_pool; 937 struct dma_pool *reply_post_free_dma_pool;
914 u32 reply_post_host_index; 938 u8 reply_queue_count;
939 struct list_head reply_queue_list;
915 940
916 struct list_head delayed_tr_list; 941 struct list_head delayed_tr_list;
917 struct list_head delayed_tr_volume_list; 942 struct list_head delayed_tr_volume_list;
@@ -955,6 +980,7 @@ void *mpt2sas_base_get_sense_buffer(struct MPT2SAS_ADAPTER *ioc, u16 smid);
955void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr); 980void mpt2sas_base_build_zero_len_sge(struct MPT2SAS_ADAPTER *ioc, void *paddr);
956__le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc, 981__le32 mpt2sas_base_get_sense_buffer_dma(struct MPT2SAS_ADAPTER *ioc,
957 u16 smid); 982 u16 smid);
983void mpt2sas_base_flush_reply_queues(struct MPT2SAS_ADAPTER *ioc);
958 984
959/* hi-priority queue */ 985/* hi-priority queue */
960u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx); 986u16 mpt2sas_base_get_smid_hpr(struct MPT2SAS_ADAPTER *ioc, u8 cb_idx);