From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 32423A0567; Fri, 13 Mar 2020 10:57:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9F5E21C02C; Fri, 13 Mar 2020 10:57:17 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id D39991BFBF for ; Fri, 13 Mar 2020 10:57:16 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id n15so11216507wrw.13 for ; Fri, 13 Mar 2020 02:57:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6462nVoVmYj3VyFYHU8V7faDl0JfU+HXV5flaWnQewE=; b=CUyddq8/CeLYQW7Tr+DeKzSr6ngfOwHUyRPF4ynuSsS4CqSZjtgxAxolo84vV0hVVQ Htp3M3hPzF5vj09qw/3V9MSaUYGRoAv5xlXhil4mTm9ZD17QurdY6Ji0gqpaYtY0DzOA 4mrfUqtNddErw0DwvordXX2SipScsWr7ogyLIL2MFD/ogTA5BJdvufiMJvqaCKT119Zp sBjKIrl7UhdbqC9rPnCRyStzbFBnH2bII5uYSn2rEmO3lMuMxmDYjreYPbHGJfIu9UCz NCROIQJZv6OmpDnmB/j3I9Yf3f9usMMUEunulqmzlYnF+/hmtz+0x1vKk4fBit8Kvs2A GSIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6462nVoVmYj3VyFYHU8V7faDl0JfU+HXV5flaWnQewE=; b=tB9+C4fvfvhGWfYjSISvwumQmWNbuDrjM92He69fMzKwEmWFEI0sAv5hRUOSoVN5zV WxTp41IJ/dW4s+rNAkaDD7mJ8U3vvKIr1kL1+7ZZdlWbQsG0oIF8wLgW8lOkIGNMwQtc bMJJttcOjOYPeVOIzRhzykKQnHXoWR8e+Bf2C7MyCUSFqSvMforEzfvIDcIBEQgmVwrH dT0B6YDAmf7W1qMvoCoJGHbUsVz4iyB6PvJ2GEUcB9JmWD7KMNBuky5AHdkFeMkSB7u8 +vHegzhu7rTzV39n6Ee/mr4QqB1yHVg3n8LPrvehIuXDMIfmtxrI0mmD0OKcyABoTnCk 03MA== X-Gm-Message-State: ANhLgQ2HUwAVyqerms5jZVGT6pzPBwtZrqjqNmX9NMrcQhaEbQOF6RJP NlrTiMd8Y8bw49Ewm6+BAVX2o6ropEuHqQ== X-Google-Smtp-Source: ADFU+vvfb/zvNFfRcPqS95INKlcTxEqoKpsTJTWXZNPgbkrtbXu5I8GyV/1mF6lPqKW113DkQaRwCA== X-Received: by 2002:adf:91c3:: with SMTP id 61mr3893554wri.384.1584093436292; Fri, 13 Mar 2020 02:57:16 -0700 (PDT) Received: from pala.dev.6wind.com. (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id f127sm16573892wma.4.2020.03.13.02.57.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Mar 2020 02:57:15 -0700 (PDT) From: Didier Pallard To: dev@dpdk.org Cc: stable@dpdk.org Date: Fri, 13 Mar 2020 10:56:59 +0100 Message-Id: <20200313095659.19000-1-didier.pallard@6wind.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/mlx5: fix Rx descriptor status returned value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Two bugs in rx_queue_count function: - One entry may contain several segments, so 'used' must be multiplied by number of segments per entry to properly reflect the queue usage. - rx_queue_count returns the number of entries used in queue, so it ranges from 0 to max number of entries in queue, not this number minus one. Fixes: 8788fec1f269 ("net/mlx5: implement descriptor status API") Cc: stable@dpdk.org Signed-off-by: Didier Pallard --- drivers/net/mlx5/mlx5_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c index 5ac63da8039d..17f80c25443e 100644 --- a/drivers/net/mlx5/mlx5_rxtx.c +++ b/drivers/net/mlx5/mlx5_rxtx.c @@ -500,7 +500,7 @@ rx_queue_count(struct mlx5_rxq_data *rxq) used += n; cqe = &(*rxq->cqes)[cq_ci & cqe_cnt]; } - used = RTE_MIN(used, (1U << rxq->elts_n) - 1); + used = RTE_MIN(used * (1 << rxq->sges_n), 1U << rxq->elts_n); return used; } -- 2.24.1