Browse Source

msm: ipa: eogre fixes/embellishments as follows:

1) Race condition fix: eogre_enabled set to true too late
   relative to ipacm induced ipa3_cfg_ep_metadat ioctl

2) Added more logging when eogre add/del mapping ioctl's arrive

Change-Id: I58c132a8d0b412c3dc8c5e26773fe358fe58df8f
Signed-off-by: Perry Randise <[email protected]>
Perry Randise 3 years ago
parent
commit
616d86d3be

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

@@ -3935,6 +3935,7 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		break;
 
 	case IPA_IOC_ADD_EoGRE_MAPPING:
+		IPADBG("Got IPA_IOC_ADD_EoGRE_MAPPING\n");
 		if (copy_from_user(
 				&eogre_info,
 				(const void __user *) arg,
@@ -3946,6 +3947,8 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 
 		retval = ipa3_check_eogre(&eogre_info, &send2uC, &send2ipacm);
 
+		ipa3_ctx->eogre_enabled = (retval == 0);
+
 		if (retval == 0 && send2uC == true) {
 			/*
 			 * Send map to uC...
@@ -3961,13 +3964,15 @@ static long ipa3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 			retval = ipa3_send_eogre_info(IPA_EoGRE_UP_EVENT, &eogre_info);
 		}
 
-		if (retval == 0) {
-			ipa3_ctx->eogre_enabled = true;
+		if (retval != 0) {
+			ipa3_ctx->eogre_enabled = false;
 		}
 
 		break;
 
 	case IPA_IOC_DEL_EoGRE_MAPPING:
+		IPADBG("Got IPA_IOC_DEL_EoGRE_MAPPING\n");
+
 		memset(&eogre_info, 0, sizeof(eogre_info));
 
 		retval = ipa3_check_eogre(&eogre_info, &send2uC, &send2ipacm);

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

@@ -8598,6 +8598,8 @@ int ipa3_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
 	/* copy over EP cfg */
 	ipa3_ctx->ep[clnt_hdl].cfg.meta = *ep_md;
 
+	IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
+
 	if (ipa3_ctx->eogre_enabled) {
 		/* reconfigure ep metadata reg to override mux-id */
 		ipa3_ctx->ep[clnt_hdl].cfg.hdr.hdr_ofst_metadata_valid = 0;
@@ -8607,8 +8609,6 @@ int ipa3_cfg_ep_metadata(u32 clnt_hdl, const struct ipa_ep_cfg_metadata *ep_md)
 			&ipa3_ctx->ep[clnt_hdl].cfg.hdr);
 	}
 
-	IPA_ACTIVE_CLIENTS_INC_EP(ipa3_get_client_mapping(clnt_hdl));
-
 	ep_md_reg_wrt = *ep_md;
 	qmap_id = (ep_md->qmap_id <<
 		IPA_ENDP_INIT_HDR_METADATA_n_MUX_ID_SHFT) &