X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fcsumonly.c;h=0a96b24eb27b499a78617aa9d029313aa498fc73;hb=fbc8c7003b93a7555887a4195678aca9ee69f4ae;hp=c3fd5e17d1ab903589ce81ab5b90f20277a06b1f;hpb=d8e5e69f3a9b14c336ecc31a11a41c92488a1d28;p=dpdk.git diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index c3fd5e17d1..0a96b24eb2 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -46,9 +47,6 @@ #include "testpmd.h" #define IP_DEFTTL 64 /* from RFC 1340. */ -#define IP_VERSION 0x40 -#define IP_HDRLEN 0x05 /* default IP header length == five 32-bits words. */ -#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN) #define GRE_CHECKSUM_PRESENT 0x8000 #define GRE_KEY_PRESENT 0x2000 @@ -88,7 +86,7 @@ struct testpmd_offload_info { struct simple_gre_hdr { uint16_t flags; uint16_t proto; -} __attribute__((__packed__)); +} __rte_packed; static uint16_t get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) @@ -141,22 +139,23 @@ parse_ipv6(struct rte_ipv6_hdr *ipv6_hdr, struct testpmd_offload_info *info) /* * Parse an ethernet header to fill the ethertype, l2_len, l3_len and - * ipproto. This function is able to recognize IPv4/IPv6 with one optional vlan - * header. The l4_len argument is only set in case of TCP (useful for TSO). + * ipproto. This function is able to recognize IPv4/IPv6 with optional VLAN + * headers. The l4_len argument is only set in case of TCP (useful for TSO). */ static void parse_ethernet(struct rte_ether_hdr *eth_hdr, struct testpmd_offload_info *info) { struct rte_ipv4_hdr *ipv4_hdr; struct rte_ipv6_hdr *ipv6_hdr; + struct rte_vlan_hdr *vlan_hdr; info->l2_len = sizeof(struct rte_ether_hdr); info->ethertype = eth_hdr->ether_type; - if (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN)) { - struct rte_vlan_hdr *vlan_hdr = ( - struct rte_vlan_hdr *)(eth_hdr + 1); - + while (info->ethertype == _htons(RTE_ETHER_TYPE_VLAN) || + info->ethertype == _htons(RTE_ETHER_TYPE_QINQ)) { + vlan_hdr = (struct rte_vlan_hdr *) + ((char *)eth_hdr + info->l2_len); info->l2_len += sizeof(struct rte_vlan_hdr); info->ethertype = vlan_hdr->eth_proto; } @@ -543,6 +542,9 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, udp_hdr = (struct rte_udp_hdr *) ((char *)outer_l3_hdr + info->outer_l3_len); + if (tso_enabled) + ol_flags |= PKT_TX_TCP_SEG; + /* Skip SW outer UDP checksum generation if HW supports it */ if (tx_offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM) { if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPV4)) @@ -800,11 +802,12 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* receive a burst of packet */ nb_rx = rte_eth_rx_burst(fs->rx_port, fs->rx_queue, pkts_burst, nb_pkt_per_burst); - if (unlikely(nb_rx == 0)) - return; #ifdef RTE_TEST_PMD_RECORD_BURST_STATS fs->rx_burst_stats.pkt_burst_spread[nb_rx]++; #endif + if (unlikely(nb_rx == 0)) + return; + fs->rx_packets += nb_rx; rx_bad_ip_csum = 0; rx_bad_l4_csum = 0;