Skip to content

Commit 3f44899

Browse files
Boris PismennySaeed Mahameed
authored andcommitted
net/mlx5e: Use PARTIAL_GSO for UDP segmentation
This patch removes the splitting of UDP_GSO_L4 packets in the driver, and exposes UDP_GSO_L4 as a PARTIAL_GSO feature. Thus, the network stack is not responsible for splitting the packet into two. Signed-off-by: Boris Pismenny <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent cc49518 commit 3f44899

File tree

5 files changed

+23
-140
lines changed

5 files changed

+23
-140
lines changed

drivers/net/ethernet/mellanox/mlx5/core/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ mlx5_core-$(CONFIG_MLX5_FPGA) += fpga/cmd.o fpga/core.o fpga/conn.o fpga/sdk.o \
1414
fpga/ipsec.o fpga/tls.o
1515

1616
mlx5_core-$(CONFIG_MLX5_CORE_EN) += en_main.o en_common.o en_fs.o en_ethtool.o \
17-
en_tx.o en_rx.o en_dim.o en_txrx.o en_accel/rxtx.o en_stats.o \
18-
vxlan.o en_arfs.o en_fs_ethtool.o en_selftest.o en/port.o
17+
en_tx.o en_rx.o en_dim.o en_txrx.o en_stats.o vxlan.o \
18+
en_arfs.o en_fs_ethtool.o en_selftest.o en/port.o
1919

2020
mlx5_core-$(CONFIG_MLX5_MPFS) += lib/mpfs.o
2121

drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,22 @@
3838
#include <linux/netdevice.h>
3939
#include "en_accel/ipsec_rxtx.h"
4040
#include "en_accel/tls_rxtx.h"
41-
#include "en_accel/rxtx.h"
4241
#include "en.h"
4342

44-
static inline struct sk_buff *mlx5e_accel_handle_tx(struct sk_buff *skb,
45-
struct mlx5e_txqsq *sq,
46-
struct net_device *dev,
47-
struct mlx5e_tx_wqe **wqe,
48-
u16 *pi)
43+
static inline void
44+
mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb)
45+
{
46+
int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr);
47+
48+
udp_hdr(skb)->len = htons(payload_len);
49+
}
50+
51+
static inline struct sk_buff *
52+
mlx5e_accel_handle_tx(struct sk_buff *skb,
53+
struct mlx5e_txqsq *sq,
54+
struct net_device *dev,
55+
struct mlx5e_tx_wqe **wqe,
56+
u16 *pi)
4957
{
5058
#ifdef CONFIG_MLX5_EN_TLS
5159
if (test_bit(MLX5E_SQ_STATE_TLS, &sq->state)) {
@@ -63,11 +71,8 @@ static inline struct sk_buff *mlx5e_accel_handle_tx(struct sk_buff *skb,
6371
}
6472
#endif
6573

66-
if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4) {
67-
skb = mlx5e_udp_gso_handle_tx_skb(dev, sq, skb, wqe, pi);
68-
if (unlikely(!skb))
69-
return NULL;
70-
}
74+
if (skb_is_gso(skb) && skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
75+
mlx5e_udp_gso_handle_tx_skb(skb);
7176

7277
return skb;
7378
}

drivers/net/ethernet/mellanox/mlx5/core/en_accel/rxtx.c

Lines changed: 0 additions & 109 deletions
This file was deleted.

drivers/net/ethernet/mellanox/mlx5/core/en_accel/rxtx.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

drivers/net/ethernet/mellanox/mlx5/core/en_main.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4538,7 +4538,6 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
45384538
netdev->hw_features |= NETIF_F_HW_VLAN_STAG_TX;
45394539

45404540
if (mlx5e_vxlan_allowed(mdev) || MLX5_CAP_ETH(mdev, tunnel_stateless_gre)) {
4541-
netdev->hw_features |= NETIF_F_GSO_PARTIAL;
45424541
netdev->hw_enc_features |= NETIF_F_IP_CSUM;
45434542
netdev->hw_enc_features |= NETIF_F_IPV6_CSUM;
45444543
netdev->hw_enc_features |= NETIF_F_TSO;
@@ -4563,6 +4562,11 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
45634562
NETIF_F_GSO_GRE_CSUM;
45644563
}
45654564

4565+
netdev->hw_features |= NETIF_F_GSO_PARTIAL;
4566+
netdev->gso_partial_features |= NETIF_F_GSO_UDP_L4;
4567+
netdev->hw_features |= NETIF_F_GSO_UDP_L4;
4568+
netdev->features |= NETIF_F_GSO_UDP_L4;
4569+
45664570
mlx5_query_port_fcs(mdev, &fcs_supported, &fcs_enabled);
45674571

45684572
if (fcs_supported)
@@ -4595,9 +4599,6 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev)
45954599
netdev->features |= NETIF_F_HIGHDMA;
45964600
netdev->features |= NETIF_F_HW_VLAN_STAG_FILTER;
45974601

4598-
netdev->features |= NETIF_F_GSO_UDP_L4;
4599-
netdev->hw_features |= NETIF_F_GSO_UDP_L4;
4600-
46014602
netdev->priv_flags |= IFF_UNICAST_FLT;
46024603

46034604
mlx5e_set_netdev_dev_addr(netdev);

0 commit comments

Comments
 (0)