mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ziyang Xuan (William)" <william.xuanziyang@huawei.com>
To: Oliver Hartkopp <socketcan@hartkopp.net>, <mkl@pengutronix.de>,
	<edumazet@google.com>, <kuba@kernel.org>,
	<linux-can@vger.kernel.org>, <netdev@vger.kernel.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] can: bcm: check the result of can_send() in bcm_can_tx()
Date: Thu, 8 Sep 2022 20:09:06 +0800	[thread overview]
Message-ID: <88a5cdf5-d8e3-3822-7864-80aecf3c4ac3@huawei.com> (raw)
In-Reply-To: <1caf3e52-c862-e702-c833-153f130b790a@hartkopp.net>

> Sorry, but NACK.
> 
> The curr_frame counter handles the sequence counter of multiplex messages.
> 
> Even when this single send attempt failed the curr_frame counter has to continue.
> 
> For that reason the comment about statistics *before* the curr_frame++ might be misleading.
> 
> A potential improvement could be:
> 
>     if (!(can_send(skb, 1)))
>         op->frames_abs++;
> 
>     op->currframe++;
> 
> But as op->frames_abs is a functional unused(!) value for tx ops and only displayed via procfs I would NOT tag such improvement as a 'fix' which might then be queued up for stable.
> 
I will modify and remove 'Fixes' tag in v2.

Thank you for your review.

> This could be something for the can-next tree ...
> 
> Best regards,
> Oliver
> 
> 
> On 08.09.22 05:04, Ziyang Xuan wrote:
>> If can_send() fail, it should not update statistics in bcm_can_tx().
>> Add the result check for can_send() in bcm_can_tx().
>>
>> Fixes: ffd980f976e7 ("[CAN]: Add broadcast manager (bcm) protocol")
>> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
>> ---
>>   net/can/bcm.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/can/bcm.c b/net/can/bcm.c
>> index e2783156bfd1..8f5d704a409f 100644
>> --- a/net/can/bcm.c
>> +++ b/net/can/bcm.c
>> @@ -298,7 +298,8 @@ static void bcm_can_tx(struct bcm_op *op)
>>       /* send with loopback */
>>       skb->dev = dev;
>>       can_skb_set_owner(skb, op->sk);
>> -    can_send(skb, 1);
>> +    if (can_send(skb, 1))
>> +        goto out;
>>         /* update statistics */
>>       op->currframe++;
> .

  reply	other threads:[~2022-09-08 12:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-08  3:04 [PATCH 0/2] can: bcm: random optimizations Ziyang Xuan
2022-09-08  3:04 ` [PATCH 1/2] can: bcm: registration process optimization in bcm_module_init() Ziyang Xuan
2022-09-08  7:10   ` Oliver Hartkopp
2022-09-08  7:17     ` Oliver Hartkopp
2022-09-08 11:14       ` Ziyang Xuan (William)
2022-09-08 13:05         ` Oliver Hartkopp
2022-09-09  3:58           ` Ziyang Xuan (William)
2022-09-09 15:04             ` Oliver Hartkopp
2022-09-12 12:00               ` Marc Kleine-Budde
2022-09-12 14:54                 ` Oliver Hartkopp
2022-09-14  6:42                   ` Ziyang Xuan (William)
2022-09-08  3:04 ` [PATCH 2/2] can: bcm: check the result of can_send() in bcm_can_tx() Ziyang Xuan
2022-09-08  6:47   ` Oliver Hartkopp
2022-09-08 12:09     ` Ziyang Xuan (William) [this message]
2022-09-12 12:02     ` Marc Kleine-Budde

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=88a5cdf5-d8e3-3822-7864-80aecf3c4ac3@huawei.com \
    --to=william.xuanziyang@huawei.com \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=socketcan@hartkopp.net \
    /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

all inboxes | Powered by JetHome®