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 87E7CA0544; Mon, 10 Oct 2022 16:58:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A70442BD9; Mon, 10 Oct 2022 16:58:02 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50059.outbound.protection.outlook.com [40.107.5.59]) by mails.dpdk.org (Postfix) with ESMTP id 7FF6E42BD0 for ; Mon, 10 Oct 2022 16:58:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=niIcTNusz7K7RqVleZqPgIyHn6ImLWOWXwdiT4cToAlolbCLj2SqBHXtG9lrwG4lGsdQugrDC4OOD5YNNeq/Y5KuNyJCjz4xH1WK1qDDQRsfMiUOZXUj1US+Oyk0Abwpo7DUG9+mf5v47cQQle3Hb1zLbvw8+NkkK1FSMaDdmM3Wl7juLljhGH9T3K1Lp7Votj04pJlOkNgJbT/FpSY8k2xsetWEnL/R9ijsLjbJIhEmJoCve4DK1ZgKUUts0DkXUQlN5jVHRSFzbutPqS0IprPXITJlI9EOkOpdc37vi8+i02CYYbegmg3hxHvp5OTlYYfA8FanNBxUB8HC9SMIqQ== 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=mbWvf0TEO5g2IesUfX4sUmDBFhLt1ZN7bjRrK5wSuno=; b=ku8i5aaReePOyL+S5BrJrQU04Y3UGslnzB0h9SveZYrYCesZ5I/l9r+Z+ff7hMw92bwpyq3HncaJD358rdMw9KwSABCLXokKXcfxFPgjvSJT9t443r7+f0G0TkUbFQq+mkbVjpAIVO1oEAEbcXpsG25iwyM7QIvIfPsATMSXsdidOujm2fyDlu4MKgr0u6dPBw2rAmdwerXSCmz/18+q2mrJoHD0IBzU/Ucy01LMKKKQOuxu5CvfjefoEbiiUOp/NZB6bYm/9bNqwqy20wvVNZVtCm+yTCFx1n7eywx0bJDyNjyU+szBeiUSOD4ZQ00J75EwBCM+vo3+SXR4NWvEiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=dpdk.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mbWvf0TEO5g2IesUfX4sUmDBFhLt1ZN7bjRrK5wSuno=; b=IsraW0k4VX1/zutVZ71nTIy4ch/8bRTZMg69kK5nj6+CaJAPyrE3PXemQow5tyLoCKdSA7GITVU9MmQcqsLdow0tc1ktqBjIT7uu5KwLxJ7B0bJ/iYXRTA2hTjWu4NdvNMzPbxkt2/Hg7Kut2zJc39/np5TCnJI1B7x7GRDcscM= Received: from FR0P281CA0135.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:97::7) by PA4PR07MB8887.eurprd07.prod.outlook.com (2603:10a6:102:268::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.14; Mon, 10 Oct 2022 14:57:58 +0000 Received: from VE1EUR02FT039.eop-EUR02.prod.protection.outlook.com (2603:10a6:d10:97:cafe::e7) by FR0P281CA0135.outlook.office365.com (2603:10a6:d10:97::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Mon, 10 Oct 2022 14:57:58 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; pr=C Received: from oa.msg.ericsson.com (192.176.1.74) by VE1EUR02FT039.mail.protection.outlook.com (10.152.13.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.5709.10 via Frontend Transport; Mon, 10 Oct 2022 14:57:58 +0000 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESBMR506.ericsson.se (153.88.183.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Mon, 10 Oct 2022 16:57:58 +0200 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESSMB505.ericsson.se (153.88.183.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Mon, 10 Oct 2022 16:57:57 +0200 Received: from seliicinfr00049.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.193) with Microsoft SMTP Server id 15.1.2375.31 via Frontend Transport; Mon, 10 Oct 2022 16:57:57 +0200 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliicinfr00049.seli.gic.ericsson.se (Postfix) with ESMTP id D3EEB380061; Mon, 10 Oct 2022 16:57:57 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: Jay Jayatheerthan , Erik Gabriel Carrillo , Abhinandan Gujjar , Jerin Jacob CC: , Harry van Haaren , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Subject: [PATCH 2/4] eventdev: have ethernet Rx adapter appropriately report idle Date: Mon, 10 Oct 2022 16:54:04 +0200 Message-ID: <20221010145406.118880-3-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221010145406.118880-1-mattias.ronnblom@ericsson.com> References: <20221010145406.118880-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1EUR02FT039:EE_|PA4PR07MB8887:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f66a3b3-6940-459b-467b-08daaacfd208 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lNQhUtyGLWuSq7euFIS+y+QcbzjsvObIlqPYnt1kZpJ6Zip0lZq35l0bdPUGYn7DaQ85Kpf4PQnKmeVpQzyVmbKgwwXeUVDn83RGPV2nbr+HY4lhuhV35YCb3PZYAfgK76/+CA4NbA4a8djkcsttRmdAQ+FqMSPVcAFJUixkqFFakZwVyqu1+OXfpd//c8E/53FQTuNLWIksww+upq/SV0v3Cx6k4xG2Qj6UsMS3sQRgZzhv6+Y+oO0j3008ePP2pD2LtcRwQbE3n/tnMnvxKwanI7Bg6PpwxLGdDkodMbHKN1aWEunmksCJe7oxo2N7sbWJnMAJ9a4QL1Og4+RUl0NjojgdrGg9HI5YFsIB+Fn05Mw53cNR0X+AxtnskZUCoiQ3cesq/Kx3Qmt8nHnHiK/V6o0c+JItv//y1elE0Yftdf8SmgKCSvLA5uJ7lRKdk/9mQnuURImnue8k82NnpLF0QZNWFrd1x5u/A8MzizG97HZEhLtqN2RPxxy/Njfj5/MXW5Kzia/j4PNf7kzsXmqn52M47K+wTL5agTN4DDQQ7lxNXEbi55IHHkXS8crNXfDS8JBz5Gu/BEQtV0cVQuFSMRNnrEgqAyoqv20WsMMvoE+QGCaQq8LwOas8k93YPFMMSfw7u0/bIBCb2evBtje/bfiBpB2Tb1eLthhMp9m4j9g6dCsrBWHnMjBvifGZyJTPQP7i9ljSOpUEWiVp58jeU8hyBU2cQGoLoTHFd5t9m7PnyJAWDXU15py1/IQtwbr8R+X0AyhzI27/9EtqxCHgxsK8i52n0h3HAQnQU0FFrl7ums5NkCRbUOQq9tMj X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(13230022)(4636009)(136003)(376002)(346002)(396003)(39860400002)(451199015)(40470700004)(46966006)(36840700001)(83380400001)(66899015)(26005)(6266002)(316002)(54906003)(82740400003)(7636003)(356005)(82960400001)(86362001)(40460700003)(36756003)(40480700001)(110136005)(47076005)(36860700001)(186003)(66574015)(2616005)(6666004)(107886003)(8676002)(2906002)(5660300002)(8936002)(82310400005)(478600001)(336012)(41300700001)(70586007)(70206006)(4326008)(1076003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 14:57:58.4118 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f66a3b3-6940-459b-467b-08daaacfd208 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR02FT039.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR07MB8887 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 Update the Event Ethernet Rx Adapter's service function to report as idle (i.e., return -EAGAIN) in case no Ethernet frames were received from the ethdev and no events were enqueued to the event device. Signed-off-by: Mattias Rönnblom --- lib/eventdev/rte_event_eth_rx_adapter.c | 56 ++++++++++++++++++------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 5c3021a184..cf7bbd4d69 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -1184,7 +1184,7 @@ rxa_intr_thread(void *arg) /* Dequeue from interrupt ring and enqueue received * mbufs to eventdev */ -static inline void +static inline bool rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter) { uint32_t n; @@ -1194,20 +1194,27 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter) struct rte_event_eth_rx_adapter_stats *stats; rte_spinlock_t *ring_lock; uint8_t max_done = 0; + bool work = false; if (rx_adapter->num_rx_intr == 0) - return; + return work; if (rte_ring_count(rx_adapter->intr_ring) == 0 && !rx_adapter->qd_valid) - return; + return work; buf = &rx_adapter->event_enqueue_buffer; stats = &rx_adapter->stats; ring_lock = &rx_adapter->intr_ring_lock; - if (buf->count >= BATCH_SIZE) - rxa_flush_event_buffer(rx_adapter, buf, stats); + if (buf->count >= BATCH_SIZE) { + uint16_t n; + + n = rxa_flush_event_buffer(rx_adapter, buf, stats); + + if (likely(n > 0)) + work = true; + } while (rxa_pkt_buf_available(buf)) { struct eth_device_info *dev_info; @@ -1289,7 +1296,12 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter) } done: - rx_adapter->stats.rx_intr_packets += nb_rx; + if (nb_rx > 0) { + rx_adapter->stats.rx_intr_packets += nb_rx; + work = true; + } + + return work; } /* @@ -1305,7 +1317,7 @@ rxa_intr_ring_dequeue(struct event_eth_rx_adapter *rx_adapter) * the hypervisor's switching layer where adjustments can be made to deal with * it. */ -static inline void +static inline bool rxa_poll(struct event_eth_rx_adapter *rx_adapter) { uint32_t num_queue; @@ -1314,6 +1326,7 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter) struct rte_event_eth_rx_adapter_stats *stats = NULL; uint32_t wrr_pos; uint32_t max_nb_rx; + bool work = false; wrr_pos = rx_adapter->wrr_pos; max_nb_rx = rx_adapter->max_nb_rx; @@ -1329,14 +1342,20 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter) /* Don't do a batch dequeue from the rx queue if there isn't * enough space in the enqueue buffer. */ - if (buf->count >= BATCH_SIZE) - rxa_flush_event_buffer(rx_adapter, buf, stats); + if (buf->count >= BATCH_SIZE) { + uint16_t n; + + n = rxa_flush_event_buffer(rx_adapter, buf, stats); + + if (likely(n > 0)) + work = true; + } if (!rxa_pkt_buf_available(buf)) { if (rx_adapter->use_queue_event_buf) goto poll_next_entry; else { rx_adapter->wrr_pos = wrr_pos; - return; + break; } } @@ -1352,6 +1371,11 @@ rxa_poll(struct event_eth_rx_adapter *rx_adapter) if (++wrr_pos == rx_adapter->wrr_len) wrr_pos = 0; } + + if (nb_rx > 0) + work = true; + + return work; } static void @@ -1384,12 +1408,14 @@ static int rxa_service_func(void *args) { struct event_eth_rx_adapter *rx_adapter = args; + bool intr_work; + bool poll_work; if (rte_spinlock_trylock(&rx_adapter->rx_lock) == 0) - return 0; + return -EAGAIN; if (!rx_adapter->rxa_started) { rte_spinlock_unlock(&rx_adapter->rx_lock); - return 0; + return -EAGAIN; } if (rx_adapter->ena_vector) { @@ -1410,12 +1436,12 @@ rxa_service_func(void *args) } } - rxa_intr_ring_dequeue(rx_adapter); - rxa_poll(rx_adapter); + intr_work = rxa_intr_ring_dequeue(rx_adapter); + poll_work = rxa_poll(rx_adapter); rte_spinlock_unlock(&rx_adapter->rx_lock); - return 0; + return intr_work || poll_work ? 0 : -EAGAIN; } static void * -- 2.34.1