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

Commit 94d40313 authored by Sivan Reinstein's avatar Sivan Reinstein Committed by Matt Wagantall
Browse files

msm: ipa: discard outstanding packets completion on TX after SSR



Due to a new feature/mechanism in IPA2.6L of IPA HOLB mitigation,
after SSR during TX traffic scenarios, the previous outstanding
TX packets are being consumed by IPA, and IPA sends an indication to
the IPA WAN driver that the packets were consumed.
Since they're related to the previous driver instance (IPA WAN driver
is being unregistered and freed in SSR clean-up procedure),
they need to be released immediately and not processed in order to
avoid accessing a stale/invalid IPA WAN driver pointer.

CRs-Fixed: 828602
Change-Id: I158a76fc7b2769f2a3e4aa68545ed35b044812a7
Signed-off-by: default avatarSivan Reinstein <sivanr@codeaurora.org>
Acked-by: default avatarDavid Arinzon <darinzon@qti.qualcomm.com>
parent b6c5a911
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -1058,14 +1058,24 @@ static void apps_ipa_tx_complete_notify(void *priv,
{
	struct sk_buff *skb = (struct sk_buff *)data;
	struct net_device *dev = (struct net_device *)priv;
	struct wwan_private *wwan_ptr = netdev_priv(dev);
	struct wwan_private *wwan_ptr;

	if (evt != IPA_WRITE_DONE) {
		IPAWANERR("unsupported event on Tx callback\n");
		IPAWANDBG("unsupported event on Tx callback\n");
		return;
	}

	if (dev != ipa_netdevs[0]) {
		IPAWANDBG("Received pre-SSR packet completion\n");
		dev_kfree_skb_any(skb);
		return;
	}

	wwan_ptr = netdev_priv(dev);
	atomic_dec(&wwan_ptr->outstanding_pkts);
	__netif_tx_lock_bh(netdev_get_tx_queue(dev, 0));
	if (netif_queue_stopped(wwan_ptr->net) &&
	if (!atomic_read(&is_ssr) &&
		netif_queue_stopped(wwan_ptr->net) &&
		atomic_read(&wwan_ptr->outstanding_pkts) <
					(wwan_ptr->outstanding_low)) {
		IPAWANDBG("Outstanding low (%d) - waking up queue\n",
@@ -2090,10 +2100,11 @@ static int ssr_notifier_cb(struct notifier_block *this,
	if (ipa_rmnet_ctx.ipa_rmnet_ssr) {
		if (SUBSYS_BEFORE_SHUTDOWN == code) {
			pr_info("IPA received MPSS BEFORE_SHUTDOWN\n");
			atomic_set(&is_ssr, 1);
			ipa_q6_cleanup();
			netif_stop_queue(ipa_netdevs[0]);
			ipa_qmi_stop_workqueues();
			wan_ioctl_stop_qmi_messages();
			atomic_set(&is_ssr, 1);
			if (atomic_read(&is_initialized))
				platform_driver_unregister(&rmnet_ipa_driver);
			pr_info("IPA BEFORE_SHUTDOWN handling is complete\n");