net/mlx5e: RX, Avoid possible data corruption when relaxed ordering and LRO combined
authorTariq Toukan <tariqt@nvidia.com>
Wed, 30 Jun 2021 10:45:05 +0000 (13:45 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Tue, 27 Jul 2021 23:10:03 +0000 (16:10 -0700)
commite2351e517068718724f1d3b4010e2a41ec91fa76
treec1329e8ce22ee09c2c96a3031f1b2bd7ac7eb000
parentdd3fddb82780bfa24124834edd90bbc63bd689cc
net/mlx5e: RX, Avoid possible data corruption when relaxed ordering and LRO combined

When HW aggregates packets for an LRO session, it writes the payload
of two consecutive packets of a flow contiguously, so that they usually
share a cacheline.

The first byte of a packet's payload is written immediately after
the last byte of the preceding packet.
In this flow, there are two consecutive write requests to the shared
cacheline:
1. Regular write for the earlier packet.
2. Read-modify-write for the following packet.

In case of relaxed-ordering on, these two writes might be re-ordered.
Using the end padding optimization (to avoid partial write for the last
cacheline of a packet) becomes problematic if the two writes occur
out-of-order, as the padding would overwrite payload that belongs to
the following packet, causing data corruption.

Avoid this by disabling the end padding optimization when both
LRO and relaxed-ordering are enabled.

Fixes: 17347d5430c4 ("net/mlx5e: Add support for PCI relaxed ordering")
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/params.c