Thread (8 messages) 8 messages, 2 authors, 2021-11-25

Re: [PATCH v2 4/5] can: do not increase rx_bytes statistics for RTR frames

flat view

From: Oliver Hartkopp <socketcan@hartkopp.net>
Date: 2021-11-25 18:52:15
Also in: linux-can, linux-sunxi, lkml, netdev

Hi Vincent,

On 25.11.21 18:20, Vincent Mailhol wrote:
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index d582c39fc8d0..717d4925fdb0 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -619,12 +619,13 @@ static void ucan_rx_can_msg(struct ucan_priv *up, struct ucan_message_in *m)
  	/* copy the payload of non RTR frames */
  	if (!(cf->can_id & CAN_RTR_FLAG) || (cf->can_id & CAN_ERR_FLAG))
  		memcpy(cf->data, m->msg.can_msg.data, cf->len);
+	/* only frames which are neither RTR nor ERR have a payload */
+	else
+		stats->rx_bytes += cf->len;
This 'else' path looks wrong ...
quoted hunk ↗ jump to hunk
  
  	/* don't count error frames as real packets */
-	if (!(cf->can_id & CAN_ERR_FLAG)) {
+	if (!(cf->can_id & CAN_ERR_FLAG))
  		stats->rx_packets++;
-		stats->rx_bytes += cf->len;
-	}
  
  	/* pass it to Linux */
  	netif_rx(skb);
Regards,
Oliver

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help