[dpdk-dev] [PATCH v4 4/5] examples/l3fwd: implement FIB lookup method

Walsh, Conor conor.walsh at intel.com
Mon Mar 15 11:21:19 CET 2021


Hi Vladimir,

<snip>

> > +	/* Add IPv4 and IPv6 hops to one array depending on type. */
> > +	for (i = 0; i < nb_rx; i++) {
> > +		if (type_arr[i])
> > +			nh = (uint16_t)hopsv4[ipv4_arr_assem++];
> > +		else
> > +			nh = (uint16_t)hopsv6[ipv6_arr_assem++];
> > +		hops[i] = (nh != FIB_DEFAULT_HOP && nh <=
> RTE_MAX_ETHPORTS &&
> > +			(enabled_port_mask & 1 << nh) != 0) ? nh : portid;
> 
> I think you can get rid of
> "nh <= RTE_MAX_ETHPORTS && (enabled_port_mask & 1 << nh) != 0"
> because it can be controlled during initialization when installing
> routes to the table. So you can check it just before rte_fib_add() and
> install FIB_DEFAULT_HOP if needed.

I will change this ternary to: hops[i] = nh != FIB_DEFAULT_HOP ? nh : portid;
I will also update the event code to match this.

> 
> Apart from that LGTM.

I will push a v5 with this change.

Thanks,
Conor.

> 
> 
> > +	}
> > +
> > +#if defined FIB_SEND_MULTI
> > +	send_packets_multi(qconf, pkts_burst, hops, nb_rx);
> > +#else
> > +	fib_send_single(nb_rx, qconf, pkts_burst, hops);
> > +#endif
> > +}
> > +
> 
> <snip>
> 
> >
> 
> --
> Regards,
> Vladimir


More information about the dev mailing list