diff options
author | Stephane Grosjean <s.grosjean@peak-system.com> | 2014-01-15 03:50:13 -0500 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-02-04 03:34:33 -0500 |
commit | cb2518ca9f06dfcfa3d175773631bfb1e461bdc7 (patch) | |
tree | 862c310c2fd5b765526ec112ae12c508e4fdab65 /drivers/net/can | |
parent | 16f6b87ac524f073c93ea3caadfd5111d03ecb4f (diff) |
can: add ability to allocate CANFD frame in skb data
This patch adds the ability of allocating a CANFD frame data structure in the
skb data area.
Signed-off-by: Stephane Grosjean <s.grosjean@peak-system.com>
Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/dev.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 13a909822e25..cb584ea00331 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c | |||
@@ -521,6 +521,30 @@ struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) | |||
521 | } | 521 | } |
522 | EXPORT_SYMBOL_GPL(alloc_can_skb); | 522 | EXPORT_SYMBOL_GPL(alloc_can_skb); |
523 | 523 | ||
524 | struct sk_buff *alloc_canfd_skb(struct net_device *dev, | ||
525 | struct canfd_frame **cfd) | ||
526 | { | ||
527 | struct sk_buff *skb; | ||
528 | |||
529 | skb = netdev_alloc_skb(dev, sizeof(struct can_skb_priv) + | ||
530 | sizeof(struct canfd_frame)); | ||
531 | if (unlikely(!skb)) | ||
532 | return NULL; | ||
533 | |||
534 | skb->protocol = htons(ETH_P_CANFD); | ||
535 | skb->pkt_type = PACKET_BROADCAST; | ||
536 | skb->ip_summed = CHECKSUM_UNNECESSARY; | ||
537 | |||
538 | can_skb_reserve(skb); | ||
539 | can_skb_prv(skb)->ifindex = dev->ifindex; | ||
540 | |||
541 | *cfd = (struct canfd_frame *)skb_put(skb, sizeof(struct canfd_frame)); | ||
542 | memset(*cfd, 0, sizeof(struct canfd_frame)); | ||
543 | |||
544 | return skb; | ||
545 | } | ||
546 | EXPORT_SYMBOL_GPL(alloc_canfd_skb); | ||
547 | |||
524 | struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) | 548 | struct sk_buff *alloc_can_err_skb(struct net_device *dev, struct can_frame **cf) |
525 | { | 549 | { |
526 | struct sk_buff *skb; | 550 | struct sk_buff *skb; |