From patchwork Mon Jan 23 07:28:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marvin Liu X-Patchwork-Id: 19868 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E83032C57; Mon, 23 Jan 2017 08:27:28 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 1556B2C38 for ; Mon, 23 Jan 2017 08:27:26 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 22 Jan 2017 23:27:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,273,1477983600"; d="scan'208";a="34126450" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by orsmga002.jf.intel.com with ESMTP; 22 Jan 2017 23:27:24 -0800 From: Yong Liu To: dev@dpdk.org Cc: Yong Liu Date: Mon, 23 Jan 2017 15:28:29 +0800 Message-Id: <1485156509-4919-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [dpdk-dev] [PATCH v2] examples: fix ip_reassembly not work with some NICs 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Some network device drivers like Fortville may not fill packet type by default. Changed the method for detecting packet type from mbuf packet type to ethernet header MAC type will make sure this example compatible with all NICs. Fixes: b84fb4cb88ff ("examples/ip_reassembly: overhaul") v2: * fix code style issue Signed-off-by: Yong Liu diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 50fe422..974fabc 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -356,7 +356,7 @@ struct rte_lpm6_config lpm6_config = { dst_port = portid; /* if packet is IPv4 */ - if (RTE_ETH_IS_IPV4_HDR(m->packet_type)) { + if (eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv4)) { struct ipv4_hdr *ip_hdr; uint32_t ip_dst; @@ -395,8 +395,7 @@ struct rte_lpm6_config lpm6_config = { dst_port = next_hop_ipv4; } - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv4); - } else if (RTE_ETH_IS_IPV6_HDR(m->packet_type)) { + } else if (eth_hdr->ether_type == rte_cpu_to_be_16(ETHER_TYPE_IPv6)) { /* if packet is IPv6 */ struct ipv6_extension_fragment *frag_hdr; struct ipv6_hdr *ip_hdr; @@ -431,8 +430,6 @@ struct rte_lpm6_config lpm6_config = { (enabled_port_mask & 1 << next_hop_ipv6) != 0) { dst_port = next_hop_ipv6; } - - eth_hdr->ether_type = rte_be_to_cpu_16(ETHER_TYPE_IPv6); } /* if packet wasn't IPv4 or IPv6, it's forwarded to the port it came from */