public inbox for ofono@lists.linux.dev
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: Grant Erickson <gerickson@nuovations.com>, ofono@lists.linux.dev
Subject: Re: [PATCH v3 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data'.
Date: Fri, 14 Feb 2025 09:29:42 -0600	[thread overview]
Message-ID: <bee3deed-8285-4452-9c14-c40b60c06ade@gmail.com> (raw)
In-Reply-To: <31c04f926af6ddfe0e244c2d6b0999ee9442659a.1739509438.git.gerickson@nuovations.com>

Hi Grant,

 >   struct qmi_qmux_device {
> @@ -653,8 +665,25 @@ static bool can_write_data(struct l_io *io, void *user_data)
>   {
>   	struct qmi_transport *transport = user_data;
>   	struct qmi_request *req;
> +	const bool throttle_enabled = transport->min_req_period_us > 0;
> +	uint64_t now = 0;

I think this is still wrong?  There's a reason why we have doc/coding-style.txt 
item M7.

> +	uint64_t delta;
>   	int r;
>   
> +	/*
> +	 * Determine if we need to rate-limit commands to a
> +	 * transport-specific minimum request period. If so,
> +	 * return true so that the queue can be retried again
> +	 * later.
> +	 */
> +	if (throttle_enabled && transport->last_req_sent_time_us != 0) {

Consider the starting condition:

- last_req_sent_time_us -> zero
- throttle_enabled -> true

We don't enter into this if(), 'now' is still zero.

> +		now = l_time_now();
> +		delta = l_time_diff(now, transport->last_req_sent_time_us);
> +
> +		if (delta < transport->min_req_period_us)
> +			return true;
> +	}
> +
>   	req = l_queue_pop_head(transport->req_queue);
>   	if (!req)
>   		return false;
> @@ -665,6 +694,9 @@ static bool can_write_data(struct l_io *io, void *user_data)
>   		return false;
>   	}
>   
> +	if (throttle_enabled)
> +		transport->last_req_sent_time_us = now;
> +

throttle_enabled is true, we set last_req_sent_time_us to 0.  In effect your 
throttling doesn't work...?

>   	if (l_queue_length(transport->req_queue) > 0)
>   		return true;
>   

Regards,
-Denis

  reply	other threads:[~2025-02-14 15:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-14  5:04 [PATCH v3 0/7] Add QMI Device Service Request Rate-limit Option Grant Erickson
2025-02-14  5:04 ` [PATCH v3 1/7] qmi: Added enumeration for device quirk flags Grant Erickson
2025-02-14  5:04 ` [PATCH v3 2/7] qmi: Added structure for device options Grant Erickson
2025-02-14  5:04 ` [PATCH v3 3/7] qmi: Added device options parameter to 'qmi_qmux_device_new' Grant Erickson
2025-02-14  5:04 ` [PATCH v3 4/7] qmi: Implement QMI service request rate limiting in 'can_write_data' Grant Erickson
2025-02-14 15:29   ` Denis Kenzior [this message]
2025-02-14 17:27     ` Grant Erickson
2025-02-14 21:12       ` Denis Kenzior
2025-02-14  5:04 ` [PATCH v3 5/7] qmi: Handle request rate limit option in 'qmi_qmux_device_new' Grant Erickson
2025-02-14  5:04 ` [PATCH v3 6/7] udevng: Set the QMI minimum service request period for Quectel BG96 modems Grant Erickson
2025-02-14  5:04 ` [PATCH v3 7/7] gobi: Pass QMI qmux device options to 'qmi_qmux_device_new' Grant Erickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bee3deed-8285-4452-9c14-c40b60c06ade@gmail.com \
    --to=denkenz@gmail.com \
    --cc=gerickson@nuovations.com \
    --cc=ofono@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox