git: 406ff3d57e46 - main - Simplify buffer count calculation
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 07 Jul 2023 22:38:19 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=406ff3d57e464073c5bb2db2a744b9bf6b714a1e
commit 406ff3d57e464073c5bb2db2a744b9bf6b714a1e
Author: Mark O'Donovan <shiftee@posteo.net>
AuthorDate: 2023-07-07 22:31:47 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-07-07 22:36:28 +0000
Simplify buffer count calculation
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
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);