From patchwork Mon Apr 17 09:12:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Fialko X-Patchwork-Id: 126167 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 1DE1E4296B; Mon, 17 Apr 2023 11:13:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC7E840698; Mon, 17 Apr 2023 11:13:40 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3266140144 for ; Mon, 17 Apr 2023 11:13:39 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33H6uvnt019593; Mon, 17 Apr 2023 02:13:38 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=UdOvoRJJi2rx1Z0zEqkj2AeoK/GtIUXbN6fhi2XX/6Q=; b=GIafaD7ZVeX8rZTWh67KKIIv8PbaFV+50s41mpTwZXyCJntmLjrfiDCiqBJSuXKurNaV Gahap+6UvRgKF7+DKNgyw+mNh8WG5sB/J0R0xx6u8LccoEvMHIeyT53qyn+Lu1aKvy3b 8zQNZ8/dExDKqmNjV7eSkoFX26DjUbxf06D4E/IeXH89Hp5znBbMc/vDX51s3srRBo7d wmOdHZXdas3ZonXGmY68BfCV0hF3wkugs8T6s1mDp+wNKt43ThMxjbrAqCyFU+dG7m8V XZxO5UM3SV6b+hTKQ7CSPvRmRl8Kd1+8KRHAO967suEZhJ7kxS8PrxHo2pzbXKyfA17T tg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3pyuengpc9-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 17 Apr 2023 02:13:38 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Mon, 17 Apr 2023 02:12:48 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Mon, 17 Apr 2023 02:12:48 -0700 Received: from cavium-DT10.. (unknown [10.28.34.39]) by maili.marvell.com (Postfix) with ESMTP id 53D6F3F7087; Mon, 17 Apr 2023 02:12:46 -0700 (PDT) From: Volodymyr Fialko To: , Reshma Pattan CC: , , , , , "Volodymyr Fialko" Subject: [PATCH v2] reorder: improve buffer structure layout Date: Mon, 17 Apr 2023 11:12:33 +0200 Message-ID: <20230417091233.1406974-1-vfialko@marvell.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230414084344.271602-1-vfialko@marvell.com> References: <20230414084344.271602-1-vfialko@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: W-9iEGnKFfZlilruvBdZJSeXG_VGSORd X-Proofpoint-ORIG-GUID: W-9iEGnKFfZlilruvBdZJSeXG_VGSORd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-17_05,2023-04-14_01,2023-02-09_01 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 Rearrange the reorder buffer structure to prevent padding to extra one cache line. Current layout: struct rte_reorder_buffer { char name[RTE_REORDER_NAMESIZE]; uint32_t min_seqn; unsigned int memsize; // -> padding to cache align (cir_buffer is also cache aligned) struct cir_buffer ready_buf; struct cir_buffer order_buf; int is_initialized; // -> padding to cache align, eat whole line }; New layout: struct rte_reorder_buffer { char name[RTE_REORDER_NAMESIZE]; uint32_t min_seqn; unsigned int memsize; bool is_initialized; // -> padding to cache align (cir_buffer is also cache aligned) struct cir_buffer ready_buf; struct cir_buffer order_buf; // -> no padding }; Signed-off-by: Volodymyr Fialko Acked-by: Bruce Richardson --- v2: - changed flag type to `bool` lib/reorder/rte_reorder.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c index f55f383700..4de1aa4056 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -46,9 +46,10 @@ struct rte_reorder_buffer { char name[RTE_REORDER_NAMESIZE]; uint32_t min_seqn; /**< Lowest seq. number that can be in the buffer */ unsigned int memsize; /**< memory area size of reorder buffer */ + bool is_initialized; /**< flag indicates that buffer was initialized */ + struct cir_buffer ready_buf; /**< temp buffer for dequeued entries */ struct cir_buffer order_buf; /**< buffer used to reorder entries */ - int is_initialized; } __rte_cache_aligned; static void