I pushed here some raw code:
https://git.linaro.org/people/maxim.uvarov/odp.git/shortlog/refs/heads/odp_ipc2

Example here app here:
https://git.linaro.org/people/maxim.uvarov/odp.git/blob/refs/heads/odp_ipc2:/example/fork/odp_fork.c

pktio_queue_thread() takes packets from inq queue and put them to ipc queue.

ring_thread() takes packets from ipc queue and free this buffer.

Example log:
./odp_fork -i vethOMtZIZ -m 1 -c 1 -t 3
waiting for packet...
Enqueue the packet to ipc queue size 98/1856
waiting for packet...
        ring_thread() got buffer from IPC queue size 98/1856
Enqueue the packet to ipc queue size 98/1856
waiting for packet...
        ring_thread() got buffer from IPC queue size 98/1856
Enqueue the packet to ipc queue size 98/1856
waiting for packet...
        ring_thread() got buffer from IPC queue size 98/1856
Enqueue the packet to ipc queue size 98/1856

There are bunch of things which needed to clean up:
1. general code clean up.
2. remove shared flag from odp_shm_reserve().
3. dynamic odp_ring initialisation.

So I will work on that and send updated version. If you have some notes now about test app please let me know.

Also I had to implement bunch of functions:
+               queue->s.enqueue = queue_enq_ipc;
+               queue->s.dequeue = queue_deq_ipc;
+               queue->s.enqueue_multi = queue_enq_multi_ipc;
+               queue->s.dequeue_multi = queue_deq_multi_ipc;

Which actually queue/dequeue odp_buffer_t which is uint_32t instead of pointer to odp_buffer_hdr_t. This is required for pass buffers to other process due to different mapping and pointers will differ.

So the plan is or in your HW case you use hw queues for multi process support. Or if there is no hardware queues, then software
implementation can be used with odp_ring.

Best regards,
Maxim.

On 08/22/2014 12:07 AM, Maxim Uvarov wrote:
Taras,

I want to check with you that you will be fine with following api for ipc app:

1. Process one:

Create standard ingress queue:
pktio = odp_pktio_open(thr_args->pktio_dev, pkt_pool, &params);
inq_def = odp_queue_create(inq_name, ODP_QUEUE_TYPE_PKTIN, &qparam);
ret = odp_pktio_inq_setdef(pktio, inq_def);

Create IPC queue:
/* here simple assign packet I/O to pool */
pktio_ipc_params.type = ODP_PKTIO_TYPE_IPC;
pktio_ipc = odp_pktio_open(NULL, pkt_pool, &pktio_ipc_params); // dev is NULL
/* create some shared queue */
ipcq_def = odp_queue_create("shared-queue", ODP_QUEUE_TYPE_IPC, &qparam);
/* set up queue method */
ret = odp_pktio_inq_setdef(pktio_ipc, ipcq_def);

/* loop to get buffer from inq_def and it to ipcq_def */

    for (;;) {
        buf = odp_schedule(NULL, ODP_SCHED_WAIT);
         odp_queue_enq(ipcq_def, buf);
   }

2. Process two:
/* Here queue checks if it was created before, then attach to it. Look up is done by name. */
ipcq_def = odp_queue_create("shared-queue", ODP_QUEUE_TYPE_IPC, &qparam);

ret = odp_pktio_inq_setdef(pktio_ipc, ipcq_def);

/* look for packets in ipcq_def */
while (1) {
            buf = odp_queue_deq(ipcq_def);
            odp_buffer_free(buf);
}

Is that the same what we are talked about?

Thank you,
Maxim.


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to