diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 21210aff43..d73f08b2c6 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -870,16 +870,28 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) /* receive a burst of packet */ nb_rx = common_fwd_stream_receive(fs, pkts_burst, nb_pkt_per_burst); - if (unlikely(nb_rx == 0)) + if (unlikely(nb_rx == 0)) { +#ifndef RTE_LIB_GRO return false; +#else + gro_enable = gro_ports[fs->rx_port].enable; + /* + * Check if packets need to be flushed in the GRO context + * due to a timeout. + * + * Continue only in GRO heavyweight mode and if there are + * packets in the GRO context. + */ + if (!gro_enable || (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) || + (rte_gro_get_pkt_count(current_fwd_lcore()->gro_ctx) == 0)) + return false; +#endif + } rx_bad_ip_csum = 0; rx_bad_l4_csum = 0; rx_bad_outer_l4_csum = 0; rx_bad_outer_ip_csum = 0; -#ifdef RTE_LIB_GRO - gro_enable = gro_ports[fs->rx_port].enable; -#endif txp = &ports[fs->tx_port]; tx_offloads = txp->dev_conf.txmode.offloads; @@ -1110,6 +1122,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) } #ifdef RTE_LIB_GRO + gro_enable = gro_ports[fs->rx_port].enable; if (unlikely(gro_enable)) { if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) { nb_rx = rte_gro_reassemble_burst(pkts_burst, nb_rx,