From patchwork Mon Mar 7 12:53:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 108576 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7EBD1A0093; Mon, 7 Mar 2022 13:54:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25C8C411B6; Mon, 7 Mar 2022 13:54:16 +0100 (CET) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2072.outbound.protection.outlook.com [40.107.223.72]) by mails.dpdk.org (Postfix) with ESMTP id 927F140688; Mon, 7 Mar 2022 13:54:14 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mqYBAzLYPJDhmXv1TCFvP+4j7LoYcNfxgr976pIJizMoZcWJho7M+wF5FAOLdCd6+sFB2ns9NqIAJeaYOwGPg+WTL1XWfKvNoUkd7w1ydj0k3eiEQcpqYetPG/+8yvGhpTdM4H9t2P/xq1XE/cFYninNMWtTeitjTjfpvekdtHHS0xplJmg4Wku/jaVq+zWYah8xb+qx6Z4HRZJivqxMQrYt9AJERf/17tXxbdv/hJfKWvh8W4JXzwiRLILUizmncB7ZZa0+WN3hxzhGE23tevg57hn+KImwkCKhUBywU9tPfQgdZE5gUhbRGqtFnvXKE8PY+ikDsT4h30sUxHU2XQ== 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=Y7w1Y9VBoWKh9RD/mRWrejOrEUnCDc78oCZBrpbVhRE=; b=YFny9VnezjGbzRRPe+gcl9Ju4k8amX58NH4cLzs32LguEvXXBawz2ItHChxbnMHDh9NU/uxVHbCUX8hII7ICzKskaD0ed7KksMrMnBIJ0nbkGlHYrocxMUEw9S2L4hZFuhtY7/b478Jmr1U1gX69ApWGURSvT1PJwkeDfA24nspNMOLIGuAMqZsoeby27pbau7oI5JCXtPQ/wSWTRdj057/sqicXVL6vKF5OMIJBmUyB3IdZjdbDCLYJa3w8RxXz+M5ssQv+VXG8IAiUwzh/VsuRfXk63bmD3hx9CvGsiurnPMU9RUDCCuJ+hvUMINL/dmaEU1BPI9+IffKMbt+aug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=intel.com 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=Y7w1Y9VBoWKh9RD/mRWrejOrEUnCDc78oCZBrpbVhRE=; b=nn5JNbaziBoRd950uB0MHSz5HVNfO2AderU8tAIWgaAafOKTY/SsPCZkTWLD4x+KHDwiEublFc5YOvKKlto6PCxhGkijVqn2cF4H866XNsg5j3+PTwQBQkdrQ6OoBwk6ZZERTBk10MTXPo1X7gtCsGsKxqKT0PNdAHcoU19djae07aiMU9NL2sU+XIa4gmNv/Vys3sRVUghCoIqEEZSphuiUwdEmQgw7RLEWVvuHc9LvZaBN3zcjXkncRCUeForVwDhHnqAHyoXQFlnthcrACUS17ZzEyt21V3zPRAsVMBorHDd2IlHdu4oceU337JF2nOUyH/HWxcrrJwL8gDCMDA== Received: from BN0PR04CA0073.namprd04.prod.outlook.com (2603:10b6:408:ea::18) by SN1PR12MB2365.namprd12.prod.outlook.com (2603:10b6:802:2e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.17; Mon, 7 Mar 2022 12:54:12 +0000 Received: from BN8NAM11FT029.eop-nam11.prod.protection.outlook.com (2603:10b6:408:ea:cafe::2b) by BN0PR04CA0073.outlook.office365.com (2603:10b6:408:ea::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Mon, 7 Mar 2022 12:54:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) 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 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by BN8NAM11FT029.mail.protection.outlook.com (10.13.177.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Mon, 7 Mar 2022 12:54:10 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 7 Mar 2022 12:54:08 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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.9; Mon, 7 Mar 2022 04:54:07 -0800 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.9) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Mon, 7 Mar 2022 04:54:05 -0800 From: Dmitry Kozlyuk To: CC: , Matan Azrad , Thomas Monjalon , Ferruh Yigit , "Andrew Rybchenko" Subject: [PATCH v3 2/2] ethdev: prohibit polling of a stopped queue Date: Mon, 7 Mar 2022 14:53:51 +0200 Message-ID: <20220307125351.697936-3-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220307125351.697936-1-dkozlyuk@nvidia.com> References: <20220306232310.613552-1-dkozlyuk@nvidia.com> <20220307125351.697936-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0d8ea05c-9eca-49fd-56ec-08da0039933f X-MS-TrafficTypeDiagnostic: SN1PR12MB2365:EE_ X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YKKR+KylufX4r1HOic5322iZ3R0nVfk1H3JLUpBd/lYUWK1v7Cw4xHXjlr7gUs7Ju350GWmOe8333qTBtVEd8iLRvyUOHh9huZybSqb5cMpyPu/Yk88k8DZsUloK9VgA0WhlsBEUS8PxL/KJZ0yrgU/aiTyOidKt6Rc35qQmBiaT5PS+9I7pREHDzJVDsY6jcBkMx+SO85YgeW+4+V6QDskpUfDGPUSSYWED7wuNePAhYJbNneW+vSHT5i37dUAsq+lnfQTZXKvs9EiDyBa6mvmmluyJP1O2NQnXj234Sk98mPtNSokCN08C9VBcNzmw9m37U+0DyGWwBtC950urRVVxQ8yEm03hH6y10EVM760ihUmJK08lUkAgnUC8YzU+LvPm6+T+OFemx6IRSiX6j77FZQiZygALKA/M9G7plDMLGCWmlSyE4Pw01FU65JaWl9SjkvYyULq/PSOFn3VKpjV+0IUm/6Agx+mPasaDVMrUuwJj0nTs2xOMx6j4JfeKKI92geOzX6RLRkGPs/elZmI9HzFGmihi9jVk9XQlyshLCf5xT9sIQP6P9AgcQjwEc+ZjHzhGsbtIpA42Db6PL0lKY7RpC3bA8d0ZhzZCAPMKBRwyrF6uOJLafyZ2BJK3C4fdW+mM5V3Ey6LBkhphMvGdEPD3KDigfKyG1l36UT9LdejWB3wyWThX8kbbwzmzj8MaQMao/hqshgGoXz49yA== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(5660300002)(54906003)(83380400001)(356005)(36860700001)(8936002)(47076005)(36756003)(2616005)(26005)(336012)(186003)(1076003)(426003)(55016003)(2906002)(81166007)(6916009)(82310400004)(508600001)(8676002)(4326008)(86362001)(316002)(40460700003)(70586007)(70206006)(7696005)(6666004)(6286002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2022 12:54:10.8165 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0d8ea05c-9eca-49fd-56ec-08da0039933f X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT029.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2365 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 Whether it is allowed to call Rx/Tx functions for a stopped queue was undocumented. Some PMDs make this behavior a no-op either by explicitly checking the queue state or by the way how their routines are implemented or HW works. No-op behavior may be convenient for application developers. But it also means that pollers of stopped queues would go all the way down to PMD Rx/Tx routines, wasting cycles. Some PMDs would do a check for the queue state on data path, even though it may never be needed for a particular application. Also, use cases for stopping queues or starting them deferred do not logically require polling stopped queues. Use case 1: a secondary that was polling the queue has crashed, the primary is doing a recovery to free all mbufs. By definition the queue to be restarted is not polled. Use case 2: deferred queue start or queue reconfiguration. The polling thread must be synchronized anyway, because queue start and stop are non-atomic. Prohibit calling Rx/Tx functions on stopped queues. Fixes: 0748be2cf9a2 ("ethdev: queue start and stop") Cc: stable@dpdk.org Signed-off-by: Dmitry Kozlyuk Acked-by: Matan Azrad --- lib/ethdev/rte_ethdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index c2d1f9a972..9f12a6043c 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -74,7 +74,7 @@ * rte_eth_rx_queue_setup()), it must call rte_eth_dev_stop() first to stop the * device and then do the reconfiguration before calling rte_eth_dev_start() * again. The transmit and receive functions should not be invoked when the - * device is stopped. + * device is stopped or when the queue is stopped (for that queue). * * Please note that some configuration is not stored between calls to * rte_eth_dev_stop()/rte_eth_dev_start(). The following configuration will