From e8f7a53505ecbe2fb93d85e8ec7f1e04dadfae4e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 21 Sep 2015 12:25:40 +0800 Subject: 适配DPDK2.1.0,修改mbuf判断Ipv4或ipv6的代码,适应新的ABI接口。 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- driver/runtime.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/driver/runtime.c b/driver/runtime.c index 1d949de..af4f234 100644 --- a/driver/runtime.c +++ b/driver/runtime.c @@ -102,6 +102,22 @@ int get_hash_result(struct rte_mbuf * mbuf, uint8_t *data, uint32_t *hash_value) tsc_start = nstat_rdtsc(); uint16_t protrol_type = 0; +/* DPDK 2.1.0 */ +#ifdef RTE_NEXT_ABI + if(RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) + { + data += sizeof(struct ether_hdr); + protrol_type = ADDR_TYPE_IPV4; + } + + else if(RTE_ETH_IS_IPV6_HDR(mbuf->packet_type)) + { + data += sizeof(struct ether_hdr); + protrol_type = ADDR_TYPE_IPV6; + } + +/* DPDK 1.5.2-2.0.0 */ +#else if(mbuf->ol_flags & PKT_RX_IPV4_HDR) { data += sizeof(struct ether_hdr); @@ -112,6 +128,7 @@ int get_hash_result(struct rte_mbuf * mbuf, uint8_t *data, uint32_t *hash_value) data += sizeof(struct ether_hdr); protrol_type = ADDR_TYPE_IPV6; } +#endif else { data = (uint8_t *) network_data_jump_to_layer_ip(data,&protrol_type); -- cgit v1.2.3