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

Commit ec968541 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "soc: qcom: glink: Introduce RX intent request timeout in SSR"

parents 8f3cd33d 04ec5fe1
Loading
Loading
Loading
Loading
+36 −10
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ struct glink_core_xprt_ctx {
 * @int_req_ack:		Remote side intent request ACK state
 * @int_req_ack_complete:	Intent tracking completion - received remote ACK
 * @int_req_complete:		Intent tracking completion - received intent
 * @rx_intent_req_timeout_jiffies:	Timeout for requesting an RX intent, in
 *			jiffies; if set to 0, timeout is infinite
 *
 * @local_rx_intent_lst_lock_lhc1:	RX intent list lock
 * @local_rx_intent_list:		Active RX Intents queued by client
@@ -244,6 +246,7 @@ struct channel_ctx {
	bool int_req_ack;
	struct completion int_req_ack_complete;
	struct completion int_req_complete;
	unsigned long rx_intent_req_timeout_jiffies;

	spinlock_t local_rx_intent_lst_lock_lhc1;
	struct list_head local_rx_intent_list;
@@ -2401,6 +2404,8 @@ void *glink_open(const struct glink_open_config *cfg)

	/* initialize port structure */
	ctx->user_priv = cfg->priv;
	ctx->rx_intent_req_timeout_jiffies =
		msecs_to_jiffies(cfg->rx_intent_req_timeout_ms);
	ctx->notify_rx = cfg->notify_rx;
	ctx->notify_tx_done = cfg->notify_tx_done;
	ctx->notify_state = cfg->notify_state;
@@ -2421,6 +2426,9 @@ void *glink_open(const struct glink_open_config *cfg)
	if (!ctx->notify_tx_abort)
		ctx->notify_tx_abort = glink_dummy_notify_tx_abort;

	if (!ctx->rx_intent_req_timeout_jiffies)
		ctx->rx_intent_req_timeout_jiffies = MAX_SCHEDULE_TIMEOUT;

	ctx->local_xprt_req = best_id;
	ctx->no_migrate = cfg->transport &&
				!(cfg->options & GLINK_OPT_INITIAL_XPORT);
@@ -2712,7 +2720,16 @@ static int glink_tx_common(void *handle, void *pkt_priv,
			}

			/* wait for the remote intent req ack */
			wait_for_completion(&ctx->int_req_ack_complete);
			if (!wait_for_completion_timeout(
					&ctx->int_req_ack_complete,
					ctx->rx_intent_req_timeout_jiffies)) {
				GLINK_ERR_CH(ctx,
					"%s: Intent request ack with size: %zu not granted for lcid\n",
					__func__, size);
				rwref_put(&ctx->ch_state_lhc0);
				return -ETIMEDOUT;
			}

			if (!ctx->int_req_ack) {
				GLINK_ERR_CH(ctx,
				    "%s: Intent Request with size: %zu %s",
@@ -2723,7 +2740,16 @@ static int glink_tx_common(void *handle, void *pkt_priv,
			}

			/* wait for the rx_intent from remote side */
			wait_for_completion(&ctx->int_req_complete);
			if (!wait_for_completion_timeout(
					&ctx->int_req_complete,
					ctx->rx_intent_req_timeout_jiffies)) {
				GLINK_ERR_CH(ctx,
					"%s: Intent request with size: %zu not granted for lcid\n",
					__func__, size);
				rwref_put(&ctx->ch_state_lhc0);
				return -ETIMEDOUT;
			}

			reinit_completion(&ctx->int_req_complete);
			if (!ch_is_fully_opened(ctx)) {
				GLINK_ERR_CH(ctx,
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include "glink_private.h"

#define GLINK_SSR_REPLY_TIMEOUT	HZ
#define GLINK_SSR_INTENT_REQ_TIMEOUT_MS 500
#define GLINK_SSR_EVENT_INIT ~0
#define NUM_LOG_PAGES 3

@@ -642,6 +643,7 @@ static int configure_and_open_channel(struct subsys_info *ss_info)
	open_cfg.notify_state = glink_ssr_notify_state;
	open_cfg.notify_rx_intent_req = glink_ssr_notify_rx_intent_req;
	open_cfg.priv = ss_info->cb_data;
	open_cfg.rx_intent_req_timeout_ms = GLINK_SSR_INTENT_REQ_TIMEOUT_MS;

	handle = glink_open(&open_cfg);
	if (IS_ERR_OR_NULL(handle)) {
+12 −9
Original line number Diff line number Diff line
@@ -45,12 +45,14 @@ enum {
 *
 * priv:			Private data passed into user callbacks
 * options:			Open option flags
 * rx_intent_req_timeout_ms:	Timeout for requesting an RX intent, in
 *			milliseconds; if set to 0, timeout is infinite
 * notify_rx:			Receive notification function (required)
 * notify_tx_done:		Transmit-done notification function (required)
 * notify_state:		State-change notification (required)
 * notify_rx_intent_req:	Receive intent request (optional)
 * notify_rxv:	Receive notification function for vector buffers (required if
 *		notify_rx is not provided)
 * notify_rxv:			Receive notification function for vector buffers
 *			(required if notify_rx is not provided)
 * notify_sig:			Signal-change notification (optional)
 * notify_rx_tracer_pkt:	Receive notification for tracer packet
 * notify_remote_rx_intent:	Receive notification for remote-queued RX intent
@@ -67,6 +69,7 @@ struct glink_open_config {
	const char *transport;
	const char *edge;
	const char *name;
	unsigned int rx_intent_req_timeout_ms;

	void (*notify_rx)(void *handle, const void *priv, const void *pkt_priv,
			const void *ptr, size_t size);