From nobody Fri Jul 7 22:38:19 2023 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 4QySwX0pg5z4l8Km; Fri, 7 Jul 2023 22:38:20 +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 4QySwW2VZgz3Npc; Fri, 7 Jul 2023 22:38:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688769499; 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=VuzTyD3yk+/AY8E53+AMDT9P0JVEmdQhKUVqOg1KJF4=; b=Xq2AqPQ1z6aRGPJM/JWMY7bN1IaNmRZ55/UtI6ngFRF7TNjTkBPh+dBx2e6G8phlC5CWgS jLsizWWZktSRdHhnh7hgsR6QJfKc1J6aTXzaB1EqDytOwCgIipGG47sP8VfmiTE81WPK+I cYm6++keEjCZmcWoT2NEhEJZb8y9T9CIhMK3s6OrlKYYU5myJF1J0rwyiP29yknpEal3We C3/V8GdkbHy06VvnvSFbfE7mspkdTKIgZUV9zc/EXx/1IyIB3W99oOrhOw595nH1kPAxUv 3GTQzIOFIkg3ID7RwB9Obsmq9rzDTbFXij/f3cBsCaKxVhYp09cM3+mHfwkjaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688769499; 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=VuzTyD3yk+/AY8E53+AMDT9P0JVEmdQhKUVqOg1KJF4=; b=VXH18fVt95DTdZXLrotS5zfR3BIixAixc9230mKiaXyqcJ2o4y37ueB5R8n/ad5RG67X1G eVsqf9v+d6vRfgeZ6i6JTmD8lSr7SEm92Mv6Wfl+ixG5jVpvLzChuulk1xLZmqKm2Jl25s 2owffBKjN3YIMCeVLKCZPk85k4ZW4THsowOfyvL0t9QaSPeYOoPzdav6dfnOrDaOJlUh2T /DU6D1mbuNmOYXKS58Mxm/Jswms1jFskJwpTeFJHOIKabZuBcC5EoZB97nfl3hklHBv/7V 9LKIzUvsxUvBqvKfr3xtWVfwrL9nXGLdS5RdiwEU28FRLTQEhTog0+vnGUSXDQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688769499; a=rsa-sha256; cv=none; b=gXwj8ryVOzTC1NOv0sw90IFZLFuWc+QqBGO5XoV3SaBtemaxJGmmEs6OtFubSbPCFdWS6g Le+OVNOUzE/PdimtXpfhu2OPZTgJUSDVbbOzpGXT1CulAj+4Kx4kIbxp27ov4bWz37XN2z 7rsdM7Wedy1eLQw9Lw/W9ESM7FtwqUC1hV9S2osf37q5yUeA5LNH1u/8S749tsGUjSlNaX 5gdT86tto0eHO9e/iFpBQ4xi2+4saURZCfck+hiV87oX4tkn7cIjlibPlAWUoH3ag27eUT Kfwr2Cg+9MGANhCbzzy372bJpSMnlUw91Rt1qB0sNAtiCqqi1b+FxGktMzl7IA== 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 4QySwW1btxzwmN; Fri, 7 Jul 2023 22:38:19 +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 367McJEa078751; Fri, 7 Jul 2023 22:38:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 367McJZB078750; Fri, 7 Jul 2023 22:38:19 GMT (envelope-from git) Date: Fri, 7 Jul 2023 22:38:19 GMT Message-Id: <202307072238.367McJZB078750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 406ff3d57e46 - main - Simplify buffer count calculation 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 406ff3d57e464073c5bb2db2a744b9bf6b714a1e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=406ff3d57e464073c5bb2db2a744b9bf6b714a1e commit 406ff3d57e464073c5bb2db2a744b9bf6b714a1e Author: Mark O'Donovan AuthorDate: 2023-07-07 22:31:47 +0000 Commit: Warner Losh CommitDate: 2023-07-07 22:36:28 +0000 Simplify buffer count calculation Signed-off-by: Mark O'Donovan Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/778 --- sys/dev/qlnx/qlnxe/qlnx_os.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c index fa95e31543a1..135aea62c05b 100644 --- a/sys/dev/qlnx/qlnxe/qlnx_os.c +++ b/sys/dev/qlnx/qlnxe/qlnx_os.c @@ -451,17 +451,12 @@ qlnx_num_tx_compl(qlnx_host_t *ha, struct qlnx_fastpath *fp, { u16 hw_bd_cons; u16 ecore_cons_idx; - uint16_t diff; hw_bd_cons = le16toh(*txq->hw_cons_ptr); ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl); - if (hw_bd_cons < ecore_cons_idx) { - diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); - } else { - diff = hw_bd_cons - ecore_cons_idx; - } - return diff; + + return (hw_bd_cons - ecore_cons_idx); } static void @@ -2952,11 +2947,7 @@ qlnx_tx_int(qlnx_host_t *ha, struct qlnx_fastpath *fp, while (hw_bd_cons != (ecore_cons_idx = ecore_chain_get_cons_idx(&txq->tx_pbl))) { - if (hw_bd_cons < ecore_cons_idx) { - diff = (1 << 16) - (ecore_cons_idx - hw_bd_cons); - } else { - diff = hw_bd_cons - ecore_cons_idx; - } + diff = hw_bd_cons - ecore_cons_idx; if ((diff > TX_RING_SIZE) || QL_ERR_INJECT(ha, QL_ERR_INJCT_TX_INT_DIFF)){ QL_RESET_ERR_INJECT(ha, QL_ERR_INJCT_TX_INT_DIFF);