Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2673710pxb; Mon, 19 Apr 2021 10:57:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaWN5+b9KInt1RozpbDMKuHp/ttTKXMs0ABbb77QYHGm6Gr79q/1meUUQz80AnfyifW5VV X-Received: by 2002:a17:90a:fa84:: with SMTP id cu4mr313169pjb.178.1618855038372; Mon, 19 Apr 2021 10:57:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618855038; cv=none; d=google.com; s=arc-20160816; b=ewrr0HmlAC2TXGTA2p4Uvf821ZbuSx6pQWOOaA9dg/GdX+jGfcZzPnidIlRndWlEbt t0KAHKwTwDwDfaQkn0WgR86fUsaN3yF6fon/RoU6CE0wyTmY5bx3x7UDLnmXT2xAPzDz M8H8sw5eT1wtNe8zpsWgvz1sptZJg5wPPV9rSVAaLP/FJ6m4Cgt37Pz3xakezvxDUvlu mtPwBpwhQ7j5uz93TlUGHT2mFodrUEPMfQkBiZ+F3GSUOvVcJygpjW2C/rKhW5mH6mhE pUFrdDp473Ij0dGM6C0vUqWS7DozmwZOJ0gqpSrF5xiM+TgPFmUiNVJOn+LpkD/iYEJv Ckhg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=NYxwoODAAchYjc4pxW5C/qym1vRj5ZmaGJVIrq1tp6U=; b=LLAzh8AVpBoreH30fhsY77IWwFoSkVuPvqguGNep1gHtyabQMsSj6Qkzt8CmlM3yVw rR2m6UakMmGIHal+90rPiOVLkL6DJjnChPCL2Wxh456+BjAnaSXCVbwB0YL5DHZrhhNe H7FAtn5uL3M0lrvfFjpD0u0W8JW1AEAbvE1aF1XUJbDD9VGuNry/CIDakk/qEJcmTdRV yps6qX+Uf5FH5uaJtSstOrikAsC9YJxf9RVjcKz7a7wCoNN1zdf7aGZ1ifPVf4j0Q8+n qIr+h9lfbRAOw+nXbKIbmlQlFiNJN3sLvrB52KnvaRI7cEawPuTqJkTbRNyfbLfdUuNb 6adw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="B/zxwuxg"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si20220156pgf.576.2021.04.19.10.57.06; Mon, 19 Apr 2021 10:57:18 -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=@linuxfoundation.org header.s=korg header.b="B/zxwuxg"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241391AbhDSNbe (ORCPT + 99 others); Mon, 19 Apr 2021 09:31:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:56334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241572AbhDSNWx (ORCPT ); Mon, 19 Apr 2021 09:22:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E1D0561406; Mon, 19 Apr 2021 13:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838291; bh=pgZ4aU/RyMSL0vPVZs1aMPL8OWO/M/xhCwtE0D5ydmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/zxwuxgcbAciioyNlv56Kjp156fCpht/eVIezLsNQY7HOLnzzdZoy26si6us0+jA +8SDIF/pbq0U/jXtacUVUyJeCL2J3pxMmvSn2M1h/0EZB0YWrwkAoeD22XqObszlWU cghJdZ3Zbf78ZcTzgwjqKtpKiIGqfOVMiu6s/o1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , "David S. Miller" Subject: [PATCH 5.10 075/103] ethtool: pause: make sure we init driver stats Date: Mon, 19 Apr 2021 15:06:26 +0200 Message-Id: <20210419130530.386347411@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski commit 16756d3e77ad58cd07e36cbed724aa13ae5a0278 upstream. The intention was for pause statistics to not be reported when driver does not have the relevant callback (only report an empty netlink nest). What happens currently we report all 0s instead. Make sure statistics are initialized to "not set" (which is -1) so the dumping code skips them. Fixes: 9a27a33027f2 ("ethtool: add standard pause stats") Signed-off-by: Jakub Kicinski Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ethtool/pause.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/net/ethtool/pause.c +++ b/net/ethtool/pause.c @@ -38,16 +38,16 @@ static int pause_prepare_data(const stru if (!dev->ethtool_ops->get_pauseparam) return -EOPNOTSUPP; + ethtool_stats_init((u64 *)&data->pausestat, + sizeof(data->pausestat) / 8); + ret = ethnl_ops_begin(dev); if (ret < 0) return ret; dev->ethtool_ops->get_pauseparam(dev, &data->pauseparam); if (req_base->flags & ETHTOOL_FLAG_STATS && - dev->ethtool_ops->get_pause_stats) { - ethtool_stats_init((u64 *)&data->pausestat, - sizeof(data->pausestat) / 8); + dev->ethtool_ops->get_pause_stats) dev->ethtool_ops->get_pause_stats(dev, &data->pausestat); - } ethnl_ops_complete(dev); return 0;