Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fa62d0f9 authored by Sean Tranchetti's avatar Sean Tranchetti Committed by Gerrit - the friendly Code Review server
Browse files

net: qualcomm: rmnet: Avoid *_hdr() helpers while adding linear GSO



These various helpers rely on the network_offset and transport_offset
fields in the SKB being set to appropriate values, and they might not be
set appropriately in all cases (e.g. reusing the coalesced SKB from the
lower levels). Access the headers for updating the GSO information
directly via skb->data to ensure the correct bytes are updated.

Change-Id: I4ac2b3118c190587d8178b1d780c9ec842438c86
Signed-off-by: default avatarSean Tranchetti <stranche@codeaurora.org>
parent 99a8045e
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -651,30 +651,32 @@ static void rmnet_map_gso_stamp(struct sk_buff *skb,
				struct rmnet_map_coal_metadata *coal_meta)
{
	struct skb_shared_info *shinfo = skb_shinfo(skb);
	struct iphdr *iph = ip_hdr(skb);
	unsigned char *data = skb->data;
	__sum16 pseudo;
	u16 pkt_len = skb->len - coal_meta->ip_len;
	bool ipv4 = coal_meta->ip_proto == 4;

	if (ipv4) {
		struct iphdr *iph = (struct iphdr *)data;

		pseudo = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
					    pkt_len, coal_meta->trans_proto,
					    0);
	} else {
		struct ipv6hdr *ip6h = ipv6_hdr(skb);
		struct ipv6hdr *ip6h = (struct ipv6hdr *)data;

		pseudo = ~csum_ipv6_magic(&ip6h->saddr, &ip6h->daddr,
					  pkt_len, coal_meta->trans_proto, 0);
	}

	if (coal_meta->trans_proto == IPPROTO_TCP) {
		struct tcphdr *tp = tcp_hdr(skb);
		struct tcphdr *tp = (struct tcphdr *)(data + coal_meta->ip_len);

		tp->check = pseudo;
		shinfo->gso_type = (ipv4) ? SKB_GSO_TCPV4 : SKB_GSO_TCPV6;
		skb->csum_offset = offsetof(struct tcphdr, check);
	} else {
		struct udphdr *up = udp_hdr(skb);
		struct udphdr *up = (struct udphdr *)(data + coal_meta->ip_len);

		up->check = pseudo;
		shinfo->gso_type = SKB_GSO_UDP_L4;