Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp214137lqd; Tue, 23 Apr 2024 22:55:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfapOa1funBtVoPysT4sTyLMFLY6pgTk29ThYwyuQkrggvP0dB1UEXQOYQh+Zy1F1lxwB7eDE61ish0++Y2kukaozih0l2FrzqDUF62w== X-Google-Smtp-Source: AGHT+IFD5HaYzvNf2YJ025Q2o2/lYemBc4Od5vBd2pymeu4AfGkEQB8O0vb0yt8diMJYuIvIDZ13 X-Received: by 2002:a05:622a:38a:b0:437:b2e:5309 with SMTP id j10-20020a05622a038a00b004370b2e5309mr1693195qtx.52.1713938108255; Tue, 23 Apr 2024 22:55:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713938108; cv=pass; d=google.com; s=arc-20160816; b=KgOwgBZeHCHIobC2MgHStSlRByRZ7SK4s1dj/gB0wjx4vOUqZnWVHiOKQF9ECtCru9 TvLamZ338amwca+oKXknkGPLEKMjr6YRHGeLxWQi2ypkjSf+y5sO7jztqPH5zStPxoaX 7jiBQn3Y+7gdifEx8YdYBMDaxbyEHPij8JvimvrKux0/AumlWAcVGw5kwZtZs8sJ1W68 vox6hGeHNRslL87yKEyr+w9nH0RCAUQrsm998l35dzeY1vGDNhbLqzksjMunEi8QF1Wv WXovbFIgYe1YskcxK5JKlR9FQ0nGSaY/9BhQ0kQmhmnsa6PEk7bZPHABNrqZW8/Y2Xrq f6EQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Vm716h/E/MvmkXYl+WfP3NBFMb2+sgnZJIcF5EnCuNQ=; fh=zuqnlX5sIewR1COugIGq5KOu9BiLzCfTyr9RGA8iFc4=; b=v37ri6RnNsXNK2axNa0Ul/36IyQtE7RsnLeHqrizDHmfPhUuI3wXQSGGpRVtCmZLBF n8irjvEIiqKeZmtzlzdgLlmJkFQVbCmzhZpX/oekLmlhDGPTuFebGd55HwJjxnXuryoS fVIcrRDiTlDiJCGogAUUHrCK9+KYCD2jNdpWSMgu7e9w20G6xInxnIOKE8QiC80uOvBN rBw3EsE7vtuIMzoGOOhiJuwfOycmzb7JT7Zdt1ni08Q0zCJMsXR+90X+pwNDorl0F6Tv pV+ZSoJP/19Gr4N/c0B7OLn8PYx87HY0bxRRt++U3u0u9g/AtsWEvCgUgQPJsGhOM2dV VThw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=Kctn6Ro2; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-156335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g19-20020ac87d13000000b004396a3ba713si10471820qtb.185.2024.04.23.22.55.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 22:55:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=Kctn6Ro2; arc=pass (i=1 spf=pass spfdomain=fastly.com dkim=pass dkdomain=fastly.com dmarc=pass fromdomain=fastly.com); spf=pass (google.com: domain of linux-kernel+bounces-156335-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156335-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fastly.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A068C1C22AF7 for ; Wed, 24 Apr 2024 05:55:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59CEE156893; Wed, 24 Apr 2024 05:54:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="Kctn6Ro2" Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E325156873 for ; Wed, 24 Apr 2024 05:54:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713938096; cv=none; b=jRrVnffLGDJZqAFWQ3iZMzQm7yx3hj3A95aU3FiWtiO5NaOdCJF76z3bnigghiiR8vjODjKFFQGn4e68LK7zO5f39T08AthfceRj7WeWyO3o8ogFVaBhvMebJ/rOFDXHTVX+e1HMQcqMIrLtbyGX7PwchsGJ1uFWmIKMsThm/P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713938096; c=relaxed/simple; bh=fSlQFB5Q741BlJMoGM4ZGE+J/3+Kp0MMKIppAcJsTTo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QfpAxn42TdJIo013v6uwUT+aFbBeLuossIMa2iNvN+TFCLPIHNy6IiKMirkannaKRJYPoY3ERHYYZN37YU8rG+n7FR4oJVx8JzzfqcLktHBFWCY1JSj0Ur4/+7k4eBHVp6RuXwROnjMDqTrCu8DdPb6ZgXnMCgceGBcBbK6kepI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com; spf=pass smtp.mailfrom=fastly.com; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b=Kctn6Ro2; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fastly.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastly.com Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6eb82af305dso3663197a34.1 for ; Tue, 23 Apr 2024 22:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1713938094; x=1714542894; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Vm716h/E/MvmkXYl+WfP3NBFMb2+sgnZJIcF5EnCuNQ=; b=Kctn6Ro2VI6ZXDFtD4BIlKS50q8xlyTe7WzkzDEXtmr6jH6RWyXE0wDNot+F/kgdlz afjHUIAglfyd7uJJmclmzPzUj6kmFsjQyWKCacJZDBapjygtdDQB5LDQdBiMTuQ0nYvO UIbw8EWxOyDUhKNxR7bSJlL1JqNDlc+xi0ICI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713938094; x=1714542894; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Vm716h/E/MvmkXYl+WfP3NBFMb2+sgnZJIcF5EnCuNQ=; b=nfaAYteOnw3WtZjeI9qn8Q97n+LDUcuyottc1ogfG46m7tL3avjx8xA67t7NQDneRT zMiVK1nQZL0QtzQ1nCFZa2V9jSbZwXiWyBZRHC5cj+1eUecvPb3+gJinGGnk6PLK0fw2 +t/vMyTVPujskboU+uwEa0OJSWFAwRItW3IsQ7buDtT2VH8IsgkwtAdQkkNaRLQZ1Gug jywdzlzJHnpl0OvRHa9ZybWbku0ZCHt41NVbj5guFIWUx/TC8hzoiyAEruRl0nD4nhJG z/LKW7fsi01tecpUMj6XRrlVf0FlwQ1SEYZ+BLSnQcipgfZOc+6vNxxs171y199x+3Wq v1iw== X-Gm-Message-State: AOJu0Ywztyf1w5OHx1w8S9R9lU4pSeo59EG1RNjO2jvKlsZcCtC7sENL vQ9Zz27+eKFttHkppcwUAMu4Qv30Uh0DzAp7sBJumrrlS5yQBGjJRvar6m0OZvudVEQHKNW03r3 Tzg0= X-Received: by 2002:a05:6870:9209:b0:22e:c4e7:8aba with SMTP id e9-20020a056870920900b0022ec4e78abamr1877084oaf.47.1713938093958; Tue, 23 Apr 2024 22:54:53 -0700 (PDT) Received: from LQ3V64L9R2 (c-24-6-151-244.hsd1.ca.comcast.net. [24.6.151.244]) by smtp.gmail.com with ESMTPSA id f4-20020a656284000000b005c6617b52e6sm9222159pgv.5.2024.04.23.22.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 22:54:53 -0700 (PDT) Date: Tue, 23 Apr 2024 22:54:50 -0700 From: Joe Damato To: Jakub Kicinski Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, tariqt@nvidia.com, saeedm@nvidia.com, mkarsten@uwaterloo.ca, gal@nvidia.com, nalramli@fastly.com, "David S. Miller" , Eric Dumazet , Paolo Abeni , "open list:MELLANOX MLX4 core VPI driver" Subject: Re: [PATCH net-next 3/3] net/mlx4: support per-queue statistics via netlink Message-ID: References: <20240423194931.97013-1-jdamato@fastly.com> <20240423194931.97013-4-jdamato@fastly.com> <20240423175718.4ad4dc5a@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240423175718.4ad4dc5a@kernel.org> On Tue, Apr 23, 2024 at 05:57:18PM -0700, Jakub Kicinski wrote: > On Tue, 23 Apr 2024 12:42:13 -1000 Joe Damato wrote: > > I realized in this case, I'll need to set the fields initialized to 0xff > > above to 0 before doing the increments below. > > I don't know mlx4 very well, but glancing at the code - are you sure we > need to loop over the queues is the "base" callbacks? > > The base callbacks are for getting "historical" data, i.e. info which > was associated with queues which are no longer present. You seem to > sweep all queues, so I'd have expected "base" to just set the values > to 0. And the real values to come from the per-queue callbacks. Hmm. Sorry I must have totally misunderstood what the purpose of "base" was. I've just now more closely looked at bnxt which (maybe?) is the only driver that implements base and I think maybe I kind of get it now. For some reason, I thought it meant "the total stats of all queues"; I didn't know it was intended to provide "historical" data as you say. Making it set everything to 0 makes sense to me. I suppose I could also simply omit it? What do you think? > The init to 0xff looks quite sus. Yes the init to 0xff is wrong, too. I noticed that, as well. Here's what I have listed so far in my changelog for the v2 (which I haven't sent yet), but perhaps the maintainers of mlx4 can weigh in? v1 -> v2: - Patch 1/3 now initializes dropped to 0. - Patch 3/3 includes several changes: - mlx4_get_queue_stats_rx and mlx4_get_queue_stats_tx check if i is valid before proceeding. - All initialization to 0xff for stats fields has been omit. The network stack does this before calling into the driver functions, so I've adjusted the driver functions to only set values if there is data to set, leaving the network stack's 0xff in place if not. - mlx4_get_base_stats sets all stats to 0 (no locking etc needed). Let me know if that sounds vaguely correct? > Also what does this: > > > if (!priv->port_up || mlx4_is_master(priv->mdev->dev)) > > do? ????️ what's a "master" in this context? I have a guess, but I'd rather let the Mellanox folks provide the official answer :) > > Sorry about that; just realized that now and will fix that in the v2 (along > > with any other feedback I get), probably something: > > > > if (priv->rx_ring_num) { > > rx->packets = 0; > > rx->bytes = 0; > > rx->alloc_fail = 0; > > } > > > > Here for the RX side and see below for the TX side. > > FWIW I added a simple test for making sure queue stats match interface > stats, it's tools/testing/selftests/drivers/net/stats.py > > You have to export NETIF=$name to make it run on a real interface. > > To copy the tests to a remote machine I do: > > make -C tools/testing/selftests/ TARGETS="net drivers/net drivers/net/hw" install INSTALL_PATH=/tmp/ksft-net-drv > rsync -ra --delete /tmp/ksft-net-drv root@${machine}:/root/ > > HTH Thanks, this is a great help actually. I have a similar changeset for mlx5 (which is hardware I do have access to) that adds the per-queue stats stuff so I'll definitely give your test a try. Seeing as I made a lot of errors in this series, I'll hold off on sending the mlx5 series until this mlx4 series is fixed and accepted, that way I can produce a much better v1 for mlx5. Thanks, Joe