Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: bcm: add support for CAN FD frames

The programming API of the CAN_BCM depends on struct can_frame which is
given as array directly behind the bcm_msg_head structure. To follow this
schema for the CAN FD frames a new flag 'CAN_FD_FRAME' in the bcm_msg_head
flags indicates that the concatenated CAN frame structures behind the
bcm_msg_head are defined as struct canfd_frame.

This patch adds the support to handle CAN and CAN FD frames on a per BCM-op
base. Main changes:

- generally use struct canfd_frames instead if struct can_frames
- use canfd_frame.flags instead of can_frame.can_dlc for private BCM flags
- make all CAN frame sizes depending on the new CAN_FD_FRAME flags
- separate between CAN and CAN FD when sending/receiving frames

Due to the dependence of the CAN_FD_FRAME flag the former binary interface
for classic CAN frames remains stable.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Oliver Hartkopp and committed by
Marc Kleine-Budde
6f3b911d 2b5f5f5d

+136 -88
+1
include/uapi/linux/can/bcm.h
··· 99 99 #define RX_ANNOUNCE_RESUME 0x0100 100 100 #define TX_RESET_MULTI_IDX 0x0200 101 101 #define RX_RTR_FRAME 0x0400 102 + #define CAN_FD_FRAME 0x0800 102 103 103 104 #endif /* !_UAPI_CAN_BCM_H */
+135 -88
net/can/bcm.c
··· 1 1 /* 2 2 * bcm.c - Broadcast Manager to filter/send (cyclic) CAN content 3 3 * 4 - * Copyright (c) 2002-2007 Volkswagen Group Electronic Research 4 + * Copyright (c) 2002-2016 Volkswagen Group Electronic Research 5 5 * All rights reserved. 6 6 * 7 7 * Redistribution and use in source and binary forms, with or without ··· 67 67 */ 68 68 #define MAX_NFRAMES 256 69 69 70 - /* use of last_frames[index].can_dlc */ 70 + /* use of last_frames[index].flags */ 71 71 #define RX_RECV 0x40 /* received data for this element */ 72 72 #define RX_THR 0x80 /* element not been sent due to throttle feature */ 73 - #define BCM_CAN_DLC_MASK 0x0F /* clean private flags in can_dlc by masking */ 73 + #define BCM_CAN_FLAGS_MASK 0x3F /* to clean private flags after usage */ 74 74 75 75 /* get best masking value for can_rx_register() for a given single can_id */ 76 76 #define REGMASK(id) ((id & CAN_EFF_FLAG) ? \ 77 77 (CAN_EFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG) : \ 78 78 (CAN_SFF_MASK | CAN_EFF_FLAG | CAN_RTR_FLAG)) 79 79 80 - #define CAN_BCM_VERSION CAN_VERSION 80 + #define CAN_BCM_VERSION "20160617" 81 81 82 82 MODULE_DESCRIPTION("PF_CAN broadcast manager protocol"); 83 83 MODULE_LICENSE("Dual BSD/GPL"); 84 84 MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>"); 85 85 MODULE_ALIAS("can-proto-2"); 86 86 87 - /* easy access to CAN frame payload */ 88 - static inline u64 GET_U64(const struct can_frame *cp) 87 + /* 88 + * easy access to the first 64 bit of can(fd)_frame payload. cp->data is 89 + * 64 bit aligned so the offset has to be multiples of 8 which is ensured 90 + * by the only callers in bcm_rx_cmp_to_index() bcm_rx_handler(). 91 + */ 92 + static inline u64 get_u64(const struct canfd_frame *cp, int offset) 89 93 { 90 - return *(u64 *)cp->data; 94 + return *(u64 *)(cp->data + offset); 91 95 } 92 96 93 97 struct bcm_op { ··· 105 101 struct tasklet_struct tsklet, thrtsklet; 106 102 ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg; 107 103 int rx_ifindex; 104 + int cfsiz; 108 105 u32 count; 109 106 u32 nframes; 110 107 u32 currframe; 111 - struct can_frame *frames; 112 - struct can_frame *last_frames; 113 - struct can_frame sframe; 114 - struct can_frame last_sframe; 108 + struct canfd_frame *frames; 109 + struct canfd_frame *last_frames; 110 + struct canfd_frame sframe; 111 + struct canfd_frame last_sframe; 115 112 struct sock *sk; 116 113 struct net_device *rx_reg_dev; 117 114 }; ··· 141 136 return ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC); 142 137 } 143 138 144 - #define CFSIZ sizeof(struct can_frame) 139 + #define CFSIZ(flags) ((flags & CAN_FD_FRAME) ? CANFD_MTU : CAN_MTU) 145 140 #define OPSIZ sizeof(struct bcm_op) 146 141 #define MHSIZ sizeof(struct bcm_msg_head) 147 142 ··· 188 183 if (!op->frames_abs) 189 184 continue; 190 185 191 - seq_printf(m, "rx_op: %03X %-5s ", 192 - op->can_id, bcm_proc_getifname(ifname, op->ifindex)); 193 - seq_printf(m, "[%u]%c ", op->nframes, 194 - (op->flags & RX_CHECK_DLC) ? 'd' : ' '); 186 + seq_printf(m, "rx_op: %03X %-5s ", op->can_id, 187 + bcm_proc_getifname(ifname, op->ifindex)); 188 + 189 + if (op->flags & CAN_FD_FRAME) 190 + seq_printf(m, "(%u)", op->nframes); 191 + else 192 + seq_printf(m, "[%u]", op->nframes); 193 + 194 + seq_printf(m, "%c ", (op->flags & RX_CHECK_DLC) ? 'd' : ' '); 195 + 195 196 if (op->kt_ival1.tv64) 196 197 seq_printf(m, "timeo=%lld ", 197 198 (long long)ktime_to_us(op->kt_ival1)); ··· 217 206 218 207 list_for_each_entry(op, &bo->tx_ops, list) { 219 208 220 - seq_printf(m, "tx_op: %03X %s [%u] ", 221 - op->can_id, 222 - bcm_proc_getifname(ifname, op->ifindex), 223 - op->nframes); 209 + seq_printf(m, "tx_op: %03X %s ", op->can_id, 210 + bcm_proc_getifname(ifname, op->ifindex)); 211 + 212 + if (op->flags & CAN_FD_FRAME) 213 + seq_printf(m, "(%u) ", op->nframes); 214 + else 215 + seq_printf(m, "[%u] ", op->nframes); 224 216 225 217 if (op->kt_ival1.tv64) 226 218 seq_printf(m, "t1=%lld ", ··· 260 246 { 261 247 struct sk_buff *skb; 262 248 struct net_device *dev; 263 - struct can_frame *cf = &op->frames[op->currframe]; 249 + struct canfd_frame *cf = op->frames + op->cfsiz * op->currframe; 264 250 265 251 /* no target device? => exit */ 266 252 if (!op->ifindex) ··· 272 258 return; 273 259 } 274 260 275 - skb = alloc_skb(CFSIZ + sizeof(struct can_skb_priv), gfp_any()); 261 + skb = alloc_skb(op->cfsiz + sizeof(struct can_skb_priv), gfp_any()); 276 262 if (!skb) 277 263 goto out; 278 264 ··· 280 266 can_skb_prv(skb)->ifindex = dev->ifindex; 281 267 can_skb_prv(skb)->skbcnt = 0; 282 268 283 - memcpy(skb_put(skb, CFSIZ), cf, CFSIZ); 269 + memcpy(skb_put(skb, op->cfsiz), cf, op->cfsiz); 284 270 285 271 /* send with loopback */ 286 272 skb->dev = dev; ··· 303 289 * (consisting of bcm_msg_head + x CAN frames) 304 290 */ 305 291 static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head, 306 - struct can_frame *frames, int has_timestamp) 292 + struct canfd_frame *frames, int has_timestamp) 307 293 { 308 294 struct sk_buff *skb; 309 - struct can_frame *firstframe; 295 + struct canfd_frame *firstframe; 310 296 struct sockaddr_can *addr; 311 297 struct sock *sk = op->sk; 312 - unsigned int datalen = head->nframes * CFSIZ; 298 + unsigned int datalen = head->nframes * op->cfsiz; 313 299 int err; 314 300 315 301 skb = alloc_skb(sizeof(*head) + datalen, gfp_any()); ··· 320 306 321 307 if (head->nframes) { 322 308 /* CAN frames starting here */ 323 - firstframe = (struct can_frame *)skb_tail_pointer(skb); 309 + firstframe = (struct canfd_frame *)skb_tail_pointer(skb); 324 310 325 311 memcpy(skb_put(skb, datalen), frames, datalen); 326 312 327 313 /* 328 - * the BCM uses the can_dlc-element of the CAN frame 314 + * the BCM uses the flags-element of the canfd_frame 329 315 * structure for internal purposes. This is only 330 316 * relevant for updates that are generated by the 331 317 * BCM, where nframes is 1 332 318 */ 333 319 if (head->nframes == 1) 334 - firstframe->can_dlc &= BCM_CAN_DLC_MASK; 320 + firstframe->flags &= BCM_CAN_FLAGS_MASK; 335 321 } 336 322 337 323 if (has_timestamp) { ··· 418 404 /* 419 405 * bcm_rx_changed - create a RX_CHANGED notification due to changed content 420 406 */ 421 - static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data) 407 + static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data) 422 408 { 423 409 struct bcm_msg_head head; 424 410 ··· 430 416 op->frames_filtered = op->frames_abs = 0; 431 417 432 418 /* this element is not throttled anymore */ 433 - data->can_dlc &= (BCM_CAN_DLC_MASK|RX_RECV); 419 + data->flags &= (BCM_CAN_FLAGS_MASK|RX_RECV); 434 420 435 421 head.opcode = RX_CHANGED; 436 422 head.flags = op->flags; ··· 449 435 * 2. send a notification to the user (if possible) 450 436 */ 451 437 static void bcm_rx_update_and_send(struct bcm_op *op, 452 - struct can_frame *lastdata, 453 - const struct can_frame *rxdata) 438 + struct canfd_frame *lastdata, 439 + const struct canfd_frame *rxdata) 454 440 { 455 - memcpy(lastdata, rxdata, CFSIZ); 441 + memcpy(lastdata, rxdata, op->cfsiz); 456 442 457 443 /* mark as used and throttled by default */ 458 - lastdata->can_dlc |= (RX_RECV|RX_THR); 444 + lastdata->flags |= (RX_RECV|RX_THR); 459 445 460 446 /* throttling mode inactive ? */ 461 447 if (!op->kt_ival2.tv64) { ··· 493 479 * received data stored in op->last_frames[] 494 480 */ 495 481 static void bcm_rx_cmp_to_index(struct bcm_op *op, unsigned int index, 496 - const struct can_frame *rxdata) 482 + const struct canfd_frame *rxdata) 497 483 { 484 + struct canfd_frame *cf = op->frames + op->cfsiz * index; 485 + struct canfd_frame *lcf = op->last_frames + op->cfsiz * index; 486 + int i; 487 + 498 488 /* 499 - * no one uses the MSBs of can_dlc for comparison, 489 + * no one uses the MSBs of flags for comparison, 500 490 * so we use it here to detect the first time of reception 501 491 */ 502 492 503 - if (!(op->last_frames[index].can_dlc & RX_RECV)) { 493 + if (!(lcf->flags & RX_RECV)) { 504 494 /* received data for the first time => send update to user */ 505 - bcm_rx_update_and_send(op, &op->last_frames[index], rxdata); 495 + bcm_rx_update_and_send(op, lcf, rxdata); 506 496 return; 507 497 } 508 498 509 499 /* do a real check in CAN frame data section */ 510 - 511 - if ((GET_U64(&op->frames[index]) & GET_U64(rxdata)) != 512 - (GET_U64(&op->frames[index]) & GET_U64(&op->last_frames[index]))) { 513 - bcm_rx_update_and_send(op, &op->last_frames[index], rxdata); 514 - return; 500 + for (i = 0; i < rxdata->len; i += 8) { 501 + if ((get_u64(cf, i) & get_u64(rxdata, i)) != 502 + (get_u64(cf, i) & get_u64(lcf, i))) { 503 + bcm_rx_update_and_send(op, lcf, rxdata); 504 + return; 505 + } 515 506 } 516 507 517 508 if (op->flags & RX_CHECK_DLC) { 518 - /* do a real check in CAN frame dlc */ 519 - if (rxdata->can_dlc != (op->last_frames[index].can_dlc & 520 - BCM_CAN_DLC_MASK)) { 521 - bcm_rx_update_and_send(op, &op->last_frames[index], 522 - rxdata); 509 + /* do a real check in CAN frame length */ 510 + if (rxdata->len != lcf->len) { 511 + bcm_rx_update_and_send(op, lcf, rxdata); 523 512 return; 524 513 } 525 514 } ··· 572 555 /* if user wants to be informed, when cyclic CAN-Messages come back */ 573 556 if ((op->flags & RX_ANNOUNCE_RESUME) && op->last_frames) { 574 557 /* clear received CAN frames to indicate 'nothing received' */ 575 - memset(op->last_frames, 0, op->nframes * CFSIZ); 558 + memset(op->last_frames, 0, op->nframes * op->cfsiz); 576 559 } 577 560 578 561 return HRTIMER_NORESTART; ··· 584 567 static inline int bcm_rx_do_flush(struct bcm_op *op, int update, 585 568 unsigned int index) 586 569 { 587 - if ((op->last_frames) && (op->last_frames[index].can_dlc & RX_THR)) { 570 + struct canfd_frame *lcf = op->last_frames + op->cfsiz * index; 571 + 572 + if ((op->last_frames) && (lcf->flags & RX_THR)) { 588 573 if (update) 589 - bcm_rx_changed(op, &op->last_frames[index]); 574 + bcm_rx_changed(op, lcf); 590 575 return 1; 591 576 } 592 577 return 0; ··· 653 634 static void bcm_rx_handler(struct sk_buff *skb, void *data) 654 635 { 655 636 struct bcm_op *op = (struct bcm_op *)data; 656 - const struct can_frame *rxframe = (struct can_frame *)skb->data; 637 + const struct canfd_frame *rxframe = (struct canfd_frame *)skb->data; 657 638 unsigned int i; 658 - 659 - /* disable timeout */ 660 - hrtimer_cancel(&op->timer); 661 639 662 640 if (op->can_id != rxframe->can_id) 663 641 return; 642 + 643 + /* make sure to handle the correct frame type (CAN / CAN FD) */ 644 + if (skb->len != op->cfsiz) 645 + return; 646 + 647 + /* disable timeout */ 648 + hrtimer_cancel(&op->timer); 664 649 665 650 /* save rx timestamp */ 666 651 op->rx_stamp = skb->tstamp; ··· 696 673 * multiplex compare 697 674 * 698 675 * find the first multiplex mask that fits. 699 - * Remark: The MUX-mask is stored in index 0 676 + * Remark: The MUX-mask is stored in index 0 - but only the 677 + * first 64 bits of the frame data[] are relevant (CAN FD) 700 678 */ 701 679 702 680 for (i = 1; i < op->nframes; i++) { 703 - if ((GET_U64(&op->frames[0]) & GET_U64(rxframe)) == 704 - (GET_U64(&op->frames[0]) & 705 - GET_U64(&op->frames[i]))) { 681 + if ((get_u64(op->frames, 0) & get_u64(rxframe, 0)) == 682 + (get_u64(op->frames, 0) & 683 + get_u64(op->frames + op->cfsiz * i, 0))) { 706 684 bcm_rx_cmp_to_index(op, i, rxframe); 707 685 break; 708 686 } ··· 723 699 struct bcm_op *op; 724 700 725 701 list_for_each_entry(op, ops, list) { 726 - if ((op->can_id == mh->can_id) && (op->ifindex == ifindex)) 702 + if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && 703 + (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) 727 704 return op; 728 705 } 729 706 ··· 773 748 struct bcm_op *op, *n; 774 749 775 750 list_for_each_entry_safe(op, n, ops, list) { 776 - if ((op->can_id == mh->can_id) && (op->ifindex == ifindex)) { 751 + if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && 752 + (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) { 777 753 778 754 /* 779 755 * Don't care if we're bound or not (due to netdev ··· 820 794 struct bcm_op *op, *n; 821 795 822 796 list_for_each_entry_safe(op, n, ops, list) { 823 - if ((op->can_id == mh->can_id) && (op->ifindex == ifindex)) { 797 + if ((op->can_id == mh->can_id) && (op->ifindex == ifindex) && 798 + (op->flags & CAN_FD_FRAME) == (mh->flags & CAN_FD_FRAME)) { 824 799 list_del(&op->list); 825 800 bcm_remove_op(op); 826 801 return 1; /* done */ ··· 862 835 { 863 836 struct bcm_sock *bo = bcm_sk(sk); 864 837 struct bcm_op *op; 838 + struct canfd_frame *cf; 865 839 unsigned int i; 866 840 int err; 867 841 ··· 889 861 890 862 /* update CAN frames content */ 891 863 for (i = 0; i < msg_head->nframes; i++) { 892 - err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ); 893 864 894 - if (op->frames[i].can_dlc > 8) 895 - err = -EINVAL; 865 + cf = op->frames + op->cfsiz * i; 866 + err = memcpy_from_msg((u8 *)cf, msg, op->cfsiz); 867 + 868 + if (op->flags & CAN_FD_FRAME) { 869 + if (cf->len > 64) 870 + err = -EINVAL; 871 + } else { 872 + if (cf->len > 8) 873 + err = -EINVAL; 874 + } 896 875 897 876 if (err < 0) 898 877 return err; 899 878 900 879 if (msg_head->flags & TX_CP_CAN_ID) { 901 880 /* copy can_id into frame */ 902 - op->frames[i].can_id = msg_head->can_id; 881 + cf->can_id = msg_head->can_id; 903 882 } 904 883 } 884 + op->flags = msg_head->flags; 905 885 906 886 } else { 907 887 /* insert new BCM operation for the given can_id */ ··· 918 882 if (!op) 919 883 return -ENOMEM; 920 884 921 - op->can_id = msg_head->can_id; 885 + op->can_id = msg_head->can_id; 886 + op->cfsiz = CFSIZ(msg_head->flags); 887 + op->flags = msg_head->flags; 922 888 923 889 /* create array for CAN frames and copy the data */ 924 890 if (msg_head->nframes > 1) { 925 - op->frames = kmalloc(msg_head->nframes * CFSIZ, 891 + op->frames = kmalloc(msg_head->nframes * op->cfsiz, 926 892 GFP_KERNEL); 927 893 if (!op->frames) { 928 894 kfree(op); ··· 934 896 op->frames = &op->sframe; 935 897 936 898 for (i = 0; i < msg_head->nframes; i++) { 937 - err = memcpy_from_msg((u8 *)&op->frames[i], msg, CFSIZ); 938 899 939 - if (op->frames[i].can_dlc > 8) 940 - err = -EINVAL; 900 + cf = op->frames + op->cfsiz * i; 901 + err = memcpy_from_msg((u8 *)cf, msg, op->cfsiz); 902 + 903 + if (op->flags & CAN_FD_FRAME) { 904 + if (cf->len > 64) 905 + err = -EINVAL; 906 + } else { 907 + if (cf->len > 8) 908 + err = -EINVAL; 909 + } 941 910 942 911 if (err < 0) { 943 912 if (op->frames != &op->sframe) ··· 955 910 956 911 if (msg_head->flags & TX_CP_CAN_ID) { 957 912 /* copy can_id into frame */ 958 - op->frames[i].can_id = msg_head->can_id; 913 + cf->can_id = msg_head->can_id; 959 914 } 960 915 } 961 916 ··· 990 945 991 946 /* check flags */ 992 947 993 - op->flags = msg_head->flags; 994 - 995 948 if (op->flags & TX_RESET_MULTI_IDX) { 996 949 /* start multiple frame transmission with index 0 */ 997 950 op->currframe = 0; ··· 1023 980 if (op->flags & STARTTIMER) 1024 981 bcm_tx_start_timer(op); 1025 982 1026 - return msg_head->nframes * CFSIZ + MHSIZ; 983 + return msg_head->nframes * op->cfsiz + MHSIZ; 1027 984 } 1028 985 1029 986 /* ··· 1069 1026 if (msg_head->nframes) { 1070 1027 /* update CAN frames content */ 1071 1028 err = memcpy_from_msg((u8 *)op->frames, msg, 1072 - msg_head->nframes * CFSIZ); 1029 + msg_head->nframes * op->cfsiz); 1073 1030 if (err < 0) 1074 1031 return err; 1075 1032 1076 1033 /* clear last_frames to indicate 'nothing received' */ 1077 - memset(op->last_frames, 0, msg_head->nframes * CFSIZ); 1034 + memset(op->last_frames, 0, msg_head->nframes * op->cfsiz); 1078 1035 } 1079 1036 1080 1037 op->nframes = msg_head->nframes; 1038 + op->flags = msg_head->flags; 1081 1039 1082 1040 /* Only an update -> do not call can_rx_register() */ 1083 1041 do_rx_register = 0; ··· 1089 1045 if (!op) 1090 1046 return -ENOMEM; 1091 1047 1092 - op->can_id = msg_head->can_id; 1093 - op->nframes = msg_head->nframes; 1048 + op->can_id = msg_head->can_id; 1049 + op->nframes = msg_head->nframes; 1050 + op->cfsiz = CFSIZ(msg_head->flags); 1051 + op->flags = msg_head->flags; 1094 1052 1095 1053 if (msg_head->nframes > 1) { 1096 1054 /* create array for CAN frames and copy the data */ 1097 - op->frames = kmalloc(msg_head->nframes * CFSIZ, 1055 + op->frames = kmalloc(msg_head->nframes * op->cfsiz, 1098 1056 GFP_KERNEL); 1099 1057 if (!op->frames) { 1100 1058 kfree(op); ··· 1104 1058 } 1105 1059 1106 1060 /* create and init array for received CAN frames */ 1107 - op->last_frames = kzalloc(msg_head->nframes * CFSIZ, 1061 + op->last_frames = kzalloc(msg_head->nframes * op->cfsiz, 1108 1062 GFP_KERNEL); 1109 1063 if (!op->last_frames) { 1110 1064 kfree(op->frames); ··· 1119 1073 1120 1074 if (msg_head->nframes) { 1121 1075 err = memcpy_from_msg((u8 *)op->frames, msg, 1122 - msg_head->nframes * CFSIZ); 1076 + msg_head->nframes * op->cfsiz); 1123 1077 if (err < 0) { 1124 1078 if (op->frames != &op->sframe) 1125 1079 kfree(op->frames); ··· 1161 1115 } /* if ((op = bcm_find_op(&bo->rx_ops, msg_head->can_id, ifindex))) */ 1162 1116 1163 1117 /* check flags */ 1164 - op->flags = msg_head->flags; 1165 1118 1166 1119 if (op->flags & RX_RTR_FRAME) { 1167 1120 ··· 1232 1187 } 1233 1188 } 1234 1189 1235 - return msg_head->nframes * CFSIZ + MHSIZ; 1190 + return msg_head->nframes * op->cfsiz + MHSIZ; 1236 1191 } 1237 1192 1238 1193 /* ··· 1289 1244 struct bcm_sock *bo = bcm_sk(sk); 1290 1245 int ifindex = bo->ifindex; /* default ifindex for this bcm_op */ 1291 1246 struct bcm_msg_head msg_head; 1247 + int cfsiz; 1292 1248 int ret; /* read bytes or error codes as return value */ 1293 1249 1294 1250 if (!bo->bound) ··· 1304 1258 if (ret < 0) 1305 1259 return ret; 1306 1260 1307 - if ((size - MHSIZ) % CFSIZ) 1261 + cfsiz = CFSIZ(msg_head.flags); 1262 + if ((size - MHSIZ) % cfsiz) 1308 1263 return -EINVAL; 1309 1264 1310 1265 /* check for alternative ifindex for this bcm_op */ ··· 1379 1332 1380 1333 case TX_SEND: 1381 1334 /* we need exactly one CAN frame behind the msg head */ 1382 - if ((msg_head.nframes != 1) || (size != CFSIZ + MHSIZ)) 1335 + if ((msg_head.nframes != 1) || (size != cfsiz + MHSIZ)) 1383 1336 ret = -EINVAL; 1384 1337 else 1385 - ret = bcm_tx_send(msg, ifindex, sk, CFSIZ); 1338 + ret = bcm_tx_send(msg, ifindex, sk, cfsiz); 1386 1339 break; 1387 1340 1388 1341 default: