Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1241915lqd; Thu, 25 Apr 2024 09:33:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWh4+pRGRC4L+InpdqA0v6Y3xztzTuDjbrDXHQ+F4pJUMbDIvQVfnRweWQESYJSs7b798uY4zGrMGb80jUezrPIAUgOU5yUsEyiy4aGSQ== X-Google-Smtp-Source: AGHT+IEdja4wVnzGo8/AIlMbg9X60jtfBB9sG8ef9UHjSBryCdxy5jaOx3w4Q+PHj/N0OPOS64Kj X-Received: by 2002:a05:6122:da2:b0:4d3:3952:1d1a with SMTP id bc34-20020a0561220da200b004d339521d1amr7433169vkb.4.1714062783750; Thu, 25 Apr 2024 09:33:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714062783; cv=pass; d=google.com; s=arc-20160816; b=hv45eFuO2NsylUWl0AhXTPK+RGJWMgILU98cZ5cjDhaDVpLOHVpYoaPJK24wKPdSzm BBu6OZ8ET/r3ZwsGj42eJHag4/4rYCuTD5jC4kjaVF/pYOrltw5vMM8Zw8QK+ZhBmTYb xwPiNRvcAphIhe7TQ5ipAOKf6lSdoUcouSzXWbaKRpTxVcd2TxUupzLYoHmsSlTIxoew owXUe1r2jbCVpBEd2piA5+3ZSa3sJBHxFO55Ge6XvgKU4XidSZbz03QOULOaqeLKTDwQ Cgq0TaW2TqdOIHf4DGZ5ix5ppNcJNtY5UqUEiblsJmtlZnexayw1oeRFXOvMWs2bLfyu Xqvg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=3tBrT3OfOkKuIv1xzAscKnKl0pQQOx5r5vdyc5h+6Qc=; fh=zuqnlX5sIewR1COugIGq5KOu9BiLzCfTyr9RGA8iFc4=; b=D/XhwTQp7bZtLot/6q3ddUM62jei8tfMowjRgefDDu6X8m8Ud2fA5CVNePCBjsGpkA H+4bRIVIsV0jEuRQnTJkRaLnu5xRJyJdjBhXxU0JJSUAET/SWMte/B9OM9JTGN/Yaaum WJeoikbHEYZcwzLRrKTazZXQ6DLAA65Bc4A14vbYhFxpPOSzGdeBG8Y6Pe2SdEzjRkQH tQtJ4TVznGJAw9zAIVj8LKDTfba8ckpBRmYOvX+oNYNuChd81V2OtXkSPepo6ht6R0ji Dm1OutAeoiDx9K1bMGoetwanZZPcJEneMGSMHPdiIgcHu09o1XpNt5W3p4/QWkXzrHpu 3m1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fastly.com header.s=google header.b=Bw7sa1OQ; 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-158908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158908-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 ic6-20020a0561024b8600b0047be90b9aefsi2220043vsb.107.2024.04.25.09.33.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 09:33:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158908-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=Bw7sa1OQ; 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-158908-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158908-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 C1D7C1C23753 for ; Thu, 25 Apr 2024 16:32:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C1A014EC58; Thu, 25 Apr 2024 16:31:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=fastly.com header.i=@fastly.com header.b="Bw7sa1OQ" Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) (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 A9A6414E2C0 for ; Thu, 25 Apr 2024 16:31:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714062680; cv=none; b=tuVCD3Zh+rSzk+gaCJyR3j2WBlkU3y6BmKylHJGNX0l/T7xpMtpz3jl7Pmg7HN/YIywIVJWtHZSlEIsfjft/mFuDYPlGv2xmNLTe0Mkd2kIRjQR9MM/xisFbI4G/xf0naAOIv/7uaZ5+tVR3JgxD/qWB64Vx+k79UtIvmKce0MI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714062680; c=relaxed/simple; bh=+WK1EsPbKaLW4xZIO0RiFVArQ9u/eVK7/399NjWW13s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FpPlIGiJ/CGO95i3uk6tcQFo+gkBubsdNuTcH8vPFQ6sbGMjcffJ5Dq+MSnfW1JCHZkCiPAY7QwAn9gGRomihYa3DxNdiqI0EOP5iuFwkx/75JnjmsHNA2Mljnkrwb4TAu4i2XwogVYT/rGIOAO9I4XmD34nVOeYm8Zt/nh6ytM= 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=Bw7sa1OQ; arc=none smtp.client-ip=209.85.214.177 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-pl1-f177.google.com with SMTP id d9443c01a7336-1e4f341330fso11740295ad.0 for ; Thu, 25 Apr 2024 09:31:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastly.com; s=google; t=1714062678; x=1714667478; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3tBrT3OfOkKuIv1xzAscKnKl0pQQOx5r5vdyc5h+6Qc=; b=Bw7sa1OQ59JGMgxhj5YPLnuiZolwB/J01tsphie180JM5HjcmSFq9GrbO+/zJn7xAP TAj+mbc0b2jhZ21719B2PKWFNnpC+QxYuUYAPgqPKyTZLoFm44giEZoJEhh2ztAJ6r29 aQqvCZOnX2hq8F8N3f8EgeOr4VTmGngKW1/RQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714062678; x=1714667478; h=in-reply-to: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=3tBrT3OfOkKuIv1xzAscKnKl0pQQOx5r5vdyc5h+6Qc=; b=hgm96q9UKYN7VGkulrXKyQnsVcWZMrAEpOJ1Hoe2YAWPK43lHpff7EF2M7joSqhydB d5dpgsgf2PJ2WOVEvdkajhoMvZON4laZOrXORyZngt5yqiupDcYxWWRVEZtx2a9N0k3A lJU4X1Cwx1GGKUnI7xvlUWK/R9yjORfaPOXMaAfn0fftNnv9BdQXUvvu7Hb5+zGjhwQQ s/toQWQY4C5+4eYvv5hjTvftEVqz6596JRmHTrRAj1XVhbTkAVZ6W446GR2VgusKLzWr LDJA8FUxiS597l+HPc6n2azzB2ti91W30R20fFhKlwblhRaXrxcU3zVUqdyrDLVpbscl 5LaA== X-Gm-Message-State: AOJu0YwYq7uSuDZm2yDSVziOQPRgpmWZExfmVfZkHtwkmclptwRTl+zG wyCDmYoR6NTEcOgGLJKaiyECXPN4yZ9SKcxIkugvSm8UYUMmU/ktuUUg7kwEkN8= X-Received: by 2002:a17:902:d883:b0:1e6:3577:1912 with SMTP id b3-20020a170902d88300b001e635771912mr35663plz.25.1714062678031; Thu, 25 Apr 2024 09:31:18 -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 n8-20020a170902e54800b001e2bb03893dsm13940883plf.198.2024.04.25.09.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 09:31:17 -0700 (PDT) Date: Thu, 25 Apr 2024 09:31:14 -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> <20240424072818.2c68a1ab@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=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Apr 24, 2024 at 09:39:43AM -0700, Joe Damato wrote: > On Wed, Apr 24, 2024 at 07:28:18AM -0700, Jakub Kicinski wrote: > > On Tue, 23 Apr 2024 22:54:50 -0700 Joe Damato wrote: > > > 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 base is used to figure out which stats are reported when we dump > > a summary for the whole device. So you gotta set them to 0. > > OK, thanks for your patience and the explanation. Will do. > > > > > 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). > > > > All the ones you report right? Not just zero the struct. > > Any day now (tm) someone will add a lot more stats to the struct > > so the init should be selective only to the stats that are actually > > supported. > > Yes, not just zero the struct. Since I am reporting bytes packets for both > RX and TX and alloc_fail for RX I'll be setting those fields to 0 > explicitly. > > And there's also a warning about unused qtype (oops) in patch 2/3. > > So, the revised v2 list (pending anything Mellanox wants) is: > > v1 -> v2: > - Patch 1/3 now initializes dropped to 0. > - Patch 2/3 fix use of unitialized qtype warning. > - 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 set all stat fields to 0 individually (no locking etc needed). > > I'll hold off on sending this v2 until we hear back from Mellanox to be > sure there isn't anything else I'm missing. It's been a few days and I haven't heard back from the mlx4 folks, so I think I'll probably send my v2 later today which, hopefully, will fix most of the above issues.