[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJFZqHyYwnBJJonnVRngq7wA6ZnnSUuAGXLbNZnvuuxtjVw_AA@mail.gmail.com>
Date: Mon, 10 Mar 2014 15:45:48 +0800
From: RongQing Li <roy.qing.li@...il.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ipv4: use unlikely to optimise in ip_forward
Ok, thanks
-R
On Mon, Mar 10, 2014 at 2:03 PM, Eric Dumazet <eric.dumazet@...il.com> wrote:
> On Mon, 2014-03-10 at 13:10 +0800, roy.qing.li@...il.com wrote:
>> From: Li RongQing <roy.qing.li@...il.com>
>>
>> The condition that skb->pkt_type is not PACKET_HOST in ip_forward, should never
>> happen, so use unlikely to optimise this check
>>
>> Signed-off-by: Li RongQing <roy.qing.li@...il.com>
>> ---
>> net/ipv4/ip_forward.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
>> index be8abe7..b82833a 100644
>> --- a/net/ipv4/ip_forward.c
>> +++ b/net/ipv4/ip_forward.c
>> @@ -128,7 +128,7 @@ int ip_forward(struct sk_buff *skb)
>> struct ip_options *opt = &(IPCB(skb)->opt);
>>
>> /* that should never happen */
>> - if (skb->pkt_type != PACKET_HOST)
>> + if (unlikely(skb->pkt_type != PACKET_HOST))
>> goto drop;
>>
>> if (skb_warn_if_lro(skb))
>
> Compilers already do the right thing.
>
> This is one of the reason you see so many goto in the kernel.
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists