Rajat Jain
|
Is "npkt->framelen" different than sum total of all iov_len(s)?
|
Rajat Jain
07/11/2008 12:37 AM
post10379
|
Is "npkt->framelen" different than sum total of all iov_len(s)?
Hi,
I have a simple question that stuck my mind while trying to understand
the devn-mpc85xx driver - transmit code. Can "framelen" of the npkt
handed over to the driver (by io-net), be any different than the sum
total of all its iov_len(s)?
My question arises from the following code in the driver. Why is the
need to separately calculate the totalLen for checking against the MTU
size? Why not directly use framelen?
Thanks,
Rajat
=========================================================
static npkt_t *mpc_defrag (mpc85xx_t *ext, npkt_t *npkt)
{
....
....
/* Setup our default return value */
dpkt = NULL;
/* Do some checks */
buf = TAILQ_FIRST (&npkt->buffers);
totalLen = 0;
while (buf != NULL) {
for (i = 0, iov = buf->net_iov; i < buf->niov; i++, iov++) {
totalLen += iov->iov_len;
}
buf = TAILQ_NEXT (buf, ptrs);
}
if(totalLen <= MPC_MTU_SIZE) {
if((dpkt = mpc_alloc_npkt (ext, npkt->framelen, 1)) != NULL) {
dpkt->framelen = npkt->framelen;
......
......
}
}
....
}
|
|
|