diff options
author | Paolo Abeni <pabeni@redhat.com> | 2019-04-10 08:32:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-10 15:20:46 -0400 |
commit | b0a231a26d56265521abbb6db1748accd6bb036a (patch) | |
tree | eebf7ab0e43d4ac498ad5039315bfb8e750cc13d | |
parent | 4c75be07f9385364be3a5033ff3a20faf3f3bce0 (diff) |
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: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/caif/caif_dev.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/caif/caif_dev.c b/net/caif/caif_dev.c index 711d7156efd8..6c6e01963aac 100644 --- a/net/caif/caif_dev.c +++ b/net/caif/caif_dev.c | |||
@@ -186,15 +186,19 @@ static int transmit(struct cflayer *layer, struct cfpkt *pkt) | |||
186 | goto noxoff; | 186 | goto noxoff; |
187 | 187 | ||
188 | if (likely(!netif_queue_stopped(caifd->netdev))) { | 188 | if (likely(!netif_queue_stopped(caifd->netdev))) { |
189 | struct Qdisc *sch; | ||
190 | |||
189 | /* If we run with a TX queue, check if the queue is too long*/ | 191 | /* If we run with a TX queue, check if the queue is too long*/ |
190 | txq = netdev_get_tx_queue(skb->dev, 0); | 192 | txq = netdev_get_tx_queue(skb->dev, 0); |
191 | qlen = qdisc_qlen(rcu_dereference_bh(txq->qdisc)); | 193 | sch = rcu_dereference_bh(txq->qdisc); |
192 | 194 | if (likely(qdisc_is_empty(sch))) | |
193 | if (likely(qlen == 0)) | ||
194 | goto noxoff; | 195 | goto noxoff; |
195 | 196 | ||
197 | /* can check for explicit qdisc len value only !NOLOCK, | ||
198 | * always set flow off otherwise | ||
199 | */ | ||
196 | high = (caifd->netdev->tx_queue_len * q_high) / 100; | 200 | high = (caifd->netdev->tx_queue_len * q_high) / 100; |
197 | if (likely(qlen < high)) | 201 | if (!(sch->flags & TCQ_F_NOLOCK) && likely(sch->q.qlen < high)) |
198 | goto noxoff; | 202 | goto noxoff; |
199 | } | 203 | } |
200 | 204 | ||