Skip to content

Commit b0a231a

Browse files
Paolo Abenidavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4c75be0 commit b0a231a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

net/caif/caif_dev.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,15 +186,19 @@ static int transmit(struct cflayer *layer, struct cfpkt *pkt)
186186
goto noxoff;
187187

188188
if (likely(!netif_queue_stopped(caifd->netdev))) {
189+
struct Qdisc *sch;
190+
189191
/* If we run with a TX queue, check if the queue is too long*/
190192
txq = netdev_get_tx_queue(skb->dev, 0);
191-
qlen = qdisc_qlen(rcu_dereference_bh(txq->qdisc));
192-
193-
if (likely(qlen == 0))
193+
sch = rcu_dereference_bh(txq->qdisc);
194+
if (likely(qdisc_is_empty(sch)))
194195
goto noxoff;
195196

197+
/* can check for explicit qdisc len value only !NOLOCK,
198+
* always set flow off otherwise
199+
*/
196200
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))
198202
goto noxoff;
199203
}
200204

0 commit comments

Comments
 (0)