[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <608ddca9-4ab8-1aef-767f-92a90e7e0970@kernel.org>
Date: Wed, 6 Sep 2023 11:59:14 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Ayush Singh <ayushdevel1325@...il.com>,
greybus-dev@...ts.linaro.org
Cc: devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org,
Vaishnav M A <vaishnav@...gleboard.org>,
Jason Kridner <jkridner@...gleboard.org>,
Nishanth Menon <nm@...com>
Subject: Re: [PATCH v4 2/3] greybus: Add BeaglePlay Linux Driver
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
Powered by blists - more mailing lists