From: Wolfram Sang <wsa+renesas@sang-engineering.com>
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
Date: Fri, 31 Mar 2023 08:02:21 +0200 [thread overview]
Message-ID: <ZCZ3bSlOF9Sm4DJ2@ninjato> (raw)
In-Reply-To: <CRIP4UR9M4IS.V7ZOZHKV9QRX@den-dk-m31857>
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
> > + if (pdata->is_open) {
>
> Couldn't you just use netif_carrier_ok() here and drop the is_open
> variable?
From 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 == 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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-03-31 6:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 6:40 [PATCH net v4] smsc911x: only update stats when interface is up Wolfram Sang
2023-03-29 7:41 ` Steen.Hegelund
2023-03-31 6:02 ` Wolfram Sang [this message]
2023-03-29 19:39 ` Jakub Kicinski
2023-03-29 19:48 ` Wolfram Sang
2023-03-29 20:17 ` Jakub Kicinski
2023-03-31 6:33 ` Wolfram Sang
2023-03-31 6:50 ` Jakub Kicinski
2023-03-31 9:53 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZCZ3bSlOF9Sm4DJ2@ninjato \
--to=wsa+renesas@sang-engineering.com \
--cc=Steen.Hegelund@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steve.glendinning@shawell.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.