This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SRIO loopback example

Hi,

I modified the SRIO Loopback example so it will execute the blocking test on single core. The test passed.

Now, i try to send and recieve the messages in loop, in the following way:

Producer:

while(1)

{

Task_sleep(100);

/* allocate Tx buffer, fill it etc. */

Send()

}

Cnsumer:

while(1)

{

Recv()

Free Rx buffer{}

}

This code run great for the first 3 buffers and than the consumer stop to recieve any messages - I found that in each send operation, 2 descriptors from the Rx queue are being used (instead of 1) so after 3 reception there are no free descriptor to recieve the data.

I am using SRIO_DATA_LEM=256

  • Tzvika,

    What PDK version are you using?

    Did you make any modifications to the test_osal.c functions or change the placement of the descriptors in memory?  When descriptors are pushed and popped by the SRIO driver via the osal functions defined in test_osal.c.  So if the descriptor memory placement changed the osal functions would need to be updated to account for the that.

    Otherwise, I wouldn't expect a double pop.  Are you sure that in editing the test code you didn't leave another task running that could be allocating descriptors?  Also, keep in mind that your send task is going to send uninhibited, besides the task_sleep, so at some point the send side will have to start waiting for the receive side to free buffers and descriptors.

    Lastly, you should make sure the Srio_freeRxDrvBuffer is actually freeing the buffer.  If operating in normal mode, the freeRxDrvBuffer function will call the Osal_DataBufferFree function in test_osal.c

    Justin

  • Justin Hi,

    I use PDK version 1.0.0.11

    The only modifications i made were:

    1. Disable the non-blocking test

    2. Add a loop in the producer task (start with the allocation of Tx buffer and finisih with the send operation)

    3. Add a loop in the consumer tak (start with the Recv operation and finish with free the Rx buffer)

    4. I increased the sleep time to be 10000 ticks in order to ensure the producer does not send during the consumer operation.

    The problem still exist !!!

    I added an option to monitor the number of entries in the Rx queue when starting the rxCompletionIsr and after freeing the BD to the Rx queue (in the SrioProcessRecievedBD function). I found that within each ISR - two descriptors are poped from the Rx queue instead of one descriptor so if the application allocates 4 descriptors (when initialized) the number of entries in the Rx queue during the send-recieve operations is as follow:

    Iteration #        Rx queue entries at rxCompletionIsr  function start           Rx queue entries at  SrioProcessRecievedBD function (after free the BD)

      1                                                            2                                                                               3

    2                                                              1                                                                                2

    3                                                               0                                                                               1

    AND instead of 4th iteration the system stopped to receieve because it request (from some reason) 2 descriptors but only 1 is available

    Thanks,

     Tzvika

  • I'd just like to comment that the IpcChiptoChip example has what appears to be similar behavior in that the first time it's run, it receives all 4 messages, but then running it a 2nd time (without a full system reset) it only receives 2 messages, and then a 3rd time, it only receives 1 message.  I tried freeing the Qmss queues explicitly, but that didn't appear to have an effect, so I'm not sure what the cause of that is.

  • Tim,

    SRIO not working without doing a full system reset (board power-down/up or pushing the RST_FULL1 switch) is a known issue and covered by the following thread:

    http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/p/124376/444137.aspx#444137

    I'll post some code in the thread to disable reset isolation for all the SRIO example and test projects.

     

    Tzvika,

    Can you attach your test_main.c, test_blocking.c and any other files you may have modified from the LoopbackTest project?  I'll plug them into my local build and test environment to see if I can reproduce the issue you're seeing.

     

    Thanks,

    Justin

  • Justin, yes I did encounter that issue previously (when none of the subsequent tests were running). I'm saying that *with* that fix, I have the ability to 'Restart' the program and have it run, but when I do so, it only receives 2 out of 4 messages (as opposed to 4 or 0) and then 1 out of 4.  Given my extremely limited knowledge, I can only guess that there's some missing cleanup so that some of the messages are being dropped or sent elsewhere.

    I believe when I do a System Reset, all 4 messages work again, which, to me, would suggest a cleanup problem, but I can't confirm those results myself at the present time.

  • Justin hi,

    Attached are my modified source file and the console output from mine execution:

    1. SRIO_LoopbackTestProject_modifiedSourceFIles.zip which include the following modified source file: srio_drv.c   ,  test_main.c , test_blocking.c

    8103.SRIO_LoopbackTestProject_modifiedSourceFIles.zip

    2. The console output when execute the example with SRIO_DATA_LEN 248  and with SRIO_DATA_LEN 256

    [C66xx_0] Debug(Core 0): Host Region 0x82a570
    [C66xx_0] Debug(Core 0): SRIO Driver has been initialized
    [C66xx_0] Debug(Core 0): AppConfig RxFreeQueue: 0x381 RxCompletionQueue: 0x382
    [C66xx_0] Debug: AppConfig Tx Queue: 0x2a0 Flow Id: 0
    [C66xx_0] Debug: SRIO Driver Instance 0x@0081e6a0 has been created
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a630 Buffer: 0x@1081cca0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a660 Buffer: 0x@1081cda0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a690 Buffer: 0x@1081cea0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a6c0 Buffer: 0x@1081cfa0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Ping: 0x1082bd70 Pong: 0x1082bd78
    [C66xx_0] Debug: DrvConfig Rx Free Queue: 0x2e0 Rx Completion Queue: 0x2c0 Flow Id: 1
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a6f0 Buffer: 0x@1081d0a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a720 Buffer: 0x@1081d1a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a750 Buffer: 0x@1081d2a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a780 Buffer: 0x@1081d3a0
    [C66xx_0] Debug: DrvConfig Tx Free Queue: 0x2e1 Tx Queue: 0x2a1
    [C66xx_0] Debug: SRIO Driver Instance 0x@0081e8b0 has been created
    [C66xx_0] **********************************************
    [C66xx_0] ******** Blocking Testing (Core 0) **********
    [C66xx_0] **********************************************
    [C66xx_0] Debug(Core 0): Consumer Task started.
    [C66xx_0] Debug(Core 0): Consumer is waiting for data...
    [C66xx_0] Debug(Core 0): Producer Task started.
    [C66xx_0] Debug(Core 0): Producer sockets have been created and bound.
    [C66xx_0] Producer send: 1
    [C66xx_0] Consumer receieved: 1
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cca0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 3
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 4
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 2
    [C66xx_0] Consumer receieved: 2
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cda0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 3
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 4
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 3
    [C66xx_0] Consumer receieved: 3
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cea0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 3
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 4
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 4
    [C66xx_0] Consumer receieved: 4
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cfa0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 3
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 4
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 5
    [C66xx_0] Consumer receieved: 5
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081d4a0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 3
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 4
    [C66xx_0] --------------------------------------------------------------------------
    

    [C66xx_0] Executing the SRIO Unit Tests on the DEVICE
    [C66xx_0] Debug(Core 0): System Initialization for CPPI & QMSS
    [C66xx_0] Debug(Core 0): Queue Manager and CPPI are initialized.
    [C66xx_0] Debug(Core 0): Host Region 0x82a570
    [C66xx_0] Debug(Core 0): SRIO Driver has been initialized
    [C66xx_0] Debug(Core 0): AppConfig RxFreeQueue: 0x381 RxCompletionQueue: 0x382
    [C66xx_0] Debug: AppConfig Tx Queue: 0x2a0 Flow Id: 0
    [C66xx_0] Debug: SRIO Driver Instance 0x@0081e6a0 has been created
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a630 Buffer: 0x@1081cca0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a660 Buffer: 0x@1081cda0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a690 Buffer: 0x@1081cea0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Rx host descriptor 0x@1082a6c0 Buffer: 0x@1081cfa0 Return Queue 0x2e0
    [C66xx_0] Debug: DrvConfig Ping: 0x1082bd70 Pong: 0x1082bd78
    [C66xx_0] Debug: DrvConfig Rx Free Queue: 0x2e0 Rx Completion Queue: 0x2c0 Flow Id: 1
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a6f0 Buffer: 0x@1081d0a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a720 Buffer: 0x@1081d1a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a750 Buffer: 0x@1081d2a0
    [C66xx_0] Debug: DrvConfig Tx host descriptor 0x@1082a780 Buffer: 0x@1081d3a0
    [C66xx_0] Debug: DrvConfig Tx Free Queue: 0x2e1 Tx Queue: 0x2a1
    [C66xx_0] Debug: SRIO Driver Instance 0x@0081e8b0 has been created
    [C66xx_0] **********************************************
    [C66xx_0] ******** Blocking Testing (Core 0) **********
    [C66xx_0] **********************************************
    [C66xx_0] Debug(Core 0): Consumer Task started.
    [C66xx_0] Debug(Core 0): Consumer is waiting for data...
    [C66xx_0] Debug(Core 0): Producer Task started.
    [C66xx_0] Debug(Core 0): Producer sockets have been created and bound.
    [C66xx_0] Producer send: 1
    [C66xx_0] Consumer receieved: 1
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cca0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 2
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 3
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 2
    [C66xx_0] Consumer receieved: 2
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081cea0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 1
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 2
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 3
    [C66xx_0] Consumer receieved: 3
    [C66xx_0] Debug(Core 0): Cleaning up receive buffer 0x@1081d4a0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr start = 0
    [C66xx_0] rxQueueCont at Srio_rxCompletionIsr end = 1
    [C66xx_0] --------------------------------------------------------------------------
    [C66xx_0] Producer send: 4
    [C66xx_0] Producer send: 5
    [C66xx_0] Producer send: 6

     

    I run the example on single core only (undefine: TEST_MULTICORE)

    Thanks

  • Thanks Tzvika.  I'll run the example with your changes and get back to you with what I find.

    Justin

  • Tzvika,

    I'm very sorry for the late response.  I do have some good news, or bad, depending on the way you look at it.

    The reason you were seeing two descriptors allocated during a transfer is due to a "bug" within the CDMA.  If a payload fills a buffer exactly, then is followed by protocol specific info, such as the sRIO words, the CDMA will chain a second buffer and descriptor that will not contain any data.  This is not illegal but would require the application  to parse and recycle both buffers and descriptors.

    This explains why your blocking test with a 248 byte message passed, while the 256 byte failed.  I compiled your files into my project, ran both 248 and 256, and confirmed the outputs you provided.

    To workaround the CDMA "bug" you can increase the buffer sizes, making them at least 1 byte larger than the payload.  Using your code I increased the SRIO_MAX_MTU size by 1 byte at the top of test_main.c

    #define SRIO_MAX_MTU                257

    I reran the test for the case with the 256 byte payload setting in test_blocking.c and everything worked.  I halted the test after the producer and consumer send and received 28 times.

    Again, I'm very sorry for the late response but hopefully the latter information resolves your problems

    Justin