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

Commit 306f178d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: remove ipa3_ctx access from wan driver and qmi service"

parents f2b18e28 75cf0024
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -429,6 +429,21 @@ enum {

#define MBOX_TOUT_MS 100

/* miscellaneous for rmnet_ipa and qmi_service */
enum ipa_type_mode {
	IPA_HW_TYPE,
	PLATFORM_TYPE,
	IPA3_HW_MODE,
};

enum ipa_flag {
	IPA_PM_EN,
	IPA_ENDP_DELAY_WA_EN,
	IPA_HW_STATS_EN,
	IPA_MHI_EN,
	IPA_FLTRT_NOT_HASHABLE_EN,
};

struct ipa3_active_client_htable_entry {
	struct hlist_node list;
	char id_string[IPA3_ACTIVE_CLIENTS_LOG_NAME_LEN];
@@ -2639,6 +2654,10 @@ int ipa3_get_ep_mapping(enum ipa_client_type client);

bool ipa3_is_ready(void);

int ipa3_ctx_get_type(enum ipa_type_mode type);
bool ipa3_ctx_get_flag(enum ipa_flag flag);
u32 ipa3_ctx_get_num_pipes(void);

void ipa3_proxy_clk_vote(void);
void ipa3_proxy_clk_unvote(void);

+8 −8
Original line number Diff line number Diff line
@@ -566,7 +566,7 @@ static int ipa3_qmi_init_modem_send_sync_msg(void)
	/* if hashing not supported, Modem filter/routing hash
	 * tables should not fill with valid data.
	 */
	if (!ipa3_ctx->ipa_fltrt_not_hashable) {
	if (!ipa3_ctx_get_flag(IPA_FLTRT_NOT_HASHABLE_EN)) {
		req.v4_hash_route_tbl_info_valid = true;
		req.v4_hash_route_tbl_info.route_tbl_start_addr =
			IPA_MEM_PART(v4_rt_hash_ofst) + smem_restr_bytes;
@@ -709,7 +709,7 @@ int ipa3_qmi_filter_request_send(struct ipa_install_fltr_rule_req_msg_v01 *req)
		"IPACM passes source_pipe_index_valid not zero 0 != %d\n",
			req->source_pipe_index_valid);
		return -EINVAL;
	} else if (req->source_pipe_index >= ipa3_ctx->ipa_num_pipes) {
	} else if (req->source_pipe_index >= ipa3_ctx_get_num_pipes()) {
		IPAWANDBG(
		"IPACM passes source pipe index not valid ID = %d\n",
		req->source_pipe_index);
@@ -1214,8 +1214,8 @@ int ipa3_qmi_enable_force_clear_datapath_send(
		return -EINVAL;
	}

	if (ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_VIRTUAL ||
		ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) {
	if (ipa3_ctx_get_type(IPA3_HW_MODE) == IPA_HW_MODE_VIRTUAL ||
		ipa3_ctx_get_type(IPA3_HW_MODE) == IPA_HW_MODE_EMULATION) {
		IPAWANDBG("Simulating success on emu/virt mode\n");
		return 0;
	}
@@ -1272,8 +1272,8 @@ int ipa3_qmi_disable_force_clear_datapath_send(
		return -EINVAL;
	}

	if (ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_VIRTUAL ||
		ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) {
	if (ipa3_ctx_get_type(IPA3_HW_MODE) == IPA_HW_MODE_VIRTUAL ||
		ipa3_ctx_get_type(IPA3_HW_MODE) == IPA_HW_MODE_EMULATION) {
		IPAWANDBG("Simulating success on emu/virt mode\n");
		return 0;
	}
@@ -1355,7 +1355,7 @@ int ipa3_qmi_filter_notify_send(
			req->source_pipe_index, req->rule_id_valid,
			req->rule_id_ex_valid);
		return -EINVAL;
	} else if (req->source_pipe_index >= ipa3_ctx->ipa_num_pipes) {
	} else if (req->source_pipe_index >= ipa3_ctx_get_num_pipes()) {
		IPAWANDBG(
		"IPACM passes source pipe index not valid ID = %d\n",
		req->source_pipe_index);
@@ -1367,7 +1367,7 @@ int ipa3_qmi_filter_notify_send(
		IPAWANERR(
			"IPACM passes embedded pipe and mux valid not valid\n");
		return -EINVAL;
	} else if (req->embedded_pipe_index >= ipa3_ctx->ipa_num_pipes) {
	} else if (req->embedded_pipe_index >= ipa3_ctx_get_num_pipes()) {
		IPAWANERR("IPACM passes source pipe index not valid ID = %d\n",
		req->source_pipe_index);
		return -EINVAL;
+58 −0
Original line number Diff line number Diff line
@@ -8468,3 +8468,61 @@ u32 ipa3_get_r_rev_version(void)

	return r_rev;
}

/**
 * ipa3_ctx_get_type() - to get platform type, hw type
 * and hw mode
 *
 * Return value: enumerated types of platform and ipa hw
 *
 */
int ipa3_ctx_get_type(enum ipa_type_mode type)
{
	switch (type) {
	case IPA_HW_TYPE:
		return ipa3_ctx->ipa_hw_type;
	case PLATFORM_TYPE:
		return ipa3_ctx->platform_type;
	case IPA3_HW_MODE:
		return ipa3_ctx->ipa3_hw_mode;
	default:
		IPAERR("cannot read ipa3_ctx types\n");
		return 0;
	}
}

/**
 * ipa3_ctx_get_flag() - to read some ipa3_ctx_flags
 *
 * Return value: true/false based on read value
 *
 */
bool ipa3_ctx_get_flag(enum ipa_flag flag)
{
	switch (flag) {
	case IPA_PM_EN:
		return ipa3_ctx->use_ipa_pm;
	case IPA_ENDP_DELAY_WA_EN:
		return ipa3_ctx->ipa_endp_delay_wa;
	case IPA_HW_STATS_EN:
		return ipa3_ctx->hw_stats.enabled;
	case IPA_MHI_EN:
		return ipa3_ctx->ipa_config_is_mhi;
	case IPA_FLTRT_NOT_HASHABLE_EN:
		return ipa3_ctx->ipa_fltrt_not_hashable;
	default:
		IPAERR("cannot read ipa3_ctx flags\n");
		return false;
	}
}

/**
 * ipa3_ctx_get_num_pipes() - to read pipe number from ipa3_ctx
 *
 * Return value: unsigned number
 *
 */
u32 ipa3_ctx_get_num_pipes(void)
{
	return ipa3_ctx->ipa_num_pipes;
}
+21 −20
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ static int ipa3_setup_a7_qmap_hdr(void)

	strlcpy(hdr_entry->name, IPA_A7_QMAP_HDR_NAME,
				IPA_RESOURCE_NAME_MAX);
	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5 &&
	if (ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5 &&
		rmnet_ipa3_ctx->dl_csum_offload_enabled) {
		hdr_entry->hdr_len = IPA_DL_CHECKSUM_LENGTH; /* 8 bytes */
		/* new DL QMAP header format */
@@ -331,7 +331,7 @@ static int ipa3_add_qmap_hdr(uint32_t mux_id, uint32_t *hdr_hdl)

	if (rmnet_ipa3_ctx->dl_csum_offload_enabled) {
		if (rmnet_ipa3_ctx->ipa_config_is_apq ||
			ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5) {
			ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5) {
			hdr_entry->hdr_len =
				IPA_DL_CHECKSUM_LENGTH; /* 8 bytes */
			/* new DL QMAP header format */
@@ -1491,7 +1491,7 @@ static int handle3_ingress_format(struct net_device *dev,

	ipa_wan_ep_cfg = &rmnet_ipa3_ctx->ipa_to_apps_ep_cfg;
	if ((in->u.data) & RMNET_IOCTL_INGRESS_FORMAT_CHECKSUM) {
		if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5)
		if (ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5)
			ipa_wan_ep_cfg->ipa_ep_cfg.cfg.cs_offload_en =
				IPA_ENABLE_CS_DL_QMAP;
		else
@@ -1517,7 +1517,7 @@ static int handle3_ingress_format(struct net_device *dev,
		}
	}

	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5 &&
	if (ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5 &&
		(in->u.data) & RMNET_IOCTL_INGRESS_FORMAT_CHECKSUM) {
		ipa_wan_ep_cfg->ipa_ep_cfg.hdr.hdr_len = 8;
		rmnet_ipa3_ctx->dl_csum_offload_enabled = true;
@@ -2443,11 +2443,11 @@ static int ipa3_wwan_probe(struct platform_device *pdev)
				sizeof(struct ipa3_rmnet_mux_val));

	/* start A7 QMI service/client */
	if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_MSM ||
		ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ)
	if (ipa3_ctx_get_type(PLATFORM_TYPE) == IPA_PLAT_TYPE_MSM ||
		ipa3_ctx_get_type(PLATFORM_TYPE) == IPA_PLAT_TYPE_APQ)
		/* Android platform loads uC */
		ipa3_qmi_service_init(QMI_IPA_PLATFORM_TYPE_MSM_ANDROID_V01);
	else if (ipa3_ctx->ipa_config_is_mhi)
	else if (ipa3_ctx_get_flag(IPA_MHI_EN))
		/* LE MHI platform */
		ipa3_qmi_service_init(QMI_IPA_PLATFORM_TYPE_LE_MHI_V01);
	else
@@ -2522,7 +2522,7 @@ static int ipa3_wwan_probe(struct platform_device *pdev)
	}

	/* for > IPA 4.5, we set the colaescing feature flag on */
	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v4_5)
	if (ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_5)
		dev->hw_features |= NETIF_F_GRO_HW | NETIF_F_RXCSUM;

	/*
@@ -2530,7 +2530,8 @@ static int ipa3_wwan_probe(struct platform_device *pdev)
	 * power collapse until IPA uC is loaded.
	 */
	atomic_set(&rmnet_ipa3_ctx->is_initialized, 1);
	if (!atomic_read(&rmnet_ipa3_ctx->is_ssr) && ipa3_ctx->ipa_hw_type !=
	if (!atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
		ipa3_ctx_get_type(IPA_HW_TYPE) !=
		IPA_HW_v4_0) {
		/* offline charging mode */
		ipa3_proxy_clk_unvote();
@@ -2781,7 +2782,7 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
			platform_driver_unregister(&rmnet_ipa_driver);
		imp_handle_modem_shutdown();
		if (atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
			ipa3_ctx->ipa_hw_type >= IPA_HW_v4_0)
			ipa3_ctx_get_type(IPA_HW_TYPE) >= IPA_HW_v4_0)
			ipa3_q6_post_shutdown_cleanup();
		ipa3_odl_pipe_cleanup(true);
		IPAWANINFO("IPA BEFORE_SHUTDOWN handling is complete\n");
@@ -2789,10 +2790,10 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
	case SUBSYS_AFTER_SHUTDOWN:
		IPAWANINFO("IPA Received MPSS AFTER_SHUTDOWN\n");
		if (atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
			ipa3_ctx->ipa_hw_type < IPA_HW_v4_0)
			ipa3_ctx_get_type(IPA_HW_TYPE) < IPA_HW_v4_0)
			ipa3_q6_post_shutdown_cleanup();

		if (ipa3_ctx->ipa_endp_delay_wa)
		if (ipa3_ctx_get_flag(IPA_ENDP_DELAY_WA_EN))
			ipa3_client_prod_post_shutdown_cleanup();

		IPAWANINFO("IPA AFTER_SHUTDOWN handling is complete\n");
@@ -2838,7 +2839,7 @@ static int ipa3_rmt_mdm_ssr_notifier_cb(struct notifier_block *this,

	if (!rmnet_ipa3_ctx->ipa_config_is_apq) {
		IPAWANERR("Remote mdm SSR event=%lu on non-APQ platform=%d\n",
			code, ipa3_ctx->platform_type);
			code, ipa3_ctx_get_type(PLATFORM_TYPE));
		return NOTIFY_DONE;
	}

@@ -3446,7 +3447,7 @@ static int rmnet_ipa3_query_tethering_stats_hw(
		}
	}

	if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_5)
	if (ipa3_ctx_get_type(IPA_HW_TYPE) == IPA_HW_v4_5)
		wlan_client = IPA_CLIENT_WLAN2_CONS;
	else
		wlan_client = IPA_CLIENT_WLAN1_CONS;
@@ -3549,7 +3550,7 @@ static int rmnet_ipa3_query_tethering_stats_hw(
	/* query WLAN UL stats */
	memset(con_stats, 0, sizeof(struct ipa_quota_stats_all));

	if (ipa3_ctx->ipa_hw_type == IPA_HW_v4_5)
	if (ipa3_ctx_get_type(IPA_HW_TYPE) == IPA_HW_v4_5)
		rc = ipa_query_teth_stats(IPA_CLIENT_WLAN2_PROD,
			con_stats, reset);
	else
@@ -3699,11 +3700,11 @@ int rmnet_ipa3_query_tethering_stats_all(
	} else {
		IPAWANDBG_LOW(" query modem-backhaul stats\n");
		tether_stats.ipa_client = data->ipa_client;
		if (ipa3_ctx->ipa_hw_type < IPA_HW_v4_0 ||
			!ipa3_ctx->hw_stats.enabled) {
		if (ipa3_ctx_get_type(IPA_HW_TYPE) < IPA_HW_v4_0 ||
			!ipa3_ctx_get_flag(IPA_HW_STATS_EN)) {
			IPAWANDBG("hw version %d,hw_stats.enabled %d\n",
				ipa3_ctx->ipa_hw_type,
				ipa3_ctx->hw_stats.enabled);
				ipa3_ctx_get_type(IPA_HW_TYPE),
				ipa3_ctx_get_flag(IPA_HW_STATS_EN));
			/* get modem stats from QMI */
			rc = rmnet_ipa3_query_tethering_stats_modem(
				&tether_stats, data->reset_stats);
@@ -4531,7 +4532,7 @@ static int __init ipa3_wwan_init(void)
	return 0;

fail_unreg_rmt_mdm_ssr:
	if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ) {
	if (ipa3_ctx_get_type(PLATFORM_TYPE) == IPA_PLAT_TYPE_APQ) {
		subsys_notif_unregister_notifier(
			rmnet_ipa3_ctx->rmt_mdm_subsys_notify_handle,
			&ipa3_rmt_mdm_ssr_notifier);