Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp235382rwn; Thu, 8 Sep 2022 00:14:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR5g6RxiMrc1C94jpMJcbT1Gy05Ekz55L7qAEwwUCMqzmrFFR1R9JI7gUFRBQMwc543qCvgL X-Received: by 2002:aa7:cc97:0:b0:445:afab:2634 with SMTP id p23-20020aa7cc97000000b00445afab2634mr5989433edt.54.1662621286028; Thu, 08 Sep 2022 00:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662621286; cv=none; d=google.com; s=arc-20160816; b=Wx6kBjpxTsslECUWdkueA4GrFJvw5FaievEQ1kZL4Uq3ymwEIYeOXxwFaSZxk/JH0e Jr8RksW/M//ZiywN9t7LbifKkh74KzbVcjFLEiCnfaRjl17DBcmmgM0HhmDAdA4EhnUY U6H+KzOxA6kwmO8OfenIr3Ra8DUQ7ZqMZuIFC1AMClkhFAlZxm5YAKyITi1y5wcse+ms LLFiv7na3tTJMhSBnOdzCf5nSTT9+X2pD7fYmd5Jm7muaBFyIo6OCyOm/A0vikom+1pc U8EQtmLHijjr15vzilJ0OyaWnKP8hEAwj1bQGvNPqzGcDdDYmN1OQNTwvJ8UbNVtGTdy 3hpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=O1xo/jjb+NdYDRz2qFvm3F+/OFhapvqfEg6EDCRFB44=; b=M5S4pxrGPP7HDXsuLzqeVbneYBnXheYhFMet6KIsY5M9EZDl78f6TIAqVAWjfxO+pT SGbEP9lDl3dCbq/R88+qH7cNgsFWzCiJdd76YooQsI90Os3opHyAw8+tVb7EbTM+tz7K E0yMYvVUA0tvlysDsC8lfZ+dMaR0T2oapzaQBxGAEGh9aSlECN0eQF7ANFvfr/o5NG10 36nzIxbLyziNCSzXSyjiXM/Ye5R31PvC5i7DzGYg9Gz4w7yEnFV2SnBFv9oUqe3jfE4l car3yqvTP7VuE/i+jRDItQZWUSm0VFg4u4uxu47rDgVeC7B7jsl4c+BP6XBHjyno7EzG 5f8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=qq2fYL4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji16-20020a170907981000b0073d71124609si1391742ejc.182.2022.09.08.00.14.19; Thu, 08 Sep 2022 00:14:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@hartkopp.net header.s=strato-dkim-0002 header.b=qq2fYL4p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=hartkopp.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbiIHGtI (ORCPT + 99 others); Thu, 8 Sep 2022 02:49:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231132AbiIHGsr (ORCPT ); Thu, 8 Sep 2022 02:48:47 -0400 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [81.169.146.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08DE3D2B0D; Wed, 7 Sep 2022 23:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1662619683; s=strato-dkim-0002; d=hartkopp.net; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=O1xo/jjb+NdYDRz2qFvm3F+/OFhapvqfEg6EDCRFB44=; b=qq2fYL4pMNxmi56Dy/4bW3/tUO9k27iILB5jy82RXy9tclbWVfP9uRnUJVrRqnQGY2 5RNy7PT6CBq0Hw30j+233F4+KVQp1bUB5YRKqaNZP+33eL7cDMD9EeZh5ZDhFt/vTGLN KxRxmEngDJPQbSO1svem5rUIxz2eZ61X3gMce1gSxtJ7izcGs58u6yO2G+5jtRbmfW+m IMPhqHx6YHSvu/Q3a9YH1mON16n6ZpZ7mqW13Vim2H9h3ctlvA9jwh1cKxoeK/m3Fqgg YNeoXnAu/tTTaUc4IBYZoSZOSWIH3CbAbzWIlNdgZBqtccOKvnchAN5Ihp/NB2yNV1qX mK5A== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P2MHfkW8eP4Mre39l357AZT/I7AY/7nT2yrDxb8mjG14FZxedJy6qgO1qCHSa1GLptZHusx3hdIrpKytJSr63tDxrw==" X-RZG-CLASS-ID: mo00 Received: from [IPV6:2a00:6020:1cfd:d100::b82] by smtp.strato.de (RZmta 48.0.2 AUTH) with ESMTPSA id wfa541y886m3685 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Thu, 8 Sep 2022 08:48:03 +0200 (CEST) Message-ID: <1caf3e52-c862-e702-c833-153f130b790a@hartkopp.net> Date: Thu, 8 Sep 2022 08:47:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 2/2] can: bcm: check the result of can_send() in bcm_can_tx() Content-Language: en-US To: Ziyang Xuan , mkl@pengutronix.de, edumazet@google.com, kuba@kernel.org, linux-can@vger.kernel.org, netdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org References: <5c0f2f1bd1dc7bbb9500afd4273e36378e00a35d.1662606045.git.william.xuanziyang@huawei.com> From: Oliver Hartkopp In-Reply-To: <5c0f2f1bd1dc7bbb9500afd4273e36378e00a35d.1662606045.git.william.xuanziyang@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 > --- > 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++;