diff options
| author | root <[email protected]> | 2015-09-21 12:25:40 +0800 |
|---|---|---|
| committer | root <[email protected]> | 2015-09-21 12:25:40 +0800 |
| commit | e8f7a53505ecbe2fb93d85e8ec7f1e04dadfae4e (patch) | |
| tree | 7bc55c5817bbd39893485b5ba4c179e9415e4643 | |
| parent | 34d1f28b5acae43e8009eb89c9f461c37c64ab4f (diff) | |
适配DPDK2.1.0,修改mbuf判断Ipv4或ipv6的代码,适应新的ABI接口。20150921
| -rw-r--r-- | driver/runtime.c | 17 |
1 files changed, 17 insertions, 0 deletions
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); |
