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

Commit 4199b1fe authored by Lena Salman's avatar Lena Salman
Browse files

usb: gadget: Fix problem with disable/enable RNDIS interface



RNDIS interface would not get IP after disable/enable via device
manager. The problem was due to non-reset of the trigger with the IPA
in this flow and the fact that infinite transfers were not stopped.
In this change we reset the trigger and remove the infinite transfers.

CRs-fixed:  673591
Change-Id: I434c47796f00e0abbda2b8945e72fcd9c1add644
Signed-off-by: default avatarLena Salman <esalman@codeaurora.org>
parent f3406196
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -1050,6 +1050,23 @@ bool is_rndis_ipa_supported(void)
	return rndis_ipa_supported;
}

void rndis_ipa_reset_trigger(void)
{
	struct f_rndis_qc *rndis;
	unsigned long flags;

	spin_lock_irqsave(&rndis_lock, flags);
	rndis = _rndis_qc;
	if (!rndis) {
		pr_err("%s: No RNDIS instance", __func__);
		spin_unlock_irqrestore(&rndis_lock, flags);
		return;
	}

	rndis->net_ready_trigger = false;
	spin_unlock_irqrestore(&rndis_lock, flags);
}

/*
 * Callback let RNDIS_IPA trigger us when network interface is up
 * and userspace is ready to answer DHCP requests
+7 −1
Original line number Diff line number Diff line
@@ -1177,9 +1177,15 @@ void u_bam_data_stop_rndis_ipa(void)
{
	pr_debug("%s\n", __func__);

	if (is_ipa_rndis_net_on)
	if (is_ipa_rndis_net_on) {
		struct bam_data_port *port =
			bam2bam_data_ports[RNDIS_QC_ACTIVE_PORT];

		rndis_ipa_reset_trigger();
		bam_data_stop_endless_tx(port);
		queue_work(bam_data_wq, rndis_disconn_w);
	}
}

void bam_data_disconnect(struct data_port *gr, u8 port_num)
{