aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can/vcan.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/can/vcan.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/can/vcan.c')
-rw-r--r--drivers/net/can/vcan.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/net/can/vcan.c b/drivers/net/can/vcan.c
index 80ac56313981..a30b8f480f61 100644
--- a/drivers/net/can/vcan.c
+++ b/drivers/net/can/vcan.c
@@ -47,6 +47,8 @@
47#include <linux/if_arp.h> 47#include <linux/if_arp.h>
48#include <linux/if_ether.h> 48#include <linux/if_ether.h>
49#include <linux/can.h> 49#include <linux/can.h>
50#include <linux/can/dev.h>
51#include <linux/slab.h>
50#include <net/rtnetlink.h> 52#include <net/rtnetlink.h>
51 53
52static __initdata const char banner[] = 54static __initdata const char banner[] =
@@ -70,10 +72,11 @@ MODULE_PARM_DESC(echo, "Echo sent frames (for testing). Default: 0 (Off)");
70 72
71static void vcan_rx(struct sk_buff *skb, struct net_device *dev) 73static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
72{ 74{
75 struct can_frame *cf = (struct can_frame *)skb->data;
73 struct net_device_stats *stats = &dev->stats; 76 struct net_device_stats *stats = &dev->stats;
74 77
75 stats->rx_packets++; 78 stats->rx_packets++;
76 stats->rx_bytes += skb->len; 79 stats->rx_bytes += cf->can_dlc;
77 80
78 skb->protocol = htons(ETH_P_CAN); 81 skb->protocol = htons(ETH_P_CAN);
79 skb->pkt_type = PACKET_BROADCAST; 82 skb->pkt_type = PACKET_BROADCAST;
@@ -85,11 +88,15 @@ static void vcan_rx(struct sk_buff *skb, struct net_device *dev)
85 88
86static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev) 89static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
87{ 90{
91 struct can_frame *cf = (struct can_frame *)skb->data;
88 struct net_device_stats *stats = &dev->stats; 92 struct net_device_stats *stats = &dev->stats;
89 int loop; 93 int loop;
90 94
95 if (can_dropped_invalid_skb(dev, skb))
96 return NETDEV_TX_OK;
97
91 stats->tx_packets++; 98 stats->tx_packets++;
92 stats->tx_bytes += skb->len; 99 stats->tx_bytes += cf->can_dlc;
93 100
94 /* set flag whether this packet has to be looped back */ 101 /* set flag whether this packet has to be looped back */
95 loop = skb->pkt_type == PACKET_LOOPBACK; 102 loop = skb->pkt_type == PACKET_LOOPBACK;
@@ -103,7 +110,7 @@ static netdev_tx_t vcan_tx(struct sk_buff *skb, struct net_device *dev)
103 * CAN core already did the echo for us 110 * CAN core already did the echo for us
104 */ 111 */
105 stats->rx_packets++; 112 stats->rx_packets++;
106 stats->rx_bytes += skb->len; 113 stats->rx_bytes += cf->can_dlc;
107 } 114 }
108 kfree_skb(skb); 115 kfree_skb(skb);
109 return NETDEV_TX_OK; 116 return NETDEV_TX_OK;