Commit b0a231a2 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

net: caif: avoid using qdisc_qlen()

Such helper does not cope correctly with NOLOCK qdiscs.
In the following patches we will move back qlen to per CPU
values for such qdiscs, so qdisc_qlen_sum() is not an option,
too.
Instead, use qlen only for lock qdiscs, and always set
flow off for NOLOCK qdiscs with a not empty tx queue.
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4c75be07
...@@ -186,15 +186,19 @@ static int transmit(struct cflayer *layer, struct cfpkt *pkt) ...@@ -186,15 +186,19 @@ static int transmit(struct cflayer *layer, struct cfpkt *pkt)
goto noxoff; goto noxoff;
if (likely(!netif_queue_stopped(caifd->netdev))) { if (likely(!netif_queue_stopped(caifd->netdev))) {
struct Qdisc *sch;
/* If we run with a TX queue, check if the queue is too long*/ /* If we run with a TX queue, check if the queue is too long*/
txq = netdev_get_tx_queue(skb->dev, 0); txq = netdev_get_tx_queue(skb->dev, 0);
qlen = qdisc_qlen(rcu_dereference_bh(txq->qdisc)); sch = rcu_dereference_bh(txq->qdisc);
if (likely(qdisc_is_empty(sch)))
if (likely(qlen == 0))
goto noxoff; goto noxoff;
/* can check for explicit qdisc len value only !NOLOCK,
* always set flow off otherwise
*/
high = (caifd->netdev->tx_queue_len * q_high) / 100; high = (caifd->netdev->tx_queue_len * q_high) / 100;
if (likely(qlen < high)) if (!(sch->flags & TCQ_F_NOLOCK) && likely(sch->q.qlen < high))
goto noxoff; goto noxoff;
} }
......
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