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

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

drivers: rmnet_perf: Set payload length for all packets



For non-TCP/UDP and fragmented packets, the payload length is not set in
the pkt_info struct. This can cause an invalid checksum offload trailer to
be passed to the core driver when validating checksum packets.

157.995781: <2> rmnet_map_checksum_downlink_packet+0x68/0x37c
158.001428: <2> rmnet_perf_core_validate_pkt_csum+0x94/0xc4
158.008053: <2> rmnet_perf_core_handle_packet_ingress+0x60/0x9c
158.015031: <2> __rmnet_perf_core_deaggregate+0x274/0x2d0
158.021475: <2> rmnet_perf_core_deaggregate+0x64/0x144
158.027646: <2> rmnet_rx_handler+0x150/0x1c8

Change-Id: I1d565e214469f00e4892ce487ee750b1427f0f58
Signed-off-by: default avatarSean Tranchetti <stranche@codeaurora.org>
parent 41dfdf84
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -565,6 +565,8 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
				 struct rmnet_perf_pkt_info *pkt_info,
				 int offset, u16 pkt_len)
{
	bool flush = true;

	payload += offset;
	pkt_info->ip_proto = (*payload & 0xF0) >> 4;
	if (pkt_info->ip_proto == 4) {
@@ -576,7 +578,7 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
		/* Pass off frags immediately */
		if (iph->frag_off & htons(IP_MF | IP_OFFSET)) {
			rmnet_perf_frag_flush++;
			return true;
			goto done;
		}

		pkt_info->ip_len = iph->ihl * 4;
@@ -613,7 +615,7 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
			/* Something somewhere has gone horribly wrong...
			 * Let the stack deal with it.
			 */
			return true;
			goto done;
		}

		/* Returned length will include the offset value */
@@ -628,7 +630,7 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
				len += sizeof(struct frag_hdr);
			pkt_info->ip_len = (u16)len;
			rmnet_perf_frag_flush++;
			return true;
			goto done;
		}

		pkt_info->ip_len = (u16)len;
@@ -643,7 +645,7 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
		}
	} else {
		/* Not a valid IP packet */
		return true;
		goto done;
	}

	if (pkt_info->trans_proto == IPPROTO_TCP) {
@@ -666,14 +668,17 @@ bool rmnet_perf_core_dissect_pkt(unsigned char *payload,
			pkt_info->frag_desc->trans_len = pkt_info->trans_len;
	} else {
		/* Not a protocol we can optimize */
		return true;
		goto done;
	}

	flush = false;
	pkt_info->hash_key = rmnet_perf_core_compute_flow_hash(pkt_info);

done:
	pkt_info->payload_len = pkt_len - pkt_info->ip_len -
				pkt_info->trans_len;
	pkt_info->hash_key = rmnet_perf_core_compute_flow_hash(pkt_info);

	return false;
	return flush;
}

/* rmnet_perf_core_dissect_skb() - Extract packet header metadata for easier