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 4A50F46084; Tue, 14 Jan 2025 10:22:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DD7594025F; Tue, 14 Jan 2025 10:22:14 +0100 (CET) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by mails.dpdk.org (Postfix) with ESMTP id 9A99B400EF for ; Tue, 14 Jan 2025 10:22:12 +0100 (CET) Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4YXNr43bL3z22l9p; Tue, 14 Jan 2025 17:19:48 +0800 (CST) Received: from kwepemo500011.china.huawei.com (unknown [7.202.195.194]) by mail.maildlp.com (Postfix) with ESMTPS id EF05B1A016C; Tue, 14 Jan 2025 17:22:09 +0800 (CST) Received: from [10.67.121.193] (10.67.121.193) by kwepemo500011.china.huawei.com (7.202.195.194) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 14 Jan 2025 17:22:09 +0800 Message-ID: <59587382-d90d-4141-936a-6af5fed5c859@huawei.com> Date: Tue, 14 Jan 2025 17:22:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] examples/l3fwd: add option to set refetch offset To: Stephen Hemminger CC: , , , , , , References: <20241225075302.353013-1-huangdengdui@huawei.com> <20250110093715.4044681-1-huangdengdui@huawei.com> <20250110092036.23a762dd@hermes.local> Content-Language: en-US From: huangdengdui In-Reply-To: <20250110092036.23a762dd@hermes.local> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.121.193] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemo500011.china.huawei.com (7.202.195.194) 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 2025/1/11 1:20, Stephen Hemminger wrote: > This will make it slower for many platforms. > GCC will unroll a loop of fixed small size, which is what we want. Do you mean to replace option with a macro? But most of prefetch_offset are used with the nb_rx, So using macros is the same as using options. const int32_t k = RTE_ALIGN_FLOOR(nb_rx, FWDSTEP); for (j = 0; j != k; j += FWDSTEP) { for (i = 0, pos = j + prefetch_offset; i < FWDSTEP && pos < k; i++, pos++) rte_prefetch0(rte_pktmbuf_mtod(pkts_burst[pos], void *)); processx4_step1(&pkts_burst[j], &dip, &ipv4_flag); processx4_step2(qconf, dip, ipv4_flag, portid, &pkts_burst[j], &dst_port[j]); if (do_step3) processx4_step3(&pkts_burst[j], &dst_port[j]); } The option can dynamically adjust the prefetch window, which makes it easier to find the prefetch window for a HW platform. So I think it's better to use option.