Parcourir la source

ipa: Add HW support check for IP_PACKET_INIT_EX IMM

The IP_PACKET_INIT_EX IMM is not supported on older targets.
To avoid runtime errors, adding HW version check
for this feature.

Change-Id: Ide6d38eceffa7e34d2b90a7b5caf6f5bb3b1fcca
Signed-off-by: Ilia Lin <[email protected]>
Ilia Lin il y a 4 ans
Parent
commit
e81f9ee16a

+ 9 - 6
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -6756,11 +6756,13 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
 		goto fail_alloc_pkt_init;
 	}
 
-	result = ipa_alloc_pkt_init_ex();
-	if (result) {
-		IPAERR("Failed to alloc pkt_init_ex payload\n");
-		result = -ENODEV;
-		goto fail_alloc_pkt_init_ex;
+	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_0) {
+		result = ipa_alloc_pkt_init_ex();
+		if (result) {
+			IPAERR("Failed to alloc pkt_init_ex payload\n");
+			result = -ENODEV;
+			goto fail_alloc_pkt_init_ex;
+		}
 	}
 
 	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5)
@@ -6970,7 +6972,8 @@ fail_register_device:
 fail_init_interrupts:
 	ipa3_remove_interrupt_handler(IPA_TX_SUSPEND_IRQ);
 	ipa3_interrupts_destroy(ipa3_res.ipa_irq, &ipa3_ctx->master_pdev->dev);
-	ipa3_free_pkt_init_ex();
+	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v5_0)
+		ipa3_free_pkt_init_ex();
 fail_alloc_pkt_init_ex:
 	ipa3_free_pkt_init();
 fail_alloc_pkt_init:

+ 3 - 2
drivers/platform/msm/ipa/ipa_v3/ipa_dp.c

@@ -1951,10 +1951,11 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
 			data_idx++;
 		}
 
-		if ((network_header->version == 4 &&
+		if ((ipa3_ctx->ipa_hw_type >= IPA_HW_v5_0) &&
+		    ((network_header->version == 4 &&
 		     network_header->protocol == IPPROTO_ICMP) ||
 		    (((struct ipv6hdr *)network_header)->version == 6 &&
-		     ((struct ipv6hdr *)network_header)->nexthdr == NEXTHDR_ICMP)) {
+		     ((struct ipv6hdr *)network_header)->nexthdr == NEXTHDR_ICMP))) {
 			ipa_imm_cmd_modify_ip_packet_init_ex_dest_pipe(
 				ipa3_ctx->pkt_init_ex_imm[ipa3_ctx->ipa_num_pipes].base,
 				dst_ep_idx);