From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id E3C4C69D4; Mon, 13 Mar 2017 08:01:53 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP; 13 Mar 2017 00:01:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,157,1486454400"; d="scan'208";a="74684587" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga005.jf.intel.com with ESMTP; 13 Mar 2017 00:01:51 -0700 Received: from irsmsx155.ger.corp.intel.com (163.33.192.3) by IRSMSX154.ger.corp.intel.com (163.33.192.96) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 13 Mar 2017 07:01:51 +0000 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.44]) by irsmsx155.ger.corp.intel.com ([169.254.14.204]) with mapi id 14.03.0248.002; Mon, 13 Mar 2017 07:01:50 +0000 From: "Ananyev, Konstantin" To: "Dai, Wei" , "dev@dpdk.org" CC: "stable@dpdk.org" Thread-Topic: [PATCH] examples/ip_fragmentation: fix check of packet type Thread-Index: AQHSmU8yg5E/bdsm10Cc+RyE+vgWlqGN/nwQgAQi4wCAADsAUA== Date: Mon, 13 Mar 2017 07:01:49 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583FACE36C@IRSMSX109.ger.corp.intel.com> References: <1489116490-2490-1-git-send-email-wei.dai@intel.com> <2601191342CEEE43887BDE71AB9772583FACD1BD@IRSMSX109.ger.corp.intel.com> <49759EB36A64CF4892C1AFEC9231E8D63A377512@PGSMSX106.gar.corp.intel.com> In-Reply-To: <49759EB36A64CF4892C1AFEC9231E8D63A377512@PGSMSX106.gar.corp.intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/ip_fragmentation: fix check of packet type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Mar 2017 07:01:54 -0000 Hi Wei, >=20 > Hi, Konstantin > I see your point. > I think your method can work. > But I think your method is a bit complex. As you method need to add more = codes. > Anyway this is a simple bug. > How do you think now ? I still think it is better for all apps to handle this issue in a uniform w= ay. Again in that case for NICs that do support PTYPE offloads the performance = should be unaffected. Konstantin >=20 > > -----Original Message----- > > From: Ananyev, Konstantin > > Sent: Friday, March 10, 2017 8:21 PM > > To: Dai, Wei ; dev@dpdk.org > > Cc: stable@dpdk.org > > Subject: RE: [PATCH] examples/ip_fragmentation: fix check of packet typ= e > > > > Hi Wei, > > > > > -----Original Message----- > > > From: Dai, Wei > > > Sent: Friday, March 10, 2017 3:28 AM > > > To: dev@dpdk.org; Ananyev, Konstantin > > > Cc: Dai, Wei ; stable@dpdk.org > > > Subject: [PATCH] examples/ip_fragmentation: fix check of packet type > > > > > > The packet_type in mbuf is not correctly filled by ixgbe 82599 NIC. > > > To use the ether_type in ethernet header to check packet type is more > > > reliaber. > > > > > > Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packe= t > > > type") > > > Fixes: ab351fe1c95c ("mbuf: remove packet type from offload flags") > > > > > > Cc: stable@dpdk.org > > > > > > Reported-by: Fangfang Wei > > > Signed-off-by: Wei Dai > > > Tested-by: Fagnfang Wei > > > --- > > > examples/ip_fragmentation/main.c | 10 ++++++---- > > > 1 file changed, 6 insertions(+), 4 deletions(-) > > > > > > diff --git a/examples/ip_fragmentation/main.c > > > b/examples/ip_fragmentation/main.c > > > index e1e32c6..8612984 100644 > > > --- a/examples/ip_fragmentation/main.c > > > +++ b/examples/ip_fragmentation/main.c > > > @@ -268,6 +268,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct > > lcore_queue_conf *qconf, > > > uint32_t i, len, next_hop_ipv4; > > > uint8_t next_hop_ipv6, port_out, ipv6; > > > int32_t len2; > > > + struct ether_hdr *eth_hdr; > > > > > > ipv6 =3D 0; > > > rxq =3D &qconf->rx_queue_list[queueid]; @@ -276,13 +277,14 @@ > > > l3fwd_simple_forward(struct rte_mbuf *m, struct lcore_queue_conf *qco= nf, > > > port_out =3D port_in; > > > > > > /* Remove the Ethernet header and trailer from the input packet */ > > > + eth_hdr =3D rte_pktmbuf_mtod(m, struct ether_hdr *); > > > rte_pktmbuf_adj(m, (uint16_t)sizeof(struct ether_hdr)); > > > > > > /* Build transmission burst */ > > > len =3D qconf->tx_mbufs[port_out].len; > > > > > > /* if this is an IPv4 packet */ > > > - if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { > > > + if (eth_hdr->ether_type =3D=3D rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { > > > struct ipv4_hdr *ip_hdr; > > > uint32_t ip_dst; > > > /* Read the lookup key (i.e. ip_dst) from the input packet */ @@ > > > -316,7 +318,7 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct > > lcore_queue_conf *qconf, > > > if (unlikely (len2 < 0)) > > > return; > > > } > > > - } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { > > > + } else if (eth_hdr->ether_type =3D=3D rte_be_to_cpu_16(ETHER_TYPE_I= Pv6)) > > > +{ > > > /* if this is an IPv6 packet */ > > > struct ipv6_hdr *ip_hdr; > > > > > > @@ -363,8 +365,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct > > lcore_queue_conf *qconf, > > > void *d_addr_bytes; > > > > > > m =3D qconf->tx_mbufs[port_out].m_table[i]; > > > - struct ether_hdr *eth_hdr =3D (struct ether_hdr *) > > > - rte_pktmbuf_prepend(m, (uint16_t)sizeof(struct ether_hdr)); > > > + eth_hdr =3D (struct ether_hdr *)rte_pktmbuf_prepend(m, > > > + (uint16_t)sizeof(struct ether_hdr)); > > > if (eth_hdr =3D=3D NULL) { > > > rte_panic("No headroom in mbuf.\n"); > > > } > > > > Thanks for the fix. > > Would it be more convenient to do what l3fwd does: > > Check what ptype capabilities are provided by HW, if no ptype support d= etected, > > then install an RX callback? > > Konstantin > > > > > -- > > > 2.7.4