[v7] app/testpmd : fix packets not getting flushed in heavy-weight mode API
Checks
Commit Message
In heavy-weight mode GRO which is based on timer, the GRO packets
will not be flushed in spite of timer expiry if there is no packet
in the current poll. If timer mode GRO is enabled the
rte_gro_timeout_flush API should be invoked.
Fixes: b7091f1dcfbc ("app/testpmd: enable the heavyweight mode TCP/IPv4 GRO")
Cc: jiayu.hu@intel.com
Signed-off-by: Kumara Parameshwaran <kumaraparamesh92@gmail.com>
---
v1:
Changes to make sure that the GRO flush API is invoked if there are no packets in
current poll and timer expiry.
v2:
Fix code organisation issue
v3:
Fix warnings
v4:
Fix error and warnings
v5:
Fix compilation issue when GRO is not defined
v6:
Address review comments
v7:
Address review comments
app/test-pmd/csumonly.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
Comments
On Fri, 16 Feb 2024 09:10:25 +0530
Kumara Parameshwaran <kumaraparamesh92@gmail.com> wrote:
> +#ifndef RTE_LIB_GRO
> return false;
> +#else
> + gro_enable = gro_ports[fs->rx_port].enable;
> + /*
> + * Make sure that in case of Heavyweight mode GRO the packets in
> + * GRO cache should be flushed as the timer could have expired.
> + *
> + * The order of condidtions should be the same as gro_ctx is valid
Run spell check on the comments please
> + * only when gro_flush_cycles is not the GRO_DEFAULT_FLUSH_CYCLES which
> + * indicates ligth weight mode GRO
> + */
> + if (!gro_enable || (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) ||
> + (rte_gro_get_pkt_count(current_fwd_lcore()->gro_ctx) == 0))
> + return false;
> +#endif
FYI - Linux kernel GRO does a flush when ever NAPI finishes. Pretty much equivalent
to this but flushes more frequently.
@@ -863,16 +863,29 @@ 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;
+ /*
+ * Make sure that in case of Heavyweight mode GRO the packets in
+ * GRO cache should be flushed as the timer could have expired.
+ *
+ * The order of condidtions should be the same as gro_ctx is valid
+ * only when gro_flush_cycles is not the GRO_DEFAULT_FLUSH_CYCLES which
+ * indicates ligth weight mode GRO
+ */
+ 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;
@@ -1103,6 +1116,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,