]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
eth: fbnic: fix ordering of heartbeat vs ownership
authorJakub Kicinski <kuba@kernel.org>
Mon, 22 Jun 2026 15:47:53 +0000 (08:47 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 24 Jun 2026 02:53:13 +0000 (19:53 -0700)
commitd87363b0edfc7504ff2b144fe4cdd8154f90f42e
tree9c95f63fac0deed0df7aa7a00beb63370987f4da
parentc79349905706d1a9f5047cda1a155d1870535221
eth: fbnic: fix ordering of heartbeat vs ownership

When requesting ownership of the NIC (MAC/PHY control), we set up
the heartbeat to look stale:

  /* Initialize heartbeat, set last response to 1 second in the past
   * so that we will trigger a timeout if the firmware doesn't respond
   */
  fbd->last_heartbeat_response = req_time - HZ;
  fbd->last_heartbeat_request = req_time;

The response handler then sets:

  fbd->last_heartbeat_response = jiffies;

for which we wait via:

  fbnic_fw_init_heartbeat() -> fbnic_fw_heartbeat_current()

The scheme is a bit odd, but it should work in principle.

Fix the ordering of operations. We have to set up the stale heartbeat
before we send the message. Otherwise if the response is very fast
we will override it. This triggers on QEMU if we run on the core
that handles the IRQ, and results in ndo_open failing with ETIMEDOUT.

The change in ordering doesn't impact releasing the ownership.
Both ndo_stop and heartbeat check are under rtnl_lock.

Fixes: 20d2e88cc746 ("eth: fbnic: Add initial messaging to notify FW of our presence")
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Link: https://patch.msgid.link/20260622154753.827506-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/meta/fbnic/fbnic_fw.c