[dpdk-dev] [PATCH] examples: add ip version check for l3fwd app

Chilikin, Andrey andrey.chilikin at intel.com
Wed Jun 3 10:24:42 CEST 2015


> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas.monjalon at 6wind.com]
> Sent: Wednesday, June 3, 2015 9:17 AM
> To: Chilikin, Andrey
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] examples: add ip version check for l3fwd app
> 
> 2015-05-15 17:08, Andrey Chilikin:
> > Added optional ip version check to l3fwd app to allow to detect the ip
> > version if mbuf ol_flags are not set in case of running in a VM with
> > emulated network controllers
> >
> > Signed-off-by: Andrey Chilikin <andrey.chilikin at intel.com>
> [...]
> > +#define DO_IP_VERSION_CHECK             0
> [...]
> > @@ -953,6 +955,15 @@ l3fwd_simple_forward(struct rte_mbuf *m, uint8_t
> portid, struct lcore_conf *qcon
> >  	void *d_addr_bytes;
> >  	uint8_t dst_port;
> >
> > +#if DO_IP_VERSION_CHECK
> > +	if (!(m->ol_flags & (PKT_RX_IPV4_HDR | PKT_RX_IPV6_HDR))) {
> > +		uint8_t ip_ver = *(uint8_t *)(rte_pktmbuf_mtod(m, unsigned
> char *) +
> > +			sizeof(struct ether_hdr)) >> 4;
> > +		if (ip_ver == 4)
> > +			m->ol_flags |= PKT_RX_IPV4_HDR;
> > +	}
> > +#endif
> 
> You are adding dead code. When ol_flags will be updated, it will be forget until
> someone enables it.
> In general, compile-time configurations are avoided and it's even worst when
> this is hidden and not easily testable like here.

Agree, we already thinking about creating separate example l3fwd-vm to cover emulated network controllers.

Thanks,
Andrey


More information about the dev mailing list