OSDN Git Service

net/mlx5e: Fix GRE key by controlling port tunnel entropy calculation
authorEli Britstein <elibr@mellanox.com>
Mon, 14 Jan 2019 08:07:44 +0000 (10:07 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Fri, 22 Feb 2019 21:38:23 +0000 (13:38 -0800)
commit97417f6182f80a80c9b4443f282ef707be74dade
treea354870a5a20fcb5acce14e8d3cca81d9348f133
parent0dcaafc0b8dcf65d786b12f74d96aaba63884d1b
net/mlx5e: Fix GRE key by controlling port tunnel entropy calculation

Flow entropy is calculated on the inner packet headers and used for
flow distribution in processing, routing etc. For GRE-type
encapsulations the entropy value is placed in the eight LSB of the key
field in the GRE header as defined in NVGRE RFC 7637. For UDP based
encapsulations the entropy value is placed in the source port of the
UDP header.
The hardware may support entropy calculation specifically for GRE and
for all tunneling protocols. With commit df2ef3bff193 ("net/mlx5e: Add
GRE protocol offloading") GRE is offloaded, but the hardware is
configured by default to calculate flow entropy so packets transmitted
on the wire have a wrong key. To support UDP based tunnels (i.e VXLAN),
GRE (i.e. no flow entropy) and NVGRE (i.e. with flow entropy) the
hardware behaviour must be controlled by the driver.

Ensure port entropy calculation is enabled for offloaded VXLAN tunnels
and disable port entropy calculation in the presence of offloaded GRE
tunnels by monitoring the presence of entropy enabling tunnels (i.e
VXLAN) and entropy disabing tunnels (i.e GRE).

Fixes: df2ef3bff193 ("net/mlx5e: Add GRE protocol offloading")
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/Makefile
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.h
drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.c [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/lib/port_tun.h [new file with mode: 0644]
drivers/net/ethernet/mellanox/mlx5/core/port.c
include/linux/mlx5/port.h