1. 08 11月, 2019 1 次提交
  2. 07 11月, 2019 23 次提交
  3. 06 11月, 2019 5 次提交
  4. 05 11月, 2019 11 次提交
    • T
      can: mcp251x: mcp251x_restart_work_handler(): Fix potential force_quit race condition · 27a0e54b
      Timo Schlüßler 提交于
      In mcp251x_restart_work_handler() the variable to stop the interrupt
      handler (priv->force_quit) is reset after the chip is restarted and thus
      a interrupt might occur.
      
      This patch fixes the potential race condition by resetting force_quit
      before enabling interrupts.
      Signed-off-by: NTimo Schlüßler <schluessler@krause.de>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      27a0e54b
    • J
      can: ti_hecc: add missing state changes · b5018be6
      Jeroen Hofstee 提交于
      While the ti_hecc has interrupts to report when the error counters increase
      to a certain level and which change state it doesn't handle the case that
      the error counters go down again, so the reported state can actually be
      wrong. Since there is no interrupt for that, do update state based on the
      error counters, when the state is not error active and goes down again.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      b5018be6
    • J
      can: ti_hecc: properly report state changes · 3b2d652d
      Jeroen Hofstee 提交于
      The HECC_CANES register handles the flags specially, it only updates
      the flags after a one is written to them. Since the interrupt for
      frame errors is not enabled an old error can hence been seen when a
      state interrupt arrives. For example if the device is not connected
      to the CAN-bus the error warning interrupt will have HECC_CANES
      indicating there is no ack. The error passive interrupt thereafter
      will have HECC_CANES flagging that there is a warning level. And if
      thereafter there is a message successfully send HECC_CANES points to
      an error passive event, while in reality it became error warning
      again. In summary, the state is not always reported correctly.
      
      So handle the state changes and frame errors separately. The state
      changes are now based on the interrupt flags and handled directly
      when they occur. The reporting of the frame errors is still done as
      before, as a side effect of another interrupt.
      
      note: the hecc_clear_bit will do a read, modify, write. So it will
      not only clear the bit, but also reset all other bits being set as
      a side affect, hence it is replaced with only clearing the flags.
      
      note: The HECC_CANMC_CCR is no longer cleared in the state change
      interrupt, it is completely unrelated.
      
      And use net_ratelimit to make checkpatch happy.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      3b2d652d
    • J
      can: ti_hecc: add fifo overflow error reporting · 678d85ed
      Jeroen Hofstee 提交于
      When the rx FIFO overflows the ti_hecc would silently drop them since
      the overwrite protection is enabled for all mailboxes. So disable it for
      the lowest priority mailbox and return a proper error value when receive
      message lost is set. Drop the message itself in that case, since it
      might be partially updated.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Acked-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      678d85ed
    • J
      can: ti_hecc: release the mailbox a bit earlier · 99383749
      Jeroen Hofstee 提交于
      Release the mailbox after reading it, so it can be reused a bit earlier.
      Since "can: rx-offload: continue on error" all pending message bits are
      cleared directly, so remove clearing them in ti_hecc.
      Suggested-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      99383749
    • J
      can: ti_hecc: keep MIM and MD set · 10f5d55d
      Jeroen Hofstee 提交于
      The HECC_CANMIM is set in the xmit path and cleared in the interrupt.
      Since this is done with a read, modify, write action the register might
      end up with some more MIM enabled then intended, since it is not
      protected. That doesn't matter at all, since the tx interrupt disables
      the mailbox with HECC_CANME (while holding a spinlock). So lets just
      always keep MIM set.
      
      While at it, since the mailbox direction never changes, don't set it
      every time a message is send, ti_hecc_reset() already sets them to tx.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      10f5d55d
    • J
      can: ti_hecc: ti_hecc_stop(): stop the CPK on down · 59f415c2
      Jeroen Hofstee 提交于
      When the interface goes down, the CPK should no longer take an active
      part in the CAN-bus communication, like sending acks and error frames.
      So enable configuration mode in ti_hecc_stop, so the CPK is no longer
      active.
      
      When a transceiver switch is present the acks and errors don't make it
      to the bus, but disabling the CPK then does prevent oddities, like
      ti_hecc_reset() failing, since the CPK can become bus-off and starts
      counting the 11 bit recessive bits, which seems to block the reset. It
      can also cause invalid interrupts and disrupt the CAN-bus, since
      transmission can be stopped in the middle of a message, by disabling the
      tranceiver while the CPK is sending.
      
      Since the CPK is disabled after normal power on, it is typically only
      seen when the interface is restarted.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      59f415c2
    • M
      can: ti_hecc: ti_hecc_error(): increase error counters if skb enqueueing via... · c4409e9f
      Marc Kleine-Budde 提交于
      can: ti_hecc: ti_hecc_error(): increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails
      
      The call to can_rx_offload_queue_sorted() may fail and return an error
      (in the current implementation due to resource shortage). The passed skb
      is consumed.
      
      This patch adds incrementing of the appropriate error counters to let
      the device statistics reflect that there's a problem.
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      c4409e9f
    • M
      can: flexcan: increase error counters if skb enqueueing via can_rx_offload_queue_sorted() fails · 75812433
      Marc Kleine-Budde 提交于
      The call to can_rx_offload_queue_sorted() may fail and return an error
      (in the current implementation due to resource shortage). The passed skb
      is consumed.
      
      This patch adds incrementing of the appropriate error counters to let
      the device statistics reflect that there's a problem.
      Reported-by: NMartin Hundebøll <martin@geanix.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      75812433
    • M
      can: rx-offload: can_rx_offload_irq_offload_fifo(): continue on error · 1f7f504d
      Marc Kleine-Budde 提交于
      In case of a resource shortage, i.e. the rx_offload queue will overflow
      or a skb fails to be allocated (due to OOM),
      can_rx_offload_offload_one() will call mailbox_read() to discard the
      mailbox and return an ERR_PTR.
      
      If the hardware FIFO is empty can_rx_offload_offload_one() will return
      NULL.
      
      In case a CAN frame was read from the hardware,
      can_rx_offload_offload_one() returns the skb containing it.
      
      Without this patch can_rx_offload_irq_offload_fifo() bails out if no skb
      returned, regardless of the reason.
      
      Similar to can_rx_offload_irq_offload_timestamp() in case of a resource
      shortage the whole FIFO should be discarded, to avoid an IRQ storm and
      give the system some time to recover. However if the FIFO is empty the
      loop can be left.
      
      With this patch the loop is left in case of empty FIFO, but not on
      errors.
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      1f7f504d
    • J
      can: rx-offload: can_rx_offload_irq_offload_timestamp(): continue on error · c2a9f74c
      Jeroen Hofstee 提交于
      In case of a resource shortage, i.e. the rx_offload queue will overflow
      or a skb fails to be allocated (due to OOM),
      can_rx_offload_offload_one() will call mailbox_read() to discard the
      mailbox and return an ERR_PTR.
      
      However can_rx_offload_irq_offload_timestamp() bails out in the error
      case. In case of a resource shortage all mailboxes should be discarded,
      to avoid an IRQ storm and give the system some time to recover.
      
      Since can_rx_offload_irq_offload_timestamp() is typically called from a
      while loop, all message will eventually be discarded. So let's continue
      on error instead to discard them directly.
      Signed-off-by: NJeroen Hofstee <jhofstee@victronenergy.com>
      Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      c2a9f74c