Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Is "npkt->framelen" different than sum total of all iov_len(s)?: (2 Items)
   
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;
            ......
            ......
        }
    }
    ....
}
RE: Is "npkt->framelen" different than sum total of all iov_len(s)?  
Npkt->framelen should be the same as the sum of all the iov lengths.
I guess the code in the defrag routine is just a safety check.


-----Original Message-----
From: Rajat Jain [mailto:rajat.jain@infogain.com] 
Sent: Friday, July 11, 2008 12:38 AM
To: drivers-networking
Subject: 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;
            ......
            ......
        }
    }
    ....
}

_______________________________________________
Networking Drivers
http://community.qnx.com/sf/go/post10379