case 0:
                /* transmission complete */
                netdev->stats.tx_packets++;
-               netdev->stats.tx_bytes += context->dlc;
+               netdev->stats.tx_bytes += context->data_len;
 
                /* prevent tx timeout */
                netdev->trans_start = jiffies;
        struct peak_usb_device *dev = netdev_priv(netdev);
        struct peak_tx_urb_context *context = NULL;
        struct net_device_stats *stats = &netdev->stats;
-       struct can_frame *cf = (struct can_frame *)skb->data;
+       struct canfd_frame *cfd = (struct canfd_frame *)skb->data;
        struct urb *urb;
        u8 *obuf;
        int i, err;
        }
 
        context->echo_index = i;
-       context->dlc = cf->can_dlc;
+
+       /* Note: this works with CANFD frames too */
+       context->data_len = cfd->len;
 
        usb_anchor_urb(urb, &dev->tx_submitted);