diff options
| -rw-r--r-- | drivers/net/can/c_can/Kconfig | 7 | ||||
| -rw-r--r-- | drivers/net/can/c_can/c_can.c | 36 |
2 files changed, 0 insertions, 43 deletions
diff --git a/drivers/net/can/c_can/Kconfig b/drivers/net/can/c_can/Kconfig index 8ab7103d4f44..61ffc12d8fd8 100644 --- a/drivers/net/can/c_can/Kconfig +++ b/drivers/net/can/c_can/Kconfig | |||
| @@ -14,13 +14,6 @@ config CAN_C_CAN_PLATFORM | |||
| 14 | SPEAr1310 and SPEAr320 evaluation boards & TI (www.ti.com) | 14 | SPEAr1310 and SPEAr320 evaluation boards & TI (www.ti.com) |
| 15 | boards like am335x, dm814x, dm813x and dm811x. | 15 | boards like am335x, dm814x, dm813x and dm811x. |
| 16 | 16 | ||
| 17 | config CAN_C_CAN_STRICT_FRAME_ORDERING | ||
| 18 | bool "Force a strict RX CAN frame order (may cause frame loss)" | ||
| 19 | ---help--- | ||
| 20 | The RX split buffer prevents packet reordering but can cause packet | ||
| 21 | loss. Only enable this option when you accept to lose CAN frames | ||
| 22 | in favour of getting the received CAN frames in the correct order. | ||
| 23 | |||
| 24 | config CAN_C_CAN_PCI | 17 | config CAN_C_CAN_PCI |
| 25 | tristate "Generic PCI Bus based C_CAN/D_CAN driver" | 18 | tristate "Generic PCI Bus based C_CAN/D_CAN driver" |
| 26 | depends on PCI | 19 | depends on PCI |
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index a2ca820b5373..95e04e2002da 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c | |||
| @@ -732,26 +732,12 @@ static u32 c_can_adjust_pending(u32 pend) | |||
| 732 | static inline void c_can_rx_object_get(struct net_device *dev, | 732 | static inline void c_can_rx_object_get(struct net_device *dev, |
| 733 | struct c_can_priv *priv, u32 obj) | 733 | struct c_can_priv *priv, u32 obj) |
| 734 | { | 734 | { |
| 735 | #ifdef CONFIG_CAN_C_CAN_STRICT_FRAME_ORDERING | ||
| 736 | if (obj < C_CAN_MSG_RX_LOW_LAST) | ||
| 737 | c_can_object_get(dev, IF_RX, obj, IF_COMM_RCV_LOW); | ||
| 738 | else | ||
| 739 | #endif | ||
| 740 | c_can_object_get(dev, IF_RX, obj, priv->comm_rcv_high); | 735 | c_can_object_get(dev, IF_RX, obj, priv->comm_rcv_high); |
| 741 | } | 736 | } |
| 742 | 737 | ||
| 743 | static inline void c_can_rx_finalize(struct net_device *dev, | 738 | static inline void c_can_rx_finalize(struct net_device *dev, |
| 744 | struct c_can_priv *priv, u32 obj) | 739 | struct c_can_priv *priv, u32 obj) |
| 745 | { | 740 | { |
| 746 | #ifdef CONFIG_CAN_C_CAN_STRICT_FRAME_ORDERING | ||
| 747 | if (obj < C_CAN_MSG_RX_LOW_LAST) | ||
| 748 | priv->rxmasked |= BIT(obj - 1); | ||
| 749 | else if (obj == C_CAN_MSG_RX_LOW_LAST) { | ||
| 750 | priv->rxmasked = 0; | ||
| 751 | /* activate all lower message objects */ | ||
| 752 | c_can_activate_all_lower_rx_msg_obj(dev, IF_RX); | ||
| 753 | } | ||
| 754 | #endif | ||
| 755 | if (priv->type != BOSCH_D_CAN) | 741 | if (priv->type != BOSCH_D_CAN) |
| 756 | c_can_object_get(dev, IF_RX, obj, IF_COMM_CLR_NEWDAT); | 742 | c_can_object_get(dev, IF_RX, obj, IF_COMM_CLR_NEWDAT); |
| 757 | } | 743 | } |
| @@ -799,9 +785,6 @@ static inline u32 c_can_get_pending(struct c_can_priv *priv) | |||
| 799 | { | 785 | { |
| 800 | u32 pend = priv->read_reg(priv, C_CAN_NEWDAT1_REG); | 786 | u32 pend = priv->read_reg(priv, C_CAN_NEWDAT1_REG); |
| 801 | 787 | ||
| 802 | #ifdef CONFIG_CAN_C_CAN_STRICT_FRAME_ORDERING | ||
| 803 | pend &= ~priv->rxmasked; | ||
| 804 | #endif | ||
| 805 | return pend; | 788 | return pend; |
| 806 | } | 789 | } |
| 807 | 790 | ||
| @@ -814,25 +797,6 @@ static inline u32 c_can_get_pending(struct c_can_priv *priv) | |||
| 814 | * has arrived. To work-around this issue, we keep two groups of message | 797 | * has arrived. To work-around this issue, we keep two groups of message |
| 815 | * objects whose partitioning is defined by C_CAN_MSG_OBJ_RX_SPLIT. | 798 | * objects whose partitioning is defined by C_CAN_MSG_OBJ_RX_SPLIT. |
| 816 | * | 799 | * |
| 817 | * If CONFIG_CAN_C_CAN_STRICT_FRAME_ORDERING = y | ||
| 818 | * | ||
| 819 | * To ensure in-order frame reception we use the following | ||
| 820 | * approach while re-activating a message object to receive further | ||
| 821 | * frames: | ||
| 822 | * - if the current message object number is lower than | ||
| 823 | * C_CAN_MSG_RX_LOW_LAST, do not clear the NEWDAT bit while clearing | ||
| 824 | * the INTPND bit. | ||
| 825 | * - if the current message object number is equal to | ||
| 826 | * C_CAN_MSG_RX_LOW_LAST then clear the NEWDAT bit of all lower | ||
| 827 | * receive message objects. | ||
| 828 | * - if the current message object number is greater than | ||
| 829 | * C_CAN_MSG_RX_LOW_LAST then clear the NEWDAT bit of | ||
| 830 | * only this message object. | ||
| 831 | * | ||
| 832 | * This can cause packet loss! | ||
| 833 | * | ||
| 834 | * If CONFIG_CAN_C_CAN_STRICT_FRAME_ORDERING = n | ||
| 835 | * | ||
| 836 | * We clear the newdat bit right away. | 800 | * We clear the newdat bit right away. |
| 837 | * | 801 | * |
| 838 | * This can result in packet reordering when the readout is slow. | 802 | * This can result in packet reordering when the readout is slow. |
