Bläddra i källkod

msm: ipa: align to latest kernel version

Make changes to align to the latest kernel version.
Fixes to compilation errors and forbidden warnings.

Change-Id: I5c7a7b8a8ce2ccd98af3d6458bd6a9bdddeb361b
Signed-off-by: Chaitanya Pratapa <[email protected]>
Chaitanya Pratapa 4 år sedan
förälder
incheckning
d10d7d54b9

+ 27 - 27
drivers/platform/msm/gsi/gsi.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/of.h>
@@ -4772,6 +4772,32 @@ void gsi_wdi3_dump_register(unsigned long chan_hdl)
 }
 EXPORT_SYMBOL(gsi_wdi3_dump_register);
 
+int gsi_query_aqc_msi_addr(unsigned long chan_hdl, phys_addr_t *addr)
+{
+        if (!gsi_ctx) {
+                pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
+                return -GSI_STATUS_NODEV;
+        }
+
+        if (chan_hdl >= gsi_ctx->max_ch) {
+                GSIERR("bad params chan_hdl=%lu\n", chan_hdl);
+                return -GSI_STATUS_INVALID_PARAMS;
+        }
+
+        if (gsi_ctx->chan[chan_hdl].state == GSI_CHAN_STATE_NOT_ALLOCATED) {
+                GSIERR("bad state %d\n",
+                        gsi_ctx->chan[chan_hdl].state);
+                return -GSI_STATUS_UNSUPPORTED_OP;
+        }
+
+        *addr = (phys_addr_t)(gsi_ctx->per.phys_addr +
+                gsihal_get_reg_nk_ofst(GSI_EE_n_GSI_CH_k_CNTXT_8,
+                        gsi_ctx->per.ee, chan_hdl));
+
+        return 0;
+}
+EXPORT_SYMBOL(gsi_query_aqc_msi_addr);
+
 static union __packed gsi_channel_scratch __gsi_update_mhi_channel_scratch(
 	unsigned long chan_hdl, struct __packed gsi_mhi_channel_scratch mscr)
 {
@@ -4812,32 +4838,6 @@ static union __packed gsi_channel_scratch __gsi_update_mhi_channel_scratch(
 	return scr;
 }
 
-int gsi_query_aqc_msi_addr(unsigned long chan_hdl, phys_addr_t *addr)
-{
-	if (!gsi_ctx) {
-		pr_err("%s:%d gsi context not allocated\n", __func__, __LINE__);
-		return -GSI_STATUS_NODEV;
-	}
-
-	if (chan_hdl >= gsi_ctx->max_ch) {
-		GSIERR("bad params chan_hdl=%lu\n", chan_hdl);
-		return -GSI_STATUS_INVALID_PARAMS;
-	}
-
-	if (gsi_ctx->chan[chan_hdl].state == GSI_CHAN_STATE_NOT_ALLOCATED) {
-		GSIERR("bad state %d\n",
-			gsi_ctx->chan[chan_hdl].state);
-		return -GSI_STATUS_UNSUPPORTED_OP;
-	}
-
-	*addr = (phys_addr_t)(gsi_ctx->per.phys_addr +
-		gsihal_get_reg_nk_ofst(GSI_EE_n_GSI_CH_k_CNTXT_8,
-			gsi_ctx->per.ee, chan_hdl));
-
-	return 0;
-}
-EXPORT_SYMBOL(gsi_query_aqc_msi_addr);
-
 static int msm_gsi_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;

+ 1 - 2
drivers/platform/msm/gsi/gsi_dbg.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/completion.h>
@@ -148,7 +148,6 @@ static ssize_t gsi_dump_ch(struct file *file,
 	u32 arg2;
 	unsigned long missing;
 	char *sptr, *token;
-	uint32_t val;
 	struct gsi_chan_ctx *ctx;
 	uint16_t i;
 

+ 16 - 11
drivers/platform/msm/ipa/ipa_clients/ecm_ipa.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/debugfs.h>
@@ -13,6 +13,7 @@
 #include <linux/skbuff.h>
 #include <linux/sched.h>
 #include <linux/atomic.h>
+#include <linux/version.h>
 #include "ecm_ipa.h"
 #include "../ipa_common_i.h"
 #include "../ipa_pm.h"
@@ -176,7 +177,14 @@ static void ecm_ipa_packet_receive_notify
 	(void *priv, enum ipa_dp_evt_type evt, unsigned long data);
 static void ecm_ipa_tx_complete_notify
 	(void *priv, enum ipa_dp_evt_type evt, unsigned long data);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static void ecm_ipa_tx_timeout(struct net_device *net,
+	unsigned int txqueue);
+#else /* Legacy API. */
 static void ecm_ipa_tx_timeout(struct net_device *net);
+#endif
+
 static int ecm_ipa_stop(struct net_device *net);
 static void ecm_ipa_enable_data_path(struct ecm_ipa_dev *ecm_ipa_ctx);
 static int ecm_ipa_rules_cfg
@@ -1196,7 +1204,12 @@ out:
 	dev_kfree_skb_any(skb);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static void ecm_ipa_tx_timeout(struct net_device *net,
+	unsigned int txqueue)
+#else /* Legacy API */
 static void ecm_ipa_tx_timeout(struct net_device *net)
+#endif
 {
 	struct ecm_ipa_dev *ecm_ipa_ctx = netdev_priv(net);
 
@@ -1248,20 +1261,12 @@ static void ecm_ipa_debugfs_init(struct ecm_ipa_dev *ecm_ipa_ctx)
 		ECM_IPA_ERROR("could not create debugfs directory entry\n");
 		goto fail_directory;
 	}
-	file = debugfs_create_u8
+	debugfs_create_u8
 		("outstanding_high", flags_read_write,
 		ecm_ipa_ctx->directory, &ecm_ipa_ctx->outstanding_high);
-	if (!file) {
-		ECM_IPA_ERROR("could not create outstanding_high file\n");
-		goto fail_file;
-	}
-	file = debugfs_create_u8
+	debugfs_create_u8
 		("outstanding_low", flags_read_write,
 		ecm_ipa_ctx->directory, &ecm_ipa_ctx->outstanding_low);
-	if (!file) {
-		ECM_IPA_ERROR("could not create outstanding_low file\n");
-		goto fail_file;
-	}
 	file = debugfs_create_file
 		("outstanding", flags_read_only,
 		ecm_ipa_ctx->directory,

+ 2 - 28
drivers/platform/msm/ipa/ipa_clients/ipa_mhi_client.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/debugfs.h>
@@ -371,17 +371,6 @@ static ssize_t ipa_mhi_debugfs_stats(struct file *file,
 	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, nbytes);
 }
 
-static ssize_t ipa_mhi_debugfs_uc_stats(struct file *file,
-	char __user *ubuf,
-	size_t count,
-	loff_t *ppos)
-{
-	int nbytes = 0;
-
-	nbytes += ipa3_uc_mhi_print_stats(dbg_buff, IPA_MHI_MAX_MSG_LEN);
-	return simple_read_from_buffer(ubuf, count, ppos, dbg_buff, nbytes);
-}
-
 static ssize_t ipa_mhi_debugfs_dump_host_ch_ctx_arr(struct file *file,
 	char __user *ubuf,
 	size_t count,
@@ -447,10 +436,6 @@ const struct file_operations ipa_mhi_stats_ops = {
 	.read = ipa_mhi_debugfs_stats,
 };
 
-const struct file_operations ipa_mhi_uc_stats_ops = {
-	.read = ipa_mhi_debugfs_uc_stats,
-};
-
 const struct file_operations ipa_mhi_dump_host_ch_ctx_ops = {
 	.read = ipa_mhi_debugfs_dump_host_ch_ctx_arr,
 };
@@ -477,19 +462,8 @@ static void ipa_mhi_debugfs_init(void)
 		goto fail;
 	}
 
-	file = debugfs_create_file("uc_stats", read_only_mode, dent,
-		0, &ipa_mhi_uc_stats_ops);
-	if (!file || IS_ERR(file)) {
-		IPA_MHI_ERR("fail to create file uc_stats\n");
-		goto fail;
-	}
-
-	file = debugfs_create_u32("use_ipadma", read_write_mode, dent,
+	debugfs_create_u32("use_ipadma", read_write_mode, dent,
 		&ipa_mhi_client_ctx->use_ipadma);
-	if (!file || IS_ERR(file)) {
-		IPA_MHI_ERR("fail to create file use_ipadma\n");
-		goto fail;
-	}
 
 	file = debugfs_create_file("dump_host_channel_ctx_array",
 		read_only_mode, dent, 0, &ipa_mhi_dump_host_ch_ctx_ops);

+ 25 - 55
drivers/platform/msm/ipa/ipa_clients/rndis_ipa.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/atomic.h>
@@ -20,6 +20,7 @@
 #include <linux/ipa.h>
 #include <linux/random.h>
 #include <linux/workqueue.h>
+#include <linux/version.h>
 #include "rndis_ipa.h"
 #include "ipa_common_i.h"
 #include "ipa_pm.h"
@@ -247,7 +248,14 @@ static void rndis_ipa_packet_receive_notify
 	(void *private, enum ipa_dp_evt_type evt, unsigned long data);
 static void rndis_ipa_tx_complete_notify
 	(void *private, enum ipa_dp_evt_type evt, unsigned long data);
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static void rndis_ipa_tx_timeout(struct net_device *net,
+	unsigned int txqueue);
+#else /* Legacy API. */
 static void rndis_ipa_tx_timeout(struct net_device *net);
+#endif
+
 static int rndis_ipa_stop(struct net_device *net);
 static void rndis_ipa_enable_data_path(struct rndis_ipa_dev *rndis_ipa_ctx);
 static struct sk_buff *rndis_encapsulate_skb(struct sk_buff *skb,
@@ -1075,7 +1083,12 @@ out:
 	dev_kfree_skb_any(skb);
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static void rndis_ipa_tx_timeout(struct net_device *net,
+	unsigned int txqueue)
+#else /* Legacy API. */
 static void rndis_ipa_tx_timeout(struct net_device *net)
+#endif
 {
 	struct rndis_ipa_dev *rndis_ipa_ctx = netdev_priv(net);
 	int outstanding = atomic_read(&rndis_ipa_ctx->outstanding_pkts);
@@ -2189,23 +2202,15 @@ static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
 		goto fail_file;
 	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("outstanding_high", flags_read_write,
 		rndis_ipa_ctx->directory,
 		&rndis_ipa_ctx->outstanding_high);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create outstanding_high file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("outstanding_low", flags_read_write,
 		rndis_ipa_ctx->directory,
 		&rndis_ipa_ctx->outstanding_low);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create outstanding_low file\n");
-		goto fail_file;
-	}
 
 	file = debugfs_create_file
 		("outstanding", flags_read_only,
@@ -2216,29 +2221,17 @@ static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
 		goto fail_file;
 	}
 
-	file = debugfs_create_u8
+	debugfs_create_u8
 		("state", flags_read_only,
 		rndis_ipa_ctx->directory, (u8 *)&rndis_ipa_ctx->state);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create state file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("tx_dropped", flags_read_only,
 		rndis_ipa_ctx->directory, &rndis_ipa_ctx->tx_dropped);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create tx_dropped file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("rx_dropped", flags_read_only,
 		rndis_ipa_ctx->directory, &rndis_ipa_ctx->rx_dropped);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create rx_dropped file\n");
-		goto fail_file;
-	}
 
 	aggr_directory = debugfs_create_dir
 		(DEBUGFS_AGGR_DIR_NAME,
@@ -2257,48 +2250,29 @@ static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
 		goto fail_file;
 	}
 
-	file = debugfs_create_u8
+	debugfs_create_u8
 		("aggr_enable", flags_read_write,
 		aggr_directory, (u8 *)&ipa_to_usb_ep_cfg.aggr.aggr_en);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create aggr_enable file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u8
+	debugfs_create_u8
 		("aggr_type", flags_read_write,
 		aggr_directory, (u8 *)&ipa_to_usb_ep_cfg.aggr.aggr);
-	if (!file) {
 		RNDIS_IPA_ERROR("could not create aggr_type file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("aggr_byte_limit", flags_read_write,
 		aggr_directory,
 		&ipa_to_usb_ep_cfg.aggr.aggr_byte_limit);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create aggr_byte_limit file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("aggr_time_limit", flags_read_write,
 		aggr_directory,
 		&ipa_to_usb_ep_cfg.aggr.aggr_time_limit);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create aggr_time_limit file\n");
-		goto fail_file;
-	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("aggr_pkt_limit", flags_read_write,
 		aggr_directory,
 		&ipa_to_usb_ep_cfg.aggr.aggr_pkt_limit);
-	if (!file) {
-		RNDIS_IPA_ERROR("could not create aggr_pkt_limit file\n");
-		goto fail_file;
-	}
 
 	file = debugfs_create_bool
 		("tx_dump_enable", flags_read_write,
@@ -2327,14 +2301,10 @@ static void rndis_ipa_debugfs_init(struct rndis_ipa_dev *rndis_ipa_ctx)
 		goto fail_file;
 	}
 
-	file = debugfs_create_u32
+	debugfs_create_u32
 		("error_msec_sleep_time", flags_read_write,
 		rndis_ipa_ctx->directory,
 		&rndis_ipa_ctx->error_msec_sleep_time);
-	if (!file) {
-		RNDIS_IPA_ERROR("fail to create error_msec_sleep_time file\n");
-		goto fail_file;
-	}
 
 	file = debugfs_create_bool
 		("during_xmit_error", flags_read_only,

+ 5 - 1
drivers/platform/msm/ipa/ipa_clients/rndis_ipa_trace.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -70,5 +70,9 @@ TRACE_EVENT(
 
 /* This part must be outside protection */
 #undef TRACE_INCLUDE_PATH
+#ifdef CONFIG_IPA_VENDOR_DLKM
+#define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/ipa/ipa_clients
+#else
 #define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/ipa/ipa_clients
+#endif
 #include <trace/define_trace.h>

+ 7 - 2
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/clk.h>
@@ -145,6 +145,11 @@ static struct ipa3_plat_drv_res ipa3_res = {0, };
 static struct clk *ipa3_clk;
 
 struct ipa3_context *ipa3_ctx = NULL;
+/* ipa_i.h is included in ipa_client modules and ipa3_ctx is
+ * declared as extern in ipa_i.h. So export ipa3_ctx variable
+ * to be visible to ipa_client module.
+*/
+EXPORT_SYMBOL(ipa3_ctx);
 
 int ipa3_plat_drv_probe(struct platform_device *pdev_p);
 int ipa3_pci_drv_probe(
@@ -629,7 +634,7 @@ static int ipa3_active_clients_log_init(void)
 			GFP_KERNEL);
 	active_clients_table_buf = kzalloc(sizeof(
 			char[IPA3_ACTIVE_CLIENTS_TABLE_BUF_SIZE]), GFP_KERNEL);
-	if (ipa3_ctx->ipa3_active_clients_logging.log_buffer == NULL) {
+	if (ipa3_ctx->ipa3_active_clients_logging.log_buffer[0] == NULL) {
 		pr_err("Active Clients Logging memory allocation failed\n");
 		goto bail;
 	}

+ 8 - 37
drivers/platform/msm/ipa/ipa_v3/ipa_debugfs.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  */
 
 #ifdef CONFIG_DEBUG_FS
@@ -2967,13 +2967,8 @@ void ipa3_debugfs_init(void)
 		return;
 	}
 
-	file = debugfs_create_u32("hw_type", IPA_READ_ONLY_MODE,
+	debugfs_create_u32("hw_type", IPA_READ_ONLY_MODE,
 		dent, &ipa3_ctx->ipa_hw_type);
-	if (!file) {
-		IPAERR("could not create hw_type file\n");
-		goto fail;
-	}
-
 
 	for (i = 0; i < debugfs_files_num; ++i) {
 		const struct ipa3_debugfs_file *curr = &debugfs_files[i];
@@ -2993,50 +2988,26 @@ void ipa3_debugfs_init(void)
 	if (active_clients_buf == NULL)
 		goto fail;
 
-	file = debugfs_create_u32("enable_clock_scaling", IPA_READ_WRITE_MODE,
+	debugfs_create_u32("enable_clock_scaling", IPA_READ_WRITE_MODE,
 		dent, &ipa3_ctx->enable_clock_scaling);
-	if (!file) {
-		IPAERR("could not create enable_clock_scaling file\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u32("tx_wrapper_cache_max_size",
+	debugfs_create_u32("tx_wrapper_cache_max_size",
 		IPA_READ_WRITE_MODE,
 		dent, &ipa3_ctx->tx_wrapper_cache_max_size);
-	if (!file) {
-		IPAERR("could not create tx_wrapper_cache_max_size file\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u32("enable_napi_chain", IPA_READ_WRITE_MODE,
+	debugfs_create_u32("enable_napi_chain", IPA_READ_WRITE_MODE,
 		dent, &ipa3_ctx->enable_napi_chain);
-	if (!file) {
-		IPAERR("could not create enable_napi_chain file\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u32("clock_scaling_bw_threshold_nominal_mbps",
+	debugfs_create_u32("clock_scaling_bw_threshold_nominal_mbps",
 		IPA_READ_WRITE_MODE, dent,
 		&ipa3_ctx->ctrl->clock_scaling_bw_threshold_nominal);
-	if (!file) {
-		IPAERR("could not create bw_threshold_nominal_mbps\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u32("clock_scaling_bw_threshold_turbo_mbps",
+	debugfs_create_u32("clock_scaling_bw_threshold_turbo_mbps",
 			IPA_READ_WRITE_MODE, dent,
 			&ipa3_ctx->ctrl->clock_scaling_bw_threshold_turbo);
-	if (!file) {
-		IPAERR("could not create bw_threshold_turbo_mbps\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u32("clk_rate", IPA_READ_ONLY_MODE,
+	debugfs_create_u32("clk_rate", IPA_READ_ONLY_MODE,
 		dent, &ipa3_ctx->curr_ipa_clk_rate);
-	if (!file) {
-		IPAERR("could not create clk_rate file\n");
-		goto fail;
-	}
 
 	ipa_debugfs_init_stats(dent);
 

+ 3 - 3
drivers/platform/msm/ipa/ipa_v3/ipa_eth_i.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  */
 #include "ipa_i.h"
 #include <linux/if_vlan.h>
@@ -353,7 +353,7 @@ static int ipa_eth_setup_rtk_gsi_channel(
 		gsi_channel_props.dir = GSI_CHAN_DIR_FROM_GSI;
 	else
 		gsi_channel_props.dir = GSI_CHAN_DIR_TO_GSI;
-		gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);
+	gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);
 	if (!gsi_ep_info) {
 		IPAERR("Failed getting GSI EP info for client=%d\n",
 		       ep->client);
@@ -554,7 +554,7 @@ static int ipa_eth_setup_aqc_gsi_channel(
 		gsi_channel_props.dir = GSI_CHAN_DIR_FROM_GSI;
 	else
 		gsi_channel_props.dir = GSI_CHAN_DIR_TO_GSI;
-		gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);
+	gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);
 	if (!gsi_ep_info) {
 		IPAERR("Failed getting GSI EP info for client=%d\n",
 		       ep->client);

+ 6 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_nat.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/device.h>
@@ -9,7 +9,12 @@
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/uaccess.h>
+#include <linux/version.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
+#include <linux/dma-map-ops.h>
+#else /* Legacy */
 #include <linux/dma-noncoherent.h>
+#endif
 #include "ipa_i.h"
 #include "ipahal.h"
 #include "ipahal_nat.h"

+ 5 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_trace.h

@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /*
- * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  */
 
 #undef TRACE_SYSTEM
@@ -301,5 +301,9 @@ TRACE_EVENT(
 
 /* This part must be outside protection */
 #undef TRACE_INCLUDE_PATH
+#ifdef CONFIG_IPA_VENDOR_DLKM
+#define TRACE_INCLUDE_PATH ../../../../vendor/qcom/opensource/dataipa/drivers/platform/msm/ipa/ipa_v3
+#else
 #define TRACE_INCLUDE_PATH ../../techpack/dataipa/drivers/platform/msm/ipa/ipa_v3
+#endif
 #include <trace/define_trace.h>

+ 5 - 26
drivers/platform/msm/ipa/ipa_v3/ipa_wigig_i.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
  */
 
 #include "ipa_i.h"
@@ -1954,7 +1954,6 @@ int ipa3_wigig_init_debugfs_i(struct dentry *parent) { return 0; }
 int ipa3_wigig_init_debugfs_i(struct dentry *parent)
 {
 	const mode_t read_write_mode = 0664;
-	struct dentry *file = NULL;
 	struct dentry *dent;
 
 	dent = debugfs_create_dir("ipa_wigig", parent);
@@ -1965,38 +1964,18 @@ int ipa3_wigig_init_debugfs_i(struct dentry *parent)
 
 	wigig_dent = dent;
 
-	file = debugfs_create_u8("modc", read_write_mode, dent,
+	debugfs_create_u8("modc", read_write_mode, dent,
 		&int_modc);
-	if (IS_ERR_OR_NULL(file)) {
-		IPAERR("fail to create file modc\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u16("modt", read_write_mode, dent,
+	debugfs_create_u16("modt", read_write_mode, dent,
 		&int_modt);
-	if (IS_ERR_OR_NULL(file)) {
-		IPAERR("fail to create file modt\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u8("rx_mod_th", read_write_mode, dent,
+	debugfs_create_u8("rx_mod_th", read_write_mode, dent,
 		&rx_hwtail_mod_threshold);
-	if (IS_ERR_OR_NULL(file)) {
-		IPAERR("fail to create file rx_mod_th\n");
-		goto fail;
-	}
 
-	file = debugfs_create_u8("tx_mod_th", read_write_mode, dent,
+	debugfs_create_u8("tx_mod_th", read_write_mode, dent,
 		&tx_hwtail_mod_threshold);
-	if (IS_ERR_OR_NULL(file)) {
-		IPAERR("fail to create file tx_mod_th\n");
-		goto fail;
-	}
 
 	return 0;
-fail:
-	debugfs_remove_recursive(dent);
-	wigig_dent = NULL;
-	return -EFAULT;
 }
 #endif

+ 2 - 2
drivers/platform/msm/ipa/ipa_v3/ipahal/ipahal_hw_stats.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  */
 
 #include "ipahal.h"
@@ -480,7 +480,7 @@ static struct ipahal_stats_init_pyld *ipahal_generate_init_pyld_flt_rt_v4_5(
 	void *params, bool is_atomic_ctx)
 {
 	struct ipahal_stats_init_pyld *pyld;
-	int num = (int)(params);
+	long num = (long)(params); /* params is treated as a pointer. */
 
 	if (num > IPA_MAX_FLT_RT_CNT_INDEX ||
 		num <= 0) {

+ 8 - 24
drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved.
  */
 
 /*
@@ -1310,7 +1310,12 @@ out:
 	return ret;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 6, 0))
+static void ipa3_wwan_tx_timeout(struct net_device *dev,
+	unsigned int txqueue)
+#else /* Legacy API. */
 static void ipa3_wwan_tx_timeout(struct net_device *dev)
+#endif
 {
 	struct ipa3_wwan_private *wwan_ptr = netdev_priv(dev);
 
@@ -1318,7 +1323,6 @@ static void ipa3_wwan_tx_timeout(struct net_device *dev)
 		IPAWANERR("[%s] data stall in UL, %d outstanding\n",
 			dev->name, atomic_read(&wwan_ptr->outstanding_pkts));
 }
-
 /**
  * apps_ipa_tx_complete_notify() - Rx notify
  *
@@ -4868,39 +4872,19 @@ static void rmnet_ipa_debugfs_init(void)
 		return;
 	}
 
-	dbgfs->dfile_outstanding_high = debugfs_create_u32("outstanding_high",
+	debugfs_create_u32("outstanding_high",
 		read_write_mode, dbgfs->dent,
 		&rmnet_ipa3_ctx->outstanding_high);
-	if (!dbgfs->dfile_outstanding_high ||
-		IS_ERR(dbgfs->dfile_outstanding_high)) {
-		pr_err("failed to create file for outstanding_high\n");
-		goto fail;
-	}
 
-	dbgfs->dfile_outstanding_high_ctl =
 		debugfs_create_u32("outstanding_high_ctl",
 		read_write_mode, dbgfs->dent,
 		&rmnet_ipa3_ctx->outstanding_high_ctl);
-	if (!dbgfs->dfile_outstanding_high_ctl ||
-		IS_ERR(dbgfs->dfile_outstanding_high_ctl)) {
-		pr_err("failed to create file for outstanding_high_ctl\n");
-		goto fail;
-	}
 
-	dbgfs->dfile_outstanding_low = debugfs_create_u32("outstanding_low",
+	debugfs_create_u32("outstanding_low",
 		read_write_mode, dbgfs->dent,
 		&rmnet_ipa3_ctx->outstanding_low);
-	if (!dbgfs->dfile_outstanding_low ||
-		IS_ERR(dbgfs->dfile_outstanding_low)) {
-		pr_err("failed to create file for outstanding_low\n");
-		goto fail;
-	}
 
 	return;
-
-fail:
-	debugfs_remove_recursive(dbgfs->dent);
-	memset(dbgfs, 0, sizeof(struct rmnet_ipa_debugfs));
 }
 
 static void rmnet_ipa_debugfs_remove(void)