Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp623111rwl; Thu, 30 Mar 2023 23:14:45 -0700 (PDT) X-Google-Smtp-Source: AKy350ZfbxhlKyIfC1WPIAfiJcR4vdYqQE2pdaNe0ir0c3IyIW3pk2YW/cVcixs2zwSiC5lh8NWd X-Received: by 2002:a17:906:1ce:b0:92e:f520:7762 with SMTP id 14-20020a17090601ce00b0092ef5207762mr4157838ejj.6.1680243284679; Thu, 30 Mar 2023 23:14:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680243284; cv=none; d=google.com; s=arc-20160816; b=g4NI6M+A5w2fot8j1/TY4i8OPde8bSL073BH02q+2cxDfE0JyPWUnR1av6GF/oIfd7 mPFsC8wOi5j42zXbVLi6xjLHA4pdKNYli0tQQm6SA0jtkj+MsDZ3bfepmqu0csi72kSV xfO0CnK26PlDv4AvHUc79/Sa4KPy9QY3u81Tzr1sq0xEmkRRsRCeokxFvhVyvqeilrEW zjr/P0OOydhkFMYSWusKI6L/7FCO2ub8V+c5Dhvh44XH8B0x+8Ok8ESWsmtbG7pDhN6W sTcm6xSxcOylajFCIkFiKP/BW3Yp65gLz05GF4OTArNvlFLUAUiItvyclK5LtRaUABc6 tbyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=gT3P4XptqCdmdiqOP7xHP//e/F1jG+D/kNflBg0Vy9w=; b=teUyDW2mQhVnQimErloJnlm1OPrHpGRNQFWYlnIv4LEz5AUJyEPFJg3C0RaUG/Y8Jt z+54VHFzUrGAS0cORL2ILTCGLwqb8+4s8QQUztJAE0DFeQECpDSaOaMFgS6l5sazGVMw BA1IXCX0vJOeV/jC9CBix5IpvoNyFz+j8GVUZHDAbhGHKa6LeS2Ze4nITIpupNUz+fKj /bfxV41//lWeeFULZaA4kLsjOgAUXXxNsODsMpJvxjGz/G/mPUPZxUCG8VQO6OvxWdud zs0wqeK0lksNFZUDgxP2agoB30JyyepSMCZuVAaght61oFACMM5RkeOUUzcBKJONadT6 TCAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=rPtmrypJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y2-20020a17090668c200b009324eea0cedsi1281170ejr.72.2023.03.30.23.14.19; Thu, 30 Mar 2023 23:14:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@sang-engineering.com header.s=k1 header.b=rPtmrypJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229975AbjCaGC3 (ORCPT + 99 others); Fri, 31 Mar 2023 02:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjCaGC2 (ORCPT ); Fri, 31 Mar 2023 02:02:28 -0400 Received: from mail.zeus03.de (www.zeus03.de [194.117.254.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FA0BC645 for ; Thu, 30 Mar 2023 23:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=sang-engineering.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=k1; bh=oTBeSyANGvYTvZGv/yjKbgHwqoOH PgLHtmNhf4S1oEo=; b=rPtmrypJ6xxitPxAbhDbTQYB8H5YJST13c52+PaCWJB9 bJUxKakDT3sHhQf94TOxhoNZimxkEZiM7qnJrzRPl7CrZuju4WRrRxs5Alw44odP 4niiDirM3GMLHqZy4TFBpvmJlJL9DKlH3goTK/fTJGhTehb1KRu7vvduUEyi19k= Received: (qmail 1176182 invoked from network); 31 Mar 2023 08:02:22 +0200 Received: by mail.zeus03.de with ESMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 31 Mar 2023 08:02:22 +0200 X-UD-Smtp-Session: l3s3148p1@drDW8yv4gokujnv6 Date: Fri, 31 Mar 2023 08:02:21 +0200 From: Wolfram Sang To: Steen.Hegelund@microchip.com Cc: netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, steve.glendinning@shawell.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, geert+renesas@glider.be, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v4] smsc911x: only update stats when interface is up Message-ID: Mail-Followup-To: Wolfram Sang , Steen.Hegelund@microchip.com, netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org, steve.glendinning@shawell.net, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, geert+renesas@glider.be, linux-kernel@vger.kernel.org References: <20230329064010.24657-1-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="ZPUO7quT3QOZiRXY" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --ZPUO7quT3QOZiRXY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > > + if (pdata->is_open) { >=20 > Couldn't you just use netif_carrier_ok() here and drop the is_open > variable? =46rom my research, I can't: 1) netif_carrier_ok() uses __LINK_STATE_NOCARRIER 2) __LINK_STATE_NOCARRIER gets cleared in netif_carrier_on() 3) netif_carrier_on() is this code: if (test_and_clear_bit(__LINK_STATE_NOCARRIER, &dev->state)) { if (dev->reg_state =3D=3D NETREG_UNINITIALIZED) return; atomic_inc(&dev->carrier_up_count); linkwatch_fire_event(dev); if (netif_running(dev)) __netdev_watchdog_up(dev); } 4) Notice the last if. It checks netif_running(). So, it is possible to have the carrier on and the device not opened yet. 5) Sadly, no cigar. If I didn't miss something... But thanks for the suggestion! Happy hacking, Wolfram --ZPUO7quT3QOZiRXY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmQmd2kACgkQFA3kzBSg KbaWBA//fNTM7DoeNK5082KA1GRiby93GS14IGQqwOJbugpYLk+36OilPukr+Egm pRjLvfTjZ8Dw5r+DlxPopbMQpjWH2+vlTgFVa11AmZszqQI4P4l4HDLP/tHcBQ3w o0GyFDzD3t/ZJArRXJJX9CytuVBnZQ5l06Uu+PPg6xjysxna+JKd+1SMxMVU+gA8 i/jWBkfstKjLQhp7x78n+wDTG/i2GBTlMo9SayQVxQbYk1h9XdWuq9vdaLe4xVgb LLQ5DwFw+KrTQdHd0Va6+ESxYsD0hljd8I2ICjJrARELVzzb7ZMimArO1LVWaqPy /OoBSgSJRSV/7pqoLm84E4Jdpr2lkI4AZM70t6HoXOF/DRubSanrx8/C23ATKzhx mwL9iMm17+bYZELNG9Ny9QEYm5Sup1sprcyU2BBAH0TRRQ6w7KcHkv7eLwS8WCBj mu0pf1gcDrNng2xO9CqdyXdPeiRGWWXAuqzdHqRxnxvxr0yqnlyR78g/stf2kmc5 ow0soo4idGQZPH2mkqZu9gw9HK6nikful1xY8gzv3rDZMfs70rnS53uN84qUmY63 kIkd+8EvDo8vTXr+dWeE/q2Wv8QN2AU29/Lj+IGs3OHf2UluumNioQliYHB7b+l7 TZ8hs/Bu8S6BQPNE4tZRiooHsgx7HRJSdXPPUgr7ykndQ5+G2pg= =mITd -----END PGP SIGNATURE----- --ZPUO7quT3QOZiRXY--