Переглянути джерело

qcacmn: TSO - Fix ip_len for ipv6 packets

IP length is being calculated incorrectly for ipv6 packets during TSO.

Fix IP len to exclude IP header and include only the payload length
(TCP header + application payload).

Change-Id: I577e3da77e4cbfba0b76c0e5bce3700be2b70c19
CRs-Fixed: 2057055
Mohit Khanna 7 роки тому
батько
коміт
ed31227496
1 змінених файлів з 17 додано та 1 видалено
  1. 17 1
      qdf/linux/src/qdf_nbuf.c

+ 17 - 1
qdf/linux/src/qdf_nbuf.c

@@ -1757,7 +1757,21 @@ static uint8_t __qdf_nbuf_get_tso_cmn_seg_info(qdf_device_t osdev,
 		qdf_assert(0);
 		return 1;
 	}
-	tso_info->ip_tcp_hdr_len = tso_info->eit_hdr_len - tso_info->l2_len;
+
+	if (tso_info->ethproto == htons(ETH_P_IP)) {
+		/* inlcude IPv4 header length for IPV4 (total length) */
+		tso_info->ip_tcp_hdr_len =
+			tso_info->eit_hdr_len - tso_info->l2_len;
+	} else if (tso_info->ethproto == htons(ETH_P_IPV6)) {
+		/* exclude IPv6 header length for IPv6 (payload length) */
+		tso_info->ip_tcp_hdr_len = tcp_hdrlen(skb);
+	}
+	/*
+	 * The length of the payload (application layer data) is added to
+	 * tso_info->ip_tcp_hdr_len before passing it on to the msdu link ext
+	 * descriptor.
+	 */
+
 	TSO_DEBUG("%s seq# %u eit hdr len %u l2 len %u  skb len %u\n", __func__,
 		tso_info->tcp_seq_num,
 		tso_info->eit_hdr_len,
@@ -1930,6 +1944,8 @@ uint32_t __qdf_nbuf_get_tso_info(qdf_device_t osdev, struct sk_buff *skb,
 
 		curr_seg->seg.tso_flags.ip_len = tso_cmn_info.ip_tcp_hdr_len;
 		curr_seg->seg.tso_flags.l2_len = tso_cmn_info.l2_len;
+		/* frag len is added to ip_len in while loop below*/
+
 		curr_seg->seg.num_frags++;
 
 		while (more_tso_frags) {