netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Paolo Abeni <pabeni@redhat.com>,
	Haiyang Zhang <haiyangz@linux.microsoft.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Paul Rosswurm <paulros@microsoft.com>,
	Dexuan Cui <DECUI@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	Long Li <longli@microsoft.com>,
	"ssengar@linux.microsoft.com" <ssengar@linux.microsoft.com>,
	"ernis@linux.microsoft.com" <ernis@linux.microsoft.com>,
	"dipayanroy@linux.microsoft.com" <dipayanroy@linux.microsoft.com>,
	Konstantin Taranov <kotaranov@microsoft.com>,
	"horms@kernel.org" <horms@kernel.org>,
	"shradhagupta@linux.microsoft.com"
	<shradhagupta@linux.microsoft.com>,
	"leon@kernel.org" <leon@kernel.org>,
	"mlevitsk@redhat.com" <mlevitsk@redhat.com>,
	"yury.norov@gmail.com" <yury.norov@gmail.com>,
	Shiraz Saleem <shirazsaleem@microsoft.com>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXTERNAL] Re: [net-next, v3] net: mana: Support HW link state events
Date: Tue, 28 Oct 2025 15:01:51 -0700	[thread overview]
Message-ID: <20251028150151.3b3b7121@kernel.org> (raw)
In-Reply-To: <BY1PR21MB3870D5B860FB1F26932EB73ACAFDA@BY1PR21MB3870.namprd21.prod.outlook.com>

On Tue, 28 Oct 2025 19:36:02 +0000 Haiyang Zhang wrote:
> > Why is  the above needed? I thought mana_link_state_handle() should kick
> > and set the carrier on as needed???  
> 
> Thanks for the question -- our MANA NIC only sends out the link state down/up 
> messages when need to let the VM rerun DHCP client and change IP address...
> 
> So, I need to add netif_carrier_on(ndev) in the probe(), otherwise the 
> /sys/class/net/ethX/operstate will remain "unknown" until it receives the 
> Link down/up messages which do NOT always happen.

Oh that makes the code make much more sense.
Please add this and more detail into the commit message.

> +			if (!netif_carrier_ok(ndev))
> +				netif_carrier_on(ndev);

Testing carrier_ok() before calling carrier_on/off is entirely
pointless, please see the relevant implementations.

BTW I think the ac->link_event accesses are technically racy,
wrap them in READ_ONCE() / WRITE_ONCE() while you respin.
(Unless mana_hwc_init_event_handler() is somehow under rtnl_lock)
-- 
pw-bot: cr

  reply	other threads:[~2025-10-28 22:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24  1:41 [net-next, v3] net: mana: Support HW link state events Haiyang Zhang
2025-10-28 14:31 ` Paolo Abeni
2025-10-28 19:36   ` [EXTERNAL] " Haiyang Zhang
2025-10-28 22:01     ` Jakub Kicinski [this message]
2025-10-29 13:20       ` Haiyang Zhang

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=20251028150151.3b3b7121@kernel.org \
    --to=kuba@kernel.org \
    --cc=DECUI@microsoft.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=dipayanroy@linux.microsoft.com \
    --cc=edumazet@google.com \
    --cc=ernis@linux.microsoft.com \
    --cc=haiyangz@linux.microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=horms@kernel.org \
    --cc=kotaranov@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=leon@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=longli@microsoft.com \
    --cc=mlevitsk@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paulros@microsoft.com \
    --cc=shirazsaleem@microsoft.com \
    --cc=shradhagupta@linux.microsoft.com \
    --cc=ssengar@linux.microsoft.com \
    --cc=wei.liu@kernel.org \
    --cc=yury.norov@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).