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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 EDC70C169C4 for ; Wed, 6 Feb 2019 13:48:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BECF52175B for ; Wed, 6 Feb 2019 13:48:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730114AbfBFNsb (ORCPT ); Wed, 6 Feb 2019 08:48:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727179AbfBFNsb (ORCPT ); Wed, 6 Feb 2019 08:48:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8074F66977; Wed, 6 Feb 2019 13:48:30 +0000 (UTC) Received: from carbon (ovpn-200-42.brq.redhat.com [10.40.200.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 80481660C0; Wed, 6 Feb 2019 13:48:16 +0000 (UTC) Date: Wed, 6 Feb 2019 14:48:14 +0100 From: Jesper Dangaard Brouer To: Saeed Mahameed Cc: "dsahern@gmail.com" , "thoiland@redhat.com" , "virtualization@lists.linux-foundation.org" , "borkmann@iogearbox.net" , Tariq Toukan , "john.fastabend@gmail.com" , "mst@redhat.com" , "jakub.kicinski@netronome.com" , "netdev@vger.kernel.org" , "jasowang@redhat.com" , "davem@davemloft.net" , "makita.toshiaki@lab.ntt.co.jp" , brouer@redhat.com Subject: Re: [PATCH net] virtio_net: Account for tx bytes and packets on sending xdp_frames Message-ID: <20190206144814.46996933@carbon> In-Reply-To: <140ecbe1e25f54f90d859cc696c4119aa96bc6eb.camel@mellanox.com> References: <1548934830-2389-1-git-send-email-makita.toshiaki@lab.ntt.co.jp> <20190131101516-mutt-send-email-mst@kernel.org> <20190131.094523.2248120325911339180.davem@davemloft.net> <20190131211555.3b15c81f@carbon> <20190204125307.08492005@redhat.com> <140ecbe1e25f54f90d859cc696c4119aa96bc6eb.camel@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 06 Feb 2019 13:48:31 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 6 Feb 2019 00:06:33 +0000 Saeed Mahameed wrote: > 3) Unrelated, In non XDP case, if skb allocation fails or driver fails > to pass the skb up to the stack for somereason, should the driver > increase rx packets ? IMHO the answer should be yes if we want to have > similar behavior between XDP and non XDP cases. I don't think "skb allocation fails" should increase rx packets counter. The difference is that these events are outside sysadm/users control, and is an error detected inside the driver. The XDP program takes a policy choice to XDP_DROP a packet, which can be accounted inside the XDP prog (as the samples show) or as we also discuss via a more generic XDP-action counters. That said, I took at quick look at driver code, and it seems this behavior differs per driver... ixgbe and mlx5 does not count "skb allocation fails" as RX-ed packets, while mlx4 seems to count them. > But this could result in netdev->stats.rx_packets + > netdev->stats.rx_dropped to be more than the actual rx-ed packets, is > this acceptable ? This is one reasons I think this is wrong. --Jesper