Browse Source

Merge c06a51a1924425264a06071b3dc0333072247571 on remote branch

Change-Id: I4796fc11b84047c86b62b3af9b4947481d3ad87a
Linux Build Service Account 1 năm trước cách đây
mục cha
commit
f43ec129da
5 tập tin đã thay đổi với 33 bổ sung14 xóa
  1. 4 2
      core/Android.mk
  2. 22 8
      core/rmnet_descriptor.c
  3. 3 1
      core/rmnet_descriptor.h
  4. 2 1
      core/rmnet_ll_mhi.c
  5. 2 2
      core/rmnet_map_data.c

+ 4 - 2
core/Android.mk

@@ -9,6 +9,8 @@ ifeq ($(call is-board-platform-in-list, $(RMNET_CORE_DLKM_PLATFORMS_LIST)),true)
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
+BOARD_COMMON_DIR ?= device/qcom/common
+
 #Enabling BAZEL
 LOCAL_MODULE_DDK_BUILD := true
 
@@ -18,7 +20,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
 LOCAL_MODULE := rmnet_core.ko
 LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
 KBUILD_REQUIRED_KOS := ipam.ko
-DLKM_DIR := $(TOP)/device/qcom/common/dlkm
+DLKM_DIR := $(TOP)/$(BOARD_COMMON_DIR)/dlkm
 $(warning $(DLKM_DIR))
 include $(DLKM_DIR)/Build_external_kernelmodule.mk
 
@@ -31,7 +33,7 @@ LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
 LOCAL_MODULE := rmnet_ctl.ko
 LOCAL_SRC_FILES   := $(wildcard $(LOCAL_PATH)/**/*) $(wildcard $(LOCAL_PATH)/*)
 KBUILD_REQUIRED_KOS := ipam.ko
-DLKM_DIR := $(TOP)/device/qcom/common/dlkm
+DLKM_DIR := $(TOP)/$(BOARD_COMMON_DIR)/dlkm
 $(warning $(DLKM_DIR))
 include $(DLKM_DIR)/Build_external_kernelmodule.mk
 

+ 22 - 8
core/rmnet_descriptor.c

@@ -339,12 +339,13 @@ int rmnet_frag_descriptor_add_frags_from(struct rmnet_frag_descriptor *to,
 EXPORT_SYMBOL(rmnet_frag_descriptor_add_frags_from);
 
 int rmnet_frag_ipv6_skip_exthdr(struct rmnet_frag_descriptor *frag_desc,
-				int start, u8 *nexthdrp, __be16 *fragp)
+				int start, u8 *nexthdrp, __be16 *frag_offp,
+				bool *frag_hdrp)
 {
 	u8 nexthdr = *nexthdrp;
 
-	*fragp = 0;
-
+	*frag_offp = 0;
+	*frag_hdrp = false;
 	while (ipv6_ext_hdr(nexthdr)) {
 		struct ipv6_opt_hdr *hp, __hp;
 		int hdrlen;
@@ -366,8 +367,9 @@ int rmnet_frag_ipv6_skip_exthdr(struct rmnet_frag_descriptor *frag_desc,
 			if (!fp)
 				return -EINVAL;
 
-			*fragp = *fp;
-			if (ntohs(*fragp) & ~0x7)
+			*frag_offp = *fp;
+			*frag_hdrp = true;
+			if (ntohs(*frag_offp) & ~0x7)
 				break;
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH) {
@@ -1335,6 +1337,7 @@ rmnet_frag_segment_coal_data(struct rmnet_frag_descriptor *coal_desc,
 		struct ipv6hdr *ip6h, __ip6h;
 		int ip_len;
 		__be16 frag_off;
+		bool frag_hdr;
 		u8 protocol;
 
 		ip6h = rmnet_frag_header_ptr(coal_desc, 0, sizeof(*ip6h),
@@ -1347,10 +1350,11 @@ rmnet_frag_segment_coal_data(struct rmnet_frag_descriptor *coal_desc,
 		ip_len = rmnet_frag_ipv6_skip_exthdr(coal_desc,
 						     sizeof(*ip6h),
 						     &protocol,
-						     &frag_off);
+						     &frag_off,
+						     &frag_hdr);
 		coal_desc->trans_proto = protocol;
 
-		/* If we run into a problem, or this has a fragment header
+		/* If we run into a problem, or this is fragmented packet
 		 * (which should technically not be possible, if the HW
 		 * works as intended...), bail.
 		 */
@@ -1359,6 +1363,14 @@ rmnet_frag_segment_coal_data(struct rmnet_frag_descriptor *coal_desc,
 			return;
 		}
 
+		if (frag_hdr) {
+			/* There is a fragment header, but this is not a
+			 * fragmented packet. We can handle this, but it
+			 * cannot be coalesced because of kernel limitations.
+			 */
+			gro = false;
+		}
+
 		coal_desc->ip_len = (u16)ip_len;
 		if (coal_desc->ip_len > sizeof(*ip6h)) {
 			/* Don't allow coalescing of any packets with IPv6
@@ -1644,6 +1656,7 @@ static int rmnet_frag_checksum_pkt(struct rmnet_frag_descriptor *frag_desc)
 		struct ipv6hdr *ip6h, __ip6h;
 		int ip_len;
 		__be16 frag_off;
+		bool frag_hdr;
 		u8 protocol;
 
 		ip6h = rmnet_frag_header_ptr(frag_desc, offset, sizeof(*ip6h),
@@ -1655,7 +1668,8 @@ static int rmnet_frag_checksum_pkt(struct rmnet_frag_descriptor *frag_desc)
 		protocol = ip6h->nexthdr;
 		ip_len = rmnet_frag_ipv6_skip_exthdr(frag_desc,
 						     offset + sizeof(*ip6h),
-						     &protocol, &frag_off);
+						     &protocol, &frag_off,
+						     &frag_hdr);
 		if (ip_len < 0 || frag_off)
 			return -EINVAL;
 

+ 3 - 1
core/rmnet_descriptor.h

@@ -1,4 +1,5 @@
 /* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -78,7 +79,8 @@ int rmnet_frag_descriptor_add_frags_from(struct rmnet_frag_descriptor *to,
 					 struct rmnet_frag_descriptor *from,
 					 u32 off, u32 len);
 int rmnet_frag_ipv6_skip_exthdr(struct rmnet_frag_descriptor *frag_desc,
-				int start, u8 *nexthdrp, __be16 *fragp);
+				int start, u8 *nexthdrp, __be16 *frag_offp,
+				bool *frag_hdrp);
 
 /* QMAP command packets */
 void rmnet_frag_command(struct rmnet_frag_descriptor *frag_desc,

+ 2 - 1
core/rmnet_ll_mhi.c

@@ -1,4 +1,5 @@
 /* Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -90,7 +91,7 @@ static void rmnet_ll_mhi_tx_complete(struct mhi_device *mhi_dev,
 	else
 		stats->tx_complete++;
 
-	dev_kfree_skb_any(skb);
+	dev_consume_skb_any(skb);
 }
 
 static int rmnet_ll_mhi_probe(struct mhi_device *mhi_dev,

+ 2 - 2
core/rmnet_map_data.c

@@ -1523,7 +1523,7 @@ new_packet:
 		state->agg_skb->protocol = htons(ETH_P_MAP);
 		state->agg_count = 1;
 		ktime_get_real_ts64(&state->agg_time);
-		dev_kfree_skb_any(skb);
+		dev_consume_skb_any(skb);
 		goto schedule;
 	}
 	diff = timespec64_sub(state->agg_last, state->agg_time);
@@ -1538,7 +1538,7 @@ new_packet:
 
 	rmnet_map_linearize_copy(state->agg_skb, skb);
 	state->agg_count++;
-	dev_kfree_skb_any(skb);
+	dev_consume_skb_any(skb);
 
 schedule:
 	if (state->agg_state != -EINPROGRESS) {