Commit 22a923c3 authored by Chaitra P B's avatar Chaitra P B Committed by Martin K. Petersen

scsi: mpt3sas: Cache enclosure pages during enclosure add.

In function _scsih_add_device, for each device connected to an
enclosure, driver reads the enclosure page(To get details like enclosure
handle, enclosure logical ID, enclosure level etc.)

With this patch, instead of reading enclosure page everytime, driver
maintains a list for enclosure device(During enclosure add event,
enclosure device is added to the list and removed from the list on
delete events) and uses the enclosure page from the list.
Signed-off-by: default avatarChaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: default avatarSuganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 79eb96d6
...@@ -4089,6 +4089,27 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc) ...@@ -4089,6 +4089,27 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc)
ioc->temp_sensors_count = ioc->iounit_pg8.NumSensors; ioc->temp_sensors_count = ioc->iounit_pg8.NumSensors;
} }
/**
* mpt3sas_free_enclosure_list - release memory
* @ioc: per adapter object
*
* Free memory allocated during encloure add.
*
* Return nothing.
*/
void
mpt3sas_free_enclosure_list(struct MPT3SAS_ADAPTER *ioc)
{
struct _enclosure_node *enclosure_dev, *enclosure_dev_next;
/* Free enclosure list */
list_for_each_entry_safe(enclosure_dev,
enclosure_dev_next, &ioc->enclosure_list, list) {
list_del(&enclosure_dev->list);
kfree(enclosure_dev);
}
}
/** /**
* _base_release_memory_pools - release memory * _base_release_memory_pools - release memory
* @ioc: per adapter object * @ioc: per adapter object
...@@ -6669,6 +6690,7 @@ mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc) ...@@ -6669,6 +6690,7 @@ mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc)
mpt3sas_base_stop_watchdog(ioc); mpt3sas_base_stop_watchdog(ioc);
mpt3sas_base_free_resources(ioc); mpt3sas_base_free_resources(ioc);
_base_release_memory_pools(ioc); _base_release_memory_pools(ioc);
mpt3sas_free_enclosure_list(ioc);
pci_set_drvdata(ioc->pdev, NULL); pci_set_drvdata(ioc->pdev, NULL);
kfree(ioc->cpu_msix_table); kfree(ioc->cpu_msix_table);
if (ioc->is_warpdrive) if (ioc->is_warpdrive)
......
...@@ -741,6 +741,17 @@ struct _sas_node { ...@@ -741,6 +741,17 @@ struct _sas_node {
struct list_head sas_port_list; struct list_head sas_port_list;
}; };
/**
* struct _enclosure_node - enclosure information
* @list: list of enclosures
* @pg0: enclosure pg0;
*/
struct _enclosure_node {
struct list_head list;
Mpi2SasEnclosurePage0_t pg0;
};
/** /**
* enum reset_type - reset state * enum reset_type - reset state
* @FORCE_BIG_HAMMER: issue diagnostic reset * @FORCE_BIG_HAMMER: issue diagnostic reset
...@@ -1013,6 +1024,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc); ...@@ -1013,6 +1024,7 @@ typedef void (*MPT3SAS_FLUSH_RUNNING_CMDS)(struct MPT3SAS_ADAPTER *ioc);
* @iounit_pg8: static iounit page 8 * @iounit_pg8: static iounit page 8
* @sas_hba: sas host object * @sas_hba: sas host object
* @sas_expander_list: expander object list * @sas_expander_list: expander object list
* @enclosure_list: enclosure object list
* @sas_node_lock: * @sas_node_lock:
* @sas_device_list: sas device object list * @sas_device_list: sas device object list
* @sas_device_init_list: sas device object list (used only at init time) * @sas_device_init_list: sas device object list (used only at init time)
...@@ -1218,6 +1230,7 @@ struct MPT3SAS_ADAPTER { ...@@ -1218,6 +1230,7 @@ struct MPT3SAS_ADAPTER {
/* sas hba, expander, and device list */ /* sas hba, expander, and device list */
struct _sas_node sas_hba; struct _sas_node sas_hba;
struct list_head sas_expander_list; struct list_head sas_expander_list;
struct list_head enclosure_list;
spinlock_t sas_node_lock; spinlock_t sas_node_lock;
struct list_head sas_device_list; struct list_head sas_device_list;
struct list_head sas_device_init_list; struct list_head sas_device_init_list;
...@@ -1391,6 +1404,7 @@ int mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc); ...@@ -1391,6 +1404,7 @@ int mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc);
void mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_base_detach(struct MPT3SAS_ADAPTER *ioc);
int mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc); int mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc);
void mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc); void mpt3sas_base_free_resources(struct MPT3SAS_ADAPTER *ioc);
void mpt3sas_free_enclosure_list(struct MPT3SAS_ADAPTER *ioc);
int mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc, int mpt3sas_base_hard_reset_handler(struct MPT3SAS_ADAPTER *ioc,
enum reset_type type); enum reset_type type);
......
This diff is collapsed.
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