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 42F4EA0503; Wed, 18 May 2022 19:06:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9BC040156; Wed, 18 May 2022 19:06:07 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2044.outbound.protection.outlook.com [40.107.223.44]) by mails.dpdk.org (Postfix) with ESMTP id D368A400D6 for ; Wed, 18 May 2022 19:06:05 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HCJQRb/L9R/zQRZtmdGFaJWpHNubxkyo3YdPbcunprUFFhQBuxWMNFFA5TxVL6S6kq0wST5jI9IMW8UuEXp4H9Wj0ZxpXWfKfboT6qK2PbA9Nobh/zkkUNmIVgVUWhZ/6BRElE5cQeW3SGjuxMooNjRT1OLShRCwgTLwxQWJzeYyp4AM/yHBEkEwbsdSB+93sr/KOx0CN3rlHTC+jMFWGSb7GsEtTGlk6ocfXGk0ggD8uDd9i/EwImS/AdAzozilfZo1DeE2BaZAwMAF7gUaYtEUxcy8kxBE0BUKB/i+Ph6vX33DZbeU6Iunm42uSqkPtroe9/ItkRKObcHIqXs0Ew== 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=CXrutZWy1IeO6FfQBQIl+dsFcrDOkK7H/yO+jpD+vuc=; b=KAqu3voCi+NCjgzDirYSiZfT/vksIZmZlDj4jt2Z63qWq9QenpomqKV9Rikrf9uyumD6N/uygjpzOCIZHe72TAIbRpvbiJvzwtpEQCzW52dSzt5QRb+G1IFyafPE1CUSyK2Zm9wG/ChEtAnwoKBKIIQxa82fJk39pZaaOOW27lkh6RPXbKLttBBQh3i57PVfIoDvSBFLsi2niHxdAVtCu7nJcKds1++fBZiMVKezAsVNqaMMif1TzRinntiXN+xzc7HiGjFt1EiT7RYuHFtxP7u3WJHqysj6qHldpe2X7uxj0C+jGMM6rqc12Ckfme1SjcbtgMwsYLJba3DHBQEY1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.80.198) smtp.rcpttodomain=arm.com smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CXrutZWy1IeO6FfQBQIl+dsFcrDOkK7H/yO+jpD+vuc=; b=E2iWXHDWhRAi15pDUsQwrab1h5aFCvxeVCN9FpOgohKpwIEQtYK9dfvltY2/Zvw+eIGSF1OaV2BakD1vRtLztqJa2CVOa0J43zg1CFU6yG49vDAbYDFpe4Yvbh6YUAPrZSWF1tCw3ocuhJgzk3Iq/K3md55/SmCKrHzCUup5veI= Received: from DS7PR05CA0091.namprd05.prod.outlook.com (2603:10b6:8:56::12) by DM6PR02MB4076.namprd02.prod.outlook.com (2603:10b6:5:9d::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5273.13; Wed, 18 May 2022 17:06:03 +0000 Received: from DM3NAM02FT033.eop-nam02.prod.protection.outlook.com (2603:10b6:8:56:cafe::db) by DS7PR05CA0091.outlook.office365.com (2603:10b6:8:56::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.7 via Frontend Transport; Wed, 18 May 2022 17:06:03 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.80.198) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.80.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.80.198; helo=xir-pvapexch01.xlnx.xilinx.com; pr=C Received: from xir-pvapexch01.xlnx.xilinx.com (149.199.80.198) by DM3NAM02FT033.mail.protection.outlook.com (10.13.4.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5273.14 via Frontend Transport; Wed, 18 May 2022 17:06:02 +0000 Received: from xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) by xir-pvapexch01.xlnx.xilinx.com (172.21.17.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Wed, 18 May 2022 18:06:01 +0100 Received: from smtp.xilinx.com (172.21.105.198) by xir-pvapexch02.xlnx.xilinx.com (172.21.17.17) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Wed, 18 May 2022 18:06:01 +0100 Envelope-to: joyce.kong@arm.com, jgrajcia@cisco.com, ruifeng.wang@arm.com, dev@dpdk.org, nd@arm.com Received: from [172.21.34.28] (port=56531) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1nrN7Z-0001Cu-L5; Wed, 18 May 2022 18:06:01 +0100 Message-ID: <03c405ad-eb23-5f8a-782c-5f80bc9bf96d@xilinx.com> Date: Wed, 18 May 2022 18:06:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH v1 1/2] net/memif: add a Rx fast path Content-Language: en-US To: Joyce Kong , Jakub Grajciar CC: , , References: <20220412093243.3670187-1-joyce.kong@arm.com> <20220517105109.1086090-1-joyce.kong@arm.com> <20220517105109.1086090-2-joyce.kong@arm.com> From: Ferruh Yigit In-Reply-To: <20220517105109.1086090-2-joyce.kong@arm.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fdc3353-ff42-451c-f4c1-08da38f0b083 X-MS-TrafficTypeDiagnostic: DM6PR02MB4076:EE_ 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: fySQWpJUokwFJoLVP9g1YAuBMJj4rVA3IAJs9USFKN3AtIiODfldr3/PJkqfJRfIVYWxUq4IlDmTEWZBZmHlhYQ1tJxRJf/JMXHowaObm+vzoEC8pt1bQhoRQaRc/0BPmoOFO52c0gj2JQaatIY254kPsgFxDtZRrgJxGXJLnhhFhngdrVTKaIqDKblUKDZVcf7uFWnCl77lvV+RMvogUt0q5D27O9qe+CDkbg9G2e34rTCEeDH73hQkl7HvlBWRxkraPkwmKymNvdNaYEJbrSOYLcbOs76hEta2Cojcf1CWeV+/F23YTwyzyemBDR0zLrUyYm2vXeYnHCClVMOFvHkIr0YVzfGIq76+bzxyxyFpt8K6yltludsQ9uCNQnE4Z9/RImBS+SvuiB70GlPG2ojpX58fH4gP3vteaxND89UhX8tUse8bZWTmgmn32tDFlkd2Khqr+QUAmIJn2YRTAT19RW5t91bVGv8Pbs8bwY0KVlLDpnbMnvpT3USAFb+FaQXe8V3gtaptvEEFFl0UCbjIs4uWyr/E2qiHgpMr+5Zo4wrGfmYA8kiC9OYsFEhMJzTv1+D2vcqb7Dj9cxkFkpHssEpflvZkEla2ugNElOWrOgU5hx+78oTqCpGz+5d8ee4BlVEoyvb+VLDnyL26DtKBH37rV7mxsKgwQ7REkTsGU1UYeM40WXPXHokb0Qs+hYRUmibZ5W9srN2PIpg+phNpjWEbnHnmPWKe0pkMRk4= X-Forefront-Antispam-Report: CIP:149.199.80.198; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:xir-pvapexch01.xlnx.xilinx.com; PTR:unknown-80-198.xilinx.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(40470700004)(36840700001)(5660300002)(8676002)(53546011)(40460700003)(26005)(316002)(7636003)(356005)(44832011)(426003)(336012)(186003)(31696002)(47076005)(2906002)(508600001)(2616005)(8936002)(9786002)(31686004)(36860700001)(54906003)(82310400005)(4326008)(110136005)(36756003)(70206006)(70586007)(50156003)(43740500002); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2022 17:06:02.8747 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdc3353-ff42-451c-f4c1-08da38f0b083 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.80.198]; Helo=[xir-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: DM3NAM02FT033.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4076 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 On 5/17/2022 11:51 AM, Joyce Kong wrote: > For memif non-zero-copy mode, there is a branch to compare > the mbuf and memif buffer size during memory copying. Add > a fast memory copy path by removing this branch with mbuf > and memif buffer size defined at compile time. The removal > of the branch leads to considerable performance uplift. > > When memif <= buffer size, Rx chooses the fast memcpy path, > otherwise it would choose the original path. > > Test with 1p1q on Ampere Altra AArch64 server, > -------------------------------------------- > buf size | memif <= mbuf | memif > mbuf | > -------------------------------------------- > non-zc gain | 4.30% | -0.52% | > -------------------------------------------- > zc gain | 2.46% | 0.70% | > -------------------------------------------- > > Test with 1p1q on Cascade Lake Xeon X86server, > ------------------------------------------- > buf size | memif <= mbuf | memif > mbuf | > ------------------------------------------- > non-zc gain | 2.13% | -1.40% | > ------------------------------------------- > zc gain | 0.18% | 0.48% | > ------------------------------------------- > > Signed-off-by: Joyce Kong <...> > + } else { > + while (n_slots && n_rx_pkts < nb_pkts) { > + mbuf_head = rte_pktmbuf_alloc(mq->mempool); > + if (unlikely(mbuf_head == NULL)) > + goto no_free_bufs; > + mbuf = mbuf_head; > + mbuf->port = mq->in_port; > + > +next_slot2: > + s0 = cur_slot & mask; > + d0 = &ring->desc[s0]; > > - rte_memcpy(rte_pktmbuf_mtod_offset(mbuf, void *, > - dst_off), > - (uint8_t *)memif_get_buffer(proc_private, d0) + > - src_off, cp_len); > + src_len = d0->length; > + dst_off = 0; > + src_off = 0; Hi Joyce, Jakub, Something doesn't look right in the original code (not in this patch), can you please help me check if I am missing something? For the memif buffer segmented case, first buffer will be copied to mbuf, 'dst_off' increased and jump back to process next memif segment: + d0 | v +++ +-+ |a+->+b| +-+ +-+ +---+ |a | +-+-+ ^ | + dst_off " if (d0->flags & MEMIF_DESC_FLAG_NEXT) goto next_slot; " But here 'dst_off' set back to '0', wont this cause next memif buffer segment to write to beginning of mbuf overwriting previous data? Thanks, ferruh