DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dev@dpdk.org
Cc: Yong Liu <yong.liu@intel.com>
Subject: [dpdk-dev] [PATCH v2] examples: fix ip_reassembly not work with some NICs
Date: Mon, 23 Jan 2017 15:28:29 +0800	[thread overview]
Message-ID: <1485156509-4919-1-git-send-email-yong.liu@intel.com> (raw)

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 <yong.liu@intel.com>

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 */
 
-- 
1.9.3

             reply	other threads:[~2017-01-23  7:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-23  7:28 Yong Liu [this message]
2017-02-09 14:25 ` [dpdk-dev] [PATCH v3 1/3] examples/ip_reassembly: add parse-ptype option Marvin Liu
2017-02-09 14:25   ` [dpdk-dev] [PATCH v3 2/3] examples/ip_fragmentation: " Marvin Liu
2017-02-09 14:25   ` [dpdk-dev] [PATCH v3 3/3] examples/l3fwd-acl: " Marvin Liu
2017-02-09 21:27   ` [dpdk-dev] [PATCH v3 1/3] examples/ip_reassembly: " Thomas Monjalon
2017-02-10  7:53     ` Liu, Yong
2017-02-10  8:35       ` Thomas Monjalon
2017-02-10  9:00         ` Tan, Jianfeng
2017-02-10  9:02         ` Liu, Yong
2017-04-04 12:45           ` Thomas Monjalon
2018-08-27 13:20 ` [dpdk-dev] [PATCH v2] examples: fix ip_reassembly not work with some NICs Luca Boccassi
2018-08-27 13:57   ` Liu, Yong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485156509-4919-1-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).