aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2013-10-28 04:54:40 -0400
committerMarc Kleine-Budde <mkl@pengutronix.de>2013-10-31 15:18:47 -0400
commit5d0f801a2ccec3b1fdabc3392c8d99ed0413d216 (patch)
tree1f14267633c2f77bba89877beb51fc9db49c3058 /drivers
parentc17cb8b55b104c549aa20a72fa44141ad2c65ec2 (diff)
can: c_can: Fix RX message handling, handle lost message before EOB
If we handle end of block messages with higher priority than a lost message, we can run into an endless interrupt loop. This is reproducable with a am335x processor and "cansequence -r" at 1Mbit. As soon as we loose a packet we can't escape from an interrupt loop. This patch fixes the problem by handling lost packets before EOB packets. Cc: linux-stable <stable@vger.kernel.org> Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/can/c_can/c_can.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index a668cd491cb3..e3fc07cf2f62 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -814,9 +814,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
814 msg_ctrl_save = priv->read_reg(priv, 814 msg_ctrl_save = priv->read_reg(priv,
815 C_CAN_IFACE(MSGCTRL_REG, 0)); 815 C_CAN_IFACE(MSGCTRL_REG, 0));
816 816
817 if (msg_ctrl_save & IF_MCONT_EOB)
818 return num_rx_pkts;
819
820 if (msg_ctrl_save & IF_MCONT_MSGLST) { 817 if (msg_ctrl_save & IF_MCONT_MSGLST) {
821 c_can_handle_lost_msg_obj(dev, 0, msg_obj); 818 c_can_handle_lost_msg_obj(dev, 0, msg_obj);
822 num_rx_pkts++; 819 num_rx_pkts++;
@@ -824,6 +821,9 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota)
824 continue; 821 continue;
825 } 822 }
826 823
824 if (msg_ctrl_save & IF_MCONT_EOB)
825 return num_rx_pkts;
826
827 if (!(msg_ctrl_save & IF_MCONT_NEWDAT)) 827 if (!(msg_ctrl_save & IF_MCONT_NEWDAT))
828 continue; 828 continue;
829 829
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704































































































































































































































































































































































































































































































































































































































































































































                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
PK