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

Commit 5e4c2fa6 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 b74fdea5 173aac5a
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1140,6 +1140,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");
@@ -1184,6 +1185,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 */
@@ -1195,6 +1197,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) {
@@ -1202,6 +1205,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 */
@@ -1230,6 +1234,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;
}

@@ -2728,6 +2733,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");

@@ -2737,26 +2743,26 @@ 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;
	}

	/* Make sure that there is no Tx operation ongoing */
	netif_stop_queue(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