From nobody Fri Oct 09 10:12:48 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4j1N344yFSz6vRRM for ; Fri, 09 Oct 2026 10:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4j1N342PlLz4YD8 for ; Fri, 09 Oct 2026 10:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791540768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=csr9ocbFJ/ScGRO+NhzmylBR2k9bXP0thwOXIo8eQu4=; b=wr7y1+TOQQ3z5O/g6B8Sf3hMwqX9o9aeaeRl84gkBQ3QB/Ju/aTtoV+6NSKjfOZY1sCHiU FdnagTXjnl+QNwxJ2S0lpwjYO8V4SiDD1QeRvA8VyKunmQxTo0e/4PZBrcwiEz5vFz0JqX sudLL2RRby3J0rHdkhpP8+vZcX7mp81bNxy7gpPVDaku3w7b+MoIKzI15NX2vVqC7tVp0i OjRS7txOC1eAghnF7aG541uTdWbTZPupvl7ldvsN2QwTvizJaA/z5ggytV89xZVGk926vs yPVwHAmlhqON2tsk0xPTh+MuG8OXMBAZYeaiulsnPWxd0FfHQERICKKNLs8oZw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1791540768; b=HHItKsZlpD0U2UhrJMPAI6gbG+l5IkAspk2ax9di47Pw4rSydU17ADI5Or/FD+TZpGW+Hx Fpb1ExRgddaxmLtsimOx2p7671OZM12UfpuDOl3wXeYhBWWlf6uqkVxirRuuwKyKPwqpxG rDuMHjLclMGmj96DXvvkaUonbNxUDP4P3hBhyVoifn0kPyrrZmNphAZ7qnC2wTkUpEHFuV e0aAlza0h7mkru9TR0MkLTgqloqQLKZBdPsR54unBEAlVDMaa9zkHavPjFAq6/XYbgmHn3 OhZauoScBqPLfJ0y6bvG3usbFTNZZrX+GiZQraE8Y5ZzmXKeeD3r+9q3F2JQHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1791540768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=csr9ocbFJ/ScGRO+NhzmylBR2k9bXP0thwOXIo8eQu4=; b=L09CWWj+CGT8ux+qjWHwOtPwYF9IADfL7973E8UwtFuVGIQiSB/Kc7TT63J6cCtCN9b5T6 S8a+fswIn7tOEqUhdV+0YlvW+/4t6slzcGSVyfqinonYSCgXbs2+RUrZZc52/DkfZ/6/3G 8uZBKK9iVr8iDJtBmzsUdbudPwDaSmiqlI3E23wNRMFy9KAjjC/3LQgL4uUddpi6QT5PUR V6dMtx8kvvJVyuWROMicwbnVeRWJLph9CeyU1aC6cZo+XKoheo+T5p597PyM6f+GBCI9H2 8ALeXc90d5jTFmNz9oCLbnAmeOj3MO6djm6DW1X7G1m3JMJqsGnbLLCaFf0Ghg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4j1N340GYVz1KQh for ; Fri, 09 Oct 2026 10:12:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 439a1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 09 Oct 2026 10:12:48 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Sumit Saxena From: Sumit Saxena Subject: git: a48a50919da5 - main - if_bnxt: ktls: Reject new kTLS sessions once driver is detaching List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ssaxena X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a48a50919da5549b2a5a2141042087a25879435e Auto-Submitted: auto-generated Date: Fri, 09 Oct 2026 10:12:48 +0000 Message-Id: <6ac8be20.439a1.6c2ce705@gitrepo.freebsd.org> The branch main has been updated by ssaxena: URL: https://cgit.FreeBSD.org/src/commit/?id=a48a50919da5549b2a5a2141042087a25879435e commit a48a50919da5549b2a5a2141042087a25879435e Author: Sumit Saxena AuthorDate: 2026-07-31 15:53:02 +0000 Commit: Sumit Saxena CommitDate: 2026-10-09 08:24:44 +0000 if_bnxt: ktls: Reject new kTLS sessions once driver is detaching bnxt_tls_snd_tag_alloc() only gated on BNXT_STATE_OPEN, which is set once by bnxt_open()/bnxt_attach_pre() but never cleared again, so it could not reject new sessions once bnxt_detach() started tearing things down. The snd_tag_alloc_ref-based wait in bnxt_detach(), which waits for in-flight allocators to exit, was already in place, but without this gate new sessions could keep being created for the entire duration of that wait, extending it indefinitely instead of just draining existing ones. Reject new sessions once softc->detached is set, and reset it back to false in bnxt_attach_pre() so it doesn't wrongly persist across a detach/reattach cycle. Reviewed by: gallatin MFC after: 2 weeks Sponsored by: Broadcom Inc. Differential Revision: https://reviews.freebsd.org/D58612 --- sys/dev/bnxt/bnxt_en/bnxt_ktls.c | 12 ++++++++++++ sys/dev/bnxt/bnxt_en/if_bnxt.c | 1 + 2 files changed, 13 insertions(+) diff --git a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c index 0578de559910..90c59607f336 100644 --- a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c +++ b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c @@ -180,8 +180,20 @@ int bnxt_tls_snd_tag_alloc(if_t ifp, union if_snd_tag_alloc_params* params, if (!test_bit(BNXT_STATE_OPEN, &priv->state)) return (EPROTONOSUPPORT); + if (atomic_load_acq_int(&priv->detached)) + return (EPROTONOSUPPORT); + + /* + * Re-check `detached` after incrementing snd_tag_alloc_ref so + * bnxt_detach()'s drain loop can see this ref and wait for it. + */ atomic_add_32(&priv->ktls_info->snd_tag_alloc_ref, 1); + if (atomic_load_acq_int(&priv->detached)) { + atomic_subtract_32(&priv->ktls_info->snd_tag_alloc_ref, 1); + return (EPROTONOSUPPORT); + } + if (priv->ktls_info->init == 0) { counter_u64_add(ktls->err_counters[BNXT_KTLS_TX_UNINITIALIZED], 1); atomic_subtract_32(&priv->ktls_info->snd_tag_alloc_ref, 1); diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c index 6768e313f78d..25b535a67af8 100644 --- a/sys/dev/bnxt/bnxt_en/if_bnxt.c +++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c @@ -2661,6 +2661,7 @@ bnxt_attach_pre(if_ctx_t ctx) softc->slot = pci_get_slot(softc->dev); softc->function = pci_get_function(softc->dev); softc->dev_fn = PCI_DEVFN(softc->slot, softc->function); + atomic_store_rel_int(&softc->detached, 0); bnxt_set_flags_by_devid(softc);