diff options
-rw-r--r-- | Documentation/networking/can.txt | 32 | ||||
-rw-r--r-- | include/linux/can.h | 8 | ||||
-rw-r--r-- | include/linux/can/error.h | 4 | ||||
-rw-r--r-- | net/can/af_can.c | 10 |
4 files changed, 27 insertions, 27 deletions
diff --git a/Documentation/networking/can.txt b/Documentation/networking/can.txt index 56ca3b75376e..28d9b14c34ec 100644 --- a/Documentation/networking/can.txt +++ b/Documentation/networking/can.txt | |||
@@ -232,16 +232,16 @@ solution for a couple of reasons: | |||
232 | arbitration problems and error frames caused by the different | 232 | arbitration problems and error frames caused by the different |
233 | ECUs. The occurrence of detected errors are important for diagnosis | 233 | ECUs. The occurrence of detected errors are important for diagnosis |
234 | and have to be logged together with the exact timestamp. For this | 234 | and have to be logged together with the exact timestamp. For this |
235 | reason the CAN interface driver can generate so called Error Frames | 235 | reason the CAN interface driver can generate so called Error Message |
236 | that can optionally be passed to the user application in the same | 236 | Frames that can optionally be passed to the user application in the |
237 | way as other CAN frames. Whenever an error on the physical layer | 237 | same way as other CAN frames. Whenever an error on the physical layer |
238 | or the MAC layer is detected (e.g. by the CAN controller) the driver | 238 | or the MAC layer is detected (e.g. by the CAN controller) the driver |
239 | creates an appropriate error frame. Error frames can be requested by | 239 | creates an appropriate error message frame. Error messages frames can |
240 | the user application using the common CAN filter mechanisms. Inside | 240 | be requested by the user application using the common CAN filter |
241 | this filter definition the (interested) type of errors may be | 241 | mechanisms. Inside this filter definition the (interested) type of |
242 | selected. The reception of error frames is disabled by default. | 242 | errors may be selected. The reception of error messages is disabled |
243 | The format of the CAN error frame is briefly described in the Linux | 243 | by default. The format of the CAN error message frame is briefly |
244 | header file "include/linux/can/error.h". | 244 | described in the Linux header file "include/linux/can/error.h". |
245 | 245 | ||
246 | 4. How to use Socket CAN | 246 | 4. How to use Socket CAN |
247 | ------------------------ | 247 | ------------------------ |
@@ -383,7 +383,7 @@ solution for a couple of reasons: | |||
383 | defaults are set at RAW socket binding time: | 383 | defaults are set at RAW socket binding time: |
384 | 384 | ||
385 | - The filters are set to exactly one filter receiving everything | 385 | - The filters are set to exactly one filter receiving everything |
386 | - The socket only receives valid data frames (=> no error frames) | 386 | - The socket only receives valid data frames (=> no error message frames) |
387 | - The loopback of sent CAN frames is enabled (see chapter 3.2) | 387 | - The loopback of sent CAN frames is enabled (see chapter 3.2) |
388 | - The socket does not receive its own sent frames (in loopback mode) | 388 | - The socket does not receive its own sent frames (in loopback mode) |
389 | 389 | ||
@@ -434,7 +434,7 @@ solution for a couple of reasons: | |||
434 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER | 434 | 4.1.2 RAW socket option CAN_RAW_ERR_FILTER |
435 | 435 | ||
436 | As described in chapter 3.4 the CAN interface driver can generate so | 436 | As described in chapter 3.4 the CAN interface driver can generate so |
437 | called Error Frames that can optionally be passed to the user | 437 | called Error Message Frames that can optionally be passed to the user |
438 | application in the same way as other CAN frames. The possible | 438 | application in the same way as other CAN frames. The possible |
439 | errors are divided into different error classes that may be filtered | 439 | errors are divided into different error classes that may be filtered |
440 | using the appropriate error mask. To register for every possible | 440 | using the appropriate error mask. To register for every possible |
@@ -527,7 +527,7 @@ solution for a couple of reasons: | |||
527 | 527 | ||
528 | rcvlist_all - list for unfiltered entries (no filter operations) | 528 | rcvlist_all - list for unfiltered entries (no filter operations) |
529 | rcvlist_eff - list for single extended frame (EFF) entries | 529 | rcvlist_eff - list for single extended frame (EFF) entries |
530 | rcvlist_err - list for error frames masks | 530 | rcvlist_err - list for error message frames masks |
531 | rcvlist_fil - list for mask/value filters | 531 | rcvlist_fil - list for mask/value filters |
532 | rcvlist_inv - list for mask/value filters (inverse semantic) | 532 | rcvlist_inv - list for mask/value filters (inverse semantic) |
533 | rcvlist_sff - list for single standard frame (SFF) entries | 533 | rcvlist_sff - list for single standard frame (SFF) entries |
@@ -784,13 +784,13 @@ solution for a couple of reasons: | |||
784 | $ ip link set canX type can restart-ms 100 | 784 | $ ip link set canX type can restart-ms 100 |
785 | 785 | ||
786 | Alternatively, the application may realize the "bus-off" condition | 786 | Alternatively, the application may realize the "bus-off" condition |
787 | by monitoring CAN error frames and do a restart when appropriate with | 787 | by monitoring CAN error message frames and do a restart when |
788 | the command: | 788 | appropriate with the command: |
789 | 789 | ||
790 | $ ip link set canX type can restart | 790 | $ ip link set canX type can restart |
791 | 791 | ||
792 | Note that a restart will also create a CAN error frame (see also | 792 | Note that a restart will also create a CAN error message frame (see |
793 | chapter 3.4). | 793 | also chapter 3.4). |
794 | 794 | ||
795 | 6.6 Supported CAN hardware | 795 | 6.6 Supported CAN hardware |
796 | 796 | ||
diff --git a/include/linux/can.h b/include/linux/can.h index 9a19bcb3eeaf..17334c09bd93 100644 --- a/include/linux/can.h +++ b/include/linux/can.h | |||
@@ -21,7 +21,7 @@ | |||
21 | /* special address description flags for the CAN_ID */ | 21 | /* special address description flags for the CAN_ID */ |
22 | #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ | 22 | #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ |
23 | #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ | 23 | #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ |
24 | #define CAN_ERR_FLAG 0x20000000U /* error frame */ | 24 | #define CAN_ERR_FLAG 0x20000000U /* error message frame */ |
25 | 25 | ||
26 | /* valid bits in CAN ID for frame formats */ | 26 | /* valid bits in CAN ID for frame formats */ |
27 | #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ | 27 | #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ |
@@ -32,14 +32,14 @@ | |||
32 | * Controller Area Network Identifier structure | 32 | * Controller Area Network Identifier structure |
33 | * | 33 | * |
34 | * bit 0-28 : CAN identifier (11/29 bit) | 34 | * bit 0-28 : CAN identifier (11/29 bit) |
35 | * bit 29 : error frame flag (0 = data frame, 1 = error frame) | 35 | * bit 29 : error message frame flag (0 = data frame, 1 = error message) |
36 | * bit 30 : remote transmission request flag (1 = rtr frame) | 36 | * bit 30 : remote transmission request flag (1 = rtr frame) |
37 | * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) | 37 | * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) |
38 | */ | 38 | */ |
39 | typedef __u32 canid_t; | 39 | typedef __u32 canid_t; |
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Controller Area Network Error Frame Mask structure | 42 | * Controller Area Network Error Message Frame Mask structure |
43 | * | 43 | * |
44 | * bit 0-28 : error class mask (see include/linux/can/error.h) | 44 | * bit 0-28 : error class mask (see include/linux/can/error.h) |
45 | * bit 29-31 : set to zero | 45 | * bit 29-31 : set to zero |
@@ -97,7 +97,7 @@ struct sockaddr_can { | |||
97 | * <received_can_id> & mask == can_id & mask | 97 | * <received_can_id> & mask == can_id & mask |
98 | * | 98 | * |
99 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | 99 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can |
100 | * filter for error frames (CAN_ERR_FLAG bit set in mask). | 100 | * filter for error message frames (CAN_ERR_FLAG bit set in mask). |
101 | */ | 101 | */ |
102 | struct can_filter { | 102 | struct can_filter { |
103 | canid_t can_id; | 103 | canid_t can_id; |
diff --git a/include/linux/can/error.h b/include/linux/can/error.h index 63e855ea6b84..7b7148bded71 100644 --- a/include/linux/can/error.h +++ b/include/linux/can/error.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/can/error.h | 2 | * linux/can/error.h |
3 | * | 3 | * |
4 | * Definitions of the CAN error frame to be filtered and passed to the user. | 4 | * Definitions of the CAN error messages to be filtered and passed to the user. |
5 | * | 5 | * |
6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | 6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> |
7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | 7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research |
@@ -12,7 +12,7 @@ | |||
12 | #ifndef CAN_ERROR_H | 12 | #ifndef CAN_ERROR_H |
13 | #define CAN_ERROR_H | 13 | #define CAN_ERROR_H |
14 | 14 | ||
15 | #define CAN_ERR_DLC 8 /* dlc for error frames */ | 15 | #define CAN_ERR_DLC 8 /* dlc for error message frames */ |
16 | 16 | ||
17 | /* error class (mask) in can_id */ | 17 | /* error class (mask) in can_id */ |
18 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ | 18 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ |
diff --git a/net/can/af_can.c b/net/can/af_can.c index 0ce2ad0696da..6efcd37b4bd0 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -334,8 +334,8 @@ static struct dev_rcv_lists *find_dev_rcv_lists(struct net_device *dev) | |||
334 | * relevant bits for the filter. | 334 | * relevant bits for the filter. |
335 | * | 335 | * |
336 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | 336 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can |
337 | * filter for error frames (CAN_ERR_FLAG bit set in mask). For error frames | 337 | * filter for error messages (CAN_ERR_FLAG bit set in mask). For error msg |
338 | * there is a special filterlist and a special rx path filter handling. | 338 | * frames there is a special filterlist and a special rx path filter handling. |
339 | * | 339 | * |
340 | * Return: | 340 | * Return: |
341 | * Pointer to optimal filterlist for the given can_id/mask pair. | 341 | * Pointer to optimal filterlist for the given can_id/mask pair. |
@@ -347,7 +347,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, | |||
347 | { | 347 | { |
348 | canid_t inv = *can_id & CAN_INV_FILTER; /* save flag before masking */ | 348 | canid_t inv = *can_id & CAN_INV_FILTER; /* save flag before masking */ |
349 | 349 | ||
350 | /* filter for error frames in extra filterlist */ | 350 | /* filter for error message frames in extra filterlist */ |
351 | if (*mask & CAN_ERR_FLAG) { | 351 | if (*mask & CAN_ERR_FLAG) { |
352 | /* clear CAN_ERR_FLAG in filter entry */ | 352 | /* clear CAN_ERR_FLAG in filter entry */ |
353 | *mask &= CAN_ERR_MASK; | 353 | *mask &= CAN_ERR_MASK; |
@@ -408,7 +408,7 @@ static struct hlist_head *find_rcv_list(canid_t *can_id, canid_t *mask, | |||
408 | * <received_can_id> & mask == can_id & mask | 408 | * <received_can_id> & mask == can_id & mask |
409 | * | 409 | * |
410 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | 410 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can |
411 | * filter for error frames (CAN_ERR_FLAG bit set in mask). | 411 | * filter for error message frames (CAN_ERR_FLAG bit set in mask). |
412 | * | 412 | * |
413 | * The provided pointer to the sk_buff is guaranteed to be valid as long as | 413 | * The provided pointer to the sk_buff is guaranteed to be valid as long as |
414 | * the callback function is running. The callback function must *not* free | 414 | * the callback function is running. The callback function must *not* free |
@@ -578,7 +578,7 @@ static int can_rcv_filter(struct dev_rcv_lists *d, struct sk_buff *skb) | |||
578 | return 0; | 578 | return 0; |
579 | 579 | ||
580 | if (can_id & CAN_ERR_FLAG) { | 580 | if (can_id & CAN_ERR_FLAG) { |
581 | /* check for error frame entries only */ | 581 | /* check for error message frame entries only */ |
582 | hlist_for_each_entry_rcu(r, n, &d->rx[RX_ERR], list) { | 582 | hlist_for_each_entry_rcu(r, n, &d->rx[RX_ERR], list) { |
583 | if (can_id & r->mask) { | 583 | if (can_id & r->mask) { |
584 | deliver(skb, r); | 584 | deliver(skb, r); |