Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177750957
D58612.1795198200.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D58612.1795198200.diff
View Options
diff --git a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c
--- a/sys/dev/bnxt/bnxt_en/bnxt_ktls.c
+++ b/sys/dev/bnxt/bnxt_en/bnxt_ktls.c
@@ -180,8 +180,20 @@
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
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -2661,6 +2661,7 @@
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);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 20, 6:10 PM (15 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41873156
Default Alt Text
D58612.1795198200.diff (1 KB)
Attached To
Mode
D58612: if_bnxt: ktls: Reject new kTLS sessions once driver is detaching
Attached
Detach File
Event Timeline