aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca/ehca_irq.c
diff options
context:
space:
mode:
authorHoang-Nam Nguyen <hnguyen@linux.vnet.ibm.com>2007-02-15 11:08:33 -0500
committerRoland Dreier <rolandd@cisco.com>2007-02-16 16:57:34 -0500
commit4fd3006032446be2b331dd482e34c6a9e644a5b8 (patch)
treef3266f1362a6a5a12e332eae4a23daf246822bd9 /drivers/infiniband/hw/ehca/ehca_irq.c
parent8b16cef3df871b005f3a97e273b5b135ebfb3769 (diff)
IB/ehca: Allow en/disabling scaling code via module parameter
Allow users to en/disable scaling code when loading ib_ehca module, rather than requiring the module to be rebuilt to change the setting. Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_irq.c')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_irq.c47
1 files changed, 21 insertions, 26 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 9679b072ad01..3ec53c687d08 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -63,15 +63,11 @@
63#define ERROR_DATA_LENGTH EHCA_BMASK_IBM(52,63) 63#define ERROR_DATA_LENGTH EHCA_BMASK_IBM(52,63)
64#define ERROR_DATA_TYPE EHCA_BMASK_IBM(0,7) 64#define ERROR_DATA_TYPE EHCA_BMASK_IBM(0,7)
65 65
66#ifdef CONFIG_INFINIBAND_EHCA_SCALING
67
68static void queue_comp_task(struct ehca_cq *__cq); 66static void queue_comp_task(struct ehca_cq *__cq);
69 67
70static struct ehca_comp_pool* pool; 68static struct ehca_comp_pool* pool;
71static struct notifier_block comp_pool_callback_nb; 69static struct notifier_block comp_pool_callback_nb;
72 70
73#endif
74
75static inline void comp_event_callback(struct ehca_cq *cq) 71static inline void comp_event_callback(struct ehca_cq *cq)
76{ 72{
77 if (!cq->ib_cq.comp_handler) 73 if (!cq->ib_cq.comp_handler)
@@ -423,13 +419,13 @@ static inline void process_eqe(struct ehca_shca *shca, struct ehca_eqe *eqe)
423 return; 419 return;
424 } 420 }
425 reset_eq_pending(cq); 421 reset_eq_pending(cq);
426#ifdef CONFIG_INFINIBAND_EHCA_SCALING 422 if (ehca_scaling_code) {
427 queue_comp_task(cq); 423 queue_comp_task(cq);
428 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 424 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
429#else 425 } else {
430 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags); 426 spin_unlock_irqrestore(&ehca_cq_idr_lock, flags);
431 comp_event_callback(cq); 427 comp_event_callback(cq);
432#endif 428 }
433 } else { 429 } else {
434 ehca_dbg(&shca->ib_device, 430 ehca_dbg(&shca->ib_device,
435 "Got non completion event"); 431 "Got non completion event");
@@ -508,13 +504,12 @@ void ehca_process_eq(struct ehca_shca *shca, int is_irq)
508 /* call completion handler for cached eqes */ 504 /* call completion handler for cached eqes */
509 for (i = 0; i < eqe_cnt; i++) 505 for (i = 0; i < eqe_cnt; i++)
510 if (eq->eqe_cache[i].cq) { 506 if (eq->eqe_cache[i].cq) {
511#ifdef CONFIG_INFINIBAND_EHCA_SCALING 507 if (ehca_scaling_code) {
512 spin_lock(&ehca_cq_idr_lock); 508 spin_lock(&ehca_cq_idr_lock);
513 queue_comp_task(eq->eqe_cache[i].cq); 509 queue_comp_task(eq->eqe_cache[i].cq);
514 spin_unlock(&ehca_cq_idr_lock); 510 spin_unlock(&ehca_cq_idr_lock);
515#else 511 } else
516 comp_event_callback(eq->eqe_cache[i].cq); 512 comp_event_callback(eq->eqe_cache[i].cq);
517#endif
518 } else { 513 } else {
519 ehca_dbg(&shca->ib_device, "Got non completion event"); 514 ehca_dbg(&shca->ib_device, "Got non completion event");
520 parse_identifier(shca, eq->eqe_cache[i].eqe->entry); 515 parse_identifier(shca, eq->eqe_cache[i].eqe->entry);
@@ -540,8 +535,6 @@ void ehca_tasklet_eq(unsigned long data)
540 ehca_process_eq((struct ehca_shca*)data, 1); 535 ehca_process_eq((struct ehca_shca*)data, 1);
541} 536}
542 537
543#ifdef CONFIG_INFINIBAND_EHCA_SCALING
544
545static inline int find_next_online_cpu(struct ehca_comp_pool* pool) 538static inline int find_next_online_cpu(struct ehca_comp_pool* pool)
546{ 539{
547 int cpu; 540 int cpu;
@@ -764,14 +757,14 @@ static int comp_pool_callback(struct notifier_block *nfb,
764 return NOTIFY_OK; 757 return NOTIFY_OK;
765} 758}
766 759
767#endif
768
769int ehca_create_comp_pool(void) 760int ehca_create_comp_pool(void)
770{ 761{
771#ifdef CONFIG_INFINIBAND_EHCA_SCALING
772 int cpu; 762 int cpu;
773 struct task_struct *task; 763 struct task_struct *task;
774 764
765 if (!ehca_scaling_code)
766 return 0;
767
775 pool = kzalloc(sizeof(struct ehca_comp_pool), GFP_KERNEL); 768 pool = kzalloc(sizeof(struct ehca_comp_pool), GFP_KERNEL);
776 if (pool == NULL) 769 if (pool == NULL)
777 return -ENOMEM; 770 return -ENOMEM;
@@ -796,16 +789,19 @@ int ehca_create_comp_pool(void)
796 comp_pool_callback_nb.notifier_call = comp_pool_callback; 789 comp_pool_callback_nb.notifier_call = comp_pool_callback;
797 comp_pool_callback_nb.priority =0; 790 comp_pool_callback_nb.priority =0;
798 register_cpu_notifier(&comp_pool_callback_nb); 791 register_cpu_notifier(&comp_pool_callback_nb);
799#endif 792
793 printk(KERN_INFO "eHCA scaling code enabled\n");
800 794
801 return 0; 795 return 0;
802} 796}
803 797
804void ehca_destroy_comp_pool(void) 798void ehca_destroy_comp_pool(void)
805{ 799{
806#ifdef CONFIG_INFINIBAND_EHCA_SCALING
807 int i; 800 int i;
808 801
802 if (!ehca_scaling_code)
803 return;
804
809 unregister_cpu_notifier(&comp_pool_callback_nb); 805 unregister_cpu_notifier(&comp_pool_callback_nb);
810 806
811 for (i = 0; i < NR_CPUS; i++) { 807 for (i = 0; i < NR_CPUS; i++) {
@@ -814,5 +810,4 @@ void ehca_destroy_comp_pool(void)
814 } 810 }
815 free_percpu(pool->cpu_comp_tasks); 811 free_percpu(pool->cpu_comp_tasks);
816 kfree(pool); 812 kfree(pool);
817#endif
818} 813}