diff mbox series

[net-next] net: remove bypassed check in sch_direct_xmit()

Message ID 20180528213632.1412353-1-songliubraving@fb.com
State Superseded, archived
Delegated to: David Miller
Headers show
Series [net-next] net: remove bypassed check in sch_direct_xmit() | expand

Commit Message

Song Liu May 28, 2018, 9:36 p.m. UTC
Check sch_direct_xmit() at the end of sch_direct_xmit() will be bypassed.
This is because "ret" from sch_direct_xmit() will be either NETDEV_TX_OK
or NETDEV_TX_BUSY, and only ret == NETDEV_TX_OK == 0 will reach the
condition:

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

This patch cleans up the code by removing  the whole condition.

For more discussion about this, please refer to
   https://marc.info/?t=152727195700008

Signed-off-by: Song Liu <songliubraving@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: David S. Miller <davem@davemloft.net>
---
 net/sched/sch_generic.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Sergei Shtylyov May 29, 2018, 8:58 a.m. UTC | #1
Hello!

On 5/29/2018 12:36 AM, Song Liu wrote:

> Check sch_direct_xmit() at the end of sch_direct_xmit() will be bypassed.

    "Checking netif_xmit_frozen_or_stopped()", perhaps? Else it doesn't make 
much sense...

> This is because "ret" from sch_direct_xmit() will be either NETDEV_TX_OK
> or NETDEV_TX_BUSY, and only ret == NETDEV_TX_OK == 0 will reach the
> condition:
> 
>      if (ret && netif_xmit_frozen_or_stopped(txq))
>          return false;
> 
> This patch cleans up the code by removing  the whole condition.
> 
> For more discussion about this, please refer to
>     https://marc.info/?t=152727195700008
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: David S. Miller <davem@davemloft.net>
[...]

MBR, Sergei
Song Liu May 29, 2018, 5:02 p.m. UTC | #2
> On May 29, 2018, at 1:58 AM, Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> wrote:
> 
> Hello!
> 
> On 5/29/2018 12:36 AM, Song Liu wrote:
> 
>> Check sch_direct_xmit() at the end of sch_direct_xmit() will be bypassed.
> 
>   "Checking netif_xmit_frozen_or_stopped()", perhaps? Else it doesn't make much sense...

Thanks Sergei!

Sending v2 with fix. 

Song

> 
>> This is because "ret" from sch_direct_xmit() will be either NETDEV_TX_OK
>> or NETDEV_TX_BUSY, and only ret == NETDEV_TX_OK == 0 will reach the
>> condition:
>>     if (ret && netif_xmit_frozen_or_stopped(txq))
>>         return false;
>> This patch cleans up the code by removing  the whole condition.
>> For more discussion about this, please refer to
>>    https://marc.info/?t=152727195700008
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> Cc: John Fastabend <john.fastabend@gmail.com>
>> Cc: Alexei Starovoitov <ast@kernel.org>
>> Cc: David S. Miller <davem@davemloft.net>
> [...]
> 
> MBR, Sergei
diff mbox series

Patch

diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 760ab1b..69078c8 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -346,9 +346,6 @@  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;
 }