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

Commit 35e2721f authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa: Add mutex protection when updating notify req cache" into msm-4.9

parents 0aa7a4f6 bcb324ed
Loading
Loading
Loading
Loading
+45 −18
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ struct ipa3_qmi_context *ipa3_qmi_ctx;
static bool workqueues_stopped;
static bool ipa3_modem_init_cmplt;
static bool first_time_handshake;
struct mutex ipa3_qmi_lock;

/* QMI A5 service */

static struct msg_desc ipa3_indication_reg_req_desc = {
@@ -610,12 +612,17 @@ int ipa3_qmi_filter_request_send(struct ipa_install_fltr_rule_req_msg_v01 *req)
		req->filter_spec_ex_list_len);
	}

	mutex_lock(&ipa3_qmi_lock);
	if (ipa3_qmi_ctx != NULL) {
		/* cache the qmi_filter_request */
		memcpy(&(ipa3_qmi_ctx->ipa_install_fltr_rule_req_msg_cache[
			ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_msg]),
			req, sizeof(struct ipa_install_fltr_rule_req_msg_v01));
			req,
			sizeof(struct ipa_install_fltr_rule_req_msg_v01));
		ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_msg++;
		ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_msg %= 10;
	}
	mutex_unlock(&ipa3_qmi_lock);

	req_desc.max_msg_len = QMI_IPA_INSTALL_FILTER_RULE_REQ_MAX_MSG_LEN_V01;
	req_desc.msg_id = QMI_IPA_INSTALL_FILTER_RULE_REQ_V01;
@@ -655,12 +662,17 @@ int ipa3_qmi_filter_request_ex_send(
		req->filter_spec_ex_list_len);
	}

	mutex_lock(&ipa3_qmi_lock);
	if (ipa3_qmi_ctx != NULL) {
		/* cache the qmi_filter_request */
		memcpy(&(ipa3_qmi_ctx->ipa_install_fltr_rule_req_ex_msg_cache[
			ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_ex_msg]),
		req, sizeof(struct ipa_install_fltr_rule_req_ex_msg_v01));
			req,
			sizeof(struct ipa_install_fltr_rule_req_ex_msg_v01));
		ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_ex_msg++;
		ipa3_qmi_ctx->num_ipa_install_fltr_rule_req_ex_msg %= 10;
	}
	mutex_unlock(&ipa3_qmi_lock);

	req_desc.max_msg_len =
		QMI_IPA_INSTALL_FILTER_RULE_EX_REQ_MAX_MSG_LEN_V01;
@@ -796,12 +808,17 @@ int ipa3_qmi_filter_notify_send(
		return -EINVAL;
	}

	mutex_lock(&ipa3_qmi_lock);
	if (ipa3_qmi_ctx != NULL) {
		/* cache the qmi_filter_request */
		memcpy(&(ipa3_qmi_ctx->ipa_fltr_installed_notif_req_msg_cache[
			ipa3_qmi_ctx->num_ipa_fltr_installed_notif_req_msg]),
		req, sizeof(struct ipa_fltr_installed_notif_req_msg_v01));
			req,
			sizeof(struct ipa_fltr_installed_notif_req_msg_v01));
		ipa3_qmi_ctx->num_ipa_fltr_installed_notif_req_msg++;
		ipa3_qmi_ctx->num_ipa_fltr_installed_notif_req_msg %= 10;
	}
	mutex_unlock(&ipa3_qmi_lock);

	req_desc.max_msg_len =
	QMI_IPA_FILTER_INSTALLED_NOTIF_REQ_MAX_MSG_LEN_V01;
@@ -1339,3 +1356,13 @@ int ipa3_qmi_stop_data_qouta(void)
		resp.resp.error, "ipa_stop_data_usage_quota_req_msg_v01");
}

void ipa3_qmi_init(void)
{
	mutex_init(&ipa3_qmi_lock);
}

void ipa3_qmi_cleanup(void)
{
	mutex_destroy(&ipa3_qmi_lock);
}
+12 −0
Original line number Diff line number Diff line
@@ -204,6 +204,10 @@ int ipa3_qmi_stop_data_qouta(void);

void ipa3_q6_handshake_complete(bool ssr_bootup);

void ipa3_qmi_init(void);

void ipa3_qmi_cleanup(void);

#else /* CONFIG_RMNET_IPA3 */

static inline int ipa3_qmi_service_init(uint32_t wan_platform_type)
@@ -316,6 +320,14 @@ static inline int ipa3_qmi_stop_data_qouta(void)

static inline void ipa3_q6_handshake_complete(bool ssr_bootup) { }

static inline void ipa3_qmi_init(void)
{
}

static inline void ipa3_qmi_cleanup(void)
{
}

#endif /* CONFIG_RMNET_IPA3 */

#endif /* IPA_QMI_SERVICE_H */
+4 −1
Original line number Diff line number Diff line
@@ -3206,6 +3206,9 @@ static int __init ipa3_wwan_init(void)
	mutex_init(&rmnet_ipa3_ctx->pipe_handle_guard);
	rmnet_ipa3_ctx->ipa3_to_apps_hdl = -1;
	rmnet_ipa3_ctx->apps_to_ipa3_hdl = -1;

	ipa3_qmi_init();

	/* Register for Modem SSR */
	rmnet_ipa3_ctx->subsys_notify_handle = subsys_notif_register_notifier(
			SUBSYS_MODEM,
@@ -3219,7 +3222,7 @@ static int __init ipa3_wwan_init(void)
static void __exit ipa3_wwan_cleanup(void)
{
	int ret;

	ipa3_qmi_cleanup();
	mutex_destroy(&rmnet_ipa3_ctx->pipe_handle_guard);
	ret = subsys_notif_unregister_notifier(
		rmnet_ipa3_ctx->subsys_notify_handle, &ipa3_ssr_notifier);