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

Commit 2152ba96 authored by Mayank Rana's avatar Mayank Rana
Browse files

usb: gadget: gsi: Handle EVT_HOST_READY event in STATE_INITIALIZED state



'commit 5b42bd74 ("usb: gadget: gsi: Optimize TRB's buffer allocation
functionality")' removed handling of EVT_HOST_READY event with state
STATE_INITIALIZED to optimized USB GSI state machine. This handling is
required for specifically when RNDIS interface is being enabled through
device manager, otherwise RNDIS interface doesn't get private IP address
back. Fix this issue by adding back handling of EVT_HOST_READY event with
state STATE_INITIALIZED.

CRs-Fixed: 1050838
Change-Id: I7010005b37b4709f54de58d52a56cb7f5e88bd08
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent d5fa91ad
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -796,6 +796,31 @@ static void ipa_work_handler(struct work_struct *w)
			d_port->sm_state = STATE_CONNECT_IN_PROGRESS;
			log_event_dbg("%s: ST_INIT_EVT_CONN_IN_PROG",
					__func__);
		} else if (event == EVT_HOST_READY) {
			/*
			 * When in a composition such as RNDIS + ADB,
			 * RNDIS host sends a GEN_CURRENT_PACKET_FILTER msg
			 * to enable/disable flow control eg. during RNDIS
			 * adaptor disable/enable from device manager.
			 * In the case of the msg to disable flow control,
			 * connect IPA channels and enable data path.
			 * EVT_HOST_READY is posted to the state machine
			 * in the handler for this msg.
			 */
			usb_gadget_autopm_get(d_port->gadget);
			log_event_dbg("%s: get = %d", __func__,
				atomic_read(&gad_dev->power.usage_count));
			/* allocate buffers used with each TRB */
			ret = gsi_alloc_trb_buffer(gsi);
			if (ret) {
				log_event_err("%s: gsi_alloc_trb_failed\n",
								__func__);
				break;
			}
			ipa_connect_channels(d_port);
			ipa_data_path_enable(d_port);
			d_port->sm_state = STATE_CONNECTED;
			log_event_dbg("%s: ST_INIT_EVT_HOST_READY", __func__);
		}
		break;
	case STATE_CONNECT_IN_PROGRESS: