Commit 5b27d427 authored by Breno Leitao's avatar Breno Leitao Committed by David S. Miller

ehea: using wait queues instead of msleep on ehea_flush_sq

This patch just remove a msleep loop and change to wait queue,
making the code cleaner.
Signed-off-by: default avatarBreno Leitao <leitao@linux.vnet.ibm.com>
Acked-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ed51657
...@@ -491,6 +491,7 @@ struct ehea_port { ...@@ -491,6 +491,7 @@ struct ehea_port {
u8 full_duplex; u8 full_duplex;
u8 autoneg; u8 autoneg;
u8 num_def_qps; u8 num_def_qps;
wait_queue_head_t swqe_avail_wq;
}; };
struct port_res_cfg { struct port_res_cfg {
......
...@@ -888,6 +888,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota) ...@@ -888,6 +888,7 @@ static struct ehea_cqe *ehea_proc_cqes(struct ehea_port_res *pr, int my_quota)
pr->queue_stopped = 0; pr->queue_stopped = 0;
} }
spin_unlock_irqrestore(&pr->netif_queue, flags); spin_unlock_irqrestore(&pr->netif_queue, flags);
wake_up(&pr->port->swqe_avail_wq);
return cqe; return cqe;
} }
...@@ -2652,6 +2653,8 @@ static int ehea_open(struct net_device *dev) ...@@ -2652,6 +2653,8 @@ static int ehea_open(struct net_device *dev)
netif_start_queue(dev); netif_start_queue(dev);
} }
init_waitqueue_head(&port->swqe_avail_wq);
mutex_unlock(&port->port_lock); mutex_unlock(&port->port_lock);
return ret; return ret;
...@@ -2724,13 +2727,15 @@ static void ehea_flush_sq(struct ehea_port *port) ...@@ -2724,13 +2727,15 @@ static void ehea_flush_sq(struct ehea_port *port)
for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) {
struct ehea_port_res *pr = &port->port_res[i]; struct ehea_port_res *pr = &port->port_res[i];
int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count; int swqe_max = pr->sq_skba_size - 2 - pr->swqe_ll_count;
int k = 0; int ret;
while (atomic_read(&pr->swqe_avail) < swqe_max) {
msleep(5); ret = wait_event_timeout(port->swqe_avail_wq,
if (++k == 20) { atomic_read(&pr->swqe_avail) >= swqe_max,
ehea_error("WARNING: sq not flushed completely"); msecs_to_jiffies(100));
break;
} if (!ret) {
ehea_error("WARNING: sq not flushed completely");
break;
} }
} }
} }
......
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