Skip to content

Commit

Permalink
xfrm: interface: enable TSO on xfrm interfaces
Browse files Browse the repository at this point in the history
Underlying xfrm output supports gso packets.
Declare support in hw_features and adapt the xmit MTU check to pass GSO
packets.

Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
  • Loading branch information
Eyal Birger authored and Steffen Klassert committed Jan 8, 2021
1 parent ede71ca commit 18f9769
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/xfrm/xfrm_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
}

mtu = dst_mtu(dst);
if (skb->len > mtu) {
if ((!skb_is_gso(skb) && skb->len > mtu) ||
(skb_is_gso(skb) && !skb_gso_validate_network_len(skb, mtu))) {
skb_dst_update_pmtu_no_confirm(skb, mtu);

if (skb->protocol == htons(ETH_P_IPV6)) {
Expand Down Expand Up @@ -564,6 +565,11 @@ static void xfrmi_dev_setup(struct net_device *dev)
eth_broadcast_addr(dev->broadcast);
}

#define XFRMI_FEATURES (NETIF_F_SG | \
NETIF_F_FRAGLIST | \
NETIF_F_GSO_SOFTWARE | \
NETIF_F_HW_CSUM)

static int xfrmi_dev_init(struct net_device *dev)
{
struct xfrm_if *xi = netdev_priv(dev);
Expand All @@ -581,6 +587,8 @@ static int xfrmi_dev_init(struct net_device *dev)
}

dev->features |= NETIF_F_LLTX;
dev->features |= XFRMI_FEATURES;
dev->hw_features |= XFRMI_FEATURES;

if (phydev) {
dev->needed_headroom = phydev->needed_headroom;
Expand Down

0 comments on commit 18f9769

Please sign in to comment.