From patchwork Tue Feb 26 16:35:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 223352 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 756F42C0090 for ; Wed, 27 Feb 2013 03:35:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932242Ab3BZQfd (ORCPT ); Tue, 26 Feb 2013 11:35:33 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:37465 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759595Ab3BZQfc (ORCPT ); Tue, 26 Feb 2013 11:35:32 -0500 Received: by mail-pa0-f41.google.com with SMTP id fb11so2553219pad.0 for ; Tue, 26 Feb 2013 08:35:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:x-mailer:content-transfer-encoding :mime-version; bh=KwTfUSA3LSTSG79IzIramLm41cD1HFJVwptfNrXiiEY=; b=i4FtTHo5aCPvbxVOXPUCthGx8IeLFbz3LqydC3tg3BDvIbB3K9tTAGiasy8T9r7S8Y 65lB+8A+K5A1KOZ6BjczYx6jWDrc3bwm67UeQ6Y/+h3k2V7EvTLI2AE6NGtivMl4Rzr7 30DdFQ/NLpbCh6fEqAWPQy3KrTc7FKPRqVZcm0pGt0NdWfSck2jYX+uPr0oIQu9ALULh /kZ6KVoLcuU1Rk4revRjcjoUIu5GZU1IW34rZ6n2sT2A5U3mGDnS60UTpN/XHGO+DMJJ S2llhVu5W9iivdDsnJG65nNEUTNFmMDRA0Mf2XECZ1+Sa2+tA+JT+lAx+ZybxCiPtTim 4EBQ== X-Received: by 10.68.46.198 with SMTP id x6mr24346148pbm.130.1361896531502; Tue, 26 Feb 2013 08:35:31 -0800 (PST) Received: from [172.19.252.153] ([172.19.252.153]) by mx.google.com with ESMTPS id 1sm1424584pbg.18.2013.02.26.08.35.29 (version=SSLv3 cipher=RC4-SHA bits=128/128); Tue, 26 Feb 2013 08:35:30 -0800 (PST) Message-ID: <1361896528.11403.6.camel@edumazet-glaptop> Subject: Re: netif_receive_skb return value in bridging scenario From: Eric Dumazet To: Bercaru Cristian-B43982 Cc: "netdev@vger.kernel.org" Date: Tue, 26 Feb 2013 08:35:28 -0800 In-Reply-To: <675385003F19144A8CE636FC6B7BB7012F25EC@039-SN2MPN1-021.039d.mgd.msft.net> References: <675385003F19144A8CE636FC6B7BB7012F25EC@039-SN2MPN1-021.039d.mgd.msft.net> X-Mailer: Evolution 3.2.3-0ubuntu6 Mime-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 2013-02-26 at 14:57 +0000, Bercaru Cristian-B43982 wrote: > Hello! > > I noticed that the return value of __netif_receive_skb is initialized > to NET_RX_DROP. > > If the bridging code handles the packet and successfully returns > RX_HANDLER_CONSUMED, __netif_receive_skb returns the default value, > NET_RX_DROP. I don't think it is fair to consider the packet dropped, > since it is received successfully. > > I thought the return value of __netif_receive_skb was used by Ethernet > NIC drivers for updating their RX_DROP and RX_OX counters, but I > studied the source code of various drivers and they seem to ignore > whatever the return value. It seems strange. Then shouldn't the > function header look like " void netif_receive_skb(... " ? It seems better to factorize whatever is needed in core network layer, instead of adding code in all drivers to check netif_receive_skb() return code. Check the follwing "atomic_long_inc(&skb->dev->rx_dropped);" in __netif_receive_skb_core() For the case you mention, I guess we need the following patch --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/dev.c b/net/core/dev.c index 17bc535..e98fb4d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -3446,6 +3446,7 @@ ncls: } switch (rx_handler(&skb)) { case RX_HANDLER_CONSUMED: + ret = NET_RX_SUCCESS; goto unlock; case RX_HANDLER_ANOTHER: goto another_round;