can: provide library functions for skb allocation
This patch makes the private functions alloc_can_skb() and
alloc_can_err_skb() of the at91_can driver public and adapts all
drivers to use these. While making the patch I realized, that
the skb's are *not* setup consistently. The skb's are now setup
as shown:
skb->protocol = __constant_htons(ETH_P_CAN);
skb->pkt_type = PACKET_BROADCAST;
skb->ip_summed = CHECKSUM_UNNECESSARY;
*cf = (struct can_frame *)skb_put(skb, sizeof(struct can_frame));
memset(*cf, 0, sizeof(struct can_frame));
The frame is zeroed out to avoid uninitialized data to be passed
to user space.
Some drivers or library code used "htons(ETH_P_CAN)" or did not set
"pkt_type" or "ip_summed" or did not zero the fame.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Oliver Hartkopp <oliver@hartkopp.net>
git-svn-id: svn://svn.berlios.de//socketcan/trunk@1068
030b6a49-0b11-0410-94ab-
b0dab22257f2