netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: sched: check netif_xmit_frozen_or_stopped() in sch_direct_xmit()
@ 2018-05-25 18:11 Song Liu
  2018-05-25 19:46 ` Song Liu
  2018-05-29 14:02 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Song Liu @ 2018-05-25 18:11 UTC (permalink / raw)
  To: netdev; +Cc: Song Liu, kernel-team, John Fastabend, David S . Miller

Summary:

At the end of sch_direct_xmit(), we are in the else path of
!dev_xmit_complete(ret), which means ret == NETDEV_TX_OK. The following
condition will always fail and netif_xmit_frozen_or_stopped() is not
checked at all.

    if (ret && netif_xmit_frozen_or_stopped(txq))
         return false;

In this patch, this condition is fixed as:

    if (netif_xmit_frozen_or_stopped(txq))
         return false;

and further simplifies the code as:

    return !netif_xmit_frozen_or_stopped(txq);

Fixes: 29b86cdac00a ("net: sched: remove remaining uses for qdisc_qlen in xmit path")
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 net/sched/sch_generic.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 39c144b..8261d48 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -346,10 +346,7 @@ bool sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
 		return false;
 	}
 
-	if (ret && netif_xmit_frozen_or_stopped(txq))
-		return false;
-
-	return true;
+	return !netif_xmit_frozen_or_stopped(txq);
 }
 
 /*
-- 
2.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-29 16:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-25 18:11 [PATCH net] net: sched: check netif_xmit_frozen_or_stopped() in sch_direct_xmit() Song Liu
2018-05-25 19:46 ` Song Liu
2018-05-26 19:43   ` John Fastabend
2018-05-28 18:30     ` Song Liu
2018-05-29 14:02 ` David Miller
2018-05-29 16:51   ` Song Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).