From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH][net-next] net: slightly optimize eth_type_trans Date: Sat, 17 Nov 2018 20:06:18 -0800 (PST) Message-ID: <20181117.200618.1664143348881472089.davem@davemloft.net> References: <20181117.165138.801331179496411533.davem@davemloft.net> <4c39a882-2d58-f258-9bd2-df0b2540be41@gmail.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: lirongqing@baidu.com, netdev@vger.kernel.org To: eric.dumazet@gmail.com Return-path: Received: from shards.monkeyblade.net ([23.128.96.9]:40512 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725831AbeKROZS (ORCPT ); Sun, 18 Nov 2018 09:25:18 -0500 In-Reply-To: <4c39a882-2d58-f258-9bd2-df0b2540be41@gmail.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Eric Dumazet Date: Sat, 17 Nov 2018 17:19:34 -0800 > I might have been not very clear. > > Issue is that with macvlan and GRO-friend traffic we can receive the following packets : > > P1-P2 with PACKET_OTHERHOST because eth_type_trans() detected the dst MAC is not the eth0 device mac address. > > P2 has been aggregated to P1, so the sk_buff has been put to napi->skb via napi_reuse_skb() > > Then we receive on same NAPI packet P3, for this host, reusing napi->skb that was saved (old P2 sk_buff). > skb->pkt_type is PACKET_OTHERHOST. > > eth_type_trans() does not change skb->pkt_type because ethernet dst mac address is our ethernet mac address. > > -> We feed the upper stack with P3, with incorrect pkt_type. > > -> packet is dropped because pkt_type != PACKET_HOST, for example in tcp_v4_rcv() Oh I see, it is about defaults when using skb freshly from cache for another new packet. Yes, I completely agree with your suggested patch. Thanks for explaining.