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

Configure Feed

Select the types of activity you want to include in your feed.

can: replace can_dlc as variable/element for payload length

The naming of can_dlc as element of struct can_frame and also as variable
name is misleading as it claims to be a 'data length CODE' but in reality
it always was a plain data length.

With the indroduction of a new 'len' element in struct can_frame we can now
remove can_dlc as name and make clear which of the former uses was a plain
length (-> 'len') or a data length code (-> 'dlc') value.

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/r/20201120100444.3199-1-socketcan@hartkopp.net
[mkl: gs_usb: keep struct gs_host_frame::can_dlc as is]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Oliver Hartkopp and committed by
Marc Kleine-Budde
c7b74967 cd1124e7

+228 -228
+7 -7
drivers/net/can/at91_can.c
··· 468 468 } 469 469 reg_mid = at91_can_id_to_reg_mid(cf->can_id); 470 470 reg_mcr = ((cf->can_id & CAN_RTR_FLAG) ? AT91_MCR_MRTR : 0) | 471 - (cf->can_dlc << 16) | AT91_MCR_MTCR; 471 + (cf->len << 16) | AT91_MCR_MTCR; 472 472 473 473 /* disable MB while writing ID (see datasheet) */ 474 474 set_mb_mode(priv, mb, AT91_MB_MODE_DISABLED); ··· 481 481 /* This triggers transmission */ 482 482 at91_write(priv, AT91_MCR(mb), reg_mcr); 483 483 484 - stats->tx_bytes += cf->can_dlc; 484 + stats->tx_bytes += cf->len; 485 485 486 486 /* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */ 487 487 can_put_echo_skb(skb, dev, mb - get_mb_tx_first(priv)); ··· 554 554 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 555 555 556 556 stats->rx_packets++; 557 - stats->rx_bytes += cf->can_dlc; 557 + stats->rx_bytes += cf->len; 558 558 netif_receive_skb(skb); 559 559 } 560 560 ··· 580 580 cf->can_id = (reg_mid >> 18) & CAN_SFF_MASK; 581 581 582 582 reg_msr = at91_read(priv, AT91_MSR(mb)); 583 - cf->can_dlc = can_cc_dlc2len((reg_msr >> 16) & 0xf); 583 + cf->len = can_cc_dlc2len((reg_msr >> 16) & 0xf); 584 584 585 585 if (reg_msr & AT91_MSR_MRTR) 586 586 cf->can_id |= CAN_RTR_FLAG; ··· 619 619 at91_read_mb(dev, mb, cf); 620 620 621 621 stats->rx_packets++; 622 - stats->rx_bytes += cf->can_dlc; 622 + stats->rx_bytes += cf->len; 623 623 netif_receive_skb(skb); 624 624 625 625 can_led_event(dev, CAN_LED_EVENT_RX); ··· 780 780 at91_poll_err_frame(dev, cf, reg_sr); 781 781 782 782 dev->stats.rx_packets++; 783 - dev->stats.rx_bytes += cf->can_dlc; 783 + dev->stats.rx_bytes += cf->len; 784 784 netif_receive_skb(skb); 785 785 786 786 return 1; ··· 1047 1047 at91_irq_err_state(dev, cf, new_state); 1048 1048 1049 1049 dev->stats.rx_packets++; 1050 - dev->stats.rx_bytes += cf->can_dlc; 1050 + dev->stats.rx_bytes += cf->len; 1051 1051 netif_rx(skb); 1052 1052 1053 1053 priv->can.state = new_state;
+10 -10
drivers/net/can/c_can/c_can.c
··· 306 306 struct can_frame *frame, int idx) 307 307 { 308 308 struct c_can_priv *priv = netdev_priv(dev); 309 - u16 ctrl = IF_MCONT_TX | frame->can_dlc; 309 + u16 ctrl = IF_MCONT_TX | frame->len; 310 310 bool rtr = frame->can_id & CAN_RTR_FLAG; 311 311 u32 arb = IF_ARB_MSGVAL; 312 312 int i; ··· 339 339 if (priv->type == BOSCH_D_CAN) { 340 340 u32 data = 0, dreg = C_CAN_IFACE(DATA1_REG, iface); 341 341 342 - for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { 342 + for (i = 0; i < frame->len; i += 4, dreg += 2) { 343 343 data = (u32)frame->data[i]; 344 344 data |= (u32)frame->data[i + 1] << 8; 345 345 data |= (u32)frame->data[i + 2] << 16; ··· 347 347 priv->write_reg32(priv, dreg, data); 348 348 } 349 349 } else { 350 - for (i = 0; i < frame->can_dlc; i += 2) { 350 + for (i = 0; i < frame->len; i += 2) { 351 351 priv->write_reg(priv, 352 352 C_CAN_IFACE(DATA1_REG, iface) + i / 2, 353 353 frame->data[i] | ··· 397 397 return -ENOMEM; 398 398 } 399 399 400 - frame->can_dlc = can_cc_dlc2len(ctrl & 0x0F); 400 + frame->len = can_cc_dlc2len(ctrl & 0x0F); 401 401 402 402 arb = priv->read_reg32(priv, C_CAN_IFACE(ARB1_REG, iface)); 403 403 ··· 412 412 int i, dreg = C_CAN_IFACE(DATA1_REG, iface); 413 413 414 414 if (priv->type == BOSCH_D_CAN) { 415 - for (i = 0; i < frame->can_dlc; i += 4, dreg += 2) { 415 + for (i = 0; i < frame->len; i += 4, dreg += 2) { 416 416 data = priv->read_reg32(priv, dreg); 417 417 frame->data[i] = data; 418 418 frame->data[i + 1] = data >> 8; ··· 420 420 frame->data[i + 3] = data >> 24; 421 421 } 422 422 } else { 423 - for (i = 0; i < frame->can_dlc; i += 2, dreg++) { 423 + for (i = 0; i < frame->len; i += 2, dreg++) { 424 424 data = priv->read_reg(priv, dreg); 425 425 frame->data[i] = data; 426 426 frame->data[i + 1] = data >> 8; ··· 429 429 } 430 430 431 431 stats->rx_packets++; 432 - stats->rx_bytes += frame->can_dlc; 432 + stats->rx_bytes += frame->len; 433 433 434 434 netif_receive_skb(skb); 435 435 return 0; ··· 475 475 * transmit as we might race against do_tx(). 476 476 */ 477 477 c_can_setup_tx_object(dev, IF_TX, frame, idx); 478 - priv->dlc[idx] = frame->can_dlc; 478 + priv->dlc[idx] = frame->len; 479 479 can_put_echo_skb(skb, dev, idx); 480 480 481 481 /* Update the active bits */ ··· 977 977 } 978 978 979 979 stats->rx_packets++; 980 - stats->rx_bytes += cf->can_dlc; 980 + stats->rx_bytes += cf->len; 981 981 netif_receive_skb(skb); 982 982 983 983 return 1; ··· 1047 1047 } 1048 1048 1049 1049 stats->rx_packets++; 1050 - stats->rx_bytes += cf->can_dlc; 1050 + stats->rx_bytes += cf->len; 1051 1051 netif_receive_skb(skb); 1052 1052 return 1; 1053 1053 }
+7 -7
drivers/net/can/cc770/cc770.c
··· 390 390 u32 id; 391 391 int i; 392 392 393 - dlc = cf->can_dlc; 393 + dlc = cf->len; 394 394 id = cf->can_id; 395 395 rtr = cf->can_id & CAN_RTR_FLAG ? 0 : MSGCFG_DIR; 396 396 ··· 470 470 cf->can_id = CAN_RTR_FLAG; 471 471 if (config & MSGCFG_XTD) 472 472 cf->can_id |= CAN_EFF_FLAG; 473 - cf->can_dlc = 0; 473 + cf->len = 0; 474 474 } else { 475 475 if (config & MSGCFG_XTD) { 476 476 id = cc770_read_reg(priv, msgobj[mo].id[3]); ··· 486 486 } 487 487 488 488 cf->can_id = id; 489 - cf->can_dlc = can_cc_dlc2len((config & 0xf0) >> 4); 490 - for (i = 0; i < cf->can_dlc; i++) 489 + cf->len = can_cc_dlc2len((config & 0xf0) >> 4); 490 + for (i = 0; i < cf->len; i++) 491 491 cf->data[i] = cc770_read_reg(priv, msgobj[mo].data[i]); 492 492 } 493 493 494 494 stats->rx_packets++; 495 - stats->rx_bytes += cf->can_dlc; 495 + stats->rx_bytes += cf->len; 496 496 netif_rx(skb); 497 497 } 498 498 ··· 572 572 573 573 574 574 stats->rx_packets++; 575 - stats->rx_bytes += cf->can_dlc; 575 + stats->rx_bytes += cf->len; 576 576 netif_rx(skb); 577 577 578 578 return 0; ··· 699 699 } 700 700 701 701 cf = (struct can_frame *)priv->tx_skb->data; 702 - stats->tx_bytes += cf->can_dlc; 702 + stats->tx_bytes += cf->len; 703 703 stats->tx_packets++; 704 704 705 705 can_put_echo_skb(priv->tx_skb, dev, 0);
+5 -5
drivers/net/can/dev.c
··· 30 30 static const u8 dlc2len[] = {0, 1, 2, 3, 4, 5, 6, 7, 31 31 8, 12, 16, 20, 24, 32, 48, 64}; 32 32 33 - /* get data length from can_dlc with sanitized can_dlc */ 34 - u8 can_dlc2len(u8 can_dlc) 33 + /* get data length from raw data length code (DLC) */ 34 + u8 can_dlc2len(u8 dlc) 35 35 { 36 - return dlc2len[can_dlc & 0x0F]; 36 + return dlc2len[dlc & 0x0F]; 37 37 } 38 38 EXPORT_SYMBOL_GPL(can_dlc2len); 39 39 ··· 595 595 netif_rx_ni(skb); 596 596 597 597 stats->rx_packets++; 598 - stats->rx_bytes += cf->can_dlc; 598 + stats->rx_bytes += cf->len; 599 599 600 600 restart: 601 601 netdev_dbg(dev, "restarted\n"); ··· 737 737 return NULL; 738 738 739 739 (*cf)->can_id = CAN_ERR_FLAG; 740 - (*cf)->can_dlc = CAN_ERR_DLC; 740 + (*cf)->len = CAN_ERR_DLC; 741 741 742 742 return skb; 743 743 }
+5 -5
drivers/net/can/grcan.c
··· 1201 1201 cf->can_id = ((slot[0] & GRCAN_MSG_BID) 1202 1202 >> GRCAN_MSG_BID_BIT); 1203 1203 } 1204 - cf->can_dlc = can_cc_dlc2len((slot[1] & GRCAN_MSG_DLC) 1204 + cf->len = can_cc_dlc2len((slot[1] & GRCAN_MSG_DLC) 1205 1205 >> GRCAN_MSG_DLC_BIT); 1206 1206 if (rtr) { 1207 1207 cf->can_id |= CAN_RTR_FLAG; 1208 1208 } else { 1209 - for (i = 0; i < cf->can_dlc; i++) { 1209 + for (i = 0; i < cf->len; i++) { 1210 1210 j = GRCAN_MSG_DATA_SLOT_INDEX(i); 1211 1211 shift = GRCAN_MSG_DATA_SHIFT(i); 1212 1212 cf->data[i] = (u8)(slot[j] >> shift); ··· 1215 1215 1216 1216 /* Update statistics and read pointer */ 1217 1217 stats->rx_packets++; 1218 - stats->rx_bytes += cf->can_dlc; 1218 + stats->rx_bytes += cf->len; 1219 1219 netif_receive_skb(skb); 1220 1220 1221 1221 rd = grcan_ring_add(rd, GRCAN_MSG_SIZE, dma->rx.size); ··· 1399 1399 eff = cf->can_id & CAN_EFF_FLAG; 1400 1400 rtr = cf->can_id & CAN_RTR_FLAG; 1401 1401 id = cf->can_id & (eff ? CAN_EFF_MASK : CAN_SFF_MASK); 1402 - dlc = cf->can_dlc; 1402 + dlc = cf->len; 1403 1403 if (eff) 1404 1404 tmp = (id << GRCAN_MSG_EID_BIT) & GRCAN_MSG_EID; 1405 1405 else ··· 1447 1447 * can_put_echo_skb would be an error unless other measures are 1448 1448 * taken. 1449 1449 */ 1450 - priv->txdlc[slotindex] = cf->can_dlc; /* Store dlc for statistics */ 1450 + priv->txdlc[slotindex] = cf->len; /* Store dlc for statistics */ 1451 1451 can_put_echo_skb(skb, dev, slotindex); 1452 1452 1453 1453 /* Make sure everything is written before allowing hardware to
+2 -2
drivers/net/can/ifi_canfd/ifi_canfd.c
··· 431 431 writel(IFI_CANFD_ERROR_CTR_ER_ENABLE, priv->base + IFI_CANFD_ERROR_CTR); 432 432 433 433 stats->rx_packets++; 434 - stats->rx_bytes += cf->can_dlc; 434 + stats->rx_bytes += cf->len; 435 435 netif_receive_skb(skb); 436 436 437 437 return 1; ··· 523 523 } 524 524 525 525 stats->rx_packets++; 526 - stats->rx_bytes += cf->can_dlc; 526 + stats->rx_bytes += cf->len; 527 527 netif_receive_skb(skb); 528 528 529 529 return 1;
+10 -10
drivers/net/can/janz-ican3.c
··· 916 916 917 917 cf->can_id |= desc->data[0] << 3; 918 918 cf->can_id |= (desc->data[1] & 0xe0) >> 5; 919 - cf->can_dlc = can_cc_dlc2len(desc->data[1] & ICAN3_CAN_DLC_MASK); 920 - memcpy(cf->data, &desc->data[2], cf->can_dlc); 919 + cf->len = can_cc_dlc2len(desc->data[1] & ICAN3_CAN_DLC_MASK); 920 + memcpy(cf->data, &desc->data[2], cf->len); 921 921 } else { 922 - cf->can_dlc = can_cc_dlc2len(desc->data[0] & ICAN3_CAN_DLC_MASK); 922 + cf->len = can_cc_dlc2len(desc->data[0] & ICAN3_CAN_DLC_MASK); 923 923 if (desc->data[0] & ICAN3_EFF_RTR) 924 924 cf->can_id |= CAN_RTR_FLAG; 925 925 ··· 934 934 cf->can_id |= desc->data[3] >> 5; /* 2-0 */ 935 935 } 936 936 937 - memcpy(cf->data, &desc->data[6], cf->can_dlc); 937 + memcpy(cf->data, &desc->data[6], cf->len); 938 938 } 939 939 } 940 940 ··· 947 947 948 948 /* we always use the extended format, with the ECHO flag set */ 949 949 desc->command = ICAN3_CAN_TYPE_EFF; 950 - desc->data[0] |= cf->can_dlc; 950 + desc->data[0] |= cf->len; 951 951 desc->data[1] |= ICAN3_ECHO; 952 952 953 953 /* support single transmission (no retries) mode */ ··· 970 970 } 971 971 972 972 /* copy the data bits into the descriptor */ 973 - memcpy(&desc->data[6], cf->data, cf->can_dlc); 973 + memcpy(&desc->data[6], cf->data, cf->len); 974 974 } 975 975 976 976 /* ··· 1294 1294 } 1295 1295 1296 1296 cf = (struct can_frame *)skb->data; 1297 - dlc = cf->can_dlc; 1297 + dlc = cf->len; 1298 1298 1299 1299 /* check flag whether this packet has to be looped back */ 1300 1300 if (skb->pkt_type != PACKET_LOOPBACK) { ··· 1332 1332 if (cf->can_id != echo_cf->can_id) 1333 1333 return false; 1334 1334 1335 - if (cf->can_dlc != echo_cf->can_dlc) 1335 + if (cf->len != echo_cf->len) 1336 1336 return false; 1337 1337 1338 - return memcmp(cf->data, echo_cf->data, cf->can_dlc) == 0; 1338 + return memcmp(cf->data, echo_cf->data, cf->len) == 0; 1339 1339 } 1340 1340 1341 1341 /* ··· 1421 1421 1422 1422 /* update statistics, receive the skb */ 1423 1423 stats->rx_packets++; 1424 - stats->rx_bytes += cf->can_dlc; 1424 + stats->rx_bytes += cf->len; 1425 1425 netif_receive_skb(skb); 1426 1426 1427 1427 err_noalloc:
+2 -2
drivers/net/can/kvaser_pciefd.c
··· 1299 1299 cf->data[7] = bec.rxerr; 1300 1300 1301 1301 stats->rx_packets++; 1302 - stats->rx_bytes += cf->can_dlc; 1302 + stats->rx_bytes += cf->len; 1303 1303 1304 1304 netif_rx(skb); 1305 1305 return 0; ··· 1498 1498 1499 1499 if (skb) { 1500 1500 cf->can_id |= CAN_ERR_BUSERROR; 1501 - stats->rx_bytes += cf->can_dlc; 1501 + stats->rx_bytes += cf->len; 1502 1502 stats->rx_packets++; 1503 1503 netif_rx(skb); 1504 1504 } else {
+2 -2
drivers/net/can/m_can/m_can.c
··· 596 596 } 597 597 598 598 stats->rx_packets++; 599 - stats->rx_bytes += cf->can_dlc; 599 + stats->rx_bytes += cf->len; 600 600 netif_receive_skb(skb); 601 601 602 602 return 1; ··· 723 723 } 724 724 725 725 stats->rx_packets++; 726 - stats->rx_bytes += cf->can_dlc; 726 + stats->rx_bytes += cf->len; 727 727 netif_receive_skb(skb); 728 728 729 729 return 1;
+10 -10
drivers/net/can/mscan/mscan.c
··· 250 250 void __iomem *data = &regs->tx.dsr1_0; 251 251 u16 *payload = (u16 *)frame->data; 252 252 253 - for (i = 0; i < frame->can_dlc / 2; i++) { 253 + for (i = 0; i < frame->len / 2; i++) { 254 254 out_be16(data, *payload++); 255 255 data += 2 + _MSCAN_RESERVED_DSR_SIZE; 256 256 } 257 257 /* write remaining byte if necessary */ 258 - if (frame->can_dlc & 1) 259 - out_8(data, frame->data[frame->can_dlc - 1]); 258 + if (frame->len & 1) 259 + out_8(data, frame->data[frame->len - 1]); 260 260 } 261 261 262 - out_8(&regs->tx.dlr, frame->can_dlc); 262 + out_8(&regs->tx.dlr, frame->len); 263 263 out_8(&regs->tx.tbpr, priv->cur_pri); 264 264 265 265 /* Start transmission. */ ··· 312 312 if (can_id & 1) 313 313 frame->can_id |= CAN_RTR_FLAG; 314 314 315 - frame->can_dlc = can_cc_dlc2len(in_8(&regs->rx.dlr) & 0xf); 315 + frame->len = can_cc_dlc2len(in_8(&regs->rx.dlr) & 0xf); 316 316 317 317 if (!(frame->can_id & CAN_RTR_FLAG)) { 318 318 void __iomem *data = &regs->rx.dsr1_0; 319 319 u16 *payload = (u16 *)frame->data; 320 320 321 - for (i = 0; i < frame->can_dlc / 2; i++) { 321 + for (i = 0; i < frame->len / 2; i++) { 322 322 *payload++ = in_be16(data); 323 323 data += 2 + _MSCAN_RESERVED_DSR_SIZE; 324 324 } 325 325 /* read remaining byte if necessary */ 326 - if (frame->can_dlc & 1) 327 - frame->data[frame->can_dlc - 1] = in_8(data); 326 + if (frame->len & 1) 327 + frame->data[frame->len - 1] = in_8(data); 328 328 } 329 329 330 330 out_8(&regs->canrflg, MSCAN_RXF); ··· 372 372 } 373 373 } 374 374 priv->shadow_statflg = canrflg & MSCAN_STAT_MSK; 375 - frame->can_dlc = CAN_ERR_DLC; 375 + frame->len = CAN_ERR_DLC; 376 376 out_8(&regs->canrflg, MSCAN_ERR_IF); 377 377 } 378 378 ··· 407 407 mscan_get_err_frame(dev, frame, canrflg); 408 408 409 409 stats->rx_packets++; 410 - stats->rx_bytes += frame->can_dlc; 410 + stats->rx_bytes += frame->len; 411 411 work_done++; 412 412 netif_receive_skb(skb); 413 413 }
+6 -6
drivers/net/can/pch_can.c
··· 563 563 netif_receive_skb(skb); 564 564 565 565 stats->rx_packets++; 566 - stats->rx_bytes += cf->can_dlc; 566 + stats->rx_bytes += cf->len; 567 567 } 568 568 569 569 static irqreturn_t pch_can_interrupt(int irq, void *dev_id) ··· 683 683 if (id2 & PCH_ID2_DIR) 684 684 cf->can_id |= CAN_RTR_FLAG; 685 685 686 - cf->can_dlc = can_cc_dlc2len((ioread32(&priv->regs-> 686 + cf->len = can_cc_dlc2len((ioread32(&priv->regs-> 687 687 ifregs[0].mcont)) & 0xF); 688 688 689 - for (i = 0; i < cf->can_dlc; i += 2) { 689 + for (i = 0; i < cf->len; i += 2) { 690 690 data_reg = ioread16(&priv->regs->ifregs[0].data[i / 2]); 691 691 cf->data[i] = data_reg; 692 692 cf->data[i + 1] = data_reg >> 8; ··· 696 696 rcv_pkts++; 697 697 stats->rx_packets++; 698 698 quota--; 699 - stats->rx_bytes += cf->can_dlc; 699 + stats->rx_bytes += cf->len; 700 700 701 701 pch_fifo_thresh(priv, obj_num); 702 702 obj_num++; ··· 919 919 iowrite32(id2, &priv->regs->ifregs[1].id2); 920 920 921 921 /* Copy data to register */ 922 - for (i = 0; i < cf->can_dlc; i += 2) { 922 + for (i = 0; i < cf->len; i += 2) { 923 923 iowrite16(cf->data[i] | (cf->data[i + 1] << 8), 924 924 &priv->regs->ifregs[1].data[i / 2]); 925 925 } ··· 927 927 can_put_echo_skb(skb, ndev, tx_obj_no - PCH_RX_OBJ_END - 1); 928 928 929 929 /* Set the size of the data. Update if2_mcont */ 930 - iowrite32(cf->can_dlc | PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_TXRQXT | 930 + iowrite32(cf->len | PCH_IF_MCONT_NEWDAT | PCH_IF_MCONT_TXRQXT | 931 931 PCH_IF_MCONT_TXIE, &priv->regs->ifregs[1].mcont); 932 932 933 933 pch_can_rw_msg_obj(&priv->regs->ifregs[1].creq, tx_obj_no);
+6 -6
drivers/net/can/peak_canfd/peak_canfd.c
··· 410 410 } 411 411 412 412 stats->rx_packets++; 413 - stats->rx_bytes += cf->can_dlc; 413 + stats->rx_bytes += cf->len; 414 414 pucan_netif_rx(skb, msg->ts_low, msg->ts_high); 415 415 416 416 return 0; ··· 438 438 cf->data[6] = priv->bec.txerr; 439 439 cf->data[7] = priv->bec.rxerr; 440 440 441 - stats->rx_bytes += cf->can_dlc; 441 + stats->rx_bytes += cf->len; 442 442 stats->rx_packets++; 443 443 netif_rx(skb); 444 444 ··· 652 652 unsigned long flags; 653 653 bool should_stop_tx_queue; 654 654 int room_left; 655 - u8 can_dlc; 655 + u8 len; 656 656 657 657 if (can_dropped_invalid_skb(ndev, skb)) 658 658 return NETDEV_TX_OK; ··· 682 682 683 683 if (can_is_canfd_skb(skb)) { 684 684 /* CAN FD frame format */ 685 - can_dlc = can_len2dlc(cf->len); 685 + len = can_len2dlc(cf->len); 686 686 687 687 msg_flags |= PUCAN_MSG_EXT_DATA_LEN; 688 688 ··· 693 693 msg_flags |= PUCAN_MSG_ERROR_STATE_IND; 694 694 } else { 695 695 /* CAN 2.0 frame format */ 696 - can_dlc = cf->len; 696 + len = cf->len; 697 697 698 698 if (cf->can_id & CAN_RTR_FLAG) 699 699 msg_flags |= PUCAN_MSG_RTR; ··· 707 707 msg_flags |= PUCAN_MSG_SELF_RECEIVE; 708 708 709 709 msg->flags = cpu_to_le16(msg_flags); 710 - msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(priv->index, can_dlc); 710 + msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(priv->index, len); 711 711 memcpy(msg->d, cf->data, cf->len); 712 712 713 713 /* struct msg client field is used as an index in the echo skbs ring */
+7 -7
drivers/net/can/rcar/rcar_can.c
··· 364 364 365 365 if (skb) { 366 366 stats->rx_packets++; 367 - stats->rx_bytes += cf->can_dlc; 367 + stats->rx_bytes += cf->len; 368 368 netif_rx(skb); 369 369 } 370 370 } ··· 607 607 if (cf->can_id & CAN_RTR_FLAG) { /* Remote transmission request */ 608 608 data |= RCAR_CAN_RTR; 609 609 } else { 610 - for (i = 0; i < cf->can_dlc; i++) 610 + for (i = 0; i < cf->len; i++) 611 611 writeb(cf->data[i], 612 612 &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].data[i]); 613 613 } 614 614 615 615 writel(data, &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].id); 616 616 617 - writeb(cf->can_dlc, &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].dlc); 617 + writeb(cf->len, &priv->regs->mb[RCAR_CAN_TX_FIFO_MBX].dlc); 618 618 619 - priv->tx_dlc[priv->tx_head % RCAR_CAN_FIFO_DEPTH] = cf->can_dlc; 619 + priv->tx_dlc[priv->tx_head % RCAR_CAN_FIFO_DEPTH] = cf->len; 620 620 can_put_echo_skb(skb, ndev, priv->tx_head % RCAR_CAN_FIFO_DEPTH); 621 621 priv->tx_head++; 622 622 /* Start Tx: write 0xff to the TFPCR register to increment ··· 659 659 cf->can_id = (data >> RCAR_CAN_SID_SHIFT) & CAN_SFF_MASK; 660 660 661 661 dlc = readb(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].dlc); 662 - cf->can_dlc = can_cc_dlc2len(dlc); 662 + cf->len = can_cc_dlc2len(dlc); 663 663 if (data & RCAR_CAN_RTR) { 664 664 cf->can_id |= CAN_RTR_FLAG; 665 665 } else { 666 - for (dlc = 0; dlc < cf->can_dlc; dlc++) 666 + for (dlc = 0; dlc < cf->len; dlc++) 667 667 cf->data[dlc] = 668 668 readb(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].data[dlc]); 669 669 } 670 670 671 671 can_led_event(priv->ndev, CAN_LED_EVENT_RX); 672 672 673 - stats->rx_bytes += cf->can_dlc; 673 + stats->rx_bytes += cf->len; 674 674 stats->rx_packets++; 675 675 netif_receive_skb(skb); 676 676 }
+2 -2
drivers/net/can/rcar/rcar_canfd.c
··· 1025 1025 rcar_canfd_write(priv->base, RCANFD_CERFL(ch), 1026 1026 RCANFD_CERFL_ERR(~cerfl)); 1027 1027 stats->rx_packets++; 1028 - stats->rx_bytes += cf->can_dlc; 1028 + stats->rx_bytes += cf->len; 1029 1029 netif_rx(skb); 1030 1030 } 1031 1031 ··· 1134 1134 1135 1135 can_change_state(ndev, cf, tx_state, rx_state); 1136 1136 stats->rx_packets++; 1137 - stats->rx_bytes += cf->can_dlc; 1137 + stats->rx_bytes += cf->len; 1138 1138 netif_rx(skb); 1139 1139 } 1140 1140 }
+1 -1
drivers/net/can/rx-offload.c
··· 55 55 56 56 work_done++; 57 57 stats->rx_packets++; 58 - stats->rx_bytes += cf->can_dlc; 58 + stats->rx_bytes += cf->len; 59 59 netif_receive_skb(skb); 60 60 } 61 61
+5 -5
drivers/net/can/sja1000/sja1000.c
··· 295 295 296 296 netif_stop_queue(dev); 297 297 298 - fi = dlc = cf->can_dlc; 298 + fi = dlc = cf->len; 299 299 id = cf->can_id; 300 300 301 301 if (id & CAN_RTR_FLAG) ··· 367 367 | (priv->read_reg(priv, SJA1000_ID2) >> 5); 368 368 } 369 369 370 - cf->can_dlc = can_cc_dlc2len(fi & 0x0F); 370 + cf->len = can_cc_dlc2len(fi & 0x0F); 371 371 if (fi & SJA1000_FI_RTR) { 372 372 id |= CAN_RTR_FLAG; 373 373 } else { 374 - for (i = 0; i < cf->can_dlc; i++) 374 + for (i = 0; i < cf->len; i++) 375 375 cf->data[i] = priv->read_reg(priv, dreg++); 376 376 } 377 377 ··· 381 381 sja1000_write_cmdreg(priv, CMD_RRB); 382 382 383 383 stats->rx_packets++; 384 - stats->rx_bytes += cf->can_dlc; 384 + stats->rx_bytes += cf->len; 385 385 netif_rx(skb); 386 386 387 387 can_led_event(dev, CAN_LED_EVENT_RX); ··· 490 490 } 491 491 492 492 stats->rx_packets++; 493 - stats->rx_bytes += cf->can_dlc; 493 + stats->rx_bytes += cf->len; 494 494 netif_rx(skb); 495 495 496 496 return 0;
+16 -16
drivers/net/can/slcan.c
··· 106 106 107 107 /* 108 108 * A CAN frame has a can_id (11 bit standard frame format OR 29 bit extended 109 - * frame format) a data length code (can_dlc) which can be from 0 to 8 110 - * and up to <can_dlc> data bytes as payload. 109 + * frame format) a data length code (len) which can be from 0 to 8 110 + * and up to <len> data bytes as payload. 111 111 * Additionally a CAN frame may become a remote transmission frame if the 112 112 * RTR-bit is set. This causes another ECU to send a CAN frame with the 113 113 * given can_id. ··· 128 128 * 129 129 * Examples: 130 130 * 131 - * t1230 : can_id 0x123, can_dlc 0, no data 132 - * t4563112233 : can_id 0x456, can_dlc 3, data 0x11 0x22 0x33 133 - * T12ABCDEF2AA55 : extended can_id 0x12ABCDEF, can_dlc 2, data 0xAA 0x55 134 - * r1230 : can_id 0x123, can_dlc 0, no data, remote transmission request 131 + * t1230 : can_id 0x123, len 0, no data 132 + * t4563112233 : can_id 0x456, len 3, data 0x11 0x22 0x33 133 + * T12ABCDEF2AA55 : extended can_id 0x12ABCDEF, len 2, data 0xAA 0x55 134 + * r1230 : can_id 0x123, len 0, no data, remote transmission request 135 135 * 136 136 */ 137 137 ··· 156 156 fallthrough; 157 157 case 't': 158 158 /* store dlc ASCII value and terminate SFF CAN ID string */ 159 - cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN]; 159 + cf.len = sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN]; 160 160 sl->rbuff[SLC_CMD_LEN + SLC_SFF_ID_LEN] = 0; 161 161 /* point to payload data behind the dlc */ 162 162 cmd += SLC_CMD_LEN + SLC_SFF_ID_LEN + 1; ··· 167 167 case 'T': 168 168 cf.can_id |= CAN_EFF_FLAG; 169 169 /* store dlc ASCII value and terminate EFF CAN ID string */ 170 - cf.can_dlc = sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN]; 170 + cf.len = sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN]; 171 171 sl->rbuff[SLC_CMD_LEN + SLC_EFF_ID_LEN] = 0; 172 172 /* point to payload data behind the dlc */ 173 173 cmd += SLC_CMD_LEN + SLC_EFF_ID_LEN + 1; ··· 181 181 182 182 cf.can_id |= tmpid; 183 183 184 - /* get can_dlc from sanitized ASCII value */ 185 - if (cf.can_dlc >= '0' && cf.can_dlc < '9') 186 - cf.can_dlc -= '0'; 184 + /* get len from sanitized ASCII value */ 185 + if (cf.len >= '0' && cf.len < '9') 186 + cf.len -= '0'; 187 187 else 188 188 return; 189 189 190 190 /* RTR frames may have a dlc > 0 but they never have any data bytes */ 191 191 if (!(cf.can_id & CAN_RTR_FLAG)) { 192 - for (i = 0; i < cf.can_dlc; i++) { 192 + for (i = 0; i < cf.len; i++) { 193 193 tmp = hex_to_bin(*cmd++); 194 194 if (tmp < 0) 195 195 return; ··· 218 218 skb_put_data(skb, &cf, sizeof(struct can_frame)); 219 219 220 220 sl->dev->stats.rx_packets++; 221 - sl->dev->stats.rx_bytes += cf.can_dlc; 221 + sl->dev->stats.rx_bytes += cf.len; 222 222 netif_rx_ni(skb); 223 223 } 224 224 ··· 282 282 283 283 pos += (cf->can_id & CAN_EFF_FLAG) ? SLC_EFF_ID_LEN : SLC_SFF_ID_LEN; 284 284 285 - *pos++ = cf->can_dlc + '0'; 285 + *pos++ = cf->len + '0'; 286 286 287 287 /* RTR frames may have a dlc > 0 but they never have any data bytes */ 288 288 if (!(cf->can_id & CAN_RTR_FLAG)) { 289 - for (i = 0; i < cf->can_dlc; i++) 289 + for (i = 0; i < cf->len; i++) 290 290 pos = hex_byte_pack_upper(pos, cf->data[i]); 291 291 } 292 292 ··· 304 304 actual = sl->tty->ops->write(sl->tty, sl->xbuff, pos - sl->xbuff); 305 305 sl->xleft = (pos - sl->xbuff) - actual; 306 306 sl->xhead = sl->xbuff + actual; 307 - sl->dev->stats.tx_bytes += cf->can_dlc; 307 + sl->dev->stats.tx_bytes += cf->len; 308 308 } 309 309 310 310 /* Write out any remaining transmit buffer. Scheduled when tty is writable */
+1 -1
drivers/net/can/softing/softing_fw.c
··· 624 624 */ 625 625 memset(&msg, 0, sizeof(msg)); 626 626 msg.can_id = CAN_ERR_FLAG | CAN_ERR_RESTARTED; 627 - msg.can_dlc = CAN_ERR_DLC; 627 + msg.len = CAN_ERR_DLC; 628 628 for (j = 0; j < ARRAY_SIZE(card->net); ++j) { 629 629 if (!(bus_bitmask_start & (1 << j))) 630 630 continue;
+7 -7
drivers/net/can/softing/softing_main.c
··· 84 84 if (priv->index) 85 85 *ptr |= CMD_BUS2; 86 86 ++ptr; 87 - *ptr++ = cf->can_dlc; 87 + *ptr++ = cf->len; 88 88 *ptr++ = (cf->can_id >> 0); 89 89 *ptr++ = (cf->can_id >> 8); 90 90 if (cf->can_id & CAN_EFF_FLAG) { ··· 95 95 ptr += 1; 96 96 } 97 97 if (!(cf->can_id & CAN_RTR_FLAG)) 98 - memcpy(ptr, &cf->data[0], cf->can_dlc); 98 + memcpy(ptr, &cf->data[0], cf->len); 99 99 memcpy_toio(&card->dpram[DPRAM_TX + DPRAM_TX_SIZE * fifo_wr], 100 100 buf, DPRAM_TX_SIZE); 101 101 if (++fifo_wr >= DPRAM_TX_CNT) ··· 167 167 iowrite8(0, &card->dpram[DPRAM_RX_LOST]); 168 168 /* prepare msg */ 169 169 msg.can_id = CAN_ERR_FLAG | CAN_ERR_CRTL; 170 - msg.can_dlc = CAN_ERR_DLC; 170 + msg.len = CAN_ERR_DLC; 171 171 msg.data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 172 172 /* 173 173 * service to all buses, we don't know which it was applicable ··· 218 218 state = *ptr++; 219 219 220 220 msg.can_id = CAN_ERR_FLAG; 221 - msg.can_dlc = CAN_ERR_DLC; 221 + msg.len = CAN_ERR_DLC; 222 222 223 223 if (state & SF_MASK_BUSOFF) { 224 224 can_state = CAN_STATE_BUS_OFF; ··· 261 261 } else { 262 262 if (cmd & CMD_RTR) 263 263 msg.can_id |= CAN_RTR_FLAG; 264 - msg.can_dlc = can_cc_dlc2len(*ptr++); 264 + msg.len = can_cc_dlc2len(*ptr++); 265 265 if (cmd & CMD_XTD) { 266 266 msg.can_id |= CAN_EFF_FLAG; 267 267 msg.can_id |= le32_to_cpup((void *)ptr); ··· 294 294 --card->tx.pending; 295 295 ++netdev->stats.tx_packets; 296 296 if (!(msg.can_id & CAN_RTR_FLAG)) 297 - netdev->stats.tx_bytes += msg.can_dlc; 297 + netdev->stats.tx_bytes += msg.len; 298 298 } else { 299 299 int ret; 300 300 ··· 302 302 if (ret == NET_RX_SUCCESS) { 303 303 ++netdev->stats.rx_packets; 304 304 if (!(msg.can_id & CAN_RTR_FLAG)) 305 - netdev->stats.rx_bytes += msg.can_dlc; 305 + netdev->stats.rx_bytes += msg.len; 306 306 } else { 307 307 ++netdev->stats.rx_dropped; 308 308 }
+10 -10
drivers/net/can/spi/hi311x.c
··· 277 277 ((frame->can_id & CAN_EFF_MASK) << 1) | 278 278 ((frame->can_id & CAN_RTR_FLAG) ? 1 : 0); 279 279 280 - buf[HI3110_FIFO_EXT_DLC_OFF] = frame->can_dlc; 280 + buf[HI3110_FIFO_EXT_DLC_OFF] = frame->len; 281 281 282 282 memcpy(buf + HI3110_FIFO_EXT_DATA_OFF, 283 - frame->data, frame->can_dlc); 283 + frame->data, frame->len); 284 284 285 285 hi3110_hw_tx_frame(spi, buf, HI3110_TX_EXT_BUF_LEN - 286 - (HI3110_CAN_MAX_DATA_LEN - frame->can_dlc)); 286 + (HI3110_CAN_MAX_DATA_LEN - frame->len)); 287 287 } else { 288 288 /* Standard frame */ 289 289 buf[HI3110_FIFO_ID_OFF] = (frame->can_id & CAN_SFF_MASK) >> 3; ··· 291 291 ((frame->can_id & CAN_SFF_MASK) << 5) | 292 292 ((frame->can_id & CAN_RTR_FLAG) ? (1 << 4) : 0); 293 293 294 - buf[HI3110_FIFO_STD_DLC_OFF] = frame->can_dlc; 294 + buf[HI3110_FIFO_STD_DLC_OFF] = frame->len; 295 295 296 296 memcpy(buf + HI3110_FIFO_STD_DATA_OFF, 297 - frame->data, frame->can_dlc); 297 + frame->data, frame->len); 298 298 299 299 hi3110_hw_tx_frame(spi, buf, HI3110_TX_STD_BUF_LEN - 300 - (HI3110_CAN_MAX_DATA_LEN - frame->can_dlc)); 300 + (HI3110_CAN_MAX_DATA_LEN - frame->len)); 301 301 } 302 302 } 303 303 ··· 341 341 } 342 342 343 343 /* Data length */ 344 - frame->can_dlc = can_cc_dlc2len(buf[HI3110_FIFO_WOTIME_DLC_OFF] & 0x0F); 344 + frame->len = can_cc_dlc2len(buf[HI3110_FIFO_WOTIME_DLC_OFF] & 0x0F); 345 345 346 346 if (buf[HI3110_FIFO_WOTIME_ID_OFF + 3] & HI3110_FIFO_WOTIME_ID_RTR) 347 347 frame->can_id |= CAN_RTR_FLAG; 348 348 else 349 349 memcpy(frame->data, buf + HI3110_FIFO_WOTIME_DAT_OFF, 350 - frame->can_dlc); 350 + frame->len); 351 351 352 352 priv->net->stats.rx_packets++; 353 - priv->net->stats.rx_bytes += frame->can_dlc; 353 + priv->net->stats.rx_bytes += frame->len; 354 354 355 355 can_led_event(priv->net, CAN_LED_EVENT_RX); 356 356 ··· 585 585 } else { 586 586 frame = (struct can_frame *)priv->tx_skb->data; 587 587 hi3110_hw_tx(spi, frame); 588 - priv->tx_len = 1 + frame->can_dlc; 588 + priv->tx_len = 1 + frame->len; 589 589 can_put_echo_skb(priv->tx_skb, net, 0); 590 590 priv->tx_skb = NULL; 591 591 }
+9 -9
drivers/net/can/spi/mcp251x.c
··· 644 644 ((eid >> SIDL_EID_SHIFT) & SIDL_EID_MASK); 645 645 buf[TXBEID8_OFF] = GET_BYTE(eid, 1); 646 646 buf[TXBEID0_OFF] = GET_BYTE(eid, 0); 647 - buf[TXBDLC_OFF] = (rtr << DLC_RTR_SHIFT) | frame->can_dlc; 648 - memcpy(buf + TXBDAT_OFF, frame->data, frame->can_dlc); 649 - mcp251x_hw_tx_frame(spi, buf, frame->can_dlc, tx_buf_idx); 647 + buf[TXBDLC_OFF] = (rtr << DLC_RTR_SHIFT) | frame->len; 648 + memcpy(buf + TXBDAT_OFF, frame->data, frame->len); 649 + mcp251x_hw_tx_frame(spi, buf, frame->len, tx_buf_idx); 650 650 651 651 /* use INSTRUCTION_RTS, to avoid "repeated frame problem" */ 652 652 priv->spi_tx_buf[0] = INSTRUCTION_RTS(1 << tx_buf_idx); ··· 720 720 frame->can_id |= CAN_RTR_FLAG; 721 721 } 722 722 /* Data length */ 723 - frame->can_dlc = can_cc_dlc2len(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK); 724 - memcpy(frame->data, buf + RXBDAT_OFF, frame->can_dlc); 723 + frame->len = can_cc_dlc2len(buf[RXBDLC_OFF] & RXBDLC_LEN_MASK); 724 + memcpy(frame->data, buf + RXBDAT_OFF, frame->len); 725 725 726 726 priv->net->stats.rx_packets++; 727 - priv->net->stats.rx_bytes += frame->can_dlc; 727 + priv->net->stats.rx_bytes += frame->len; 728 728 729 729 can_led_event(priv->net, CAN_LED_EVENT_RX); 730 730 ··· 998 998 } else { 999 999 frame = (struct can_frame *)priv->tx_skb->data; 1000 1000 1001 - if (frame->can_dlc > CAN_FRAME_MAX_DATA_LEN) 1002 - frame->can_dlc = CAN_FRAME_MAX_DATA_LEN; 1001 + if (frame->len > CAN_FRAME_MAX_DATA_LEN) 1002 + frame->len = CAN_FRAME_MAX_DATA_LEN; 1003 1003 mcp251x_hw_tx(spi, frame, 0); 1004 - priv->tx_len = 1 + frame->can_dlc; 1004 + priv->tx_len = 1 + frame->len; 1005 1005 can_put_echo_skb(priv->tx_skb, net, 0); 1006 1006 priv->tx_skb = NULL; 1007 1007 }
+5 -5
drivers/net/can/sun4i_can.c
··· 424 424 netif_stop_queue(dev); 425 425 426 426 id = cf->can_id; 427 - dlc = cf->can_dlc; 427 + dlc = cf->len; 428 428 msg_flag_n = dlc; 429 429 430 430 if (id & CAN_RTR_FLAG) ··· 475 475 return; 476 476 477 477 fi = readl(priv->base + SUN4I_REG_BUF0_ADDR); 478 - cf->can_dlc = can_cc_dlc2len(fi & 0x0F); 478 + cf->len = can_cc_dlc2len(fi & 0x0F); 479 479 if (fi & SUN4I_MSG_EFF_FLAG) { 480 480 dreg = SUN4I_REG_BUF5_ADDR; 481 481 id = (readl(priv->base + SUN4I_REG_BUF1_ADDR) << 21) | ··· 493 493 if (fi & SUN4I_MSG_RTR_FLAG) 494 494 id |= CAN_RTR_FLAG; 495 495 else 496 - for (i = 0; i < cf->can_dlc; i++) 496 + for (i = 0; i < cf->len; i++) 497 497 cf->data[i] = readl(priv->base + dreg + i * 4); 498 498 499 499 cf->can_id = id; ··· 501 501 sun4i_can_write_cmdreg(priv, SUN4I_CMD_RELEASE_RBUF); 502 502 503 503 stats->rx_packets++; 504 - stats->rx_bytes += cf->can_dlc; 504 + stats->rx_bytes += cf->len; 505 505 netif_rx(skb); 506 506 507 507 can_led_event(dev, CAN_LED_EVENT_RX); ··· 625 625 626 626 if (likely(skb)) { 627 627 stats->rx_packets++; 628 - stats->rx_bytes += cf->can_dlc; 628 + stats->rx_bytes += cf->len; 629 629 netif_rx(skb); 630 630 } else { 631 631 return -ENOMEM;
+4 -4
drivers/net/can/ti_hecc.c
··· 496 496 spin_unlock_irqrestore(&priv->mbx_lock, flags); 497 497 498 498 /* Prepare mailbox for transmission */ 499 - data = cf->can_dlc | (get_tx_head_prio(priv) << 8); 499 + data = cf->len | (get_tx_head_prio(priv) << 8); 500 500 if (cf->can_id & CAN_RTR_FLAG) /* Remote transmission request */ 501 501 data |= HECC_CANMCF_RTR; 502 502 hecc_write_mbx(priv, mbxno, HECC_CANMCF, data); ··· 508 508 hecc_write_mbx(priv, mbxno, HECC_CANMID, data); 509 509 hecc_write_mbx(priv, mbxno, HECC_CANMDL, 510 510 be32_to_cpu(*(__be32 *)(cf->data))); 511 - if (cf->can_dlc > 4) 511 + if (cf->len > 4) 512 512 hecc_write_mbx(priv, mbxno, HECC_CANMDH, 513 513 be32_to_cpu(*(__be32 *)(cf->data + 4))); 514 514 else ··· 566 566 data = hecc_read_mbx(priv, mbxno, HECC_CANMCF); 567 567 if (data & HECC_CANMCF_RTR) 568 568 cf->can_id |= CAN_RTR_FLAG; 569 - cf->can_dlc = can_cc_dlc2len(data & 0xF); 569 + cf->len = can_cc_dlc2len(data & 0xF); 570 570 571 571 data = hecc_read_mbx(priv, mbxno, HECC_CANMDL); 572 572 *(__be32 *)(cf->data) = cpu_to_be32(data); 573 - if (cf->can_dlc > 4) { 573 + if (cf->len > 4) { 574 574 data = hecc_read_mbx(priv, mbxno, HECC_CANMDH); 575 575 *(__be32 *)(cf->data + 4) = cpu_to_be32(data); 576 576 }
+8 -8
drivers/net/can/usb/ems_usb.c
··· 306 306 return; 307 307 308 308 cf->can_id = le32_to_cpu(msg->msg.can_msg.id); 309 - cf->can_dlc = can_cc_dlc2len(msg->msg.can_msg.length & 0xF); 309 + cf->len = can_cc_dlc2len(msg->msg.can_msg.length & 0xF); 310 310 311 311 if (msg->type == CPC_MSG_TYPE_EXT_CAN_FRAME || 312 312 msg->type == CPC_MSG_TYPE_EXT_RTR_FRAME) ··· 316 316 msg->type == CPC_MSG_TYPE_EXT_RTR_FRAME) { 317 317 cf->can_id |= CAN_RTR_FLAG; 318 318 } else { 319 - for (i = 0; i < cf->can_dlc; i++) 319 + for (i = 0; i < cf->len; i++) 320 320 cf->data[i] = msg->msg.can_msg.msg[i]; 321 321 } 322 322 323 323 stats->rx_packets++; 324 - stats->rx_bytes += cf->can_dlc; 324 + stats->rx_bytes += cf->len; 325 325 netif_rx(skb); 326 326 } 327 327 ··· 396 396 } 397 397 398 398 stats->rx_packets++; 399 - stats->rx_bytes += cf->can_dlc; 399 + stats->rx_bytes += cf->len; 400 400 netif_rx(skb); 401 401 } 402 402 ··· 755 755 msg = (struct ems_cpc_msg *)&buf[CPC_HEADER_SIZE]; 756 756 757 757 msg->msg.can_msg.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK); 758 - msg->msg.can_msg.length = cf->can_dlc; 758 + msg->msg.can_msg.length = cf->len; 759 759 760 760 if (cf->can_id & CAN_RTR_FLAG) { 761 761 msg->type = cf->can_id & CAN_EFF_FLAG ? ··· 766 766 msg->type = cf->can_id & CAN_EFF_FLAG ? 767 767 CPC_CMD_TYPE_EXT_CAN_FRAME : CPC_CMD_TYPE_CAN_FRAME; 768 768 769 - for (i = 0; i < cf->can_dlc; i++) 769 + for (i = 0; i < cf->len; i++) 770 770 msg->msg.can_msg.msg[i] = cf->data[i]; 771 771 772 - msg->length = CPC_CAN_MSG_MIN_SIZE + cf->can_dlc; 772 + msg->length = CPC_CAN_MSG_MIN_SIZE + cf->len; 773 773 } 774 774 775 775 for (i = 0; i < MAX_TX_URBS; i++) { ··· 794 794 795 795 context->dev = dev; 796 796 context->echo_index = i; 797 - context->dlc = cf->can_dlc; 797 + context->dlc = cf->len; 798 798 799 799 usb_fill_bulk_urb(urb, dev->udev, usb_sndbulkpipe(dev->udev, 2), buf, 800 800 size, ems_usb_write_bulk_callback, context);
+8 -8
drivers/net/can/usb/esd_usb2.c
··· 292 292 priv->bec.rxerr = rxerr; 293 293 294 294 stats->rx_packets++; 295 - stats->rx_bytes += cf->can_dlc; 295 + stats->rx_bytes += cf->len; 296 296 netif_rx(skb); 297 297 } 298 298 } ··· 321 321 } 322 322 323 323 cf->can_id = id & ESD_IDMASK; 324 - cf->can_dlc = can_cc_dlc2len(msg->msg.rx.dlc & ~ESD_RTR); 324 + cf->len = can_cc_dlc2len(msg->msg.rx.dlc & ~ESD_RTR); 325 325 326 326 if (id & ESD_EXTID) 327 327 cf->can_id |= CAN_EFF_FLAG; ··· 329 329 if (msg->msg.rx.dlc & ESD_RTR) { 330 330 cf->can_id |= CAN_RTR_FLAG; 331 331 } else { 332 - for (i = 0; i < cf->can_dlc; i++) 332 + for (i = 0; i < cf->len; i++) 333 333 cf->data[i] = msg->msg.rx.data[i]; 334 334 } 335 335 336 336 stats->rx_packets++; 337 - stats->rx_bytes += cf->can_dlc; 337 + stats->rx_bytes += cf->len; 338 338 netif_rx(skb); 339 339 } 340 340 ··· 737 737 msg->msg.hdr.len = 3; /* minimal length */ 738 738 msg->msg.hdr.cmd = CMD_CAN_TX; 739 739 msg->msg.tx.net = priv->index; 740 - msg->msg.tx.dlc = cf->can_dlc; 740 + msg->msg.tx.dlc = cf->len; 741 741 msg->msg.tx.id = cpu_to_le32(cf->can_id & CAN_ERR_MASK); 742 742 743 743 if (cf->can_id & CAN_RTR_FLAG) ··· 746 746 if (cf->can_id & CAN_EFF_FLAG) 747 747 msg->msg.tx.id |= cpu_to_le32(ESD_EXTID); 748 748 749 - for (i = 0; i < cf->can_dlc; i++) 749 + for (i = 0; i < cf->len; i++) 750 750 msg->msg.tx.data[i] = cf->data[i]; 751 751 752 - msg->msg.hdr.len += (cf->can_dlc + 3) >> 2; 752 + msg->msg.hdr.len += (cf->len + 3) >> 2; 753 753 754 754 for (i = 0; i < MAX_TX_URBS; i++) { 755 755 if (priv->tx_contexts[i].echo_index == MAX_TX_URBS) { ··· 769 769 770 770 context->priv = priv; 771 771 context->echo_index = i; 772 - context->dlc = cf->can_dlc; 772 + context->dlc = cf->len; 773 773 774 774 /* hnd must not be 0 - MSB is stripped in txdone handling */ 775 775 msg->msg.tx.hnd = 0x80000000 | i; /* returned in TX done message */
+4 -4
drivers/net/can/usb/gs_usb.c
··· 331 331 332 332 cf->can_id = hf->can_id; 333 333 334 - cf->can_dlc = can_cc_dlc2len(hf->can_dlc); 334 + cf->len = can_cc_dlc2len(hf->can_dlc); 335 335 memcpy(cf->data, hf->data, 8); 336 336 337 337 /* ERROR frames tell us information about the controller */ ··· 378 378 goto resubmit_urb; 379 379 380 380 cf->can_id |= CAN_ERR_CRTL; 381 - cf->can_dlc = CAN_ERR_DLC; 381 + cf->len = CAN_ERR_DLC; 382 382 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 383 383 stats->rx_over_errors++; 384 384 stats->rx_errors++; ··· 504 504 cf = (struct can_frame *)skb->data; 505 505 506 506 hf->can_id = cf->can_id; 507 - hf->can_dlc = cf->can_dlc; 508 - memcpy(hf->data, cf->data, cf->can_dlc); 507 + hf->can_dlc = cf->len; 508 + memcpy(hf->data, cf->data, cf->len); 509 509 510 510 usb_fill_bulk_urb(urb, dev->udev, 511 511 usb_sndbulkpipe(dev->udev, GSUSB_ENDPOINT_OUT),
+1 -1
drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
··· 258 258 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 259 259 260 260 stats->rx_packets++; 261 - stats->rx_bytes += cf->can_dlc; 261 + stats->rx_bytes += cf->len; 262 262 netif_rx(skb); 263 263 264 264 return 0;
+8 -8
drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c
··· 895 895 896 896 stats = &netdev->stats; 897 897 stats->rx_packets++; 898 - stats->rx_bytes += cf->can_dlc; 898 + stats->rx_bytes += cf->len; 899 899 netif_rx(skb); 900 900 } 901 901 ··· 1049 1049 cf->data[7] = bec.rxerr; 1050 1050 1051 1051 stats->rx_packets++; 1052 - stats->rx_bytes += cf->can_dlc; 1052 + stats->rx_bytes += cf->len; 1053 1053 netif_rx(skb); 1054 1054 1055 1055 priv->bec.txerr = bec.txerr; ··· 1084 1084 1085 1085 stats->tx_errors++; 1086 1086 stats->rx_packets++; 1087 - stats->rx_bytes += cf->can_dlc; 1087 + stats->rx_bytes += cf->len; 1088 1088 netif_rx(skb); 1089 1089 } 1090 1090 ··· 1180 1180 if (flags & KVASER_USB_HYDRA_CF_FLAG_OVERRUN) 1181 1181 kvaser_usb_can_rx_over_error(priv->netdev); 1182 1182 1183 - cf->can_dlc = can_cc_dlc2len(cmd->rx_can.dlc); 1183 + cf->len = can_cc_dlc2len(cmd->rx_can.dlc); 1184 1184 1185 1185 if (flags & KVASER_USB_HYDRA_CF_FLAG_REMOTE_FRAME) 1186 1186 cf->can_id |= CAN_RTR_FLAG; 1187 1187 else 1188 - memcpy(cf->data, cmd->rx_can.data, cf->can_dlc); 1188 + memcpy(cf->data, cmd->rx_can.data, cf->len); 1189 1189 1190 1190 stats->rx_packets++; 1191 - stats->rx_bytes += cf->can_dlc; 1191 + stats->rx_bytes += cf->len; 1192 1192 netif_rx(skb); 1193 1193 } 1194 1194 ··· 1434 1434 u32 flags; 1435 1435 u32 id; 1436 1436 1437 - *frame_len = cf->can_dlc; 1437 + *frame_len = cf->len; 1438 1438 1439 1439 cmd = kcalloc(1, sizeof(struct kvaser_cmd), GFP_ATOMIC); 1440 1440 if (!cmd) ··· 1455 1455 id = cf->can_id & CAN_SFF_MASK; 1456 1456 } 1457 1457 1458 - cmd->tx_can.dlc = cf->can_dlc; 1458 + cmd->tx_can.dlc = cf->len; 1459 1459 1460 1460 flags = (cf->can_id & CAN_EFF_FLAG ? 1461 1461 KVASER_USB_HYDRA_CF_FLAG_EXTENDED_ID : 0);
+11 -11
drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c
··· 350 350 u8 *cmd_tx_can_flags = NULL; /* GCC */ 351 351 struct can_frame *cf = (struct can_frame *)skb->data; 352 352 353 - *frame_len = cf->can_dlc; 353 + *frame_len = cf->len; 354 354 355 355 cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC); 356 356 if (cmd) { ··· 383 383 cmd->u.tx_can.data[1] = cf->can_id & 0x3f; 384 384 } 385 385 386 - cmd->u.tx_can.data[5] = cf->can_dlc; 387 - memcpy(&cmd->u.tx_can.data[6], cf->data, cf->can_dlc); 386 + cmd->u.tx_can.data[5] = cf->len; 387 + memcpy(&cmd->u.tx_can.data[6], cf->data, cf->len); 388 388 389 389 if (cf->can_id & CAN_RTR_FLAG) 390 390 *cmd_tx_can_flags |= MSG_FLAG_REMOTE_FRAME; ··· 576 576 cf->can_id |= CAN_ERR_RESTARTED; 577 577 578 578 stats->rx_packets++; 579 - stats->rx_bytes += cf->can_dlc; 579 + stats->rx_bytes += cf->len; 580 580 netif_rx(skb); 581 581 } else { 582 582 netdev_err(priv->netdev, ··· 694 694 { 695 695 struct can_frame *cf; 696 696 struct can_frame tmp_cf = { .can_id = CAN_ERR_FLAG, 697 - .can_dlc = CAN_ERR_DLC }; 697 + .len = CAN_ERR_DLC }; 698 698 struct sk_buff *skb; 699 699 struct net_device_stats *stats; 700 700 struct kvaser_usb_net_priv *priv; ··· 778 778 cf->data[7] = es->rxerr; 779 779 780 780 stats->rx_packets++; 781 - stats->rx_bytes += cf->can_dlc; 781 + stats->rx_bytes += cf->len; 782 782 netif_rx(skb); 783 783 } 784 784 ··· 978 978 else 979 979 cf->can_id &= CAN_SFF_MASK; 980 980 981 - cf->can_dlc = can_cc_dlc2len(cmd->u.leaf.log_message.dlc); 981 + cf->len = can_cc_dlc2len(cmd->u.leaf.log_message.dlc); 982 982 983 983 if (cmd->u.leaf.log_message.flags & MSG_FLAG_REMOTE_FRAME) 984 984 cf->can_id |= CAN_RTR_FLAG; 985 985 else 986 986 memcpy(cf->data, &cmd->u.leaf.log_message.data, 987 - cf->can_dlc); 987 + cf->len); 988 988 } else { 989 989 cf->can_id = ((rx_data[0] & 0x1f) << 6) | (rx_data[1] & 0x3f); 990 990 ··· 996 996 cf->can_id |= CAN_EFF_FLAG; 997 997 } 998 998 999 - cf->can_dlc = can_cc_dlc2len(rx_data[5]); 999 + cf->len = can_cc_dlc2len(rx_data[5]); 1000 1000 1001 1001 if (cmd->u.rx_can_header.flag & MSG_FLAG_REMOTE_FRAME) 1002 1002 cf->can_id |= CAN_RTR_FLAG; 1003 1003 else 1004 - memcpy(cf->data, &rx_data[6], cf->can_dlc); 1004 + memcpy(cf->data, &rx_data[6], cf->len); 1005 1005 } 1006 1006 1007 1007 stats->rx_packets++; 1008 - stats->rx_bytes += cf->can_dlc; 1008 + stats->rx_bytes += cf->len; 1009 1009 netif_rx(skb); 1010 1010 } 1011 1011
+5 -5
drivers/net/can/usb/mcba_usb.c
··· 184 184 185 185 if (cf) { 186 186 ctx->can = true; 187 - ctx->dlc = cf->can_dlc; 187 + ctx->dlc = cf->len; 188 188 } else { 189 189 ctx->can = false; 190 190 ctx->dlc = 0; ··· 348 348 usb_msg.eid = 0; 349 349 } 350 350 351 - usb_msg.dlc = cf->can_dlc; 351 + usb_msg.dlc = cf->len; 352 352 353 353 memcpy(usb_msg.data, cf->data, usb_msg.dlc); 354 354 ··· 451 451 if (msg->dlc & MCBA_DLC_RTR_MASK) 452 452 cf->can_id |= CAN_RTR_FLAG; 453 453 454 - cf->can_dlc = can_cc_dlc2len(msg->dlc & MCBA_DLC_MASK); 454 + cf->len = can_cc_dlc2len(msg->dlc & MCBA_DLC_MASK); 455 455 456 - memcpy(cf->data, msg->data, cf->can_dlc); 456 + memcpy(cf->data, msg->data, cf->len); 457 457 458 458 stats->rx_packets++; 459 - stats->rx_bytes += cf->can_dlc; 459 + stats->rx_bytes += cf->len; 460 460 461 461 can_led_event(priv->netdev, CAN_LED_EVENT_RX); 462 462 netif_rx(skb);
+7 -7
drivers/net/can/usb/peak_usb/pcan_usb.c
··· 596 596 } 597 597 598 598 mc->netdev->stats.rx_packets++; 599 - mc->netdev->stats.rx_bytes += cf->can_dlc; 599 + mc->netdev->stats.rx_bytes += cf->len; 600 600 netif_rx(skb); 601 601 602 602 return 0; ··· 734 734 cf->can_id = le16_to_cpu(tmp16) >> 5; 735 735 } 736 736 737 - cf->can_dlc = can_cc_dlc2len(rec_len); 737 + cf->len = can_cc_dlc2len(rec_len); 738 738 739 739 /* Only first packet timestamp is a word */ 740 740 if (pcan_usb_decode_ts(mc, !mc->rec_ts_idx)) ··· 751 751 if ((mc->ptr + rec_len) > mc->end) 752 752 goto decode_failed; 753 753 754 - memcpy(cf->data, mc->ptr, cf->can_dlc); 754 + memcpy(cf->data, mc->ptr, cf->len); 755 755 mc->ptr += rec_len; 756 756 } 757 757 ··· 761 761 762 762 /* update statistics */ 763 763 mc->netdev->stats.rx_packets++; 764 - mc->netdev->stats.rx_bytes += cf->can_dlc; 764 + mc->netdev->stats.rx_bytes += cf->len; 765 765 /* push the skb */ 766 766 netif_rx(skb); 767 767 ··· 838 838 pc = obuf + PCAN_USB_MSG_HEADER_LEN; 839 839 840 840 /* status/len byte */ 841 - *pc = cf->can_dlc; 841 + *pc = cf->len; 842 842 if (cf->can_id & CAN_RTR_FLAG) 843 843 *pc |= PCAN_USB_STATUSLEN_RTR; 844 844 ··· 858 858 859 859 /* can data */ 860 860 if (!(cf->can_id & CAN_RTR_FLAG)) { 861 - memcpy(pc, cf->data, cf->can_dlc); 862 - pc += cf->can_dlc; 861 + memcpy(pc, cf->data, cf->len); 862 + pc += cf->len; 863 863 } 864 864 865 865 obuf[(*size)-1] = (u8)(stats->tx_packets & 0xff);
+5 -5
drivers/net/can/usb/peak_usb/pcan_usb_fd.c
··· 581 581 peak_usb_netif_rx(skb, &usb_if->time_ref, le32_to_cpu(sm->ts_low)); 582 582 583 583 netdev->stats.rx_packets++; 584 - netdev->stats.rx_bytes += cf->can_dlc; 584 + netdev->stats.rx_bytes += cf->len; 585 585 586 586 return 0; 587 587 } ··· 737 737 struct pucan_tx_msg *tx_msg = (struct pucan_tx_msg *)obuf; 738 738 struct canfd_frame *cfd = (struct canfd_frame *)skb->data; 739 739 u16 tx_msg_size, tx_msg_flags; 740 - u8 can_dlc; 740 + u8 len; 741 741 742 742 if (cfd->len > CANFD_MAX_DLEN) 743 743 return -EINVAL; ··· 756 756 757 757 if (can_is_canfd_skb(skb)) { 758 758 /* considering a CANFD frame */ 759 - can_dlc = can_len2dlc(cfd->len); 759 + len = can_len2dlc(cfd->len); 760 760 761 761 tx_msg_flags |= PUCAN_MSG_EXT_DATA_LEN; 762 762 ··· 767 767 tx_msg_flags |= PUCAN_MSG_ERROR_STATE_IND; 768 768 } else { 769 769 /* CAND 2.0 frames */ 770 - can_dlc = cfd->len; 770 + len = cfd->len; 771 771 772 772 if (cfd->can_id & CAN_RTR_FLAG) 773 773 tx_msg_flags |= PUCAN_MSG_RTR; 774 774 } 775 775 776 776 tx_msg->flags = cpu_to_le16(tx_msg_flags); 777 - tx_msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(dev->ctrl_idx, can_dlc); 777 + tx_msg->channel_dlc = PUCAN_MSG_CHANNEL_DLC(dev->ctrl_idx, len); 778 778 memcpy(tx_msg->d, cfd->data, cfd->len); 779 779 780 780 /* add null size message to tag the end (messages are 32-bits aligned)
+7 -7
drivers/net/can/usb/peak_usb/pcan_usb_pro.c
··· 532 532 return -ENOMEM; 533 533 534 534 can_frame->can_id = le32_to_cpu(rx->id); 535 - can_frame->can_dlc = rx->len & 0x0f; 535 + can_frame->len = rx->len & 0x0f; 536 536 537 537 if (rx->flags & PCAN_USBPRO_EXT) 538 538 can_frame->can_id |= CAN_EFF_FLAG; ··· 540 540 if (rx->flags & PCAN_USBPRO_RTR) 541 541 can_frame->can_id |= CAN_RTR_FLAG; 542 542 else 543 - memcpy(can_frame->data, rx->data, can_frame->can_dlc); 543 + memcpy(can_frame->data, rx->data, can_frame->len); 544 544 545 545 hwts = skb_hwtstamps(skb); 546 546 peak_usb_get_ts_time(&usb_if->time_ref, le32_to_cpu(rx->ts32), 547 547 &hwts->hwtstamp); 548 548 549 549 netdev->stats.rx_packets++; 550 - netdev->stats.rx_bytes += can_frame->can_dlc; 550 + netdev->stats.rx_bytes += can_frame->len; 551 551 netif_rx(skb); 552 552 553 553 return 0; ··· 662 662 hwts = skb_hwtstamps(skb); 663 663 peak_usb_get_ts_time(&usb_if->time_ref, le32_to_cpu(er->ts32), &hwts->hwtstamp); 664 664 netdev->stats.rx_packets++; 665 - netdev->stats.rx_bytes += can_frame->can_dlc; 665 + netdev->stats.rx_bytes += can_frame->len; 666 666 netif_rx(skb); 667 667 668 668 return 0; ··· 767 767 768 768 pcan_msg_init_empty(&usb_msg, obuf, *size); 769 769 770 - if ((cf->can_id & CAN_RTR_FLAG) || (cf->can_dlc == 0)) 770 + if ((cf->can_id & CAN_RTR_FLAG) || (cf->len == 0)) 771 771 data_type = PCAN_USBPRO_TXMSG0; 772 - else if (cf->can_dlc <= 4) 772 + else if (cf->len <= 4) 773 773 data_type = PCAN_USBPRO_TXMSG4; 774 774 else 775 775 data_type = PCAN_USBPRO_TXMSG8; 776 776 777 - len = (dev->ctrl_idx << 4) | (cf->can_dlc & 0x0f); 777 + len = (dev->ctrl_idx << 4) | (cf->len & 0x0f); 778 778 779 779 flags = 0; 780 780 if (cf->can_id & CAN_EFF_FLAG)
+7 -7
drivers/net/can/usb/ucan.c
··· 614 614 cf->can_id = canid; 615 615 616 616 /* compute DLC taking RTR_FLAG into account */ 617 - cf->can_dlc = ucan_can_cc_dlc2len(&m->msg.can_msg, len); 617 + cf->len = ucan_can_cc_dlc2len(&m->msg.can_msg, len); 618 618 619 619 /* copy the payload of non RTR frames */ 620 620 if (!(cf->can_id & CAN_RTR_FLAG) || (cf->can_id & CAN_ERR_FLAG)) 621 - memcpy(cf->data, m->msg.can_msg.data, cf->can_dlc); 621 + memcpy(cf->data, m->msg.can_msg.data, cf->len); 622 622 623 623 /* don't count error frames as real packets */ 624 624 stats->rx_packets++; 625 - stats->rx_bytes += cf->can_dlc; 625 + stats->rx_bytes += cf->len; 626 626 627 627 /* pass it to Linux */ 628 628 netif_rx(skb); ··· 1078 1078 mlen = UCAN_OUT_HDR_SIZE + 1079 1079 offsetof(struct ucan_can_msg, dlc) + 1080 1080 sizeof(m->msg.can_msg.dlc); 1081 - m->msg.can_msg.dlc = cf->can_dlc; 1081 + m->msg.can_msg.dlc = cf->len; 1082 1082 } else { 1083 1083 mlen = UCAN_OUT_HDR_SIZE + 1084 - sizeof(m->msg.can_msg.id) + cf->can_dlc; 1085 - memcpy(m->msg.can_msg.data, cf->data, cf->can_dlc); 1084 + sizeof(m->msg.can_msg.id) + cf->len; 1085 + memcpy(m->msg.can_msg.data, cf->data, cf->len); 1086 1086 } 1087 1087 m->len = cpu_to_le16(mlen); 1088 1088 1089 - context->dlc = cf->can_dlc; 1089 + context->dlc = cf->len; 1090 1090 1091 1091 m->subtype = echo_index; 1092 1092
+7 -7
drivers/net/can/usb/usb_8dev.c
··· 449 449 priv->bec.rxerr = rxerr; 450 450 451 451 stats->rx_packets++; 452 - stats->rx_bytes += cf->can_dlc; 452 + stats->rx_bytes += cf->len; 453 453 netif_rx(skb); 454 454 } 455 455 ··· 470 470 return; 471 471 472 472 cf->can_id = be32_to_cpu(msg->id); 473 - cf->can_dlc = can_cc_dlc2len(msg->dlc & 0xF); 473 + cf->len = can_cc_dlc2len(msg->dlc & 0xF); 474 474 475 475 if (msg->flags & USB_8DEV_EXTID) 476 476 cf->can_id |= CAN_EFF_FLAG; ··· 478 478 if (msg->flags & USB_8DEV_RTR) 479 479 cf->can_id |= CAN_RTR_FLAG; 480 480 else 481 - memcpy(cf->data, msg->data, cf->can_dlc); 481 + memcpy(cf->data, msg->data, cf->len); 482 482 483 483 stats->rx_packets++; 484 - stats->rx_bytes += cf->can_dlc; 484 + stats->rx_bytes += cf->len; 485 485 netif_rx(skb); 486 486 487 487 can_led_event(priv->netdev, CAN_LED_EVENT_RX); ··· 637 637 msg->flags |= USB_8DEV_EXTID; 638 638 639 639 msg->id = cpu_to_be32(cf->can_id & CAN_ERR_MASK); 640 - msg->dlc = cf->can_dlc; 641 - memcpy(msg->data, cf->data, cf->can_dlc); 640 + msg->dlc = cf->len; 641 + memcpy(msg->data, cf->data, cf->len); 642 642 msg->end = USB_8DEV_DATA_END; 643 643 644 644 for (i = 0; i < MAX_TX_URBS; i++) { ··· 656 656 657 657 context->priv = priv; 658 658 context->echo_index = i; 659 - context->dlc = cf->can_dlc; 659 + context->dlc = cf->len; 660 660 661 661 usb_fill_bulk_urb(urb, priv->udev, 662 662 usb_sndbulkpipe(priv->udev, USB_8DEV_ENDP_DATA_TX),
+5 -5
drivers/net/can/xilinx_can.c
··· 759 759 XCAN_DLCR_DLC_SHIFT; 760 760 761 761 /* Change Xilinx CAN data length format to socketCAN data format */ 762 - cf->can_dlc = can_cc_dlc2len(dlc); 762 + cf->len = can_cc_dlc2len(dlc); 763 763 764 764 /* Change Xilinx CAN ID format to socketCAN ID format */ 765 765 if (id_xcan & XCAN_IDR_IDE_MASK) { ··· 784 784 785 785 if (!(cf->can_id & CAN_RTR_FLAG)) { 786 786 /* Change Xilinx CAN data format to socketCAN data format */ 787 - if (cf->can_dlc > 0) 787 + if (cf->len > 0) 788 788 *(__be32 *)(cf->data) = cpu_to_be32(data[0]); 789 - if (cf->can_dlc > 4) 789 + if (cf->len > 4) 790 790 *(__be32 *)(cf->data + 4) = cpu_to_be32(data[1]); 791 791 } 792 792 793 - stats->rx_bytes += cf->can_dlc; 793 + stats->rx_bytes += cf->len; 794 794 stats->rx_packets++; 795 795 netif_receive_skb(skb); 796 796 ··· 970 970 struct net_device_stats *stats = &ndev->stats; 971 971 972 972 stats->rx_packets++; 973 - stats->rx_bytes += cf->can_dlc; 973 + stats->rx_bytes += cf->len; 974 974 netif_rx(skb); 975 975 } 976 976 }
+2 -2
include/linux/can/dev.h
··· 185 185 dev->mtu = CANFD_MTU; 186 186 } 187 187 188 - /* get data length from can_dlc with sanitized can_dlc */ 189 - u8 can_dlc2len(u8 can_dlc); 188 + /* get data length from raw data length code (DLC) */ 189 + u8 can_dlc2len(u8 dlc); 190 190 191 191 /* map the sanitized data length to an appropriate data length code */ 192 192 u8 can_len2dlc(u8 len);
+1 -1
net/can/af_can.c
··· 888 888 int err; 889 889 890 890 /* check for correct padding to be able to use the structs similarly */ 891 - BUILD_BUG_ON(offsetof(struct can_frame, can_dlc) != 891 + BUILD_BUG_ON(offsetof(struct can_frame, len) != 892 892 offsetof(struct canfd_frame, len) || 893 893 offsetof(struct can_frame, data) != 894 894 offsetof(struct canfd_frame, data));
+1 -1
net/can/gw.c
··· 207 207 */ 208 208 209 209 dst->can_id = src->can_id; 210 - dst->len = src->can_dlc; 210 + dst->len = src->len; 211 211 *(u64 *)dst->data = *(u64 *)src->data; 212 212 } 213 213
+2 -2
net/can/j1939/main.c
··· 62 62 skb_pull(skb, J1939_CAN_HDR); 63 63 64 64 /* fix length, set to dlc, with 8 maximum */ 65 - skb_trim(skb, min_t(uint8_t, cf->can_dlc, 8)); 65 + skb_trim(skb, min_t(uint8_t, cf->len, 8)); 66 66 67 67 /* set addr */ 68 68 skcb = j1939_skb_to_cb(skb); ··· 335 335 canid |= skcb->addr.da << 8; 336 336 337 337 cf->can_id = canid; 338 - cf->can_dlc = dlc; 338 + cf->len = dlc; 339 339 340 340 return can_send(skb, 1); 341 341