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

Commit 8cb5e6bd authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam Committed by Matt Wagantall
Browse files

soc: qcom: glink_pkt: Add auto-intent queuing support



Glink_pkt driver clients have to call the new IOCTL to queue an intent
to receive the data from remote side.

To ensure compatibility with smd_pkt clients add auto-intent queuing
in the read() call when glink_pkt client fails to queue an intent.

Change-Id: Iee8fca114f47921788c19d40247a768038985daa
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent a77c58e8
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -2356,6 +2356,38 @@ int glink_queue_rx_intent(void *handle, const void *pkt_priv, size_t size)
}
EXPORT_SYMBOL(glink_queue_rx_intent);

/**
 * glink_rx_intent_exists() - Check if an intent exists.
 *
 * @handle:	handle returned by glink_open()
 * @size:	size of an intent to check or 0 for any intent
 *
 * Return:	TRUE if an intent exists with greater than or equal to the size
 *		else FALSE
 */
bool glink_rx_intent_exists(void *handle, size_t size)
{
	struct channel_ctx *ctx = (struct channel_ctx *)handle;
	struct glink_core_rx_intent *intent;
	unsigned long flags;

	if (!ctx || !ch_is_fully_opened(ctx))
		return false;

	spin_lock_irqsave(&ctx->local_rx_intent_lst_lock_lhc1, flags);
	list_for_each_entry(intent, &ctx->local_rx_intent_list, list) {
		if (size <= intent->intent_size) {
			spin_unlock_irqrestore(
				&ctx->local_rx_intent_lst_lock_lhc1, flags);
			return true;
		}
	}
	spin_unlock_irqrestore(&ctx->local_rx_intent_lst_lock_lhc1, flags);

	return false;
}
EXPORT_SYMBOL(glink_rx_intent_exists);

/**
 * glink_rx_done() - Return receive buffer to remote side.
 *
+9 −0
Original line number Diff line number Diff line
@@ -494,6 +494,15 @@ ssize_t glink_pkt_read(struct file *file,
		return -ENETRESET;
	}

	if (!glink_rx_intent_exists(devp->handle, count)) {
		ret  = glink_queue_rx_intent(devp->handle, devp, count);
		if (ret) {
			GLINK_PKT_ERR("%s: failed to queue_rx_intent ret[%d]\n",
					__func__, ret);
			return ret;
		}
	}

	GLINK_PKT_INFO("Begin %s on glink_pkt_dev id:%d buffer_size %zu\n",
		__func__, devp->i, count);

+16 −0
Original line number Diff line number Diff line
@@ -184,6 +184,17 @@ int glink_tx(void *handle, void *pkt_priv, void *data, size_t size,
 */
int glink_queue_rx_intent(void *handle, const void *pkt_priv, size_t size);

/**
 * glink_rx_intent_exists() - Check if an intent of size exists.
 *
 * @handle:	handle returned by glink_open()
 * @size:	size of an intent to check or 0 for any intent
 *
 * Return:	TRUE if an intent exists with greater than or equal to the size
 *		else FALSE
 */
bool glink_rx_intent_exists(void *handle, size_t size);

/**
 * glink_rx_done() - Return receive buffer to remote side.
 *
@@ -296,6 +307,11 @@ static inline int glink_queue_rx_intent(void *handle, const void *pkt_priv,
	return -ENODEV;
}

static inline bool glink_rx_intent_exists(void *handle, size_t size)
{
	return -ENODEV;
}

static inline int glink_rx_done(void *handle, const void *ptr, bool reuse)
{
	return -ENODEV;