struct can_frame *cf;
struct sk_buff *skb;
- skb = dev_alloc_skb(sizeof(*cf));
+ skb = alloc_can_err_skb(dev, &cf);
if (unlikely(skb == NULL))
return -ENOMEM;
stats = &dev->stats;
#endif
- skb->dev = dev;
- skb->protocol = htons(ETH_P_CAN);
- cf = (struct can_frame *)skb_put(skb, sizeof(*cf));
- memset(cf, 0, sizeof(*cf));
-
- cf->can_id = CAN_ERR_FLAG | idflags;
- cf->can_dlc = CAN_ERR_DLC;
+ cf->can_id |= idflags;
cf->data[1] = d1;
netif_rx(skb);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
dev->last_rx = jiffies;
#endif
stats->rx_packets++;
struct sk_buff *skb;
int i;
- skb = netdev_alloc_skb(dev, sizeof(*cfrm));
+ skb = alloc_can_skb(dev, &cfrm);
if (unlikely(skb == NULL)) {
stats->rx_dropped++;
return;
}
- skb->protocol = htons(ETH_P_CAN);
-
- cfrm = (struct can_frame *)skb_put(skb, sizeof(*cfrm));
- memset(cfrm, 0, sizeof(*cfrm));
if (eff) {
cfrm->can_id = (msg->id << 16);
netif_rx(skb);
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
dev->last_rx = jiffies;
#endif
stats->rx_packets++;
return 0;
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
static int esd331_start_xmit(struct sk_buff *skb, struct net_device *dev)
#else
static netdev_tx_t esd331_start_xmit(struct sk_buff *skb,