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);
139 pr_err_ratelimited("can: request_module (can-proto-%d) failed.\n",
187 * can_send - transmit a CAN frame (optional with local loopback)
188 * @skb: pointer to socket buffer with CAN frame in data section
189 * @loop: loopback for listeners on local CAN sockets (recommended default!)
198 * -EPERM when trying to send on a non-CAN interface
199 * -EMSGSIZE CAN frame size is bigger than CAN interface MTU
200 * -EINVAL when the skb->data does not contain a valid CAN frame
205 struct can_pkg_stats *pkg_stats = dev_net(skb->dev)->can.pkg_stats;
217 /* set CAN FD flag for CAN FD frames by default */
223 /* Make sure the CAN frame can pass the selected CAN netdevice. */
246 /* local loopback of sent CAN frames */
248 /* indication for the CAN driver: do loopback */
274 /* indication for the CAN driver: no loopback required */
312 return net->can.rx_alldev_list;
317 * effhash - hash function for 29 bit CAN identifier reduction
318 * @can_id: 29 bit CAN identifier
321 * To reduce the linear traversal in one linked list of _single_ EFF CAN
341 * @can_id: pointer to CAN identifier of a given can_filter
342 * @mask: pointer to CAN mask of a given can_filter
357 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
414 * can_rx_register - subscribe CAN frames from a specific interface
416 * @dev: pointer to netdevice (NULL => subscribe from 'all' CAN devices list)
417 * @can_id: CAN identifier (see description)
418 * @mask: CAN mask (see description)
430 * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can
451 struct can_rcv_lists_stats *rcv_lists_stats = net->can.rcv_lists_stats;
465 spin_lock_bh(&net->can.rcvlists_lock);
484 spin_unlock_bh(&net->can.rcvlists_lock);
502 * can_rx_unregister - unsubscribe CAN frames from a specific interface
504 * @dev: pointer to netdevice (NULL => unsubscribe from 'all' CAN devices list)
505 * @can_id: CAN identifier
506 * @mask: CAN mask
519 struct can_rcv_lists_stats *rcv_lists_stats = net->can.rcv_lists_stats;
528 spin_lock_bh(&net->can.rcvlists_lock);
543 /* Check for bugs in CAN protocol implementations using af_can.c:
546 * the notifier for removing the CAN netdev is running we just print
550 pr_warn("can: receive list entry not found for dev %s, id %03X, mask %03X\n",
562 spin_unlock_bh(&net->can.rcvlists_lock);
648 struct can_pkg_stats *pkg_stats = net->can.pkg_stats;
662 matches = can_rcv_filter(net->can.rx_alldev_list, skb);
683 pr_warn_once("PF_CAN: dropped non conform CAN skbuff: dev type %d, len %d\n",
698 pr_warn_once("PF_CAN: dropped non conform CAN FD skbuff: dev type %d, len %d\n",
713 pr_warn_once("PF_CAN: dropped non conform CAN XL skbuff: dev type %d, len %d\n",
727 * can_proto_register - register CAN transport protocol
728 * @cp: pointer to CAN protocol structure
742 pr_err("can: protocol number %d out of range\n", proto);
753 pr_err("can: protocol %d already registered\n", proto);
769 * can_proto_unregister - unregister CAN transport protocol
770 * @cp: pointer to CAN protocol structure
789 spin_lock_init(&net->can.rcvlists_lock);
790 net->can.rx_alldev_list =
791 kzalloc(sizeof(*net->can.rx_alldev_list), GFP_KERNEL);
792 if (!net->can.rx_alldev_list)
794 net->can.pkg_stats = kzalloc(sizeof(*net->can.pkg_stats), GFP_KERNEL);
795 if (!net->can.pkg_stats)
797 net->can.rcv_lists_stats = kzalloc(sizeof(*net->can.rcv_lists_stats), GFP_KERNEL);
798 if (!net->can.rcv_lists_stats)
804 timer_setup(&net->can.stattimer, can_stat_update,
806 mod_timer(&net->can.stattimer,
809 net->can.pkg_stats->jiffies_init = jiffies;
816 kfree(net->can.pkg_stats);
818 kfree(net->can.rx_alldev_list);
828 timer_delete_sync(&net->can.stattimer);
831 kfree(net->can.rx_alldev_list);
832 kfree(net->can.pkg_stats);
833 kfree(net->can.rcv_lists_stats);
876 pr_info("can: controller area network core\n");