Lines Matching full:can

2 /* af_can.c - Protocol family CAN core module
3 * (used by different CAN protocol modules)
58 #include <linux/can.h>
59 #include <linux/can/core.h>
60 #include <linux/can/skb.h>
61 #include <linux/can/can-ml.h>
81 /* table of registered CAN protocols */
132 err = request_module("can-proto-%d", protocol); in can_create()
139 pr_err_ratelimited("can: request_module (can-proto-%d) failed.\n", in can_create()
184 * can_send - transmit a CAN frame (optional with local loopback)
185 * @skb: pointer to socket buffer with CAN frame in data section
186 * @loop: loopback for listeners on local CAN sockets (recommended default!)
195 * -EPERM when trying to send on a non-CAN interface
196 * -EMSGSIZE CAN frame size is bigger than CAN interface MTU
197 * -EINVAL when the skb->data does not contain a valid CAN frame
202 struct can_pkg_stats *pkg_stats = dev_net(skb->dev)->can.pkg_stats; in can_send()
214 /* set CAN FD flag for CAN FD frames by default */ in can_send()
220 /* Make sure the CAN frame can pass the selected CAN netdevice. */ in can_send()
243 /* local loopback of sent CAN frames */ in can_send()
245 /* indication for the CAN driver: do loopback */ in can_send()
271 /* indication for the CAN driver: no loopback required */ in can_send()
309 return net->can.rx_alldev_list; in can_dev_rcv_lists_find()
314 * effhash - hash function for 29 bit CAN identifier reduction
315 * @can_id: 29 bit CAN identifier
318 * To reduce the linear traversal in one linked list of _single_ EFF CAN
338 * @can_id: pointer to CAN identifier of a given can_filter
339 * @mask: pointer to CAN mask of a given can_filter
354 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
411 * can_rx_register - subscribe CAN frames from a specific interface
413 * @dev: pointer to netdevice (NULL => subscribe from 'all' CAN devices list)
414 * @can_id: CAN identifier (see description)
415 * @mask: CAN mask (see description)
427 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
448 struct can_rcv_lists_stats *rcv_lists_stats = net->can.rcv_lists_stats; in can_rx_register()
462 spin_lock_bh(&net->can.rcvlists_lock); in can_rx_register()
481 spin_unlock_bh(&net->can.rcvlists_lock); in can_rx_register()
499 * can_rx_unregister - unsubscribe CAN frames from a specific interface
501 * @dev: pointer to netdevice (NULL => unsubscribe from 'all' CAN devices list)
502 * @can_id: CAN identifier
503 * @mask: CAN mask
516 struct can_rcv_lists_stats *rcv_lists_stats = net->can.rcv_lists_stats; in can_rx_unregister()
525 spin_lock_bh(&net->can.rcvlists_lock); in can_rx_unregister()
540 /* Check for bugs in CAN protocol implementations using af_can.c: in can_rx_unregister()
543 * the notifier for removing the CAN netdev is running we just print in can_rx_unregister()
547 pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n", in can_rx_unregister()
559 spin_unlock_bh(&net->can.rcvlists_lock); in can_rx_unregister()
645 struct can_pkg_stats *pkg_stats = net->can.pkg_stats; in can_receive()
659 matches = can_rcv_filter(net->can.rx_alldev_list, skb); in can_receive()
680 pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n", in can_rcv()
695 pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n", in canfd_rcv()
710 pr_warn_once("PF_CAN: dropped non conform CAN XL skbuff: dev type %d, len %d\n", in canxl_rcv()
724 * can_proto_register - register CAN transport protocol
725 * @cp: pointer to CAN protocol structure
739 pr_err("can: protocol number %d out of range\n", proto); in can_proto_register()
750 pr_err("can: protocol %d already registered\n", proto); in can_proto_register()
766 * can_proto_unregister - unregister CAN transport protocol
767 * @cp: pointer to CAN protocol structure
786 spin_lock_init(&net->can.rcvlists_lock); in can_pernet_init()
787 net->can.rx_alldev_list = in can_pernet_init()
788 kzalloc(sizeof(*net->can.rx_alldev_list), GFP_KERNEL); in can_pernet_init()
789 if (!net->can.rx_alldev_list) in can_pernet_init()
791 net->can.pkg_stats = kzalloc(sizeof(*net->can.pkg_stats), GFP_KERNEL); in can_pernet_init()
792 if (!net->can.pkg_stats) in can_pernet_init()
794 net->can.rcv_lists_stats = kzalloc(sizeof(*net->can.rcv_lists_stats), GFP_KERNEL); in can_pernet_init()
795 if (!net->can.rcv_lists_stats) in can_pernet_init()
801 timer_setup(&net->can.stattimer, can_stat_update, in can_pernet_init()
803 mod_timer(&net->can.stattimer, in can_pernet_init()
806 net->can.pkg_stats->jiffies_init = jiffies; in can_pernet_init()
813 kfree(net->can.pkg_stats); in can_pernet_init()
815 kfree(net->can.rx_alldev_list); in can_pernet_init()
825 del_timer_sync(&net->can.stattimer); in can_pernet_exit()
828 kfree(net->can.rx_alldev_list); in can_pernet_exit()
829 kfree(net->can.pkg_stats); in can_pernet_exit()
830 kfree(net->can.rcv_lists_stats); in can_pernet_exit()
873 pr_info("can: controller area network core\n"); in can_init()