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 BE1BBA0093; Mon, 7 Mar 2022 00:23:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 851F841178; Mon, 7 Mar 2022 00:23:30 +0100 (CET) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on2071.outbound.protection.outlook.com [40.107.100.71]) by mails.dpdk.org (Postfix) with ESMTP id A03D34116A; Mon, 7 Mar 2022 00:23:28 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=edzL4hs2FqSMUdvi4WL1Mxx18MQaRFCywCFK1cBDMRV6tmGTc8GnRToGlkAdqDJHJZXxshPDg4x7MJbKWI43zIWCyWUb4bfqNHK+UE9Q1hnAlRwUzunBYNa0V72nxh/Ovn5hYNcTd+oAfmJFte5lia6N+RCyzWR3UOnYh4aiw9HZsN5T8UUTFhL2BOyGb+I47ETHrIsTtWSNleRxPL/G7N1vG07W6grIMWKjFaGL8Lal8BbCVxAtMVZjVNidNFH4O/k0qcqfWlhUcpWtV+PIHDPBjvJkCR7K7qydyjnzEw172tswbxR0ueEqd1J8loTae/Meh9aUSD9+RrSD3hhWmw== 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=JP74oU1RKBiK+uiuIy44X1Oet2/giYpPWxORFM2vE4RQRnXtJfAyvt+h74swoulMFiHcosEO/OBh9J+BoPRop+xG5EdkHEuk6IgFSlzUCV/cHL3H2yVKSkH1whPWUt+hq4GhuYMko1AOp+cf5UmZ8pQB7hNAiwf3A06ZurpORNH3DPxJ8uNiZMbjzOxMyLNbJySxSakpnokvDX0Gs4GFfl7Iq0BuWQuY35XWeG/OXysmQa9S6pWdIrthUjQqsob2R5VEwDdzjTK8eHRNQdQQuPxHNFnorfuRF+3S6Vtj93PfNGz0TLx42GowRAkLunARJ0Iidiy/TA8Htbur191FSQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=oktetlabs.ru 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=f3Em9PKKiuYa899eUBXAZ4iAEKUfbIq5hYVkx4aaakLdRxn1/ooJL9e/Y7vSdAPlR75w6vQfKU9mpZsoFz5kmSdV/99DQhYpnuK+6xNctVW48LJLbX5uAyqWDzlJv4gYhVRcmY9coyijlLS3tyWWKMTyh105pLLTjC1WVWqieMFphhr7whMyMAjV0V21ZRdpRmD5VwZCMgmDiYTp5hMVQv2cVKoL3psfH68h5ynwM8cd7IXm2pQzPkq9CzD1WNlqZN8c+GIZ0YhD4gNAJlrf115/qS6BwBPvitpfZ2Delyg0rAf88LnkYGhFLqRJWY8safiWhXAjbjfLb9cqC5EZVw== Received: from DM6PR03CA0101.namprd03.prod.outlook.com (2603:10b6:5:333::34) by BN8PR12MB2930.namprd12.prod.outlook.com (2603:10b6:408:69::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Sun, 6 Mar 2022 23:23:21 +0000 Received: from DM6NAM11FT021.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::54) by DM6PR03CA0101.outlook.office365.com (2603:10b6:5:333::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14 via Frontend Transport; Sun, 6 Mar 2022 23:23:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) 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.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by DM6NAM11FT021.mail.protection.outlook.com (10.13.173.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.5038.14 via Frontend Transport; Sun, 6 Mar 2022 23:23:20 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 6 Mar 2022 23:23:19 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.9; Sun, 6 Mar 2022 15:23:18 -0800 Received: from nvidia.com (10.127.8.11) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.9 via Frontend Transport; Sun, 6 Mar 2022 15:23:15 -0800 From: Dmitry Kozlyuk To: CC: Xiaoyun Li , Yuying Zhang , Aman Deep Singh , Ferruh Yigit , Andrew Rybchenko , Thomas Monjalon , , Matan Azrad , Thomas Monjalon Subject: [PATCH v2 1/2] ethdev: prohibit polling of a stopped queue Date: Mon, 7 Mar 2022 01:23:09 +0200 Message-ID: <20220306232310.613552-2-dkozlyuk@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220306232310.613552-1-dkozlyuk@nvidia.com> References: <20220113092103.282538-1-dkozlyuk@nvidia.com> <20220306232310.613552-1-dkozlyuk@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 786c45a6-01ed-4dd5-7bef-08d9ffc84d68 X-MS-TrafficTypeDiagnostic: BN8PR12MB2930: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: CgvR5v5UF+SlTcDeWVTU3pkw8PwJNVCLXMqzP+La3/0FwmnAUk3Vm5VRO40lgzU3S4JlGAukRSuoulyHNksOkSwuHXeGPA5WAaipBd/aE6unxM7OOrQeflxeRIvY8mb7vkoQ2Pl7heEKDKK+Af0rXKGRhxivonk09OM+Xzn/PA2zn7SR3ntUXD+zKZ+Z/DRPKSEp2dvSY6kw2Ki/njHSyUbnwDlmZyGuvF3iDsWUkxfmWm5vbN5qn2TWToUbt0o4btaQOPnTl4TGWJa97PtH+eMW8h/cmXzh4haJefxch4a+KcEqu+bStTPsw3s+DvOL9V4oR1F5Md8xMX1dx7Ffu9mQGVI71QbUubbmW0z2Nx/2GcoPBnt2I+Eeky2CtqCUa/oD6DGqHRYW4M9R5PK120nHyhA6vYKMIUHNDYfPGkBh8GEWY1GmJ0GbXZAK1wJtsdk332c5CYCcjBDZQgcu7cuwGQOlsfYH32lGSdIuqEeIG2TcUr8IC4uFF9VLzIp4VzRujmbk+uyoSElsyyOgyXuLOwyUXvC2seX0jqo2rkVoobj3EIqdZdNekbaSyDQBWAbbb76x7N2b8dBQ220CmLYTJduAp7iCja5JOK8GCR5YsjnQREmiCALcet7t2+LNEEtBqLYbBthLtwWipi0f04gKqfiUlbMfER/3uHWaeWF5bIHsS4e7gHmYZ/DA4IRPxoI4lhRHt9TTauIPJMJvlg== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(6286002)(2616005)(82310400004)(81166007)(7696005)(36860700001)(86362001)(2906002)(356005)(316002)(47076005)(70586007)(508600001)(70206006)(8676002)(55016003)(6666004)(4326008)(26005)(336012)(8936002)(426003)(5660300002)(186003)(83380400001)(36756003)(40460700003)(54906003)(6916009)(1076003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2022 23:23:20.5464 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 786c45a6-01ed-4dd5-7bef-08d9ffc84d68 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.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT021.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2930 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 -- 2.25.1