From nobody Mon Oct 21 18:39:10 2024 X-Original-To: dev-commits-src-branches@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 4XXPGk45nBz5ZcwX; Mon, 21 Oct 2024 18:39:10 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XXPGk2MLvz4Fgh; Mon, 21 Oct 2024 18:39:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vd40LtQelcIzY3YrYnSf619dbmJQ2zmD6j1r3A15mwA=; b=i/dO0UBz8ge4qokGdq7XDWOv/cPuO9EyJxtIpqZNzaoO+UIKaTspukmbNFPIvbyUhPF2AM VrKCr6qE7L2uyaB+w+SEzOZPoepAzuhexdHtQRE3BXgvCDH4phWbQ65xG4rLo7M2i6xYWR hnZRmZc3/43GobuLt06ZeocqgYCK6epK43G7TECa03tvlsAUpSeJ+SIO0YuFFOYXwSCFYO uZ5EYXUv2i13KHVvBWck3l6n5qSPJNYnrxV4Y/H2DOZisXOk5/MNuGodrDlEgYltp+EfW2 KW4dJ+2rPF5yRQn0OOIojaufy3hb4nwoSdrg3WXv2QG3a9Otj7yAG26F1EWM4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729535950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vd40LtQelcIzY3YrYnSf619dbmJQ2zmD6j1r3A15mwA=; b=jf8IhMaSvL/+cq4x0sGnaw1nI+50YA/IKkLNvlHGPL09+7u/BpCpaLP4l/NhbjcPJhfMqF SOQJiadtTYfiY0c33T0ExZM8cWoxEQ1HGi17V0On/v3X3xqSuDNnJ/ndnHKFVcIRClPwGw 9drGgf95ahSG+HjaCMtOJvZD0KLcwHhvukHSfTPf/i6VWQkKJFuM5wfsko6A4tcQzP75bl q9L+AFmVY8Ay5kKF3bMhOnHZVM4o/7lb2SmaJA3RXJuS66sv0aAFNzczplQTu6rhVXxACc glUAW9OEDe45NWw21xOV765sP7mzqbcmyJKn5aqzBZzSpOfH7lh3GsPmoxIUJA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729535950; a=rsa-sha256; cv=none; b=BNH529b9Pf2j3/d29LoPNA9xQrtaOLCph2aw1Fk3iI0ddQF2u/NJMvBG+CvPi05HRls66t 134rJeUNM++25IWUwYInYtYaeZBc34rz60ackto8DYlJ5kt6vcECBbEwtwTSj0WVqI7xfA tOngixLvzilcNPOwqcrCbZCimmJ8MF0ZNdkGnuG0q+umdIQuvX0f8yE7JI/QR+bKM8v3Va 3V0ncyShgHEQdWI8mLF/qhiWampTW3S6WtotzY+qHyys7NnhdnkMqmnIOjGtisMn5diEaP 2zPEvHWsBiOinopwHSZv5aqDILDesW9DZdPQGG+r8FgLb9tvJWKlTo6DewOZ5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XXPGk1wxNzhYK; Mon, 21 Oct 2024 18:39:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49LIdAhL036128; Mon, 21 Oct 2024 18:39:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49LIdA0I036125; Mon, 21 Oct 2024 18:39:10 GMT (envelope-from git) Date: Mon, 21 Oct 2024 18:39:10 GMT Message-Id: <202410211839.49LIdA0I036125@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Navdeep Parhar Subject: git: fb313ad44d51 - stable/14 - cxgbe(4): Stop and restart the atid allocator with the LLD. List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: fb313ad44d5143cc03446bc239fd2437f0e03bd8 Auto-Submitted: auto-generated The branch stable/14 has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=fb313ad44d5143cc03446bc239fd2437f0e03bd8 commit fb313ad44d5143cc03446bc239fd2437f0e03bd8 Author: Navdeep Parhar AuthorDate: 2024-07-12 23:53:22 +0000 Commit: Navdeep Parhar CommitDate: 2024-10-21 17:01:50 +0000 cxgbe(4): Stop and restart the atid allocator with the LLD. atids are used by both filters and TOE and the atid table is in the base driver (LLD). New atids cannot be allocated when the allocator is stopped but existing ones can still be freed. It is expected that the owners of outstanding atids will release them in their own stop processing, before the adapter is restarted. Sponsored by: Chelsio Communications (cherry picked from commit fd3aca5b41968421f243b760ac5733f39f25cc56) --- sys/dev/cxgbe/offload.h | 1 + sys/dev/cxgbe/t4_main.c | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/offload.h b/sys/dev/cxgbe/offload.h index 877fdb6b0a89..b17056dc0338 100644 --- a/sys/dev/cxgbe/offload.h +++ b/sys/dev/cxgbe/offload.h @@ -151,6 +151,7 @@ struct tid_info { union aopen_entry *atid_tab; union aopen_entry *afree; u_int atids_in_use; + bool atid_alloc_stopped; /* High priority filters and normal filters share the lock and cv. */ struct mtx ftid_lock __aligned(CACHE_LINE_SIZE); diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 2388f0863e77..f1f1cccb93c2 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -780,6 +780,8 @@ static int t4_alloc_irq(struct adapter *, struct irq *, int rid, static int t4_free_irq(struct adapter *, struct irq *); static void t4_init_atid_table(struct adapter *); static void t4_free_atid_table(struct adapter *); +static void stop_atid_allocator(struct adapter *); +static void restart_atid_allocator(struct adapter *); static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); static void vi_refresh_stats(struct vi_info *); static void cxgbe_refresh_stats(struct vi_info *); @@ -2097,6 +2099,9 @@ stop_lld(struct adapter *sc) } end_synchronized_op(sc, 0); + + stop_atid_allocator(sc); + return (rc); } @@ -2447,6 +2452,9 @@ restart_lld(struct adapter *sc) done: end_synchronized_op(sc, 0); free(old_state, M_CXGBE); + + restart_atid_allocator(sc); + return (rc); } @@ -3941,6 +3949,7 @@ t4_init_atid_table(struct adapter *sc) mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); t->afree = t->atid_tab; t->atids_in_use = 0; + t->atid_alloc_stopped = false; for (i = 1; i < t->natids; i++) t->atid_tab[i - 1].next = &t->atid_tab[i]; t->atid_tab[t->natids - 1].next = NULL; @@ -3962,6 +3971,28 @@ t4_free_atid_table(struct adapter *sc) t->atid_tab = NULL; } +static void +stop_atid_allocator(struct adapter *sc) +{ + struct tid_info *t = &sc->tids; + + mtx_lock(&t->atid_lock); + t->atid_alloc_stopped = true; + mtx_unlock(&t->atid_lock); +} + +static void +restart_atid_allocator(struct adapter *sc) +{ + struct tid_info *t = &sc->tids; + + mtx_lock(&t->atid_lock); + KASSERT(t->atids_in_use == 0, + ("%s: %d atids still in use.", __func__, t->atids_in_use)); + t->atid_alloc_stopped = false; + mtx_unlock(&t->atid_lock); +} + int alloc_atid(struct adapter *sc, void *ctx) { @@ -3969,7 +4000,7 @@ alloc_atid(struct adapter *sc, void *ctx) int atid = -1; mtx_lock(&t->atid_lock); - if (t->afree) { + if (t->afree && !t->atid_alloc_stopped) { union aopen_entry *p = t->afree; atid = p - t->atid_tab;