diff mbox series

[v2,1/1] examples/l3fwd: fix scalar LPM compilation

Message ID 20220511145650.742535-1-kda@semihalf.com (mailing list archive)
State Accepted
Delegated to: David Marchand
Headers show
Series [v2,1/1] examples/l3fwd: fix scalar LPM compilation | expand

Checks

Context Check Description
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Stanisław Kardach May 11, 2022, 2:56 p.m. UTC
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 <kda@semihalf.com>

---
v2: Replace existing logic with rfc1812_process().
---
 examples/l3fwd/l3fwd_lpm.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

Comments

David Marchand May 19, 2022, 2:53 p.m. UTC | #1
On Wed, May 11, 2022 at 4:57 PM Stanislaw Kardach <kda@semihalf.com> 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 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 <kda@semihalf.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>
David Marchand May 23, 2022, 1:29 p.m. UTC | #2
On Thu, May 19, 2022 at 4:53 PM David Marchand
<david.marchand@redhat.com> wrote:
> On Wed, May 11, 2022 at 4:57 PM Stanislaw Kardach <kda@semihalf.com> 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 it should
> > utilize rfc1812_process() and return the port/BAD_PORT.
> >
> > Fixes: 99fc91d18082 ("examples/l3fwd: add event lpm main loop")
Cc: stable@dpdk.org

> >
> > Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.
diff mbox series

Patch

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 <rte_lpm6.h>
 
 #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 *)&eth_hdr->dst_addr = dest_eth_addr[mbuf->port];
 
 	/* src addr */
 	rte_ether_addr_copy(&ports_eth_addr[mbuf->port],
 			&eth_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;
 }