Vinod Kolapuram
|
nw_pthread_create() & iov_t doubts.
|
Vinod Kolapuram
01/21/2010 1:03 PM
post45686
|
nw_pthread_create() & iov_t doubts.
Hi Forum,
I am new to QNX and basically porting from io-net to io-pkt.
I will be using nw_pthread_create() , I was looking at some implementations as suggested by the website for porting and
I see that there is a init function as 6th argument, where wtp is intialized and on it "wtp->quiesce_callout" is called
for a user specific function which basically will call "MsgSendPulse()".
Is it a must to have a init_function. What if I put all NULLs to the extra last 3 arugments in nw_pthread_create()?
Will it work?
And I have a question regarding the iov_t.
The existing implementation for io-net was done using iov now I am trying to port to io-pkt. Do I need to use iov or
just copy the address of my data location to mbuf to send it across to other machine using "if_output()" funtion
available on ifnet struct.
I am thinking if_output() function will take care of sending it in its own format and on the other end when mbuf is
received I will have
a "PFIL_IN" hook which gets the mbuf content.
The below is the structs of iov on io-net.h file
typedef struct _net_iovec net_iov_t;
struct _net_iovec {
void *iov_base;
paddr_t iov_phys;
size_t iov_len;
};
typedef struct _net_buf net_buf_t;
struct _net_buf {
TAILQ_ENTRY(_net_buf) ptrs;
int niov;
net_iov_t *net_iov;
};
I also see that in io-net implementation at some point we need to insert net_buf in "_npkt" struct as described below. I
have just copied some code line below from my io-net implementation.
/* Insert net_buf in npkt */
TAILQ_INSERT_HEAD(&npkt->buffers, nb, ptrs);
/* Setup iov, it lives right after the net_buf */
iov = (net_iov_t *)(nb + 1);
nb->niov = 1;
nb->net_iov = iov;
iov->iov_base = (char *)ptr; /* Iov points to data buffer */
/* Align it */
if (((int) iov->iov_base) % 4) {
(char *)iov->iov_base += 3;
iov->iov_base = (char *)((int)iov->iov_base & ~3);
}
iov->iov_len = HM_TOTAL_PACKET_SZ;
iov->iov_phys = (paddr_t)(pfilter_ctrl->npi->mphys(iov->iov_base));
npkt->org_data = ptr;
npkt->next = NULL;
npkt->tot_iov = 1;
return npkt;
For "io-pkt" implementation I have the iov_t on the nw_stk_ctl struct in nw_datastruct.h .
Is it a must to use iov to send and receive data.
Thanks
Vinod
|
|
|