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 309C2A0032; Wed, 11 May 2022 13:39:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D32D6410F2; Wed, 11 May 2022 13:39:10 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 44BD140DDD for ; Wed, 11 May 2022 13:39:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652269148; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bp7ceo+Bwjr509AzreOl9Mlo6pcae8FWa/DRxlDqFFg=; b=AW+vTukXBIUW8mojj/zkO8JdQyejspaeevl7GH6LSkCSsvqQlKEH6ecgWELm/w0c5RSY3/ KiS+/zuaMmHBGPxFlWJLCrugan6Mzni3w5upmV4xpf6Tb0U+bvCbhFnpuT3dCmU6NdIFDE QFsgERXEVhVyjBBUXUdGF2vLx5REdPc= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-321-E8UEDXhuNtSYY8ahxrLe3g-1; Wed, 11 May 2022 07:39:07 -0400 X-MC-Unique: E8UEDXhuNtSYY8ahxrLe3g-1 Received: by mail-lf1-f70.google.com with SMTP id e11-20020ac2546b000000b00472627d901eso685329lfn.20 for ; Wed, 11 May 2022 04:39:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bp7ceo+Bwjr509AzreOl9Mlo6pcae8FWa/DRxlDqFFg=; b=6szuBOBwhZGbekapjZLP87FhBmLV+X5O2304rq+30LwfClt3iGgNfHUIeZ5/htDnO3 z2q30xOBeAzNrgfvmrYdSULxUrqloiTZBO+zUxSjU7YbbqhVzIJCUYHaUbQKZvznFt+k T62j9kZ1RjnZOihq1aoNnoEpIWwkM0ed0+Zy39XysXL56Kmo1x8Zv8Z8avk4sjMJjPQI Ibk/4pN2MCRwWau9q3nfBXSuqtsFMVnsboC07e6C+mLVN5AN2uznGsWm6VJ1Q1Pjs/Vu DYG5os1lTCZBMMlyS0ECg9vugkGOKJte3QPHnIPScr0Gu6HtQp8erw3hFmwsBNl90SfN UtJA== X-Gm-Message-State: AOAM531ZkS2P49M0WbSsylnyFgd0+684qRcGcWv9JhiHiYQugLzo1WWM qCfMFqU8TZxzv792i30bFE9SL7bBirYAjz2z1BWaXYuVG+xVbVj6vboMEutJEMDvmBtGwSDLwXK Iodz3smNnKEFTycxvLBY= X-Received: by 2002:a05:6512:baa:b0:472:5ec9:f625 with SMTP id b42-20020a0565120baa00b004725ec9f625mr19377726lfv.560.1652269146229; Wed, 11 May 2022 04:39:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw0dptIDAtIvI9tIlolZNBh2b2OPQPx54izoHGvB+bBdZxxHYQQSsdCPaaW5MU+7afPh7dWlr6lXFixMfSGsY= X-Received: by 2002:a05:6512:baa:b0:472:5ec9:f625 with SMTP id b42-20020a0565120baa00b004725ec9f625mr19377713lfv.560.1652269146008; Wed, 11 May 2022 04:39:06 -0700 (PDT) MIME-Version: 1.0 References: <20220510115844.458009-1-kda@semihalf.com> In-Reply-To: <20220510115844.458009-1-kda@semihalf.com> From: David Marchand Date: Wed, 11 May 2022 13:38:54 +0200 Message-ID: Subject: Re: [PATCH 1/1] examples/l3fwd: fix scalar LPM compilation To: Stanislaw Kardach Cc: dev , Frank Zhao , Sam Grove , Marcin Wojtas , upstream@semihalf.com, Pavan Nikhilesh , Honnappa Nagarahalli , Konstantin Ananyev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" 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 Hello Stanislaw, On Tue, May 10, 2022 at 1:59 PM Stanislaw Kardach wrote: > > The lpm_process_event_pkt() can either process a packet using an > architecture specific (defined for X86/SSE, ARM/Neon and PPC64/Altivec) > path or a scalar one. The choice is however done using an ifdef > pre-processor macro. Because of that the scalar version was apparently > not widely excersized/compiled. > Due to some copy/paste errors, the scalar logic in > lpm_process_event_pkt() retained a "continue" statement where a BAD_PORT > should be returned after refactoring of the LPM logic in the l3fwd > example. > > Fixes: 99fc91d18082 ("examples/l3fwd: add event lpm main loop") > Cc: pbhagavatula@marvell.com > > Signed-off-by: Stanislaw Kardach > --- > examples/l3fwd/l3fwd_lpm.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c > index bec22c44cd..6e1defbf7f 100644 > --- a/examples/l3fwd/l3fwd_lpm.c > +++ b/examples/l3fwd/l3fwd_lpm.c > @@ -248,7 +248,7 @@ lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf) > if (is_valid_ipv4_pkt(ipv4_hdr, mbuf->pkt_len) > < 0) { > mbuf->port = BAD_PORT; > - continue; > + return mbuf->port; > } > /* Update time to live and header checksum */ > --(ipv4_hdr->time_to_live); Based on the vector specific implemtations of process_packet in this example, this code could be replaced with a call to rfc1812_process(). Eth macs updates can be moved prior to rfc1812_process. What do you think of (untested): diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index bec22c44cd..c73cbda6b5 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -234,33 +234,18 @@ lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf) || defined RTE_ARCH_PPC_64 process_packet(mbuf, &mbuf->port); #else - struct rte_ether_hdr *eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr *); -#ifdef DO_RFC_1812_CHECKS - struct rte_ipv4_hdr *ipv4_hdr; - if (RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) { - /* Handle IPv4 headers.*/ - ipv4_hdr = rte_pktmbuf_mtod_offset(mbuf, - struct rte_ipv4_hdr *, - sizeof(struct rte_ether_hdr)); - - if (is_valid_ipv4_pkt(ipv4_hdr, mbuf->pkt_len) - < 0) { - mbuf->port = BAD_PORT; - continue; - } - /* Update time to live and header checksum */ - --(ipv4_hdr->time_to_live); - ++(ipv4_hdr->hdr_checksum); - } -#endif + /* dst addr */ *(uint64_t *)ð_hdr->dst_addr = dest_eth_addr[mbuf->port]; /* src addr */ rte_ether_addr_copy(&ports_eth_addr[mbuf->port], ð_hdr->src_addr); + + rfc1812_process((struct rte_ipv4_hdr *)(eth_hdr + 1), &mbuf->port, + mbuf->packet_type); #endif return mbuf->port; }