From patchwork Wed May 11 14:56:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislaw Kardach X-Patchwork-Id: 111033 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 645A3A0032; Wed, 11 May 2022 16:56:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E1CC40DDD; Wed, 11 May 2022 16:56:58 +0200 (CEST) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by mails.dpdk.org (Postfix) with ESMTP id 97F16406B4 for ; Wed, 11 May 2022 16:56:57 +0200 (CEST) Received: by mail-ed1-f42.google.com with SMTP id p4so2959862edx.0 for ; Wed, 11 May 2022 07:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bMiD06qNng/wO9mklH6s7w78AMb/U9H5BSbSP6fHfqA=; b=iD+MF5adxRw3AaB4G4RaqdqmnXMX8VAwhUQoKY3qOEKka0FY1JHFJOMWddUB072pV0 OJFXAfvpqy03F3IDunw1BCHekUKjJ0TEBX+ThdvA0/bona3v4RNwKUwaRIg4Q0vxro2Q CWsGTlTxEFrrTeo3Ysi49pUxadnkeID8jQTx4kM3NMoHfQNfnT9tnlxNVAB9xJVEAeW5 TBxbuMuIM9FWB5sbJaHCdMMFG0odqY1ehqUqpow9nezNwP6VlTVFy8SPFLpuFGluEQsk wPu89g4gklAi/Wbdz6PqlITVKpNIe3YForzGGruNCoFItk7gSAnUWob2dR2IRnODYycE K3IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bMiD06qNng/wO9mklH6s7w78AMb/U9H5BSbSP6fHfqA=; b=n3hZv4PVmwKApRFx/EM37m5J0nNqRuPf3kseSnoYE0VWFlqfduyPzuLRdrc5pBLYXk Yc+X63fsNucN37z1CChz+6dHE7NPR1otXWGgeUfDrgG/qBEalF7ywEUSK6ztnBIDBtuL fUkX+WrC/1FVIDenM795TGyLliNITsKbYT1N9FEm0zaDrPTLZ2NBXwIiFRCOWmh2M6nn PDmQN8naWO81UaLBwlxvCI/qLfXKkRhEcZB4L9ij9Bg3p2g2XMKfx7mB0/Vop4vMI7P2 dUCGbjqAj2Gnq/wAKjVYBxhg0fjtRqYXAchzBhEB20RZYkdohzHxOMrPyV6xnGn6s7du ealw== X-Gm-Message-State: AOAM530U/Ia4a+MODNUD0+G1abeFzPfqvi0jt4PveJm9tP9a/BVGZOUf QSvzPCSPg6NVd5HfXEzn7DpWJxP2vz2Y5Q== X-Google-Smtp-Source: ABdhPJzU1263h8XCdtfJqjKBukVSqOt0eStzeAPkWKGOJQe6XazN4+PqOsj7NAVV4Qn1gQmx34vOow== X-Received: by 2002:a05:6402:1813:b0:425:adb9:4abd with SMTP id g19-20020a056402181300b00425adb94abdmr29685278edy.278.1652281017346; Wed, 11 May 2022 07:56:57 -0700 (PDT) Received: from localhost.localdomain (89-73-146-138.dynamic.chello.pl. [89.73.146.138]) by smtp.gmail.com with ESMTPSA id q23-20020a1709060f9700b006f3ef214de8sm1055369ejj.78.2022.05.11.07.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 May 2022 07:56:56 -0700 (PDT) From: Stanislaw Kardach To: dev@dpdk.org Cc: Stanislaw Kardach , Frank Zhao , Sam Grove , mw@semihalf.com, upstream@semihalf.com, pbhagavatula@marvell.com Subject: [PATCH v2 1/1] examples/l3fwd: fix scalar LPM compilation Date: Wed, 11 May 2022 16:56:50 +0200 Message-Id: <20220511145650.742535-1-kda@semihalf.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220510115844.458009-1-kda@semihalf.com> References: <20220510115844.458009-1-kda@semihalf.com> MIME-Version: 1.0 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 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 it should utilize rfc1812_process() and return the port/BAD_PORT. Fixes: 99fc91d18082 ("examples/l3fwd: add event lpm main loop") Cc: pbhagavatula@marvell.com Signed-off-by: Stanislaw Kardach Reviewed-by: David Marchand --- v2: Replace existing logic with rfc1812_process(). --- examples/l3fwd/l3fwd_lpm.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c index bec22c44cd..7a1e60f6b3 100644 --- a/examples/l3fwd/l3fwd_lpm.c +++ b/examples/l3fwd/l3fwd_lpm.c @@ -28,6 +28,7 @@ #include #include "l3fwd.h" +#include "l3fwd_common.h" #include "l3fwd_event.h" #include "lpm_route_parse.c" @@ -237,30 +238,17 @@ lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf) 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(rte_pktmbuf_mtod_offset(mbuf, struct rte_ipv4_hdr *, + sizeof(struct rte_ether_hdr)), + &mbuf->port, mbuf->packet_type); #endif return mbuf->port; }