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 CD41DA0540; Thu, 16 Jul 2020 07:37:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A46A04F9A; Thu, 16 Jul 2020 07:37:17 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2068.outbound.protection.outlook.com [40.107.22.68]) by dpdk.org (Postfix) with ESMTP id 160DE4C7B for ; Thu, 16 Jul 2020 07:37:16 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MGfSwWgCmOQZJw50MglEqwToM/4kBdc7F0o1DQmLYTbvUSFB4vM5qIyOTYwox42iTo94k81U3V4bR0hMZxpzuJXcEof8sS2kREv5abP4BHlY/Un26YIyrG/kO4+OqKj5VkjtBVwbMmThGZUxqzfb4k4LBCP7k0+Xtaev70NSa9bVlzt/VtIX9mPRe6Rymh2ih6PxWRfpXv6EvogjyeLZ29TyMjQOlXK9PGSCiFRCrhIjvAvCfP4AD2mirHgrgKws1rYp1lxUUzTmoI248qMEw0LLe7IHR9S+PBbNe7NdARWbC+/LUKkRUkVt+sEr3o7evoZPEY4PE7kI+36MypaI1Q== 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-SenderADCheck; bh=5j6H88kziDGaUgHY4ynk4/ooZ72bf2BmLDxzDio0tTI=; b=UtkLmO9gZinBo4aq8ZDtEmPfk3JxfvevrjCyZNcyGOXpko1UEtCnzUzOJjVgqRHQ1QtjavdNLpD2pcjNBzQ7kir5H8JwybElfs3t/4vxSfirPWsUDWhg72WSgbqCgbThv1ltm9TLXEy7aV/ouWm6WwdiCTeeubUySXnl8q5Zp/X8MBZ/Ood2IjK5ORRNdjie9FbtoYO9Gc7MISGaIkvCaP+RGaNdsQaq8rYy1izPbmRJjkGn0riUJ2sdEBLTwG3Nm86QhP9HKH27FK/sey7gqA5ue98Hf+tvzGqAaP3zPXrIxUSgjPmn4jLqaMnANvaYc7w/H356ft/ZsfZ8yBkm8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5j6H88kziDGaUgHY4ynk4/ooZ72bf2BmLDxzDio0tTI=; b=qmwQmCDj0mURHOvyCUklTXpxxXDx2Aqpg9/KOFitCrWd21iUWzb+a8mgjLeDmLRRqRImZ3CJDJZzX1USj5CluD9wy1IyxZQn2FsMOMsWk05Tg8YjEkV/SWih5xy45xl7bBs1u6IiRVeUbaGPK/awCKNhBFN9+7ZXy47nJRj4l2A= Authentication-Results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=mellanox.com; Received: from AM0PR05MB4209.eurprd05.prod.outlook.com (2603:10a6:208:61::22) by AM0PR05MB6323.eurprd05.prod.outlook.com (2603:10a6:208:13a::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.22; Thu, 16 Jul 2020 05:37:14 +0000 Received: from AM0PR05MB4209.eurprd05.prod.outlook.com ([fe80::3949:70c3:126:3972]) by AM0PR05MB4209.eurprd05.prod.outlook.com ([fe80::3949:70c3:126:3972%7]) with mapi id 15.20.3195.018; Thu, 16 Jul 2020 05:37:14 +0000 From: Ophir Munk To: dev@dpdk.org Cc: Raslan Darawsheh , Ophir Munk , Matan Azrad Date: Thu, 16 Jul 2020 05:36:58 +0000 Message-Id: <20200716053658.30453-1-ophirmu@mellanox.com> X-Mailer: git-send-email 2.8.4 Content-Type: text/plain X-ClientProxiedBy: AM4PR0202CA0020.eurprd02.prod.outlook.com (2603:10a6:200:89::30) To AM0PR05MB4209.eurprd05.prod.outlook.com (2603:10a6:208:61::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (37.142.13.130) by AM4PR0202CA0020.eurprd02.prod.outlook.com (2603:10a6:200:89::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18 via Frontend Transport; Thu, 16 Jul 2020 05:37:13 +0000 X-Mailer: git-send-email 2.8.4 X-Originating-IP: [37.142.13.130] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b7f2b16a-01ca-4e43-ebe2-08d8294a4b59 X-MS-TrafficTypeDiagnostic: AM0PR05MB6323: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jaVPyoxQRWwtboWLkxS6NaKlfxrrmadRxt4aWTCfDpGB0tOGb0o4jT0h4UwE5UWelKaDgnO9M2znbNkWJhCN+Dwi4DYP2LVJtnBCE2pZJyPaBUMGDweh/K1xeBwvF40ADjyZzdtkQY8HILAArHmiBxZFUgSRw7nRN8py5NWsK/ws50CBNfQbyZjrmCOjt+NKobxksi8QNjDJbC/6EV0/eE2XaRzQA8rAlvrQh9222NUzZlen1p/LZVJA4W80K/dPv6aBPV9WXAC++BI01gXyQ0VSIFW4ilVmKdojP+A3qgvMDtriTeN7kFrxRLfBdJEsXJlgMhlioenVAUKG7uWiUA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR05MB4209.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(396003)(136003)(39860400002)(376002)(346002)(366004)(66476007)(36756003)(956004)(1076003)(54906003)(8886007)(316002)(8676002)(86362001)(8936002)(55016002)(186003)(66946007)(5660300002)(16526019)(26005)(6916009)(478600001)(66556008)(2906002)(107886003)(6666004)(2616005)(52116002)(83380400001)(7696005)(4326008); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: iIL9JfSkPSbijtx0x7f32DI5Ox59P9q2RpZNc58mlK1xgFYxQRv+x0i6iwM9Hl0oMpIcgYl/Vtky/qRsCYJaFBdoMst3c9BG/7lxlpRu3tkkveJLyQcmtKqyKtBfw72CEeH8/s44JM8NIfANpOr+veIk0w6wUAWcH1Ed5HB5GjCNAHl1ZXgg09UBWVbH8LsyFcCMWMNz8VrTucyHn4qN6slj39bagPsLvcLte3A/fUG+K1uqFbTI7xK6HsWj0hgzyFAgw1j0A1Ja1Q06sKrYsEU9v3xIBRdTGIDfFW4eMD1gTdtekxp+9hwJrzTrPc93+4SzALfH/jw3HbooM0F0xGyTYB67aN83seuftk9TkoWiEkDoZ9PfTsz59T/A5d/prkLV97CWKzjUtgEzzg69ocUbOyIXuOjndE4JMsISvliS1HDDThqQYkOpXYhFMnT1Cnqcd+p4I6rLTQ7ogWsBmJtJHy8PLsZV2T5kSA2eYOH1zsykyStQFxHjAVNck0eg X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7f2b16a-01ca-4e43-ebe2-08d8294a4b59 X-MS-Exchange-CrossTenant-AuthSource: AM0PR05MB4209.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2020 05:37:14.5016 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OoC41JDsdNR+RQam5ENZ+oFXVKrWxaRDUJ6E6lIxN85lrzkgtGm4o/GQ82FGdHhnIM7tEZhenH/ToGt0U5PjcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6323 Subject: [dpdk-dev] [PATCH v1] net/mlx5: return EAGAIN on premature disable interrupt calls 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" RXQ interrupts under Linux are based on the epoll mechanism. An expected order of operations is as follows: 1. Call rte_eth_dev_rx_intr_enable(), to arm the CQ for receiving events on data input. 2. Block on rte_epoll_wait() with an array of file descriptors representing the CQ events. Upon data arrival the kernel will signal an input event on the corresponding CQ fd. 3. Call rte_eth_dev_rx_intr_disable() after the event was received and continue in polling mode. The mlx5 implementation of rte_eth_dev_rx_intr_disable() is to get the CQ event and ack it. In practice applications may wake up from rte_epoll_wait() due to timeout with no event to ack but still call rte_eth_dev_rx_intr_disable() unconditionally. In such cases the call should return EAGAIN (since the file descriptors are non-blocked), as opposed to EINVAL which indicates a real failure. In case of EAGAIN the PMD should not warn on "Unable to disable interrupt on Rx queue". Signed-off-by: Ophir Munk Acked-by: Viacheslav Ovsiienko --- drivers/net/mlx5/mlx5_rxq.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index b436f06..38dfb98 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -936,7 +936,14 @@ mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) } ret = mlx5_glue->get_cq_event(rxq_obj->channel, &ev_cq, &ev_ctx); if (ret || ev_cq != rxq_obj->cq) { - rte_errno = EINVAL; + /** + * For non-zero 'ret' - save the errno (may be EAGAIN which + * means this function was called before receiving an event). + */ + if (ret) + rte_errno = errno; + else + rte_errno = EINVAL; goto exit; } rxq_data->cq_arm_sn++; @@ -947,8 +954,9 @@ mlx5_rx_intr_disable(struct rte_eth_dev *dev, uint16_t rx_queue_id) ret = rte_errno; /* Save rte_errno before cleanup. */ if (rxq_obj) mlx5_rxq_obj_release(rxq_obj); - DRV_LOG(WARNING, "port %u unable to disable interrupt on Rx queue %d", - dev->data->port_id, rx_queue_id); + if (ret != EAGAIN) + DRV_LOG(WARNING, "port %u unable to disable interrupt on Rx queue %d", + dev->data->port_id, rx_queue_id); rte_errno = ret; /* Restore rte_errno. */ return -rte_errno; } -- 2.8.4