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 A01BAA0C4D; Mon, 8 Nov 2021 14:26:37 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 276B841137; Mon, 8 Nov 2021 14:26:37 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130077.outbound.protection.outlook.com [40.107.13.77]) by mails.dpdk.org (Postfix) with ESMTP id 90F1F41122; Mon, 8 Nov 2021 14:26:36 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5ctQbpbyi+p50akp4a+PwKPc6Vk4l6mxISWfZZ7/p436Zqc7M6v3mVs/RWi3I3gljR7qJ8kmGiHU+mhpxuwnok5w17Skh5w8LswL+DGv7CKhq5z4Vhg0C3aiWT18yLnsG/GUm3fCKDoXrqvjpkQ6PqLeIRlU57AnS5vf0YtA6pwet2DVcwtN5ZV14KjM15oUgNsCjVxBNdscfEsCCQV0umt/adZtl9o0ZNkX+rfHajWOdTTD0ukugHCmGz79/1f+jFb0qq++rvlKQnH0ObsuGw8JI+aC7IA4j4NCBOkscrMCKUCnLACc2Yhy8so20yapwAOpHOq8abvzl8F6Cx7eA== 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=UXfzNlxjH/9r2JTdjYEaHa4bA1CzFfXkfWpzWVqq52o=; b=ZzRg8f7r9XNSFcp4W0if0TylXHUxmKJrQHlIx0eTwtbyGZSKvCJ7wK1jtQt0PBTX2kGd7QHL0YOSN7SXGGUfToMiT4u/vRfKtBe4sbbENjUkvyfxUEBr4flQp9YzBl/P9pYx9W1982kLMHdgGV7WPNdVPw3ib7fImQaBGg/7oAm/9/FOwsDdoC1zoHsKOAfo3lcQ1DboS+ZnoY4aDiO2HUqX+g0YN1HGYDxlK37rl6Oei+jsHgnOQuhSNp46uYnE/0KF6V2WDjxGF5qaE7RUC6+0hBsMJrBTwkLMm1xMgbdbnfqCntdB50TNaQu0iyEtNCpDjfRhf/C8KjdU9JBlbA== 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=UXfzNlxjH/9r2JTdjYEaHa4bA1CzFfXkfWpzWVqq52o=; b=fkV6VDn4DwRDDK8YyP96i7z9PcK352LAcKkG0QxtWroNQA6LZC+n0k8YAIqLdiQqpHzIY7D5L9s+DGQts+dOtt8eIRu7tJ5Iw9dJu6C7ZrfNoK0SitKjVmt8s3PJfBOb7hy4WDkBiQXJTsjOiM6CwQKfp2u/78wBDS4Mat7yDuY= Received: from AM9P250CA0025.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::30) by VI1PR0701MB7038.eurprd07.prod.outlook.com (2603:10a6:800:195::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.8; Mon, 8 Nov 2021 13:26:35 +0000 Received: from AM5EUR02FT019.eop-EUR02.prod.protection.outlook.com (2603:10a6:20b:21c:cafe::1b) by AM9P250CA0025.outlook.office365.com (2603:10a6:20b:21c::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 13:26:35 +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; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT019.mail.protection.outlook.com (10.152.8.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.4669.10 via Frontend Transport; Mon, 8 Nov 2021 13:26:34 +0000 Received: from ESESBMB505.ericsson.se (153.88.183.172) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 8 Nov 2021 14:26:30 +0100 Received: from seliiuapp00218.seli.gic.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.188) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Mon, 8 Nov 2021 14:26:30 +0100 Received: from localhost.localdomain (seliicwb00002.seli.gic.ericsson.se [10.156.25.100]) by seliiuapp00218.seli.gic.ericsson.se (Postfix) with ESMTP id 3140660169; Mon, 8 Nov 2021 14:26:30 +0100 (CET) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: , CC: , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , , Date: Mon, 8 Nov 2021 14:25:58 +0100 Message-ID: <20211108132558.28748-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2e793893-0ebf-4be1-b8a2-08d9a2bb62d4 X-MS-TrafficTypeDiagnostic: VI1PR0701MB7038: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BhYkxtog0mIpoe5t5oi244MqQpkURvF8yfn9A7dDH34+slA3mI9vbRskbpYYnj8OyCnjWRUTBue5Za8e3u0ZhjgKwlTshHY/RbBNUR6kP4I4x6rkc7uw87IQv1v3/fMd1/xAarhGJy8GIeTO1MymaAqdbA5Laj/8A4fTfzbqdSGjuiDJ0n/1TQ2MGZn5PXupsIBMrwWv7YJsbqNJrMQ9HsRRdykYlmb76RFH+jl7fvosblhh8D+U89Rpn21w0VIV3RSFr4g0O8vGMOzTpkjOlVOH/CXnl+x/lz9EySTbAvjMRcn0RUsVFnxJoLb8tJPbiKWqfvl/JfkjgIaQiEG1Ul/ydYI4gWKE9K5ClclUO9qWkWNokqQByijKnDaTfQVg4NTo/TLb48dtio7fdeGW5VvRe1XYV4n/r/HXtSJ6mU3XhuZIB7G41KdioYUQ/rJtD8M+OSoaMxlyWzKhbvm8R0RhiyhrAtVQevcXAm63DyOUPvJry204dLG74L25YM6v+v4BzzPkWSbxAaSM0sqbEtBpzxmSXraVrEZlVe3JPwNRLyIswjbgyI0Ip8egJ7ocaPcy3bdECfsQ2wt4fq73oIszN0a/0zUOe7VTNRfOKqra3+bG5I34wLksj5o0/XQP9UhAgNQn98E/wEPDZhS99GjYayMR6j7IWkB4xaG2ADjpnR5CZD3ztdaTMYylv7AhyGbj3FM2z4nJdVQzvzWPILRnITVK09SE1Q+Hiz9gnbE= 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:(4636009)(46966006)(36840700001)(70206006)(5660300002)(316002)(110136005)(83380400001)(356005)(6266002)(336012)(1076003)(82310400003)(6666004)(47076005)(508600001)(26005)(4326008)(82960400001)(2616005)(36756003)(36860700001)(8676002)(186003)(86362001)(8936002)(2906002)(7636003)(54906003)(70586007)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2021 13:26:34.9718 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e793893-0ebf-4be1-b8a2-08d9a2bb62d4 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: AM5EUR02FT019.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0701MB7038 Subject: [dpdk-dev] [PATCH] eventdev: fix Rx adapter stalls on event device backpressure 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 Sender: "dev" In the Eventdev Ethernet RX Adapter, correctly handle the case where the circular enqueue buffer head and tail index points to the same element (i.e., the buffer is full) and the buffer has wrapped. This bug may be triggered in case there is backpressure from the event device to the RX adapter. Fixes: 8113fd15e229 ("eventdev/eth_rx: make enqueue buffer circular") Cc: ganapati.kundapura@intel.com Cc: stable@dpdk.org Signed-off-by: Mattias Rönnblom --- lib/eventdev/rte_event_eth_rx_adapter.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c index 56318b5a6f..809416d9b7 100644 --- a/lib/eventdev/rte_event_eth_rx_adapter.c +++ b/lib/eventdev/rte_event_eth_rx_adapter.c @@ -777,19 +777,25 @@ rxa_flush_event_buffer(struct event_eth_rx_adapter *rx_adapter, struct eth_event_enqueue_buffer *buf, struct rte_event_eth_rx_adapter_stats *stats) { - uint16_t count = buf->last ? buf->last - buf->head : buf->count; + uint16_t count = buf->count; + uint16_t n = 0; if (!count) return 0; - uint16_t n = rte_event_enqueue_new_burst(rx_adapter->eventdev_id, - rx_adapter->event_port_id, - &buf->events[buf->head], - count); - if (n != count) - stats->rx_enq_retry++; + if (buf->last) + count = buf->last - buf->head; + + if (count) { + n = rte_event_enqueue_new_burst(rx_adapter->eventdev_id, + rx_adapter->event_port_id, + &buf->events[buf->head], + count); + if (n != count) + stats->rx_enq_retry++; - buf->head += n; + buf->head += n; + } if (buf->last && n == count) { uint16_t n1; -- 2.25.1