From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7A25B5A56 for ; Wed, 3 Jun 2015 10:24:45 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 03 Jun 2015 01:24:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,546,1427785200"; d="scan'208";a="719884320" Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59]) by fmsmga001.fm.intel.com with ESMTP; 03 Jun 2015 01:24:43 -0700 Received: from irsmsx106.ger.corp.intel.com ([169.254.8.189]) by IRSMSX151.ger.corp.intel.com ([169.254.4.102]) with mapi id 14.03.0224.002; Wed, 3 Jun 2015 09:24:42 +0100 From: "Chilikin, Andrey" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH] examples: add ip version check for l3fwd app Thread-Index: AQHQjyl3Wwe3RM1uQ0msqnNr2Wr5452afCMAgAASYYA= Date: Wed, 3 Jun 2015 08:24:42 +0000 Message-ID: References: <1431706132-13223-1-git-send-email-andrey.chilikin@intel.com> <1651836.zg52yVUy7l@xps13> In-Reply-To: <1651836.zg52yVUy7l@xps13> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] examples: add ip version check for l3fwd app X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jun 2015 08:24:45 -0000 > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, June 3, 2015 9:17 AM > To: Chilikin, Andrey > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] examples: add ip version check for l3fwd = app >=20 > 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 > [...] > > +#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 =3D *(uint8_t *)(rte_pktmbuf_mtod(m, unsigned > char *) + > > + sizeof(struct ether_hdr)) >> 4; > > + if (ip_ver =3D=3D 4) > > + m->ol_flags |=3D PKT_RX_IPV4_HDR; > > + } > > +#endif >=20 > You are adding dead code. When ol_flags will be updated, it will be forge= t until > someone enables it. > In general, compile-time configurations are avoided and it's even worst w= hen > this is hidden and not easily testable like here. Agree, we already thinking about creating separate example l3fwd-vm to cove= r emulated network controllers. Thanks, Andrey