From nobody Thu Jul 04 13:32:25 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 4WFHd61SZhz5Q8GW; Thu, 04 Jul 2024 13:32:26 +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 4WFHd60xfpz4Tc1; Thu, 4 Jul 2024 13:32:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720099946; 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=e886kEQ8zDAvNON+vZZ6dqEc7MmM458v37s5KeR8REY=; b=u02Ui96nxc1Poa5iny+FGnd2DdSigmWyIbyIW0gMFgaUypRdU+A/NCUUQDHSOPogrWq4Mm V/ntrbnVmjgsMy8y95KPcCMcYEjS8xJpiXDP1QeXx/pBjbfn2k1c6UJ67OHjijLQCtkhYz kevXyYQpb0rL/gF97rVPztDPX3c4zTkozytPbF4Yy5HzBSdWRyBs/VASwM6NGwd8PTgarf BJTBZ1cYy0vI8t1QGcDPDcZHKyGqWUTFMZ2lPHkS0Ksgl8ChlKkNQqso05npD3KAF5T8NM PvaE09BZbrmx4UyMvgjk5DxmJN4pFjnmijTq4as9V8k4Ez8/ELzhq/t1Ho6Q7w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720099946; a=rsa-sha256; cv=none; b=A0vbfcXEYHQBSrtc8nvS37F8BAtiDKRoYDwhd1N0wK8Ag66LJQIvuwsCva4KbC8l10JmKA mYNdXjWnktRJKTbaNIAULU45Qg5bRNkTziWHrNrBB9IzLFRWDGOl2tt5di2G68y45DRr86 vGpVK3d0OS+Quda7iSI29hoCukQZ/ngFfAiBBkcXfATft7dA9Cf2Z3NHv5Kx+7PTHcx1KF 8B8Qy8Qk14p2RKo/O/4EJuZ06y3X5FBYSYNTRltkQnSJlsJlPFHW6iHgF7LgO3Uz/CNpNV UMHb09oe64pM/cVBRkQnn1m1ykOMJD5fm1zCvqvP1H2I5YcU9GDDfn8vjX5PBQ== 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=1720099946; 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=e886kEQ8zDAvNON+vZZ6dqEc7MmM458v37s5KeR8REY=; b=jKzl5x2br+DVjc1BoQIOLGwgxPXwwtdM6XtYX7euALEgoVeYlKsjHfV3UCDKY3yHpz2L7G 3P+2c13GspGM4O5pcI0JKSOhaoQWUDP1Yqkmkhf0zIxhADboDBcqmgCb2/W9fw9rLHTSzM 1gFbzDWgNCJPExOk3BNjdIzJgVRfnypmioXDp/H8ebHYmd4w/3KVuvKTFdm+x3m8+4CI8T 3/VUbH+RutYZ1RD7JIVgguDk5I2RnDFesITPZvQo4sfvzchwTxwITOftjf9HSv5tT93Tic GRpxmwt6SFzpfwLgzIh7nfM2KIZpd693DhC9/RHtXuv+I3MsQ/vBd96Ksf/Bgw== 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 4WFHd60Y4lzGLv; Thu, 4 Jul 2024 13:32:26 +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 464DWPsL092770; Thu, 4 Jul 2024 13:32:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 464DWPWH092767; Thu, 4 Jul 2024 13:32:25 GMT (envelope-from git) Date: Thu, 4 Jul 2024 13:32:25 GMT Message-Id: <202407041332.464DWPWH092767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 8daa60945080 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 8daa60945080c602f2a65ed2a0f2333c15bd947e Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8daa60945080c602f2a65ed2a0f2333c15bd947e commit 8daa60945080c602f2a65ed2a0f2333c15bd947e Author: Mitchell Horne AuthorDate: 2024-06-27 17:26:54 +0000 Commit: Mitchell Horne CommitDate: 2024-07-04 13:31:54 +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 (cherry picked from commit a35f66510917f5ac21c11e9642174cda7718fbc6) --- 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 40fc096208c6..8fb46a7552f1 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -1070,6 +1070,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;