[SCSI] megaraid_sas: adds tasklet for cmd completion

This patch adds a tasklet for command completion.

Signed-off-by: Sumant Patro <Sumant.Patro@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by Sumant Patro and committed by James Bottomley 5d018ad0 658dcedb

+45 -22
+44 -22
drivers/scsi/megaraid/megaraid_sas.c
··· 1271 1271 static int 1272 1272 megasas_deplete_reply_queue(struct megasas_instance *instance, u8 alt_status) 1273 1273 { 1274 - u32 producer; 1275 - u32 consumer; 1276 - u32 context; 1277 - struct megasas_cmd *cmd; 1278 - 1279 1274 /* 1280 1275 * Check if it is our interrupt 1281 1276 * Clear the interrupt ··· 1278 1283 if(instance->instancet->clear_intr(instance->reg_set)) 1279 1284 return IRQ_NONE; 1280 1285 1281 - producer = *instance->producer; 1282 - consumer = *instance->consumer; 1283 - 1284 - while (consumer != producer) { 1285 - context = instance->reply_queue[consumer]; 1286 - 1287 - cmd = instance->cmd_list[context]; 1288 - 1289 - megasas_complete_cmd(instance, cmd, alt_status); 1290 - 1291 - consumer++; 1292 - if (consumer == (instance->max_fw_cmds + 1)) { 1293 - consumer = 0; 1294 - } 1295 - } 1296 - 1297 - *instance->consumer = producer; 1286 + /* 1287 + * Schedule the tasklet for cmd completion 1288 + */ 1289 + tasklet_schedule(&instance->isr_tasklet); 1298 1290 1299 1291 return IRQ_HANDLED; 1300 1292 } ··· 1724 1742 } 1725 1743 1726 1744 /** 1745 + * megasas_complete_cmd_dpc - Returns FW's controller structure 1746 + * @instance_addr: Address of adapter soft state 1747 + * 1748 + * Tasklet to complete cmds 1749 + */ 1750 + void megasas_complete_cmd_dpc(unsigned long instance_addr) 1751 + { 1752 + u32 producer; 1753 + u32 consumer; 1754 + u32 context; 1755 + struct megasas_cmd *cmd; 1756 + struct megasas_instance *instance = (struct megasas_instance *)instance_addr; 1757 + 1758 + producer = *instance->producer; 1759 + consumer = *instance->consumer; 1760 + 1761 + while (consumer != producer) { 1762 + context = instance->reply_queue[consumer]; 1763 + 1764 + cmd = instance->cmd_list[context]; 1765 + 1766 + megasas_complete_cmd(instance, cmd, DID_OK); 1767 + 1768 + consumer++; 1769 + if (consumer == (instance->max_fw_cmds + 1)) { 1770 + consumer = 0; 1771 + } 1772 + } 1773 + 1774 + *instance->consumer = producer; 1775 + } 1776 + 1777 + /** 1727 1778 * megasas_init_mfi - Initializes the FW 1728 1779 * @instance: Adapter soft state 1729 1780 * ··· 1926 1911 1927 1912 kfree(ctrl_info); 1928 1913 1914 + /* 1915 + * Setup tasklet for cmd completion 1916 + */ 1917 + 1918 + tasklet_init(&instance->isr_tasklet, megasas_complete_cmd_dpc, 1919 + (unsigned long)instance); 1929 1920 return 0; 1930 1921 1931 1922 fail_fw_init: ··· 2491 2470 scsi_remove_host(instance->host); 2492 2471 megasas_flush_cache(instance); 2493 2472 megasas_shutdown_controller(instance); 2473 + tasklet_kill(&instance->isr_tasklet); 2494 2474 2495 2475 /* 2496 2476 * Take the instance off the instance array. Note that we will not
+1
drivers/scsi/megaraid/megaraid_sas.h
··· 1102 1102 u32 hw_crit_error; 1103 1103 1104 1104 struct megasas_instance_template *instancet; 1105 + struct tasklet_struct isr_tasklet; 1105 1106 }; 1106 1107 1107 1108 #define MEGASAS_IS_LOGICAL(scp) \