Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Handling io_write (save an additional copy): (1 Item)
   
Handling io_write (save an additional copy)  
Hi All

I am using a resource manager to feed packets to my network driver. However, in transmit side I am having to perform a 
full extra copy of the frame due to problem mentioned below. Please help me in understanding this situation better.

QNX documentation mentions following about handling io_write message while writing a resource manager:

 buf = (char *) malloc(msg->i.nbytes + 1);
    if (buf == NULL)
        return(ENOMEM);

    /*
     *  Reread the data from the sender's message buffer.
     *  We're not assuming that all of the data fit into the
     *  resource manager library's receive buffer.
     */

    resmgr_msgread(ctp, buf, msg->i.nbytes, sizeof(msg->i));
    buf [msg->i.nbytes] = '\0'; /* just in case the text is not NULL terminated */
    printf ("Received %d bytes = '%s'\n", msg -> i.nbytes, buf);
    free(buf);

I want to understant the importance of resmgr_msgread API here and the comment above it. 

I need to write the packet to the SRAM of a device which is memory mapped into my process (resource manager). However, 
If I pass the pointer to mapped memory directly into resmgr_msgread, it fails with errno ESRVRFAULT.

This now requires me to pass a local buffer to get the data from client and then copy it again into memory mapped space 
in device SRAM causing performance issues under load.

Please help me optimize performance of my system by removing this additional copy.

Regards
VG