Maxim Mikityanskiy c80794323e net: Fix packet reordering caused by GRO and listified RX cooperation
Commit 323ebb61e32b ("net: use listified RX for handling GRO_NORMAL
skbs") introduces batching of GRO_NORMAL packets in napi_frags_finish,
and commit 6570bc79c0df ("net: core: use listified Rx for GRO_NORMAL in
napi_gro_receive()") adds the same to napi_skb_finish. However,
dev_gro_receive (that is called just before napi_{frags,skb}_finish) can
also pass skbs to the networking stack: e.g., when the GRO session is
flushed, napi_gro_complete is called, which passes pp directly to
netif_receive_skb_internal, skipping napi->rx_list. It means that the
packet stored in pp will be handled by the stack earlier than the
packets that arrived before, but are still waiting in napi->rx_list. It
leads to TCP reorderings that can be observed in the TCPOFOQueue counter
in netstat.

This commit fixes the reordering issue by making napi_gro_complete also
use napi->rx_list, so that all packets going through GRO will keep their
order. In order to keep napi_gro_flush working properly, gro_normal_list
calls are moved after the flush to clear napi->rx_list.

iwlwifi calls napi_gro_flush directly and does the same thing that is
done by gro_normal_list, so the same change is applied there:
napi_gro_flush is moved to be before the flush of napi->rx_list.

A few other drivers also use napi_gro_flush (brocade/bna/bnad.c,
cortina/gemini.c, hisilicon/hns3/hns3_enet.c). The first two also use
napi_complete_done afterwards, which performs the gro_normal_list flush,
so they are fine. The latter calls napi_gro_receive right after
napi_gro_flush, so it can end up with non-empty napi->rx_list anyway.

Fixes: 323ebb61e32b ("net: use listified RX for handling GRO_NORMAL skbs")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Cc: Alexander Lobakin <alobakin@dlink.ru>
Cc: Edward Cree <ecree@solarflare.com>
Acked-by: Alexander Lobakin <alobakin@dlink.ru>
Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-22 20:36:37 +01:00
..
2020-01-17 05:54:18 -08:00
2020-01-16 19:42:08 -08:00
2019-12-01 18:43:25 -08:00
2020-01-18 13:57:31 -08:00
2019-11-30 14:35:43 -08:00
2019-12-01 18:42:02 -08:00
2020-01-04 10:41:08 -08:00
2019-12-06 08:28:51 -08:00
2019-12-03 13:58:22 -08:00
2019-12-03 14:37:12 -08:00
2020-01-18 12:08:57 -08:00
2020-01-13 18:50:18 -08:00
2019-12-01 18:43:25 -08:00
2019-12-05 11:43:31 -08:00
2019-11-25 19:40:40 -08:00
2019-12-05 11:28:14 -08:00
2020-01-06 12:04:31 -08:00
2019-12-01 18:39:24 -08:00
2020-01-18 12:12:36 -08:00
2020-01-16 19:42:08 -08:00
2020-01-06 12:34:44 -08:00
2019-12-27 17:28:41 -08:00
2020-01-17 19:40:06 +01:00
2019-12-07 14:51:04 -08:00
2019-12-03 13:58:22 -08:00
2019-11-14 13:06:33 +08:00
2019-12-21 06:24:56 -08:00