Skip to content

Commit 1a23676

Browse files
lxinkuba-moo
authored andcommitted
ip_gre: remove CRC flag from dev features in gre_gso_segment
This patch is to let it always do CRC checksum in sctp_gso_segment() by removing CRC flag from the dev features in gre_gso_segment() for SCTP over GRE, just as it does in Commit 527beb8 ("udp: support sctp over udp in skb_udp_tunnel_segment") for SCTP over UDP. It could set csum/csum_start in GSO CB properly in sctp_gso_segment() after that commit, so it would do checksum with gso_make_checksum() in gre_gso_segment(), and Commit 622e32b ("net: gre: recompute gre csum for sctp over gre tunnels") can be reverted now. Note that when need_csum is false, we can still leave CRC checksum of SCTP to HW by not clearing this CRC flag if it's supported, as Jakub and Alex noticed. v1->v2: - improve the changelog. - fix "rev xmas tree" in varibles declaration. v2->v3: - remove CRC flag from dev features only when need_csum is true. Signed-off-by: Xin Long <lucien.xin@gmail.com> Link: https://lore.kernel.org/r/00439f24d5f69e2c6fa2beadc681d056c15c258f.1610772251.git.lucien.xin@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 4eb5d4a commit 1a23676

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

net/ipv4/gre_offload.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
1515
netdev_features_t features)
1616
{
1717
int tnl_hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
18-
bool need_csum, need_recompute_csum, gso_partial;
1918
struct sk_buff *segs = ERR_PTR(-EINVAL);
2019
u16 mac_offset = skb->mac_header;
2120
__be16 protocol = skb->protocol;
21+
bool need_csum, gso_partial;
2222
u16 mac_len = skb->mac_len;
2323
int gre_offset, outer_hlen;
2424

@@ -41,10 +41,11 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
4141
skb->protocol = skb->inner_protocol;
4242

4343
need_csum = !!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE_CSUM);
44-
need_recompute_csum = skb->csum_not_inet;
4544
skb->encap_hdr_csum = need_csum;
4645

4746
features &= skb->dev->hw_enc_features;
47+
if (need_csum)
48+
features &= ~NETIF_F_SCTP_CRC;
4849

4950
/* segment inner packet. */
5051
segs = skb_mac_gso_segment(skb, features);
@@ -99,15 +100,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
99100
}
100101

101102
*(pcsum + 1) = 0;
102-
if (need_recompute_csum && !skb_is_gso(skb)) {
103-
__wsum csum;
104-
105-
csum = skb_checksum(skb, gre_offset,
106-
skb->len - gre_offset, 0);
107-
*pcsum = csum_fold(csum);
108-
} else {
109-
*pcsum = gso_make_checksum(skb, 0);
110-
}
103+
*pcsum = gso_make_checksum(skb, 0);
111104
} while ((skb = skb->next));
112105
out:
113106
return segs;

0 commit comments

Comments
 (0)