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

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

Merge "msm: ipa3: Fix to race condition in rmnet ap suspend"

parents dda7aa43 5fd4d1d3
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1149,6 +1149,7 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
	int ret = 0;
	bool qmap_check;
	struct ipa3_wwan_private *wwan_ptr = netdev_priv(dev);
	unsigned long flags;

	if (ipa3_ctx->platform_type == IPA_PLAT_TYPE_APQ) {
		IPAWANERR_RL("IPA embedded data on APQ platform\n");
@@ -1194,6 +1195,7 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
	}

send:
	spin_lock_irqsave(&wwan_ptr->lock, flags);
	/* IPA_RM checking start */
	if (ipa3_ctx->use_ipa_pm) {
		/* activate the modem pm for clock scaling */
@@ -1205,6 +1207,7 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
	}
	if (ret == -EINPROGRESS) {
		netif_stop_queue(dev);
		spin_unlock_irqrestore(&wwan_ptr->lock, flags);
		return NETDEV_TX_BUSY;
	}
	if (ret) {
@@ -1212,6 +1215,7 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
		       dev->name, ret);
		dev_kfree_skb_any(skb);
		dev->stats.tx_dropped++;
		spin_unlock_irqrestore(&wwan_ptr->lock, flags);
		return -EFAULT;
	}
	/* IPA_RM checking end */
@@ -1240,6 +1244,7 @@ static int ipa3_wwan_xmit(struct sk_buff *skb, struct net_device *dev)
				IPA_RM_RESOURCE_WWAN_0_PROD);
		}
	}
	spin_unlock_irqrestore(&wwan_ptr->lock, flags);
	return ret;
}

@@ -2742,6 +2747,7 @@ static int rmnet_ipa_ap_suspend(struct device *dev)
	struct net_device *netdev = IPA_NETDEV();
	struct ipa3_wwan_private *wwan_ptr;
	int ret;
	unsigned long flags;

	IPAWANDBG("Enter...\n");

@@ -2751,20 +2757,19 @@ static int rmnet_ipa_ap_suspend(struct device *dev)
		goto bail;
	}

	netif_tx_lock_bh(netdev);
	wwan_ptr = netdev_priv(netdev);
	if (wwan_ptr == NULL) {
		IPAWANERR("wwan_ptr is NULL.\n");
		ret = 0;
		netif_tx_unlock_bh(netdev);
		goto bail;
	}

	spin_lock_irqsave(&wwan_ptr->lock, flags);
	/* Do not allow A7 to suspend in case there are outstanding packets */
	if (atomic_read(&wwan_ptr->outstanding_pkts) != 0) {
		IPAWANDBG("Outstanding packets, postponing AP suspend.\n");
		ret = -EAGAIN;
		netif_tx_unlock_bh(netdev);
		spin_unlock_irqrestore(&wwan_ptr->lock, flags);
		goto bail;
	}

@@ -2773,7 +2778,8 @@ static int rmnet_ipa_ap_suspend(struct device *dev)
	/* Stoppig Watch dog timer when pipe was in suspend state */
	if (del_timer(&netdev->watchdog_timer))
		dev_put(netdev);
	netif_tx_unlock_bh(netdev);
	spin_unlock_irqrestore(&wwan_ptr->lock, flags);

	if (ipa3_ctx->use_ipa_pm)
		ipa_pm_deactivate_sync(rmnet_ipa3_ctx->pm_hdl);
	else