Skip to content

Commit d836918

Browse files
committed
Merge branch 'xfrm: some fixes for GSO with SW crypto'
Sabrina Dubroca says: ==================== This series fixes a few issues with GSO. Some recent patches made the incorrect assumption that GSO is only used by offload. The first two patches in this series restore the old behavior. The final patch is in the UDP GSO code, but fixes an issue with IPsec that is currently masked by the lack of GSO for SW crypto. With GSO, VXLAN over IPsec doesn't get checksummed. ==================== Signed-off-by: Steffen Klassert <[email protected]>
2 parents 42e4256 + 1118aaa commit d836918

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

net/ipv4/udp_offload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static struct sk_buff *__skb_udp_tunnel_segment(struct sk_buff *skb,
217217
remcsum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TUNNEL_REMCSUM);
218218
skb->remcsum_offload = remcsum;
219219

220-
need_ipsec = skb_dst(skb) && dst_xfrm(skb_dst(skb));
220+
need_ipsec = (skb_dst(skb) && dst_xfrm(skb_dst(skb))) || skb_sec_path(skb);
221221
/* Try to offload checksum if possible */
222222
offload_csum = !!(need_csum &&
223223
!need_ipsec &&

net/xfrm/xfrm_device.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ struct sk_buff *validate_xmit_xfrm(struct sk_buff *skb, netdev_features_t featur
155155
return skb;
156156
}
157157

158-
if (skb_is_gso(skb) && unlikely(xmit_xfrm_check_overflow(skb))) {
158+
if (skb_is_gso(skb) && (unlikely(x->xso.dev != dev) ||
159+
unlikely(xmit_xfrm_check_overflow(skb)))) {
159160
struct sk_buff *segs;
160161

161162
/* Packet got rerouted, fixup features and segment it. */
@@ -415,10 +416,12 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
415416
struct net_device *dev = x->xso.dev;
416417
bool check_tunnel_size;
417418

418-
if (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED)
419+
if (!x->type_offload ||
420+
(x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
419421
return false;
420422

421-
if ((dev == xfrm_dst_path(dst)->dev) && !xdst->child->xfrm) {
423+
if ((!dev || dev == xfrm_dst_path(dst)->dev) &&
424+
!xdst->child->xfrm) {
422425
mtu = xfrm_state_mtu(x, xdst->child_mtu_cached);
423426
if (skb->len <= mtu)
424427
goto ok;
@@ -430,6 +433,9 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
430433
return false;
431434

432435
ok:
436+
if (!dev)
437+
return true;
438+
433439
check_tunnel_size = x->xso.type == XFRM_DEV_OFFLOAD_PACKET &&
434440
x->props.mode == XFRM_MODE_TUNNEL;
435441
switch (x->props.family) {

0 commit comments

Comments
 (0)