[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-KiADmksKwZwk+6BC-gq3Q8RQcvxREU_-NQrcdUfvGb6Q@mail.gmail.com>
Date: Tue, 14 Nov 2017 19:11:16 -0500
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: John Fastabend <john.fastabend@...il.com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <eric.dumazet@...il.com>, make0818@...il.com,
Network Development <netdev@...r.kernel.org>,
Jiří Pírko <jiri@...nulli.us>,
Cong Wang <xiyou.wangcong@...il.com>
Subject: Re: [RFC PATCH 03/17] net: sched: remove remaining uses for
qdisc_qlen in xmit path
On Mon, Nov 13, 2017 at 3:08 PM, John Fastabend
<john.fastabend@...il.com> wrote:
> sch_direct_xmit() uses qdisc_qlen as a return value but all call sites
> of the routine only check if it is zero or not. Simplify the logic so
> that we don't need to return an actual queue length value.
>
> This introduces a case now where sch_direct_xmit would have returned
> a qlen of zero but now it returns true.
You mean the first case, when the likely(skb) branch failed?
Can that return false, then?
> However in this case all
> call sites of sch_direct_xmit will implement a dequeue() and get
> a null skb and abort. This trades tracking qlen in the hotpath for
> an extra dequeue operation. Overall this seems to be good for
> performance.
>
> Signed-off-by: John Fastabend <john.fastabend@...il.com>
> @@ -198,18 +198,19 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
>
> if (dev_xmit_complete(ret)) {
> /* Driver sent out skb successfully or skb was consumed */
> - ret = qdisc_qlen(q);
> + ret = true;
> } else {
> /* Driver returned NETDEV_TX_BUSY - requeue skb */
> if (unlikely(ret != NETDEV_TX_BUSY))
> net_warn_ratelimited("BUG %s code %d qlen %d\n",
> dev->name, ret, q->q.qlen);
>
> - ret = dev_requeue_skb(skb, q);
> + dev_requeue_skb(skb, q);
> + ret = false;
> }
>
> if (ret && netif_xmit_frozen_or_stopped(txq))
> - ret = 0;
> + ret = false;
>
> return ret;
> }
This can now become
if (!dev_queue_complete(ret)) {
if (unlikely(ret != NETDEV_TX_BUSY))
...
dev_requeue_skb(skb, q);
return false;
}
if (netif_xmit_frozen_or_stopped(txq))
return false;
return true;
Powered by blists - more mailing lists