Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp511592rwn; Thu, 8 Sep 2022 05:12:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Tle+42Q/mW8aytFtGl91Z1KuLptRQnv37V9M+F8er1KYGMxeG+6Y1qcmLuOV1yVPIaWUG X-Received: by 2002:a17:906:6a02:b0:730:9f44:2bff with SMTP id qw2-20020a1709066a0200b007309f442bffmr5898331ejc.209.1662639168021; Thu, 08 Sep 2022 05:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662639168; cv=none; d=google.com; s=arc-20160816; b=mhwu81nPSpZQnmnWjw0VT5WP5c9jYotVoj9mAFSihcaQDUcWPejHWsRC+3XjewTa3O o9tRbfpp6ltjH6EtsssxqaRNT+BR85JJEv3isRJXWuMETB3FX2De8x5okQkaBzTVjdka REAq9oe3lpPeJW+9orPapVytDo2p8qYW7E3qd7yTYdROpXrwiClJ6M769kNgOBED7tKQ sJ8xbcJwz6kpj5QxqwvwbeFaUBspTevbyjlZZT4zXwV3fOJsfYd6qK+WVUJ8V2JekmqF 8rKlWF12MuCMx1SA34AGTYsLu3wNh0ODhZis1VatuyL4sWd7lmrBrpRatnQqN0eFnLUM UDSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=/lCeR7u/GqB+wIUl9B47YrXwVD6fbq3Ofa4ORQ66r3k=; b=CMsnzeSv+oSN/a45wl3HoeMTWssLkTwsFF/oW+0Ka/m4B4s6KJ6Cphcr//kDpK8xxC 0U9TpXFUnZ8PVUBULDJ9PMn1p7L3t112k4RCkxnEwZ4ACSgbRAPgGAMBtN0nax5AjxF4 oLQsLn8RE2UHlgQ5de4UGoqKp9HaGURepcEnXHfho33vWfA4FBnEhJOSATbyyaAhc/EQ w8HjrT818udUch7XjR7bYzwuQJDxk4k4HciP8QVYWrQeq6VXuW7yf15oqsO4pYTgZw3z wC93AB/DNuwmdkoF6eGmoopaGX3A+VNM0HzxWN6kM9Glomd7CfWmcGN9hkynyHoWb5T6 0brg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z13-20020a056402274d00b00447ebf62410si15701175edd.2.2022.09.08.05.12.21; Thu, 08 Sep 2022 05:12:48 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231681AbiIHMKR (ORCPT + 99 others); Thu, 8 Sep 2022 08:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbiIHMJc (ORCPT ); Thu, 8 Sep 2022 08:09:32 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F14E11C168; Thu, 8 Sep 2022 05:09:12 -0700 (PDT) Received: from canpemm500006.china.huawei.com (unknown [172.30.72.55]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MNdCg4N2KzHnj3; Thu, 8 Sep 2022 20:07:11 +0800 (CST) Received: from [10.174.179.200] (10.174.179.200) by canpemm500006.china.huawei.com (7.192.105.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 8 Sep 2022 20:09:07 +0800 Subject: Re: [PATCH 2/2] can: bcm: check the result of can_send() in bcm_can_tx() To: Oliver Hartkopp , , , , , CC: References: <5c0f2f1bd1dc7bbb9500afd4273e36378e00a35d.1662606045.git.william.xuanziyang@huawei.com> <1caf3e52-c862-e702-c833-153f130b790a@hartkopp.net> From: "Ziyang Xuan (William)" Message-ID: <88a5cdf5-d8e3-3822-7864-80aecf3c4ac3@huawei.com> Date: Thu, 8 Sep 2022 20:09:06 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <1caf3e52-c862-e702-c833-153f130b790a@hartkopp.net> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.179.200] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500006.china.huawei.com (7.192.105.130) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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. > 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 >> --- >>   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++; > .