DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] examples: fix ip_reassembly not work with some NICs
@ 2017-01-23  7:14 Yong Liu
  0 siblings, 0 replies; only message in thread
From: Yong Liu @ 2017-01-23  7:14 UTC (permalink / raw)
  To: dev; +Cc: Yong Liu

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")

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..e1a1c3c 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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-23  7:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23  7:14 [dpdk-dev] [PATCH] examples: fix ip_reassembly not work with some NICs Yong Liu

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).