summaryrefslogtreecommitdiffstats
path: root/drivers/net/can/dev.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-02-13 18:16:00 -0500
committerDavid S. Miller <davem@davemloft.net>2014-02-13 18:16:00 -0500
commit886ab57c848892ebdddabca9990415176cf90679 (patch)
treeb2db893ef0aecacd26ffd9d1d69a4099a1b8885b /drivers/net/can/dev.c
parent3410f22ea9693ed66e15a0764f20388bf39dd93d (diff)
parent17a50ee4bd47bdba94546e0526fc9ce93dc77d5e (diff)
Merge tag 'linux-can-next-for-3.15-20140212' of git://gitorious.org/linux-can/linux-can-next
linux-can-next-for-3.15-20140212 Marc Kleine-Budde says: ==================== this is a pull request of eight patches for net-next/master. Florian Vaussard contributed a series that merged the sja1000 of_platform into the platform driver. The of_platform driver is finally removed. Stephane Grosjean supplied a patch to allocate CANFD skbs. In a patch by Uwe Kleine-König another missing copyright information was added to a userspace header. And a patch by Yoann DI RUZZA that adds listen only mode to the at91_can driver. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/can/dev.c')
-rw-r--r--drivers/net/can/dev.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index fc59bc6f040..c0563f18372 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -512,6 +512,30 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf)
}
EXPORT_SYMBOL_GPL(alloc_can_skb);
+struct sk_buff *alloc_canfd_skb(struct net_device *dev,
+ struct canfd_frame **cfd)
+{
+ struct sk_buff *skb;
+
+ skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) +
+ sizeof(struct canfd_frame));
+ if (unlikely(!skb))
+ return NULL;
+
+ skb->protocol = htons(ETH_P_CANFD);
+ skb->pkt_type = PACKET_BROADCAST;
+ skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+ can_skb_reserve(skb);
+ can_skb_prv(skb)->ifindex = dev->ifindex;
+
+ *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame));
+ memset(*cfd, 0, sizeof(struct canfd_frame));
+
+ return skb;
+}
+EXPORT_SYMBOL_GPL(alloc_canfd_skb);
+
struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf)
{
struct sk_buff *skb;