From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49245C433DF for ; Tue, 26 May 2020 01:00:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2714C20671 for ; Tue, 26 May 2020 01:00:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388266AbgEZBA0 (ORCPT ); Mon, 25 May 2020 21:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388083AbgEZBA0 (ORCPT ); Mon, 25 May 2020 21:00:26 -0400 Received: from shards.monkeyblade.net (shards.monkeyblade.net [IPv6:2620:137:e000::1:9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B6F7C061A0E for ; Mon, 25 May 2020 18:00:26 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id AEEF9119480FF; Mon, 25 May 2020 18:00:25 -0700 (PDT) Date: Mon, 25 May 2020 18:00:24 -0700 (PDT) Message-Id: <20200525.180024.261815334954697599.davem@davemloft.net> To: bpoirier@cumulusnetworks.com Cc: netdev@vger.kernel.org, nikolay@cumulusnetworks.com, edumazet@google.com, jiri@resnulli.us Subject: Re: [PATCH net-next] net: Avoid spurious rx_dropped increases with tap and rx_handler From: David Miller In-Reply-To: <20200525050137.412072-1-bpoirier@cumulusnetworks.com> References: <20200525050137.412072-1-bpoirier@cumulusnetworks.com> X-Mailer: Mew version 6.8 on Emacs 26.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Mon, 25 May 2020 18:00:25 -0700 (PDT) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Benjamin Poirier Date: Mon, 25 May 2020 14:01:37 +0900 > Consider an skb which doesn't match a ptype_base/ptype_specific handler. If > this skb is delivered to a ptype_all handler, it does not count as a drop. > However, if the skb is also processed by an rx_handler which returns > RX_HANDLER_PASS, the frame is now counted as a drop because pt_prev was > reset. An example of this situation is an LLDP frame received on a bridge > port while lldpd is listening on a packet socket with ETH_P_ALL (ex. by > specifying `lldpd -c`). > > Fix by adding an extra condition variable to record if the skb was > delivered to a packet tap before running an rx_handler. > > The situation is similar for RX_HANDLER_EXACT frames so their accounting is > also changed. OTOH, the behavior is unchanged for RX_HANDLER_ANOTHER frames > - they are accounted according to what happens with the new skb->dev. > > Fixes: caf586e5f23c ("net: add a core netdev->rx_dropped counter") > Message-Id: <20200522011420.263574-1-bpoirier@cumulusnetworks.com> > Signed-off-by: Benjamin Poirier You can state over and over about the semantics of PASS and other rx_handler return values, but as Eric pointed out we free this SKB so the counter should be bumped. I'm sorry if it is confusing, but the counter is counting the event accurately. If you can make that kfree_skb() not happen, then maybe it shouldn't be incremented. But until then... I'm not applying this, sorry.