aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea
diff options
context:
space:
mode:
authorBreno Leitao <leitao@linux.vnet.ibm.com>2010-10-05 09:16:23 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-05 23:10:55 -0400
commita8bb69f78194dc483f6c4a4bf8860c1ede35fa25 (patch)
treefed6f88567669fa2c59e5016f00162e54b7bd67d /drivers/net/ehea
parent5b27d42755fa6536a89f32b107fb2a53267696c2 (diff)
ehea: converting msleeps to waitqueue on check_sqs() function
Removing the msleep() call in check_sqs() function, and replacing by a wait queue. Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r--drivers/net/ehea/ehea.h1
-rw-r--r--drivers/net/ehea/ehea_main.c18
2 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 5bae7daf40fb..1321cb6401cf 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -492,6 +492,7 @@ struct ehea_port {
492 u8 autoneg; 492 u8 autoneg;
493 u8 num_def_qps; 493 u8 num_def_qps;
494 wait_queue_head_t swqe_avail_wq; 494 wait_queue_head_t swqe_avail_wq;
495 wait_queue_head_t restart_wq;
495}; 496};
496 497
497struct port_res_cfg { 498struct port_res_cfg {
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 7897bdf76e66..15401af30108 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -786,6 +786,7 @@ static void reset_sq_restart_flag(struct ehea_port *port)
786 struct ehea_port_res *pr = &port->port_res[i]; 786 struct ehea_port_res *pr = &port->port_res[i];
787 pr->sq_restart_flag = 0; 787 pr->sq_restart_flag = 0;
788 } 788 }
789 wake_up(&port->restart_wq);
789} 790}
790 791
791static void check_sqs(struct ehea_port *port) 792static void check_sqs(struct ehea_port *port)
@@ -796,6 +797,7 @@ static void check_sqs(struct ehea_port *port)
796 797
797 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { 798 for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
798 struct ehea_port_res *pr = &port->port_res[i]; 799 struct ehea_port_res *pr = &port->port_res[i];
800 int ret;
799 k = 0; 801 k = 0;
800 swqe = ehea_get_swqe(pr->qp, &swqe_index); 802 swqe = ehea_get_swqe(pr->qp, &swqe_index);
801 memset(swqe, 0, SWQE_HEADER_SIZE); 803 memset(swqe, 0, SWQE_HEADER_SIZE);
@@ -809,13 +811,14 @@ static void check_sqs(struct ehea_port *port)
809 811
810 ehea_post_swqe(pr->qp, swqe); 812 ehea_post_swqe(pr->qp, swqe);
811 813
812 while (pr->sq_restart_flag == 0) { 814 ret = wait_event_timeout(port->restart_wq,
813 msleep(5); 815 pr->sq_restart_flag == 0,
814 if (++k == 100) { 816 msecs_to_jiffies(100));
815 ehea_error("HW/SW queues out of sync"); 817
816 ehea_schedule_port_reset(pr->port); 818 if (!ret) {
817 return; 819 ehea_error("HW/SW queues out of sync");
818 } 820 ehea_schedule_port_reset(pr->port);
821 return;
819 } 822 }
820 } 823 }
821} 824}
@@ -2654,6 +2657,7 @@ static int ehea_open(struct net_device *dev)
2654 } 2657 }
2655 2658
2656 init_waitqueue_head(&port->swqe_avail_wq); 2659 init_waitqueue_head(&port->swqe_avail_wq);
2660 init_waitqueue_head(&port->restart_wq);
2657 2661
2658 mutex_unlock(&port->port_lock); 2662 mutex_unlock(&port->port_lock);
2659 2663