[PATCH] examples/l3fwd: add option to set refetch offset

huangdengdui huangdengdui at huawei.com
Tue Jan 14 10:22:08 CET 2025


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.


More information about the dev mailing list