From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EBE642825; Thu, 23 Mar 2023 13:34:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4179040E09; Thu, 23 Mar 2023 13:34:55 +0100 (CET) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by mails.dpdk.org (Postfix) with ESMTP id D880440E09 for ; Thu, 23 Mar 2023 13:34:53 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ofl+Uy5CsrfpUIV/SGoiE7JfmHOWgxxSGdUBAIVSq0029g1Bgg0nbl9WP0qM79GbKXqSFO2ToDkUxMdQnHTVoh5eSdtEssL+/h7wZ4kqFKGQV7Wr27fBG6eIwyeO0cZ96HKgxwpLAm3eE53AsuaG0qHxvuEPBmWbKBIIS/lVr0W5MQDoUHhe3X+NpNDcWkPygu33R4M4YPUP79dQ+sUILV+pvx/P343IWRRRcGagNUK3PnetGkw7qN1yxtj1H2tEihI8bY0udBrYW4LCDEGa+XZSN5mgYKKt9RgPm5FckniQgWoLY11iBebU6osrr8pJnxT0EGjfC9m0Y8g+0/+WyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kXdI+hKaAXqjUjtr+ZvWWGnhl96MXeyqHYeUuNWj0rA=; b=mfzVJEBiWikdkH6jvoM3FOlLgiJ0MKJ8lej1D14DXtHg1uY3NWQSY3wDF/Q4LKVlOj0vHkHS+dVRPkHhw0xFKn5OhBY6hzfEiZs58DYIKIOo1gsMnmQuBHU5VAN3ABo1poBtOfvBSIMuGBaX7J7ouXrBCXHTb3gcNUciYRuFm1UpA5yf7UqUNNYW/ALr0aNiNzpZjWaLF3sT6by2gxaZANfNfH/V9zt11zCNXEyJw9yVYKPUKREIBiCtu9hs7Mj9qjQG3IcvzlwH74/uHDw0qwaKtX3cwRs9mqseS0eKElqZC9q1kHAW8SoiaLEEhbXiWRz0SaBaAgA9XpA4Di/BbQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=monjalon.net smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kXdI+hKaAXqjUjtr+ZvWWGnhl96MXeyqHYeUuNWj0rA=; b=fhPzSTN1RAs7i2nMoM4FZXwSueU9sby3+JURHzrXmCZm0UFxsCeid15Akkm7lgjqPCdOzF8BrwsfVWFSAJ593ky/HHOxOMEB/TmPCanxFwSoh4P1Fb9MjsIhsxLt//WdklSII5EhVo/427VdZnGVQufcbxYvfyh4sL4j8AR9EpXePfAPHcj6VHFHCHN0OulaYht0YNPPkV15RpXk1CpR5Sx2LholvvLa7OU9a1egDAAlGJb2aT9AahwEYRemPhLLm8+OdgYj5utVBGpSMdJGVay0zIt4qUjXa9yYwgPnNkt98vaDzcdXpL+4mB6e/OGWdGOASm7WM3wYaOvj95LK0w== Received: from MW2PR16CA0038.namprd16.prod.outlook.com (2603:10b6:907:1::15) by DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Thu, 23 Mar 2023 12:34:51 +0000 Received: from CO1NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:907:1:cafe::d) by MW2PR16CA0038.outlook.office365.com (2603:10b6:907:1::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Thu, 23 Mar 2023 12:34:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT021.mail.protection.outlook.com (10.13.175.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.21 via Frontend Transport; Thu, 23 Mar 2023 12:34:50 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 23 Mar 2023 05:34:45 -0700 Received: from nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 23 Mar 2023 05:34:42 -0700 From: Alex Vesker To: , , , , Matan Azrad CC: , Subject: [PATCH] net/mlx5/hws: fix send sync drain empty queue check Date: Thu, 23 Mar 2023 14:34:15 +0200 Message-ID: <20230323123416.26636-2-valex@nvidia.com> X-Mailer: git-send-email 2.18.1 In-Reply-To: <20230323123416.26636-1-valex@nvidia.com> References: <20230323123416.26636-1-valex@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT021:EE_|DM4PR12MB5229:EE_ X-MS-Office365-Filtering-Correlation-Id: c5c80714-6cdb-4df4-e8bf-08db2b9aff38 X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Jf2BfPRIW4miZlILkv7Gp9z7LMpjjFC8qHiuPO6cI5ErsYG2xa4JxxqmL2wJQH93CPEDKnF0aVTdkhkAf1LEmPQIGzQwwtzxHY2rrWATPqSNgCkqZspTsG/n+dTbZ2SOylc4/X7NHVu2pER8JkBLgu9JD/iTwQ93S1gcRlZ3X3zJfHPb3kaqP/qg/1/4GGwPY8KSJuwOK2NFbgyP8xbTeqighPv7FoomJkk5ybcmPsvjU7eIfDfkEpJwybyHhqLn4Uy8oNodSIbRy/XiqbxwUdqg3oJos+4xxjD79m+IgxNBz4DfKRwNk3d2vBzruou3pyBayn5QAetORpVz8Frqlyp+Z7rAc0iBlRnFJI0iBbkL2x96RdXh+wGwSHV55EjmHOtIEZphFXwMWSs/0Vh++vZA2byIANnaS1mJdfGYSzCd+0yCJ2nb5qzeizRpAjUeMeoPuHdteXg5BxLqOIQgvDS1m67ncaOrtna3ui/KD0ZWLWsNYwJuTPWrkU+3AhwOHpOu6bzQC7jAg1Cn6QbGVqO/bk6EAdIf/TgRmmaWuLWIZQei+qMiXBF0vKCAqyYE+FUAZ5lxRBKEPCFL3QTFL5cYxtZSkd5aedBY0QSSgLw7oa5FG+Nsy4AhSMGQOFPKEarnJsy2Z/JqvhsMMVNgavSIjhfz/vCWMRGYE1luCKhoMH49Bs016OOlqn3VjRMKkz22foArXU0LOtxqJdKLpt+gQMjIebLOeaLggSQtP9uPGLCqby2vsrIazX5IRPxw X-Forefront-Antispam-Report: CIP:216.228.117.160; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge1.nvidia.com; CAT:NONE; SFS:(13230025)(4636009)(376002)(136003)(346002)(396003)(39860400002)(451199018)(46966006)(36840700001)(40470700004)(55016003)(356005)(40480700001)(2906002)(40460700003)(83380400001)(478600001)(2616005)(336012)(6286002)(186003)(16526019)(82310400005)(86362001)(36756003)(7696005)(316002)(110136005)(6636002)(54906003)(8676002)(36860700001)(4326008)(70586007)(70206006)(8936002)(47076005)(107886003)(6666004)(426003)(26005)(1076003)(7636003)(5660300002)(82740400003)(41300700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2023 12:34:50.8841 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c5c80714-6cdb-4df4-e8bf-08db2b9aff38 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.160]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5229 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The function that checks if the queue is empty used on queue action for SYNC and ASYNC drain didn't function correctly since cur_post is a free running value and not cyclic. The fix is bitwise AND cur_post to get the real value. Fixes: 90488887ee33 ("net/mlx5/hws: support synchronous drain") Signed-off-by: Alex Vesker Reviewed-by: Erez Shitrit Acked-by: Matan Azrad matan@nvidia.com --- drivers/net/mlx5/hws/mlx5dr_send.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/mlx5/hws/mlx5dr_send.h b/drivers/net/mlx5/hws/mlx5dr_send.h index d0977ec851..c1e8616f7e 100644 --- a/drivers/net/mlx5/hws/mlx5dr_send.h +++ b/drivers/net/mlx5/hws/mlx5dr_send.h @@ -255,7 +255,10 @@ void mlx5dr_send_engine_flush_queue(struct mlx5dr_send_engine *queue); static inline bool mlx5dr_send_engine_empty(struct mlx5dr_send_engine *queue) { - return (queue->send_ring->send_sq.cur_post == queue->send_ring->send_cq.poll_wqe); + struct mlx5dr_send_ring_sq *send_sq = &queue->send_ring->send_sq; + struct mlx5dr_send_ring_cq *send_cq = &queue->send_ring->send_cq; + + return ((send_sq->cur_post & send_sq->buf_mask) == send_cq->poll_wqe); } static inline bool mlx5dr_send_engine_full(struct mlx5dr_send_engine *queue) -- 2.18.1