- else {
- ipv6_hdr = (struct ipv6_hdr *) (rte_pktmbuf_mtod(mb,
- unsigned char *) + l2_len);
- l3_len = sizeof(struct ipv6_hdr) ;
- l4_proto = ipv6_hdr->proto;
-
- if (l4_proto == IPPROTO_UDP) {
- udp_hdr = (struct udp_hdr*) (rte_pktmbuf_mtod(mb,
- unsigned char *) + l2_len + l3_len);
- if (tx_ol_flags & 0x2) {
- /* HW Offload */
- ol_flags |= PKT_TX_UDP_CKSUM;
- udp_hdr->dgram_cksum = get_ipv6_psd_sum(ipv6_hdr);
- }
- else {
- /* SW Implementation */
- /* checksum field need be clear first */
- udp_hdr->dgram_cksum = 0;
- udp_hdr->dgram_cksum = get_ipv6_udptcp_checksum(ipv6_hdr,
- (uint16_t*)udp_hdr);
- }
- }
- else if (l4_proto == IPPROTO_TCP) {
- tcp_hdr = (struct tcp_hdr*) (rte_pktmbuf_mtod(mb,
- unsigned char *) + l2_len + l3_len);
- if (tx_ol_flags & 0x4) {
- ol_flags |= PKT_TX_TCP_CKSUM;
- tcp_hdr->cksum = get_ipv6_psd_sum(ipv6_hdr);
- }
- else {
- tcp_hdr->cksum = 0;
- tcp_hdr->cksum = get_ipv6_udptcp_checksum(ipv6_hdr,
- (uint16_t*)tcp_hdr);
- }
+ /* if verbose mode is enabled, dump debug info */
+ if (verbose_level > 0) {
+ char buf[256];
+
+ printf("-----------------\n");
+ printf("port=%u, mbuf=%p, pkt_len=%u, nb_segs=%u:\n",
+ fs->rx_port, m, m->pkt_len, m->nb_segs);
+ /* dump rx parsed packet info */
+ rte_get_rx_ol_flag_list(rx_ol_flags, buf, sizeof(buf));
+ printf("rx: l2_len=%d ethertype=%x l3_len=%d "
+ "l4_proto=%d l4_len=%d flags=%s\n",
+ info.l2_len, rte_be_to_cpu_16(info.ethertype),
+ info.l3_len, info.l4_proto, info.l4_len, buf);
+ if (rx_ol_flags & PKT_RX_LRO)
+ printf("rx: m->lro_segsz=%u\n", m->tso_segsz);
+ if (info.is_tunnel == 1)
+ printf("rx: outer_l2_len=%d outer_ethertype=%x "
+ "outer_l3_len=%d\n", info.outer_l2_len,
+ rte_be_to_cpu_16(info.outer_ethertype),
+ info.outer_l3_len);
+ /* dump tx packet info */
+ if ((testpmd_ol_flags & (TESTPMD_TX_OFFLOAD_IP_CKSUM |
+ TESTPMD_TX_OFFLOAD_UDP_CKSUM |
+ TESTPMD_TX_OFFLOAD_TCP_CKSUM |
+ TESTPMD_TX_OFFLOAD_SCTP_CKSUM)) ||
+ info.tso_segsz != 0)
+ printf("tx: m->l2_len=%d m->l3_len=%d "
+ "m->l4_len=%d\n",
+ m->l2_len, m->l3_len, m->l4_len);
+ if (info.is_tunnel == 1) {
+ if ((testpmd_ol_flags &
+ TESTPMD_TX_OFFLOAD_OUTER_IP_CKSUM) ||
+ (tx_ol_flags & PKT_TX_OUTER_IPV6))
+ printf("tx: m->outer_l2_len=%d "
+ "m->outer_l3_len=%d\n",
+ m->outer_l2_len,
+ m->outer_l3_len);
+ if (info.tunnel_tso_segsz != 0 &&
+ (m->ol_flags & PKT_TX_TCP_SEG))
+ printf("tx: m->tso_segsz=%d\n",
+ m->tso_segsz);
+ } else if (info.tso_segsz != 0 &&
+ (m->ol_flags & PKT_TX_TCP_SEG))
+ printf("tx: m->tso_segsz=%d\n", m->tso_segsz);
+ rte_get_tx_ol_flag_list(m->ol_flags, buf, sizeof(buf));
+ printf("tx: flags=%s", buf);
+ printf("\n");
+ }
+ }
+
+ if (unlikely(gro_enable)) {
+ if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) {
+ nb_rx = rte_gro_reassemble_burst(pkts_burst, nb_rx,
+ &(gro_ports[fs->rx_port].param));
+ } else {
+ gro_ctx = current_fwd_lcore()->gro_ctx;
+ nb_rx = rte_gro_reassemble(pkts_burst, nb_rx, gro_ctx);
+
+ if (++fs->gro_times >= gro_flush_cycles) {
+ gro_pkts_num = rte_gro_get_pkt_count(gro_ctx);
+ if (gro_pkts_num > MAX_PKT_BURST - nb_rx)
+ gro_pkts_num = MAX_PKT_BURST - nb_rx;
+
+ nb_rx += rte_gro_timeout_flush(gro_ctx, 0,
+ RTE_GRO_TCP_IPV4,
+ &pkts_burst[nb_rx],
+ gro_pkts_num);
+ fs->gro_times = 0;