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 808D9A0032; Thu, 12 May 2022 00:33:07 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 277BC410F2; Thu, 12 May 2022 00:33:07 +0200 (CEST) Received: from forward501o.mail.yandex.net (forward501o.mail.yandex.net [37.140.190.203]) by mails.dpdk.org (Postfix) with ESMTP id 7498C410EF for ; Thu, 12 May 2022 00:33:05 +0200 (CEST) Received: from vla1-41795c1f28f7.qloud-c.yandex.net (vla1-41795c1f28f7.qloud-c.yandex.net [IPv6:2a02:6b8:c0d:4015:0:640:4179:5c1f]) by forward501o.mail.yandex.net (Yandex) with ESMTP id 0FB6C45C5108 for ; Thu, 12 May 2022 01:33:05 +0300 (MSK) Received: from vla5-047c0c0d12a6.qloud-c.yandex.net (vla5-047c0c0d12a6.qloud-c.yandex.net [2a02:6b8:c18:3484:0:640:47c:c0d]) by vla1-41795c1f28f7.qloud-c.yandex.net (mxback/Yandex) with ESMTP id 709G6t8q5p-X4g0vXp3; Thu, 12 May 2022 01:33:05 +0300 X-Yandex-Fwd: 2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1652308385; bh=nooE4YG5ec+1rzeAm1+3myXZ8Px5HvEEjxHqIcIjQvE=; h=In-Reply-To:From:Subject:References:Date:Message-ID:To; b=Jz5IQFLSdhw20kzjjjnyUYUSeEueMTMAFPrSIt6dZi5ZVKzgnhvj1V+4+/GF6YmYw e5ebQ1hmuzJR84qu0WQ0AFREABmV9zS1dr2CV7IAEjC6jZd0OqOl1QGm5tN51lMh3g ySQhVG2hF/l5sB0mz7B9nShS6/juNbRXxvuiGzYQ= Authentication-Results: vla1-41795c1f28f7.qloud-c.yandex.net; dkim=pass header.i=@yandex.ru Received: by vla5-047c0c0d12a6.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id XIpKVG7PqG-X4Oe3Apv; Thu, 12 May 2022 01:33:04 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) Message-ID: Date: Wed, 11 May 2022 23:33:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v1 5/5] examples/l3fwd: enable direct rearm mode Content-Language: en-US To: dev@dpdk.org References: <20220420081650.2043183-1-feifei.wang2@arm.com> <20220420081650.2043183-6-feifei.wang2@arm.com> From: Konstantin Ananyev In-Reply-To: <20220420081650.2043183-6-feifei.wang2@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 20/04/2022 09:16, Feifei Wang пишет: > Enable direct rearm mode. The mapping is decided in the data plane based > on the first packet received. > > Suggested-by: Honnappa Nagarahalli > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > Reviewed-by: Honnappa Nagarahalli > --- > examples/l3fwd/l3fwd_lpm.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index bec22c44cd..38ffdf4636 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -147,7 +147,7 @@ lpm_main_loop(__rte_unused void *dummy) > unsigned lcore_id; > uint64_t prev_tsc, diff_tsc, cur_tsc; > int i, nb_rx; > - uint16_t portid; > + uint16_t portid, tx_portid; > uint8_t queueid; > struct lcore_conf *qconf; > const uint64_t drain_tsc = (rte_get_tsc_hz() + US_PER_S - 1) / > @@ -158,6 +158,8 @@ lpm_main_loop(__rte_unused void *dummy) > > const uint16_t n_rx_q = qconf->n_rx_queue; > const uint16_t n_tx_p = qconf->n_tx_port; > + int direct_rearm_map[n_rx_q]; > + > if (n_rx_q == 0) { > RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id); > return 0; > @@ -169,6 +171,7 @@ lpm_main_loop(__rte_unused void *dummy) > > portid = qconf->rx_queue_list[i].port_id; > queueid = qconf->rx_queue_list[i].queue_id; > + direct_rearm_map[i] = 0; > RTE_LOG(INFO, L3FWD, > " -- lcoreid=%u portid=%u rxqueueid=%hhu\n", > lcore_id, portid, queueid); > @@ -209,6 +212,17 @@ lpm_main_loop(__rte_unused void *dummy) > if (nb_rx == 0) > continue; > > + /* Determine the direct rearm mapping based on the first > + * packet received on the rx queue > + */ > + if (direct_rearm_map[i] == 0) { > + tx_portid = lpm_get_dst_port(qconf, pkts_burst[0], > + portid); > + rte_eth_direct_rxrearm_map(portid, queueid, > + tx_portid, queueid); > + direct_rearm_map[i] = 1; > + } > + That just doesn't look right to me: why to make decision based on the first packet? What would happen if second and all other packets have to be routed to different ports? In fact, this direct-rearm mode seems suitable only for hard-coded one to one mapped forwarding (examples/l2fwd, testpmd). For l3fwd it can be used safely only when we have one port in use. Also I think it should be selected at init-time and it shouldn't be on by default. To summarize, my opinion: special cmd-line parameter to enable it. allowable only when we run l3fwd over one port. > #if defined RTE_ARCH_X86 || defined __ARM_NEON \ > || defined RTE_ARCH_PPC_64 > l3fwd_lpm_send_packets(nb_rx, pkts_burst,