Skip to content

can: m_can: Optimizations for m_can/tcan part 2

Markus Schneider-Pargmann linux-can lkml netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 1 replyIn review

Changes in v7 from the cover letter

- Rebased to v6.8-rc1
- Fixed NULL pointer dereference in m_can_clean() on am62 that happened when doing ip link up, ip link down, ip link up
- Fixed a racecondition on am62 observed with high throughput tests. netdev_completed_queue() was called before netdev_sent_queue() as the interrupt was processed so fast. netdev_sent_queue() is now reported before the actual sent is done.
- Fixed an initializing issue on am62 where active interrupts are getting lost between runs. Fixed by resetting cdev->active_interrupts in m_can_disable_all_interrupts()
- Removed m_can_start_fast_xmit() because of a reordering of operations due to above mentioned racecondition

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14can: m_can: Start/Cancel polling timer together with interruptsdrivers/net/can/m_can/m_can.c+12 -110 replies
2/14can: m_can: Move hrtimer init to m_can_class_registerdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can_platform.c+5 -50 replies
3/14can: m_can: Write transmit header and data in one transactiondrivers/net/can/m_can/m_can.c+21 -140 replies
4/14can: m_can: Implement receive coalescingdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+76 -60 replies
5/14can: m_can: Implement transmit coalescingdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+24 -130 replies
6/14can: m_can: Add rx coalescing ethtool supportdrivers/net/can/m_can/m_can.c+54 -10 replies
7/14can: m_can: Add tx coalescing ethtool supportdrivers/net/can/m_can/m_can.c+37 -10 replies
8/14can: m_can: Use u32 for putidxdrivers/net/can/m_can/m_can.c+4 -40 replies
9/14can: m_can: Cache tx putidxdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+10 -10 replies
10/14can: m_can: Use the workqueue as queuedrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+76 -470 replies
11/14can: m_can: Introduce a tx_fifo_in_flight counterdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+34 -00 replies
12/14can: m_can: Use tx_fifo_in_flight for netif_queue controldrivers/net/can/m_can/m_can.c+20 -570 replies
13/14can: m_can: Implement BQLdrivers/net/can/m_can/m_can.c+36 -140 replies
14/14can: m_can: Implement transmit submission coalescingdrivers/net/can/m_can/m_can.c drivers/net/can/m_can/m_can.h+58 -40 replies

Reviews trailers per patch

3 of 14 patches have a Reviewed-by or Acked-by.

PatchSimon Horman
1/14
2/14
3/14R-b
4/14
5/14
6/14
7/14
8/14R-b
9/14R-b
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] can: m_can: Optimizations for m_can/tcan part 2

Hi Marc, Simon, Martin and everyone,

v7 is a rebase on v6.8. During my am62 tests I discovered some problems which are fixed with this update.

@Simon: I had to remove most of your reviews again, due to a few fixes I made.

The series implements many small and bigger throughput improvements and adds rx/tx coalescing at the end.

Based on v6.8-rc1. Also available at
https://gitlab.baylibre.com/msp8/linux/-/tree/topic/mcan-optimization/v6.8?ref_type=heads

Best,
Markus

Changes in v7:
- Rebased to v6.8-rc1
- Fixed NULL pointer dereference in m_can_clean() on am62 that happened when doing ip link up, ip link down, ip link up
- Fixed a racecondition on am62 observed with high throughput tests. netdev_completed_queue() was called before netdev_sent_queue() as the interrupt was processed so fast. netdev_sent_queue() is now reported before the actual sent is done.
- Fixed an initializing issue on am62 where active interrupts are getting lost between runs. Fixed by resetting cdev->active_interrupts in m_can_disable_all_interrupts()
- Removed m_can_start_fast_xmit() because of a reordering of operations due to above mentioned racecondition

Changes in v6:
- Rebased to v6.6-rc2
- Added two small changes for the newly integrated polling feature
- Reuse the polling hrtimer for coalescing as the timer used for coalescing has a similar purpose as the one for polling. Also polling and coalescing will never be active at the same time.

Changes in v5:
- Add back parenthesis in m_can_set_coalesce(). This will make checkpatch unhappy but gcc happy.
- Remove unused fifo_header variable in m_can_tx_handler().
- Rebased to v6.5-rc1

Changes in v4:
- Create and use struct m_can_fifo_element in m_can_tx_handler
- Fix memcpy_and_pad to copy the full buffer
- Fixed a few checkpatch warnings
- Change putidx to be unsigned
- Print hard_xmit error only once when TX FIFO is full

Changes in v3:
- Remove parenthesis in error messages
- Use memcpy_and_pad for buffer copy in 'can: m_can: Write transmit header and data in one transaction'.
- Replace spin_lock with spin_lock_irqsave. I got a report of a interrupt that was calling start_xmit just after the netqueue was woken up before the locked region was exited. spin_lock_irqsave should fix this. I attached the full stack at the end of the mail if someone wants to know.
- Rebased to v6.3-rc1.
- Removed tcan4x5x patches from this series.

Changes in v2:
- Rebased on v6.2-rc5
- Fixed missing/broken accounting for non peripheral m_can devices.

previous versions:
v1 - https://lore.kernel.org/lkml/[email protected]
v2 - https://lore.kernel.org/lkml/[email protected]
v3 - https://lore.kernel.org/lkml/[email protected]/
v4 - https://lore.kernel.org/lkml/[email protected]/
v5 - https://lore.kernel.org/lkml/[email protected]
v6 - https://lore.kernel.org/lkml/[email protected]

Markus Schneider-Pargmann (14):
can: m_can: Start/Cancel polling timer together with interrupts
can: m_can: Move hrtimer init to m_can_class_register
can: m_can: Write transmit header and data in one transaction
can: m_can: Implement receive coalescing
can: m_can: Implement transmit coalescing
can: m_can: Add rx coalescing ethtool support
can: m_can: Add tx coalescing ethtool support
can: m_can: Use u32 for putidx
can: m_can: Cache tx putidx
can: m_can: Use the workqueue as queue
can: m_can: Introduce a tx_fifo_in_flight counter
can: m_can: Use tx_fifo_in_flight for netif_queue control
can: m_can: Implement BQL
can: m_can: Implement transmit submission coalescing

 drivers/net/can/m_can/m_can.c          | 551 ++++++++++++++++++-------
 drivers/net/can/m_can/m_can.h          |  34 +-
 drivers/net/can/m_can/m_can_platform.c |   4 -
 3 files changed, 439 insertions(+), 150 deletions(-)
Signature · 1 line
2.43.0