AnsweredAssumed Answered

MCC kernel driver for Linux  (IMX6x)

Question asked by Tim Michals on Dec 31, 2015
Latest reply on Aug 18, 2017 by D. RY

I'm working on a kernel driver to expose multiple MCC ports to user space and having the following issues:

  1. mcc_recv not waking up the the receive thread  when M4 writes a packet to A9 Port:
    • The driver is designed to have a thread per port calling the mcc_recv API for each port with a infinite time out. 
    • If the mcc_recv timeout is changed to say 255ms; then the receive rate increases to the delay time.   Some times a packet does wake the thread.
  2. If two threads are accessing the API MCC API (mcc_recv and mcc_write) at the same time it seems there is a race condition locking up the A9 side.


Linux side (A9):

  • Driver
    • (1) thread for each port; there are currently only 2 threads running.
      • When a packet is received via mcc_recv, it is put into a queue different queue for each port. 
    • API for poll, read, write.
      • Poll :checks if there is any packets in a queue, if empty assigns a wait for a callback
      • Write: writes to the MCC port via mcc_write
      • Read: Allows using O_NONBLOCK, no calls to mcc_recv, in this function.  If there is no packet return -EAGAIN
  • User app
    • loop that writes a packet and waits on a read using epoll


MQX (M4)

  • two threads for each MCC port
    • Thread
      • Waits of a mcc_recv when a packet is received sends it back on the sender port.




Any suggestions?