From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753813AbbAIDHK (ORCPT ); Thu, 8 Jan 2015 22:07:10 -0500 Received: from mail-wi0-f175.google.com ([209.85.212.175]:62274 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509AbbAIDHG (ORCPT ); Thu, 8 Jan 2015 22:07:06 -0500 Date: Fri, 9 Jan 2015 05:06:57 +0200 From: "Ahmed S. Darwish" To: Marc Kleine-Budde Cc: Olivier Sobrie , Oliver Hartkopp , Wolfgang Grandegger , "David S. Miller" , Paul Gortmaker , Linux-CAN , netdev , LKML Subject: Re: [PATCH v3 4/4] can: kvaser_usb: Add support for the Usbcan-II family Message-ID: <20150109030657.GA1791@vivalin-002> References: <20141223154654.GB6460@vivalin-002> <20150105174910.GA6304@linux> <20150105175206.GB6304@linux> <20150105175713.GC6304@linux> <20150105183131.GD6304@linux> <54AE6FC1.6050007@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54AE6FC1.6050007@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 08, 2015 at 12:53:37PM +0100, Marc Kleine-Budde wrote: > On 01/05/2015 07:31 PM, Ahmed S. Darwish wrote: > > [...] > > > > cf->can_id |= CAN_ERR_CRTL; > > cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; > > > > stats->rx_over_errors++; > > stats->rx_errors++; > > > > netif_rx(skb); > > > > stats->rx_packets++; > > stats->rx_bytes += cf->can_dlc; > > Another patch would be not to touch cf after netif_rx(), please move the stats handling before calling netif_rx(). Same applies to the kvaser_usb_rx_can_msg() function. > BTW, is it guaranteed from the SocketCAN stack that netif_rx() will never return NET_RX_DROPPED? Because if no guarantee exists, I guess below fragment cannot be completely correct? stats->rx_packets++; stats->rx_bytes += cf->can_dlc; netif_rx(skb); On the other hand, I don't see evan a single CAN driver checking netif_rx() return value, so maybe such a check is an overkill... Thanks, Darwish