The l3fwd implement to do events has lots of copy/paste code.
Much of this must be never tested because it has compile errors.
Example:

static __rte_always_inline uint16_t
lpm_process_event_pkt(const struct lcore_conf *lconf, struct rte_mbuf *mbuf)
{
        mbuf->port = lpm_get_dst_port(lconf, mbuf, mbuf->port);

#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
        || 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; <<<<<<<<< not in loop?
                }

If the checks are enabled, the code doesn't compile because continue
is not in a loop.

Which leads to a number of observations:
   - copy/paste is bad, see DNR principle. Better to make it an inline
   - #ifdef are evil since no one ever tests the other half
   - why did CI not catch this?
   - do you ever build on other architectures?

Please fix!

Reply via email to