From nobody Thu Jun 27 17:44:56 2024 X-Original-To: dev-commits-src-all@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 4W95Yj0rPTz5Q6V8; Thu, 27 Jun 2024 17:44:57 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W95Yj0C7Zz4Ytn; Thu, 27 Jun 2024 17:44:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719510297; 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=3RAx09v5SAw20mS83Um/0ftkenSSH6W+KjnIHIAun7g=; b=jhZ5OI1s7vMIKc+KswkEFTseTcF37ORs05ZiXslJO2oL1CFYXTl0LaZ3q4nv7BIP+dFLye zZV+4nonAr4Xi00fVZp8jMd6eI6R+9I7Tz0H4QXRs7zv46VgYZmgmupgV9fGAdOhjvnoaV D0AN06AVkktSGcRpF7SuevsTGCMT9YFU5Y8R+1GhUNEBWW/SmVDErjLAKgAc/QILd6ptlx 2m6kcRuP7Ua6GmEKxmH3bMmyqyTB4GJeBetjZuWC9XE3C9p/Rj4m43UguSNaQ3i4dpKd1Z nIWutEUpCCC3yFG5eU9oiAEEo/U9ezP8qMA1uNZd8j5fsBWEQgf5wbbdXFmUbw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719510297; a=rsa-sha256; cv=none; b=t6wQGt54lHmCCcc4ar6/dcfxT4bBdayjPik1uHV/jC56jNbYqojXCZUsPfbC8g1HgU0AIb tkIIU17SeuR0sHMfwOdcAqXxCPtZVylkg2N1kucjcHojb9kw8DoBMnqQ7HIH3gEvIMZs9j rfdrBIXgcLZV828mpjlVqQSkN8CCjWsnhbxFlGB2GR2Us82Ve1D51UNpKyo92o0I5xcgVl CxeKaYo+Y+ddRZ6zxnOSWPeqCITRj7SXjH0DdtCp9sqyeXJIGuWrCs0Xaa/lebYMChRrnx DSvCnAFFQ5A68dPHVTCk/UPBIPaPqLEfN7+ypZvMmqXsbgbAQxom6J/nfauBPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719510297; 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=3RAx09v5SAw20mS83Um/0ftkenSSH6W+KjnIHIAun7g=; b=BVmE6Sfz82sHJfiXJK0dJaF9ixj2/MKbHnU2c4emAJZMsdBkqRDFO+sZGiZv3G2J9G9L+f 1o9o9PCeR3g7YjQ3Equ30/4EoTp0SL+ixi2oyqeRPnMOAhW8x7U5tQgo/reKdoXr1peGkI vsw9BLde7R85mgE0ijzKK2NvbkxWN8oAqLaM+kWPLWTEMJlNhPzX1wUjuO5fGw25oBonFE UMZ1BxO4VflpfMkSt/ZYpAxv+5TmH+vR5oUq6/HWujFk1ryHS6CIkaiY1PBA+NxCKOWWyh AlboR16qMe6jBX/iDO1A4zFzICQEgqH+QyN2FT47Qk0vj+ci8ejDwKoy+N0Nfw== 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 4W95Yh6lWdzM1t; Thu, 27 Jun 2024 17:44:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45RHiuJ0005016; Thu, 27 Jun 2024 17:44:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45RHiuBJ005013; Thu, 27 Jun 2024 17:44:56 GMT (envelope-from git) Date: Thu, 27 Jun 2024 17:44:56 GMT Message-Id: <202406271744.45RHiuBJ005013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: a35f66510917 - main - if_genet: don't load DMA mapping when tx_queue is full List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a35f66510917f5ac21c11e9642174cda7718fbc6 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a35f66510917f5ac21c11e9642174cda7718fbc6 commit a35f66510917f5ac21c11e9642174cda7718fbc6 Author: Mitchell Horne AuthorDate: 2024-06-27 17:26:54 +0000 Commit: Mitchell Horne CommitDate: 2024-06-27 17:44:36 +0000 if_genet: don't load DMA mapping when tx_queue is full gen_encap() always calls bus_dmamap_load_mbuf_sg() into 'map' (which is the current tx_queue). If the tx_queue is full, it will load with a 'map' that already has a currently active mapping. This violates the busdma(9) KPI. Checking for a full queue and returning ENOBUFS will allow gen_start_locked() to set the IFF_DRV_OACTIVE faster without having to needlessly check if the mbuf will fit (it won't). PR: 256482 Reviewed by: mhorne MFC after: 1 week Submitted by: ghuckriede@blackberry.com --- sys/arm64/broadcom/genet/if_genet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index e102b6c3a95f..ccc35fe841df 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -1069,6 +1069,10 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) GEN_ASSERT_LOCKED(sc); q = &sc->tx_queue[DEF_TXQUEUE]; + if (q->queued == q->nentries) { + /* tx_queue is full */ + return (ENOBUFS); + } m = *mp;