Received: by 2002:a05:6a10:c7c6:0:0:0:0 with SMTP id h6csp2841639pxy; Tue, 3 Aug 2021 17:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf4TOoDuvf3vVcHvz4QbKFS1Lb7I5RE82iqKm6tcDW7ykRt76M8gZf1eqKHsgNUqUy7liV X-Received: by 2002:a02:ba87:: with SMTP id g7mr14978525jao.110.1628036203800; Tue, 03 Aug 2021 17:16:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628036203; cv=none; d=google.com; s=arc-20160816; b=KLiU2osERytWXooVmfOMqf9mPdzq9bbykeRCjMQKNQNK/8VGEPZQW0em6qGmGi09Jl GhXOqGg7wDHNCuOB/jd6J0NSxGyLIgn3ZRerm2pfE0sYXW1mLx+sCu47gmHY6axJUfib MTli6FpeTAgBL19RUAmRRSC7tqN49NFqZY6B+UrEbWT69kbH1cxfIXrIALWiAVTaPdEM I77acv4Hl4eu6lAqZIkwzTmMJo4bsIxcy/hRL2NGpOF1RxkDkRSCJbXJjD+e7eepHuxr 77uJjvzn+UAekSZbRN+18hYlSACECDMG1CWm2uUJhUQEzI9Q8K9xKl3FUlWku0N6Y51U aLuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=qSqYPBw28TNvW6beuH6H1JrJUuZCHSjVmkrM5UNlgdY=; b=lkeEgwy4W06y66yoMV6NkYmSQVZ2IJR2hu3g+ZFLegJ6J/Ap6yaHOP0TSLTfvSbjRP GPPmhqtFwkQqijz2lX4P+owe2rPIvf5SbZ3a/7019JG0E9P2paml7sYrfn4vKO4XEpBG ydAmrl5TYa0eiY16iNdEELEyDUp47KrlyFzDaompdz+k6hBGhgpijSCPdz+q5xffuFK5 pSNQsGtTJJt/jAVke33D2vNfl160xH8qeZgUrw0vI4eMVM02zvw8nxAevnhKJXE/tT/G /zCae0j6qx6IIXnDaXfUx4AFTb3Dh+wZQi5ejX44KZakMpFA4T5dbxnGq2w6v4s/UzAO cFLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r31R5ozK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x15si604227ila.66.2021.08.03.17.16.30; Tue, 03 Aug 2021 17:16:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r31R5ozK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234737AbhHCX5i (ORCPT + 99 others); Tue, 3 Aug 2021 19:57:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:45720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233734AbhHCX5h (ORCPT ); Tue, 3 Aug 2021 19:57:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2456860F45; Tue, 3 Aug 2021 23:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628035045; bh=Y98IZD9r0/9I1bvy4BdIP6VjyzQFWfmsVGhrrmzDDRc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=r31R5ozKzXHyvIH6vCt4dFW1dv/yowBvBlNe0KTqPOgL9f2iAoLsADk8OBJoHQzzG re8mfCOcR98uGWtgR2d0bWL9NRsh7meVM1K8UxNVyOCcFsSVzcSFhmjqXv5lfbNgE5 f99a0+pOLjywwdSZ/xOYBRO5pIOjjwFGTWbPZnd7Mfs0wy54vrj2x7kBjHjGgfgdQP 0BjY0uAlswD8YNHjKi6eB8DvFFujpYgrQ3R3DNUXJfBhyhN9i7u5Amxh1ybDmOLuop zNJs1ef7vqjrE/7aJ1O+hp0Ree3wEXio1PzHbz41oWoLc9wmfYNBuJeB81guBTbE2t EipEQYo6grupA== Message-ID: Subject: Re: [PATCH net-next 03/21] ethtool, stats: introduce standard XDP statistics From: Saeed Mahameed To: Jakub Kicinski , Alexander Lobakin Cc: "David S. Miller" , Jesse Brandeburg , Lukasz Czapnik , Marcin Kubiak , Michal Kubiak , Michal Swiatkowski , Jonathan Corbet , Netanel Belgazal , Arthur Kiyanovski , Guy Tzalik , Saeed Bishara , Ioana Ciornei , Claudiu Manoil , Thomas Petazzoni , Marcin Wojtas , Russell King , Edward Cree , Martin Habets , "Michael S. Tsirkin" , Jason Wang , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Shay Agroskin , Sameeh Jubran , Alexander Duyck , Danielle Ratson , Ido Schimmel , Andrew Lunn , Vladyslav Tarasiuk , Arnd Bergmann , Andrew Morton , Jian Shen , Petr Vorel , Dan Murphy , Yangbo Lu , Michal Kubecek , Zheng Yongjun , Heiner Kallweit , YueHaibing , Johannes Berg , netdev@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, bpf@vger.kernel.org Date: Tue, 03 Aug 2021 16:57:22 -0700 In-Reply-To: <20210803134900.578b4c37@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20210803163641.3743-1-alexandr.lobakin@intel.com> <20210803163641.3743-4-alexandr.lobakin@intel.com> <20210803134900.578b4c37@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.3 (3.40.3-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2021-08-03 at 13:49 -0700, Jakub Kicinski wrote: > On Tue,  3 Aug 2021 18:36:23 +0200 Alexander Lobakin wrote: > > Most of the driver-side XDP enabled drivers provide some statistics > > on XDP programs runs and different actions taken (number of passes, > > drops, redirects etc.). > > Could you please share the statistics to back that statement up? > Having uAPI for XDP stats is pretty much making the recommendation > that drivers should implement such stats. The recommendation from > Alexei and others back in the day (IIRC) was that XDP programs should > implement stats, not the drivers, to avoid duplication. > There are stats "mainly errors*" that are not even visible or reported to the user prog, for that i had an idea in the past to attach an exception_bpf_prog provided by the user, where driver/stack will report errors to this special exception_prog. > > Regarding that it's almost pretty the same across all the drivers > > (which is obvious), we can implement some sort of "standardized" > > statistics using Ethtool standard stats infra to eliminate a lot > > of code and stringsets duplication, different approaches to count > > these stats and so on. > > I'm not 100% sold on the fact that these should be ethtool stats. > Why not rtnl_fill_statsinfo() stats? Current ethtool std stats are > all pretty Ethernet specific, and all HW stats. Mixing HW and SW > stats > is what we're trying to get away from. > XDP is going to always be eBPF based ! why not just report such stats to a special BPF_MAP ? BPF stack can collect the stats from the driver and report them to this special MAP upon user request. > > These new 12 fields provided by the standard XDP stats should cover > > most, if not all, stats that might be interesting for collecting > > and > > tracking. > > Note that most NIC drivers keep XDP statistics on a per-channel > > basis, so this also introduces a new callback for getting a number > > of channels which a driver will provide stats for. If it's not > > implemented or returns 0, it means stats are global/device-wide. > > Per-channel stats via std ethtool stats are not a good idea. Per > queue > stats must be via the queue netlink interface we keep talking about > for > ever but which doesn't seem to materialize. When stats are reported > via > a different interface than objects they pertain to matching stats, > objects and their lifetime becomes very murky.