From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 46C5C3DC; Fri, 10 Mar 2017 04:38:04 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Mar 2017 19:38:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,138,1486454400"; d="scan'208";a="234428903" Received: from kmsmsx152.gar.corp.intel.com ([172.21.73.87]) by fmsmga004.fm.intel.com with ESMTP; 09 Mar 2017 19:38:02 -0800 Received: from pgsmsx106.gar.corp.intel.com ([169.254.9.9]) by KMSMSX152.gar.corp.intel.com ([169.254.11.139]) with mapi id 14.03.0248.002; Fri, 10 Mar 2017 11:36:16 +0800 From: "Dai, Wei" To: "dev@dpdk.org" , "Ananyev, Konstantin" CC: "stable@dpdk.org" Thread-Topic: [PATCH] examples/ip_fragmentation: fix check of packet type Thread-Index: AQHSmU8y3XRgComwEk6xIyULTHsgDqGNbDNw Date: Fri, 10 Mar 2017 03:36:15 +0000 Message-ID: <49759EB36A64CF4892C1AFEC9231E8D63A376AA2@PGSMSX106.gar.corp.intel.com> References: <1489116490-2490-1-git-send-email-wei.dai@intel.com> In-Reply-To: <1489116490-2490-1-git-send-email-wei.dai@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmEzYmI3ZDMtMTBhOC00ZDAzLTkxY2QtNTA1ODQzMzcxZTFmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkowY2E2NWJ0MFAycjlhNGNkMnM2WnFuMDBjd1wvSXI3SXV0QkpvY05FemRVPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [172.30.20.206] 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: Fri, 10 Mar 2017 03:38:04 -0000 Sorry, correct the name of Tester > -----Original Message----- > From: Dai, Wei > Sent: Friday, March 10, 2017 11:28 AM > To: dev@dpdk.org; Ananyev, Konstantin > Cc: Dai, Wei ; stable@dpdk.org > Subject: [PATCH] examples/ip_fragmentation: fix check of packet type >=20 > 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 rel= iaber. >=20 > Fixes: 3c0184cc0c60 ("examples: replace some offload flags with packet ty= pe") > Fixes: ab351fe1c95c ("mbuf: remove packet type from offload flags") >=20 > Cc: stable@dpdk.org >=20 > Reported-by: Fangfang Wei > Signed-off-by: Wei Dai Tested-by: Fangfang Wei > --- > examples/ip_fragmentation/main.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > 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; >=20 > 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 *qconf, > port_out =3D port_in; >=20 > /* 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)); >=20 > /* Build transmission burst */ > len =3D qconf->tx_mbufs[port_out].len; >=20 > /* 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_IPv6)= ) { > /* if this is an IPv6 packet */ > struct ipv6_hdr *ip_hdr; >=20 > @@ -363,8 +365,8 @@ l3fwd_simple_forward(struct rte_mbuf *m, struct > lcore_queue_conf *qconf, > void *d_addr_bytes; >=20 > 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"); > } > -- > 2.7.4