Skip to contentSkip to conversation

mlx4+vxlan offload breaks gre tunnels

PATCH Florian Westphal 5 participants 8 messages Nov 5, 2014 – Nov 6, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan offload is enabled with mlx4 driver.

Given following config on tx-side:
dev=enp3s0
ip addr add dev $dev 192.168.23.1/24
ip link set $dev up
ip link add mygre type gretap remote 192.168.23.2 local 192.168.23.1 ip addr add dev mygre 192.168.42.1/24
ip link set gre0 up
ip link set mygre up

and

options mlx4_core log_num_mgm_entry_size=-1 debug_level=1 port_type_array=2,2

in
/etc/modprobe.d/mlx4.conf

all tcp packets sent to destinations over the gre tunnel have bogus tcp checksums (and are tossed on rx side when stack validates tcp checksum).

net-next head is commit 30349bdbc4da5ecf0efa25556e3caff9c9b8c5f7 .

What makes things work for me:
either

options mlx4_core 1 debug_level=1 port_type_array=2,2

(ie. no MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)

or not setting NETIF_F_IP_CSUM in enc_features:

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2579,10 +2579,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
                dev->priv_flags |= IFF_UNICAST_FLT;
 
        if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+               dev->hw_enc_features |= NETIF_F_RXCSUM |
                                        NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
 

I am not sure if its right fix, but to my eyes this basically looks like mlx4 is telling stack that it can handle tcp checksum offload within tunnels, and that doesn't seem to be the case for all types (e.g. gre).

Could someone who understand the enc_features specifics better confirm that above patch is correct (or provide a better/proper fix)?

Thanks,
Florian

#1 lore raw
Quoted 48 lines · Florian Westphal

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan offload is enabled with mlx4 driver.

Given following config on tx-side:
dev=enp3s0
ip addr add dev $dev 192.168.23.1/24
ip link set $dev up
ip link add mygre type gretap remote 192.168.23.2 local 192.168.23.1 ip addr add dev mygre 192.168.42.1/24
ip link set gre0 up
ip link set mygre up

and

options mlx4_core log_num_mgm_entry_size=-1 debug_level=1 port_type_array=2,2

in
/etc/modprobe.d/mlx4.conf

all tcp packets sent to destinations over the gre tunnel have bogus tcp checksums (and are tossed on rx side when stack validates tcp checksum).

net-next head is commit 30349bdbc4da5ecf0efa25556e3caff9c9b8c5f7 .

What makes things work for me:
either

options mlx4_core 1 debug_level=1 port_type_array=2,2

(ie. no MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)

or not setting NETIF_F_IP_CSUM in enc_features:

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2579,10 +2579,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
                 dev->priv_flags |= IFF_UNICAST_FLT;
 
         if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+               dev->hw_enc_features |= NETIF_F_RXCSUM |
                                         NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
 

I am not sure if its right fix, but to my eyes this basically looks like mlx4 is telling stack that it can handle tcp checksum offload within tunnels, and that doesn't seem to be the case for all types (e.g. gre).

Quoted 2 lines

Could someone who understand the enc_features specifics better confirm that above patch is correct (or provide a better/proper fix)?

Yep, I can see now the problem. It comes into play with ConnectX3-pro NICs that support VXLAN offloads (but not with ConnectX3 NIC which don't) when you enable the offloads support on the CX3-pro.

The problem originates from the fact that we can't advertize something like "the HW can offload the inner checksum of UDP/VXLAN encapsulated (but not for GRE)", e.g in a similar manner that exists in the GSO space, where you have NETIF_F_GSO _YYY for each yyy in {UDP, SIT, GRE, etc} tunneling scheme.

I think the best effort we can do now is

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

2. come up with proper kernel APIs to let NICs advertize which encap schemes they can actually offload the inner checksum, Tom... your work which now runs over netdev.

Tom/Jesse- thoughts? are you +1-ing the below approach?

Or.

tested to work with the following which is a bit different, tell me if it works for you

# node A - with mlx4_en address192.168.31.18
ip tunnel add gre1 mode gre local 192.168.31.18 remote 192.168.31.17 ttl 255
ifconfig gre1 10.10.10.18/24 up
ifconfig gre1 mtu 1450
# node B - with mlx4_en address192.168.31.17
ip tunnel add gre1 mode gre local 192.168.31.17 remote 192.168.31.18 ttl 255
ifconfig gre1 10.10.10.17/24 up
ifconfig gre1 mtu 1450
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -0
index 0efbae9..7753833 100644
@@ -2292,6 +2292,12 @@ static void mlx4_en_add_vxlan_offloads(struct work_struct *work)
 out:
        if (ret)
                en_err(priv, "failed setting L2 tunnel configuration 

ret %d\n", ret);
+
+ /* set offloads */
+ priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+ NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;

+       priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    |= NETIF_F_GSO_UDP_TUNNEL;

}

static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
@@ -2299,6 +2305,10 @@ static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
int ret;
struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
vxlan_del_task);

+       /* unset offloads */
+       priv->dev->hw_enc_features = 0;
+       priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    &= ~NETIF_F_GSO_UDP_TUNNEL;
        ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
                                  VXLAN_STEER_BY_OUTER_MAC, 0);
@@ -2578,13 +2588,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
        if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
                dev->priv_flags |= IFF_UNICAST_FLT;

- if (mdev->dev->caps.tunnel_offload_mode == MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
- dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
- NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;

-               dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
-               dev->features    |= NETIF_F_GSO_UDP_TUNNEL;
-       }
-
        mdev->pndev[port] = dev;

        netif_carrier_off(dev);
#2 lore raw
Quoted 8 lines · Or Gerlitz
Quoted 3 lines · Florian Westphal

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan offload is enabled with mlx4 driver.

Yep, I can see now the problem. It comes into play with ConnectX3-pro NICs that support VXLAN offloads (but not with ConnectX3 NIC which don't) when you enable the offloads support on the CX3-pro.

[..]

Quoted 6 lines

I think the best effort we can do now is

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

[..]

Quoted 3 lines

tested to work with the following which is a bit different, tell me if it works for you

Right, the patch below works in my setup as well (until link-add-vxlan, that is ;) )

Thanks,
Florian

#3 lore raw
Quoted 2 lines · Florian Westphal

Right, the patch below works in my setup as well (until link-add-vxlan, that is;) )

Good, let me look on that little further to see what's the best approach here, thanks for the report

Or.

#4 lore raw
In reply to Or Gerlitz
Quoted 69 lines · Or Gerlitz
Quoted 52 lines · Florian Westphal

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan offload
is enabled with mlx4 driver.

Given following config on tx-side:
dev=enp3s0
ip addr add dev $dev 192.168.23.1/24
ip link set $dev up
ip link add mygre type gretap remote 192.168.23.2 local 192.168.23.1 ip addr add dev mygre 192.168.42.1/24
ip link set gre0 up
ip link set mygre up

and

options mlx4_core log_num_mgm_entry_size=-1 debug_level=1 port_type_array=2,2

in
/etc/modprobe.d/mlx4.conf

all tcp packets sent to destinations over the gre tunnel have bogus tcp checksums (and are tossed on rx side when stack validates tcp checksum).

net-next head is commit 30349bdbc4da5ecf0efa25556e3caff9c9b8c5f7 .

What makes things work for me:
either

options mlx4_core 1 debug_level=1 port_type_array=2,2

(ie. no MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)

or not setting NETIF_F_IP_CSUM in enc_features:

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2579,10 +2579,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev,
 int port,
                 dev->priv_flags |= IFF_UNICAST_FLT;
           if (mdev->dev->caps.tunnel_offload_mode ==
 MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+               dev->hw_enc_features |= NETIF_F_RXCSUM |
                                         NETIF_F_TSO |
 NETIF_F_GSO_UDP_TUNNEL;
 

I am not sure if its right fix, but to my eyes this basically looks like mlx4 is telling stack that it can handle tcp checksum offload within tunnels, and that doesn't seem to be the case for all types (e.g. gre).

Quoted 3 lines

Could someone who understand the enc_features specifics better confirm that
above patch is correct (or provide a better/proper fix)?

Yep, I can see now the problem. It comes into play with ConnectX3-pro NICs that support VXLAN offloads (but not with ConnectX3 NIC which don't) when you enable the offloads support on the CX3-pro.

The problem originates from the fact that we can't advertize something like "the HW can offload the inner checksum of UDP/VXLAN encapsulated (but not for GRE)", e.g in a similar manner that exists in the GSO space, where you have NETIF_F_GSO _YYY for each yyy in {UDP, SIT, GRE, etc} tunneling scheme.

I think the best effort we can do now is

Quoted 8 lines

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

2. come up with proper kernel APIs to let NICs advertize which encap schemes they can actually offload the inner checksum, Tom... your work which now runs over netdev.

Possibly #3: add ndo_gso_check to detect nested tunneling. In this case it would see that gso_type has both SKB_GSO_GRE and SKB_GSO_UDP_TUNNEL set.

Quoted 68 lines

Tom/Jesse- thoughts? are you +1-ing the below approach?

Or.

tested to work with the following which is a bit different, tell me if it works for you

# node A - with mlx4_en address192.168.31.18
ip tunnel add gre1 mode gre local 192.168.31.18 remote 192.168.31.17 ttl 255
ifconfig gre1 10.10.10.18/24 up
ifconfig gre1 mtu 1450
# node B - with mlx4_en address192.168.31.17
ip tunnel add gre1 mode gre local 192.168.31.17 remote 192.168.31.18 ttl 255
ifconfig gre1 10.10.10.17/24 up
ifconfig gre1 mtu 1450
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +6 -0
index 0efbae9..7753833 100644
@@ -2292,6 +2292,12 @@ static void mlx4_en_add_vxlan_offloads(struct
 work_struct *work)
 out:
        if (ret)
                en_err(priv, "failed setting L2 tunnel configuration ret
 %d\n", ret);
+
+       /* set offloads */
+       priv->dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+                                     NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    |= NETIF_F_GSO_UDP_TUNNEL;
 }

static void mlx4_en_del_vxlan_offloads(struct work_struct *work)

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +4 -0
@@ -2299,6 +2305,10 @@ static void mlx4_en_del_vxlan_offloads(struct
 work_struct *work)
        int ret;
        struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
 vxlan_del_task);
+       /* unset offloads */
+       priv->dev->hw_enc_features = 0;
+       priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    &= ~NETIF_F_GSO_UDP_TUNNEL;
 
        ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
                                  VXLAN_STEER_BY_OUTER_MAC, 0);
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -7
@@ -2578,13 +2588,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int
 port,
        if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
                dev->priv_flags |= IFF_UNICAST_FLT;
 
-       if (mdev->dev->caps.tunnel_offload_mode ==
 MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
-                                       NETIF_F_TSO |
 NETIF_F_GSO_UDP_TUNNEL;
-               dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
-               dev->features    |= NETIF_F_GSO_UDP_TUNNEL;
-       }
-
        mdev->pndev[port] = dev;

        netif_carrier_off(dev);
#5 lore raw
Quoted 74 lines · Tom Herbert
Quoted 73 lines · Or Gerlitz
Quoted 52 lines · Florian Westphal

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan offload
is enabled with mlx4 driver.

Given following config on tx-side:
dev=enp3s0
ip addr add dev $dev 192.168.23.1/24
ip link set $dev up
ip link add mygre type gretap remote 192.168.23.2 local 192.168.23.1 ip addr add dev mygre 192.168.42.1/24
ip link set gre0 up
ip link set mygre up

and

options mlx4_core log_num_mgm_entry_size=-1 debug_level=1 port_type_array=2,2

in
/etc/modprobe.d/mlx4.conf

all tcp packets sent to destinations over the gre tunnel have bogus tcp checksums (and are tossed on rx side when stack validates tcp checksum).

net-next head is commit 30349bdbc4da5ecf0efa25556e3caff9c9b8c5f7 .

What makes things work for me:
either

options mlx4_core 1 debug_level=1 port_type_array=2,2

(ie. no MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)

or not setting NETIF_F_IP_CSUM in enc_features:

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -1
@@ -2579,10 +2579,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev,
 int port,
                 dev->priv_flags |= IFF_UNICAST_FLT;
           if (mdev->dev->caps.tunnel_offload_mode ==
 MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
+               dev->hw_enc_features |= NETIF_F_RXCSUM |
                                         NETIF_F_TSO |
 NETIF_F_GSO_UDP_TUNNEL;
 

I am not sure if its right fix, but to my eyes this basically looks like mlx4 is telling stack that it can handle tcp checksum offload within tunnels, and that doesn't seem to be the case for all types (e.g. gre).

Quoted 3 lines

Could someone who understand the enc_features specifics better confirm that
above patch is correct (or provide a better/proper fix)?

Yep, I can see now the problem. It comes into play with ConnectX3-pro NICs that support VXLAN offloads (but not with ConnectX3 NIC which don't) when you enable the offloads support on the CX3-pro.

The problem originates from the fact that we can't advertize something like "the HW can offload the inner checksum of UDP/VXLAN encapsulated (but not for GRE)", e.g in a similar manner that exists in the GSO space, where you have NETIF_F_GSO _YYY for each yyy in {UDP, SIT, GRE, etc} tunneling scheme.

I think the best effort we can do now is

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

Quoted 7 lines
Quoted 3 lines

2. come up with proper kernel APIs to let NICs advertize which encap schemes they can actually offload the inner checksum, Tom... your work which now runs over netdev.

Possibly #3: add ndo_gso_check to detect nested tunneling. In this case it would see that gso_type has both SKB_GSO_GRE and SKB_GSO_UDP_TUNNEL set.

I am not with you, where do we have nested tunneling here? the below setting is simple GRE tunnel
to host (say) TCP traffic

Quoted 12 lines
Quoted 12 lines

tested to work with the following which is a bit different, tell me if it works for you

# node A - with mlx4_en address192.168.31.18
ip tunnel add gre1 mode gre local 192.168.31.18 remote 192.168.31.17 ttl 255
ifconfig gre1 10.10.10.18/24 up
ifconfig gre1 mtu 1450
# node B - with mlx4_en address192.168.31.17
ip tunnel add gre1 mode gre local 192.168.31.17 remote 192.168.31.18 ttl 255
ifconfig gre1 10.10.10.17/24 up
ifconfig gre1 mtu 1450
#6 lore raw
In reply to Or Gerlitz
Quoted 70 lines

-----Original Message-----
From: [email protected] [mailto:netdev-

Quoted 1 line · Florian Westphal

tl,dr: all tcp packets sent via gre tunnel have broken tcp csum if vxlan

offload

drivers/net/ethernet/mellanox/mlx4/en_netdev.c int mlx4_en_init_netdev(struct mlx4_en_dev

Quoted 36 lines

is enabled with mlx4 driver.

Given following config on tx-side:
dev=enp3s0
ip addr add dev $dev 192.168.23.1/24
ip link set $dev up
ip link add mygre type gretap remote 192.168.23.2 local 192.168.23.1 ip addr add dev mygre 192.168.42.1/24
ip link set gre0 up
ip link set mygre up

and

options mlx4_core log_num_mgm_entry_size=-1 debug_level=1 port_type_array=2,2

in
/etc/modprobe.d/mlx4.conf

all tcp packets sent to destinations over the gre tunnel have bogus tcp checksums (and are tossed on rx side when stack validates tcp checksum).

net-next head is commit 30349bdbc4da5ecf0efa25556e3caff9c9b8c5f7 .

What makes things work for me:
either

options mlx4_core 1 debug_level=1 port_type_array=2,2

(ie. no MLX4_TUNNEL_OFFLOAD_MODE_VXLAN)

or not setting NETIF_F_IP_CSUM in enc_features:

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -0
@@ -2579,10 +2579,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev

*mdev, int port,

drivers/net/ethernet/mellanox/mlx4/en_netdev.c int mlx4_en_init_netdev(struct mlx4_en_dev · line 2581

Quoted 3 lines
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -0
                 dev->priv_flags |= IFF_UNICAST_FLT;
 
         if (mdev->dev->caps.tunnel_offload_mode ==

MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {

drivers/net/ethernet/mellanox/mlx4/en_netdev.c int mlx4_en_init_netdev(struct mlx4_en_dev · line 2582

Quoted 1 line
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -1
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM

|

Quoted 8 lines
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +1 -0
+               dev->hw_enc_features |= NETIF_F_RXCSUM |
                                         NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
 

I am not sure if its right fix, but to my eyes this basically looks like mlx4 is telling stack that it can handle tcp checksum offload within tunnels, and that doesn't seem to be the case for all types (e.g. gre).

Could someone who understand the enc_features specifics better confirm

that

Quoted 1 line

above patch is correct (or provide a better/proper fix)?

Yep, I can see now the problem. It comes into play with ConnectX3-pro NICs that support VXLAN offloads (but not with ConnectX3 NIC which don't) when you enable the offloads support on the CX3-pro.

The problem originates from the fact that we can't advertize something like "the HW can offload the inner checksum of UDP/VXLAN encapsulated (but not for GRE)", e.g in a similar manner that exists in the GSO space, where you have NETIF_F_GSO _YYY for each yyy in {UDP, SIT, GRE, etc} tunneling scheme.

Quoted 5 lines

I think the best effort we can do now is

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

Or, wouldn't the patch below not work (i.e., the same issue would persist) when there is both VXLAN and some other (say GRE) tunnel in the system and the NIC HW is capable of supporting checksum offload only on VxLAN.

Do you expect a user who uses VxLAN to not use other kinds of tunnels?

Quoted 79 lines

2. come up with proper kernel APIs to let NICs advertize which encap schemes they can actually offload the inner checksum, Tom... your work which now runs over netdev.

Tom/Jesse- thoughts? are you +1-ing the below approach?

Or.

tested to work with the following which is a bit different, tell me if it works for you

# node A - with mlx4_en address192.168.31.18
ip tunnel add gre1 mode gre local 192.168.31.18 remote 192.168.31.17 ttl 255
ifconfig gre1 10.10.10.18/24 up
ifconfig gre1 mtu 1450
# node B - with mlx4_en address192.168.31.17
ip tunnel add gre1 mode gre local 192.168.31.17 remote 192.168.31.18 ttl 255
ifconfig gre1 10.10.10.17/24 up
ifconfig gre1 mtu 1450
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +3 -0
index 0efbae9..7753833 100644
@@ -2292,6 +2292,12 @@ static void mlx4_en_add_vxlan_offloads(struct
 work_struct *work)
  out:
         if (ret)
                 en_err(priv, "failed setting L2 tunnel configuration
 ret %d\n", ret);
+
+       /* set offloads */
+       priv->dev->hw_enc_features |= NETIF_F_IP_CSUM |

NETIF_F_RXCSUM |

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +7 -0
+                                     NETIF_F_TSO | NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    |= NETIF_F_GSO_UDP_TUNNEL;
  }
 
  static void mlx4_en_del_vxlan_offloads(struct work_struct *work)
@@ -2299,6 +2305,10 @@ static void mlx4_en_del_vxlan_offloads(struct
 work_struct *work)
         int ret;
         struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
 vxlan_del_task);
+       /* unset offloads */
+       priv->dev->hw_enc_features = 0;
+       priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
+       priv->dev->features    &= ~NETIF_F_GSO_UDP_TUNNEL;
 
         ret = mlx4_SET_PORT_VXLAN(priv->mdev->dev, priv->port,
                                   VXLAN_STEER_BY_OUTER_MAC, 0);
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -3
@@ -2578,13 +2588,6 @@ int mlx4_en_init_netdev(struct mlx4_en_dev
 *mdev,
 int port,
         if (mdev->dev->caps.steering_mode != MLX4_STEERING_MODE_A0)
                 dev->priv_flags |= IFF_UNICAST_FLT;
 
-       if (mdev->dev->caps.tunnel_offload_mode ==
 MLX4_TUNNEL_OFFLOAD_MODE_VXLAN) {
-               dev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_RXCSUM |
-                                       NETIF_F_TSO |

NETIF_F_GSO_UDP_TUNNEL;

drivers/net/ethernet/mellanox/mlx4/en_netdev.c +0 -5
-               dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL;
-               dev->features    |= NETIF_F_GSO_UDP_TUNNEL;
-       }
-
         mdev->pndev[port] = dev;
 
         netif_carrier_off(dev);
 
--

To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 9 lines · Sathya Perla
Quoted 5 lines

I think the best effort we can do now is

1. come up with something such as the below patch for 3.18 which is back-ward portable for -stable kernels, it will only arm the hw offloads if the OS tells us there's VXLAN in action

Or, wouldn't the patch below not work (i.e., the same issue would persist) when there is both VXLAN and some other (say GRE) tunnel in the system and the NIC HW is capable of supporting checksum offload only on VxLAN.

Indeed, this would be the case. But the patch below will make things to work when
only GRE is used (or when only VXLAN is used). So we're making progress vs. the current
situation where GRE breaks over a HW which is capable to do VXLAN offloads even if there's no VXLAN tunnel around.

Or.

Quoted 16 lines
Quoted 16 lines

2. come up with proper kernel APIs to let NICs advertize which encap schemes they can actually offload the inner checksum, Tom... your work which now runs over netdev.

tested to work with the following which is a bit different, tell me if it works for you

# node A - with mlx4_en address192.168.31.18
ip tunnel add gre1 mode gre local 192.168.31.18 remote 192.168.31.17 ttl 255
ifconfig gre1 10.10.10.18/24 up
ifconfig gre1 mtu 1450
# node B - with mlx4_en address192.168.31.17
ip tunnel add gre1 mode gre local 192.168.31.17 remote 192.168.31.18 ttl 255
ifconfig gre1 10.10.10.17/24 up
ifconfig gre1 mtu 1450