[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjqL4uF0MG_c8+xHX1Vv8==sPYQrtzbdA3kzi96284nuQ@mail.gmail.com>
Date: Wed, 6 Aug 2025 01:40:37 +0300
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Simon Horman <horms@...nel.org>
Cc: Ammar Faizi <ammarfaizi2@...weeb.org>, Oliver Neukum <oneukum@...e.com>,
Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Linux Netdev Mailing List <netdev@...r.kernel.org>, Linux USB Mailing List <linux-usb@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Armando Budianto <sprite@...weeb.org>, gwml@...r.gnuweeb.org,
stable@...r.kernel.org, John Ernberg <john.ernberg@...ia.se>
Subject: Re: [PATCH net v2] net: usbnet: Fix the wrong netif_carrier_on() call placement
On Tue, 5 Aug 2025 at 23:28, Simon Horman <horms@...nel.org> wrote:
>
> I have looked over the patch and it appears to me that it addresses a
> straightforward logic error: a check was added to turn the carrier on only
> if it is already on. Which seems a bit nonsensical. And presumably the
> intention was to add the check for the opposite case.
>
> This patch addresses that problem.
So I agree that there was a logic error.
I'm not 100% sure about the "straightforward" part.
In particular, the whole *rest* of the code in that
if (!netif_carrier_ok(dev->net)) {
no longer makes sense after we've turned the link on with that
if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags))
netif_carrier_on(dev->net);
sequence.
Put another way - once we've turned the carrier on, now that whole
/* kill URBs for reading packets to save bus bandwidth */
unlink_urbs(dev, &dev->rxq);
/*
* tx_timeout will unlink URBs for sending packets and
* tx queue is stopped by netcore after link becomes off
*/
thing makes no sense.
So my gut feel is that the
if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags))
netif_carrier_on(dev->net);
should actually be done outside that if-statement entirely, because it
literally ends up changing the thing that if-statement is testing.
And no, I didn't actually test that version, because I was hoping that
somebody who actually knows this code better would pipe up.
Linus
Powered by blists - more mailing lists