VirtualBox

Changeset 28153 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Apr 9, 2010 5:58:51 PM (15 years ago)
Author:
vboxsync
Message:

VBoxNetFlt-linux: Receive GSO frames from the host, save calls into SrvIntNet as well as ring-0 <-> ring-3 context switches on the DrvIntNet receive thread.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmnetinline.h

    r28096 r28153  
    44 *
    55 * This is all inlined because it's too tedious to create 2-3 libraries to
    6  * contain it all (same bad excuse as for intnetinline.h).  C++ only because of
    7  * mixed code and variables.
     6 * contain it all (same bad excuse as for intnetinline.h).
    87 */
    98
     
    4847DECLINLINE(bool) PDMNetGsoIsValid(PCPDMNETWORKGSO pGso, size_t cbGsoMax, size_t cbFrame)
    4948{
     49    PDMNETWORKGSOTYPE enmType;
     50
    5051    if (RT_UNLIKELY(cbGsoMax < sizeof(*pGso)))
    5152        return false;
    5253
    53     PDMNETWORKGSOTYPE const enmType = (PDMNETWORKGSOTYPE)pGso->u8Type;
     54    enmType = (PDMNETWORKGSOTYPE)pGso->u8Type;
    5455    if (RT_UNLIKELY( enmType <= PDMNETWORKGSOTYPE_INVALID || enmType >= PDMNETWORKGSOTYPE_END ))
    5556        return false;
     
    127128DECLINLINE(uint32_t) PDMNetGsoCalcSegmentCount(PCPDMNETWORKGSO pGso, size_t cbFrame)
    128129{
     130    size_t cbPayload;
    129131    Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));
    130     size_t cbPayload = cbFrame - pGso->cbHdrs;
     132    cbPayload = cbFrame - pGso->cbHdrs;
    131133    return (uint32_t)((cbPayload + pGso->cbMaxSeg - 1) / pGso->cbMaxSeg);
    132134}
     
    266268{
    267269    /*
    268      * Check assumptions.
    269      */
    270     Assert(iSeg < cSegs);
    271     Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));
    272     Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));
    273 
    274     /*
    275270     * Figure out where the payload is and where the header starts before we
    276271     * do the protocol specific carving.
     
    284279
    285280    /*
     281     * Check assumptions (doing it after declaring the variables because of C).
     282     */
     283    Assert(iSeg < cSegs);
     284    Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));
     285    Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));
     286
     287    /*
    286288     * Copy the header and do the protocol specific massaging of it.
    287289     */
     
    332334    }
    333335
    334     *pcbSegFrame = cbSegPayload + pGso->cbHdrs;
     336    *pcbSegFrame = cbSegFrame;
    335337    return pbSegHdrs;
    336338}
     
    364366{
    365367    /*
    366      * Check assumptions.
    367      */
    368     Assert(iSeg < cSegs);
    369     Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));
    370     Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));
    371 
    372     /*
    373368     * Figure out where the payload is and where the header starts before we
    374369     * do the protocol specific carving.
     
    378373                                       ? pGso->cbMaxSeg
    379374                                       : (uint32_t)(cbFrame - iSeg * pGso->cbMaxSeg - pGso->cbHdrs);
     375
     376    /*
     377     * Check assumptions (doing it after declaring the variables because of C).
     378     */
     379    Assert(iSeg < cSegs);
     380    Assert(cSegs == PDMNetGsoCalcSegmentCount(pGso, cbFrame));
     381    Assert(PDMNetGsoIsValid(pGso, sizeof(*pGso), cbFrame));
    380382
    381383    /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette