1 ============================================================================
3 can-core.txt : core module description
5 Part of the documentation for the socketCAN subsystem
9 1 Socket CAN core module
10 1.1 can.ko module params
12 1.3 writing own CAN protocol modules
14 ============================================================================
16 1. Socket CAN core module
17 -------------------------
19 The Socket CAN core module implements the protocol family
20 PF_CAN. CAN protocol modules are loaded by the core module at
21 runtime. The core module provides an interface for CAN protocol
22 modules to subscribe needed CAN IDs (see overview.txt, chapter 3.1).
24 1.1 can.ko module params
26 - stats_timer: To calculate the Socket CAN core statistics
27 (e.g. current/maximum frames per second) this 1 second timer is
28 invoked at can.ko module start time by default. This timer can be
29 disabled by using stattimer=0 on the module commandline.
31 - debug: (removed since SocketCAN SVN r546)
35 As described in overview.txt, chapter 3.1 the Socket CAN core uses
36 several filter lists to deliver received CAN frames to CAN protocol
37 modules. These receive lists, their filters and the count of filter
38 matches can be checked in the appropriate receive list. All entries
39 contain the device and a protocol module identifier:
41 foo@bar:~$ cat /proc/net/can/rcvlist_all
43 receive list 'rx_all':
47 device can_id can_mask function userdata matches ident
48 vcan0 000 00000000 f88e6370 f6c6f400 0 raw
51 In this example an application requests any CAN traffic from vcan0.
53 rcvlist_all - list for unfiltered entries (no filter operations)
54 rcvlist_eff - list for single extended frame (EFF) entries
55 rcvlist_err - list for error frames masks
56 rcvlist_fil - list for mask/value filters
57 rcvlist_inv - list for mask/value filters (inverse semantic)
58 rcvlist_sff - list for single standard frame (SFF) entries
60 Additional procfs files in /proc/net/can
62 stats - Socket CAN core statistics (rx/tx frames, match ratios, ...)
63 reset_stats - manual statistic reset
64 version - prints the Socket CAN core version and the ABI version
66 1.3 writing own CAN protocol modules
68 To implement a new protocol in the protocol family PF_CAN a new
69 protocol has to be defined in include/linux/can.h .
70 The prototypes and definitions to use the Socket CAN core can be
71 accessed by including include/linux/can/core.h .
72 In addition to functions that register the CAN protocol and the
73 CAN device notifier chain there are functions to subscribe CAN
74 frames received by CAN interfaces and to send CAN frames:
76 can_rx_register - subscribe CAN frames from a specific interface
77 can_rx_unregister - unsubscribe CAN frames from a specific interface
78 can_send - transmit a CAN frame (optional with local loopback)
80 For details see the kerneldoc documentation in net/can/af_can.c or
81 the source code of net/can/raw.c or net/can/bcm.c .