devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Ayush Singh <ayushdevel1325@gmail.com>, greybus-dev@lists.linaro.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org,
	Vaishnav M A <vaishnav@beagleboard.org>,
	Jason Kridner <jkridner@beagleboard.org>,
	Nishanth Menon <nm@ti.com>
Subject: Re: [PATCH v4 2/3] greybus: Add BeaglePlay Linux Driver
Date: Wed, 6 Sep 2023 11:59:14 +0200	[thread overview]
Message-ID: <608ddca9-4ab8-1aef-767f-92a90e7e0970@kernel.org> (raw)
In-Reply-To: <1bbe7772-09f4-6c5a-8c4d-c88988b34c99@gmail.com>

On 05/09/2023 18:27, Ayush Singh wrote:
>>> +static void hdlc_handle_rx_frame(struct gb_beagleplay *bg)
>>> +{
>>> +	u8 address = bg->rx_buffer[0];
>>> +	char *buffer = &bg->rx_buffer[2];
>>> +	size_t buffer_len = bg->rx_buffer_len - 4;
>>> +
>>> +	switch (address) {
>>> +	case ADDRESS_DBG:
>>> +		hdlc_handle_dbg_frame(bg, buffer, buffer_len);
>>> +		break;
>>> +	case ADDRESS_GREYBUS:
>>> +		hdlc_handle_greybus_frame(bg, buffer, buffer_len);
>>> +		break;
>>> +	default:
>>> +		dev_warn(&bg->serdev->dev, "Got Unknown Frame %u", address);
>> ratelimit
>> Probably as well in several places with possible flooding.
> 
> I don't think `hdlc_handle_rx_frame` is the correct place since it only 
> processes a single completed HDLC frame.  The more appropriate place 
> would be `hdlc_rx` if we want to limit based on the number of HDLC 
> frames or `gb_beagleplay_tty_receive` to limit based on the number of bytes.
> 
> I would like to ask, though, why is rate limiting required here? Won't 
> `serdev_device_ops->receive_buf` already rate limit the number of bytes 
> somewhat? Or is it related to blocking in the 
> `serdev_device_ops->receive_buf` callback? In the case of latter, it 
> would probably make sense to ratelimit based on number of frames, I think.

My comment might not be accurate, so I do not insist. The name of the
function suggested something being called very often (on every frame),
thus you would print warning also very often.

Best regards,
Krzysztof


  reply	other threads:[~2023-09-06 10:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-02 18:28 [PATCH v4 0/3] greybus: Add BeaglePlay Greybus Driver Ayush Singh
2023-09-02 18:28 ` [PATCH v4 1/3] dt-bindings: Add beaglecc1352 Ayush Singh
2023-09-04  7:14   ` Krzysztof Kozlowski
2023-09-06 16:47     ` Ayush Singh
2023-09-11  6:23       ` Krzysztof Kozlowski
2023-09-02 18:28 ` [PATCH v4 2/3] greybus: Add BeaglePlay Linux Driver Ayush Singh
2023-09-04  7:19   ` Krzysztof Kozlowski
2023-09-05 16:27     ` Ayush Singh
2023-09-06  9:59       ` Krzysztof Kozlowski [this message]
2023-09-06 10:33         ` Ayush Singh
2023-09-06 21:05   ` kernel test robot
2023-09-02 18:28 ` [PATCH v4 3/3] dts: ti: k3-am625-beagleplay: Add beaglecc1352 Ayush Singh
2023-09-04  7:20   ` Krzysztof Kozlowski
2023-09-13 12:57 ` [PATCH v4 0/3] greybus: Add BeaglePlay Greybus Driver Jason Kridner

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=608ddca9-4ab8-1aef-767f-92a90e7e0970@kernel.org \
    --to=krzk@kernel.org \
    --cc=ayushdevel1325@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=jkridner@beagleboard.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=vaishnav@beagleboard.org \
    /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;
as well as URLs for NNTP newsgroup(s).