lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMZ6RqKn4PjYsE+MJHM36KPjcJX_RzW6cLtxyc94DWFz__AuQA@mail.gmail.com>
Date:   Wed, 24 Nov 2021 08:21:26 +0900
From:   Vincent MAILHOL <mailhol.vincent@...adoo.fr>
To:     Oliver Hartkopp <socketcan@...tkopp.net>
Cc:     Marc Kleine-Budde <mkl@...gutronix.de>, linux-can@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
        Jimmy Assarsson <extja@...ser.com>,
        Nicolas Ferre <nicolas.ferre@...rochip.com>,
        Alexandre Belloni <alexandre.belloni@...tlin.com>,
        Ludovic Desroches <ludovic.desroches@...rochip.com>,
        Chandrasekar Ramakrishnan <rcsekar@...sung.com>,
        Maxime Ripard <mripard@...nel.org>,
        Chen-Yu Tsai <wens@...e.org>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        Appana Durga Kedareswara rao <appana.durga.rao@...inx.com>,
        Naga Sureshkumar Relli <naga.sureshkumar.relli@...inx.com>,
        Michal Simek <michal.simek@...inx.com>,
        Stephane Grosjean <s.grosjean@...k-system.com>
Subject: Re: [PATCH v1 1/2] can: do not increase rx statistics when receiving
 CAN error frames

On Wed. 24 Nov. 2021 à 06:01, Oliver Hartkopp <socketcan@...tkopp.net> wrote:
> On 23.11.21 12:53, Vincent Mailhol wrote:
> > CAN error skb is an interface specific to socket CAN. The CAN error
> > skb does not correspond to any actual CAN frame sent on the wire. Only
> > an error flag and a delimiter are transmitted when an error occurs
> > (c.f. ISO 11898-1 section 10.4.4.2 "Error flag").
> >
> > For this reason, it makes no sense to increment the rx_packets and
> > rx_bytes fields of struct net_device_stats because no actual payload
> > were transmitted on the wire.
> >
>
> (..)
>
> > diff --git a/drivers/net/can/dev/rx-offload.c b/drivers/net/can/dev/rx-offload.c
> > index 37b0cc65237b..bb47e9a49240 100644
> > --- a/drivers/net/can/dev/rx-offload.c
> > +++ b/drivers/net/can/dev/rx-offload.c
> > @@ -54,8 +54,10 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota)
> >               struct can_frame *cf = (struct can_frame *)skb->data;
> >
> >               work_done++;
> > -             stats->rx_packets++;
> > -             stats->rx_bytes += cf->len;
> > +             if (!(cf->can_id & CAN_ERR_MASK)) {
>
> This looks wrong.

And it is.

> Did you think of CAN_ERR_FLAG ??

Yes, I will fix this in v2.

> > +                     stats->rx_packets++;
> > +                     stats->rx_bytes += cf->len;
> > +             }
> >               netif_receive_skb(skb);
>
> (..)
>
> > diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
> > index 1679cbe45ded..d582c39fc8d0 100644
> > --- a/drivers/net/can/usb/ucan.c
> > +++ b/drivers/net/can/usb/ucan.c
> > @@ -621,8 +621,10 @@ static void ucan_rx_can_msg(struct ucan_priv *up, struct ucan_message_in *m)
> >               memcpy(cf->data, m->msg.can_msg.data, cf->len);
> >
> >       /* don't count error frames as real packets */
> > -     stats->rx_packets++;
> > -     stats->rx_bytes += cf->len;
> > +     if (!(cf->can_id & CAN_ERR_FLAG)) {
>
> Ah, here we are :-)

Thank you!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ