From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A50E45BD41 for ; Tue, 19 May 2026 09:44:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779183895; cv=none; b=X/i76MNklC4FkDA6dkyppqLewhNYv0z0MpPNNefKjFa8KZfusLRt6RQuEYIpHo1SGTfqlf3YtTE/gRslCTRfmPeIPlozo7XS6/ljZj00886n4kOqne7cNJXao1OZ+3GXzk99jktMyto5t4xRkZQ5FN1RFPmyeq+9wHzZ9O4a2T4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779183895; c=relaxed/simple; bh=lOacJv7V5LVsinGCr6TMKN7P2fAlYwOiFkSQUvdCPU8=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=Aqy6Vetu3ulc+cCwpUmwOJRQB44Vqq6ImOcoj09C9PwIZu4qa9LhjAOKgs6UC/gLjE7JehYYRam4LOnAcZqoLBqvvqfFwFg9FfJdY/1KTQn68smLwHn5gVEhovt8oP3FrTw7WBbgLtyAju3GtxhPsaNgRD3gcu9xAK+d8Jdd8B4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=PbbFox+0; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=oljx8jmt; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PbbFox+0"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="oljx8jmt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779183893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mS/dUe0xMjxuiR1Fr534B3h7HtHQAImNE62an91opEw=; b=PbbFox+0UTl6Qv4j6ooKV9yI7TMys5fK5qCvvDFOTr5PvqQqpwBPTsAvHgqe79xa58jOJp KS9IUgzZjA/FPwLZMR4ppP7om7N41sRW5nazwZFvp6nvuU9GlElCTpvIFQyz03qU8NVLAd uBAWgVQAb4xl8cltahHgjJ4e+FHF7jQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-zSBvIP7vPPiSK3Jquq1y1A-1; Tue, 19 May 2026 05:44:50 -0400 X-MC-Unique: zSBvIP7vPPiSK3Jquq1y1A-1 X-Mimecast-MFC-AGG-ID: zSBvIP7vPPiSK3Jquq1y1A_1779183889 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-43fe791a398so2686677f8f.0 for ; Tue, 19 May 2026 02:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1779183889; x=1779788689; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=mS/dUe0xMjxuiR1Fr534B3h7HtHQAImNE62an91opEw=; b=oljx8jmtdcBWExBuN327v8e7W0RlH4qgxweTkhBMc3d+rbnPeilK6k04I4xSyg2P12 s+He3+FD+1PHw1+yC5Gb3yU5B5HJYO/7tb4A5gK6CaOrtfuV+w1ULgOA1oJsA9+6p5jC foaBMwL2OhbD+vSH9zgfrFJslxpeHSSsy5WFW/3ZhoKxQ9zOjfr1u6YYyvUrxI0/Eoh4 XPDHCWp5OwoImc5DeStLfNJwMPW+x6yh4tuHIGNVaWAeYn4SebjdWr2jqZOd95QwNQMp quhGRjculRjewlLREVUyVxJIV5q5CWX4GPZZGH85TE4P4MsfAChnIu1c4jj2zGvE+OJD 2eBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779183889; x=1779788689; h=content-transfer-encoding:in-reply-to:content-language:from :references:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mS/dUe0xMjxuiR1Fr534B3h7HtHQAImNE62an91opEw=; b=DB11oi+YlOzTU7mBEbLhX9Y2O3gCIhddJkN8YmYMEf8yx7QCRg3yxZxjL++qStfBiR pp1U19LiI+Z1dK0ruYTeoqZ2ALMTehomG/T/GNrra3075s/n5DZpSmUdYwgilGNhNvPy GXnsIWsovw4YK3MCD6WkmKRo/14+jq3zipIOKr2qqTnHP2o8OqrAuZcfuJFTr2uN2g2V bgOJjKPwwSB++/7NfW5oP6aky7pyr+07ZaAIHHDCoz02BJDb7S4tMWYP7w/6HQLItSEX yPAyW2/BkJc5aWNRmWFiMzm+x7G/jec2lfQCQPTs2ohiLNYeHN+oKT7MuLDSLc0BJTDE k06g== X-Forwarded-Encrypted: i=1; AFNElJ9lN5vkA65Rstx0imVc/hQrGcfqj/cKtrxXzKbHqtBKndk9+RkMteGLIVKr2d4PrQVgWUYWM9ImoJli3JM=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1jykGWaQQry3+yk1loigtWFR8wT9j0bw9AnTm9uEejTmxW9Sv uNDAC/DwJCK4pw33LhQp47/DcuCD1s9paWcTkmBV9DU0DEb0MI+6j9laMQTTetv287W8PvdhK3h 4OnZR0T+dx3GZ7/skk1NhnHPFd7lW0px2B5+3W8wMunDOMmknx5eJnGGNKVHIg9+BYg== X-Gm-Gg: Acq92OHRsljI4wAHSAExkw6Z/7TR1xiya9ccX+AAErSBNwz3i4JCp4b1dC4+7Mcn6Rn +C9wwba1m8TNOngVSoudrQ4ujKXmhHkgZEsX54Pijfuqel3A8n87jIPf+yIC+TzLJPxKzp9Ivli Y1DAVx/LuQUvWIZ6L4KGGaSzm8EwbFowl1jTMuGIGgi5SG1eC0pX2HHiGwrwClItCSY+0Ff6Ndj 0YeoAU8lmSyBR9t7jIWBIT7SsIDs9bKl0+l4XSlD9niZOZCKOOkGExLHztJnTc/J+ae+oAfEdKb ud3uq7yKj24yqq72BXOtKf7Xlzu/zsZ8MfjKI3FTXH0V98MCSaqvY41iwhALfWGrEYhfdHBf3me cxIm+vK00V2WTLDRkMnUs1wTNt8x7Cop1sGRseEnLkFN+2i4CjoxOAcA= X-Received: by 2002:a05:6000:2c07:b0:45e:75c5:1a6a with SMTP id ffacd0b85a97d-45e75c51b5emr16041027f8f.33.1779183888892; Tue, 19 May 2026 02:44:48 -0700 (PDT) X-Received: by 2002:a05:6000:2c07:b0:45e:75c5:1a6a with SMTP id ffacd0b85a97d-45e75c51b5emr16040980f8f.33.1779183888421; Tue, 19 May 2026 02:44:48 -0700 (PDT) Received: from [192.168.88.32] ([150.228.25.33]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45d9ec3ac86sm43826376f8f.14.2026.05.19.02.44.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2026 02:44:47 -0700 (PDT) Message-ID: <5e306e50-bced-4d4d-9eb4-766224680145@redhat.com> Date: Tue, 19 May 2026 11:44:46 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v4] octeontx2-pf: Retain ethtool stats across interface down/up. To: Anshumali Gaur , andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, gakula@marvell.com, hkelam@marvell.com, sbhatta@marvell.com, sgoutham@marvell.com, bbhushan2@marvell.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260514091634.1611537-1-agaur@marvell.com> From: Paolo Abeni Content-Language: en-US In-Reply-To: <20260514091634.1611537-1-agaur@marvell.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/14/26 11:16 AM, Anshumali Gaur wrote: > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > index 971fcab1c248..0ffcc613a4b2 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c > @@ -139,19 +139,21 @@ void otx2_get_stats64(struct net_device *netdev, > struct rtnl_link_stats64 *stats) > { > struct otx2_nic *pfvf = netdev_priv(netdev); > - struct otx2_dev_stats *dev_stats; > + struct otx2_dev_stats *dev_stats, *old_stats; Please respect the reverse christmas tree order above. > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c > index ee623476e5ff..21fd1dd4d755 100644 > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c > @@ -2154,6 +2154,8 @@ EXPORT_SYMBOL(otx2_open); > int otx2_stop(struct net_device *netdev) > { > struct otx2_nic *pf = netdev_priv(netdev); > + struct otx2_dev_stats *old_stats = &pf->hw.old_stats; > + struct otx2_dev_stats *dev = &pf->hw.dev_stats; > struct otx2_cq_poll *cq_poll = NULL; > struct otx2_qset *qset = &pf->qset; > int qidx, vec, wrk; Same here. You need to split variable declaration and initialization. > @@ -2162,6 +2164,27 @@ int otx2_stop(struct net_device *netdev) > if (pf->flags & OTX2_FLAG_INTF_DOWN) > return 0; > > + /* First stop packet Rx/Tx */ > + otx2_rxtx_enable(pf, false); > + > + /* Read final HW counters and accumulate */ > + otx2_get_dev_stats(pf); > + > + /* Accumulate old stats */ > + old_stats->rx_bytes += dev->rx_bytes; > + old_stats->rx_drops += dev->rx_drops; > + old_stats->rx_bcast_frames += dev->rx_bcast_frames; > + old_stats->rx_mcast_frames += dev->rx_mcast_frames; > + old_stats->rx_ucast_frames += dev->rx_ucast_frames; > + old_stats->rx_frames += dev->rx_frames; > + > + old_stats->tx_bytes += dev->tx_bytes; > + old_stats->tx_drops += dev->tx_drops; > + old_stats->tx_bcast_frames += dev->tx_bcast_frames; > + old_stats->tx_mcast_frames += dev->tx_mcast_frames; > + old_stats->tx_ucast_frames += dev->tx_ucast_frames; > + old_stats->tx_frames += dev->tx_frames; Sashiko notes this is still racy, as napi can still run and update the counters. You should move the stat collection just before freeing H/W resources. /P