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

Commit 77c9dfbb authored by Amir Samuelov's avatar Amir Samuelov Committed by Gerrit - the friendly Code Review server
Browse files

spcom: ignore notify-rx-abort after channel closed



When channel is connected we queue an rx buffer to be ready to receive
data from SP.
Also after each data received, we queue the next rx buffer.
When a channel is closed, or upon SSR, we get rx-abort notification.
However, a quick re-open after close, might get the rx-abort-notify
after a channel was opened, so we need to ignore it.
New rx buffer can be queued only after the channel is connected,
so ignore old rx-abort by checking if connected.

Change-Id: Ia61fd9a537bd72de983c2d3ff480e5c7eb14d65f
Signed-off-by: default avatarAmir Samuelov <amirs@codeaurora.org>
parent ade6ec4d
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -506,6 +506,7 @@ static void spcom_notify_state(void *handle, const void *priv,
		 * We do it here, ASAP, to allow rx data.
		 */

		ch->rx_abort = false; /* cleanup from previouse close */
		pr_debug("call glink_queue_rx_intent() ch [%s].\n", ch->name);
		ret = glink_queue_rx_intent(handle, ch, ch->rx_buf_size);
		if (ret) {
@@ -579,7 +580,10 @@ static bool spcom_notify_rx_intent_req(void *handle, const void *priv,
 * spcom_notify_rx_abort() - glink callback on aborting rx pending buffer.
 *
 * Rx abort may happen if channel is closed by remote side, while rx buffer is
 * pending in the queue.
 * pending in the queue, like upon SP reset (SSR).
 *
 * More common scenario, is when rx intent is queud (for next transfer),
 * and the channel is closed locally.
 */
static void spcom_notify_rx_abort(void *handle, const void *priv,
				  const void *pkt_priv)
@@ -593,7 +597,10 @@ static void spcom_notify_rx_abort(void *handle, const void *priv,

	pr_debug("ch [%s] pending rx aborted.\n", ch->name);

	if (spcom_is_channel_open(ch) && (!ch->rx_abort)) {
	/* ignore rx-abort after local channel disconect,
	 * so check that the channel is connected.
	 */
	if (spcom_is_channel_connected(ch) && (!ch->rx_abort)) {
		ch->rx_abort = true;
		complete_all(&ch->rx_done);
	}
@@ -953,6 +960,7 @@ static int spcom_rx(struct spcom_channel *ch,
		return -ETIMEDOUT;
	} else if (ch->rx_abort) {
		mutex_unlock(&ch->lock);
		pr_err("rx_abort, probably remote side reset (SSR).\n");
		return -ERESTART; /* probably SSR */
	} else if (ch->actual_rx_size) {
		pr_debug("actual_rx_size is [%zu]\n", ch->actual_rx_size);