VirtualBox

Changeset 27973 in vbox


Ignore:
Timestamp:
Apr 4, 2010 12:33:03 AM (15 years ago)
Author:
vboxsync
Message:

PDM,Network/*: GSO preps.

Location:
trunk
Files:
7 edited

Legend:

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

    r27841 r27973  
    8686/** Owner mask. */
    8787#define PDMSCATTERGATHER_FLAGS_OWNER_MASK   UINT32_C(0x00000003)
     88/** Mask of flags available to general use.
     89 * The parties using the SG must all agree upon how to use these of course. */
     90#define PDMSCATTERGATHER_FLAGS_AVL_MASK     UINT32_C(0x0000f000)
     91/** Flags reserved for future use, MBZ. */
     92#define PDMSCATTERGATHER_FLAGS_RVD_MASK     UINT32_C(0x00000ff8)
    8893/** @} */
    8994
     
    135140     */
    136141    DECLR3CALLBACKMEMBER(int, pfnReceive,(PPDMINETWORKDOWN pInterface, const void *pvBuf, size_t cb));
    137 
    138142
    139143    /**
     
    145149     *
    146150     * @param   pInterface      Pointer to this interface.
    147      * @param   pSgBuf          Scatter/gather buffer of the size previously
    148      *                          requested.  Pass to PDMINETWORKUP::pfnSendBuf or
    149      *                          PDMINETWORKUP::pfnFreeBuf.
    150      *
    151151     * @thread  Non-EMT.
    152152     */
     
    195195     *          but there could of course be races.
    196196     *
    197      * @param   pInterface      Pointer to the interface structure containing the called function pointer.
     197     * @param   pInterface      Pointer to the interface structure containing the
     198     *                          called function pointer.
    198199     * @param   cbMin           The minimum buffer size.
     200     * @param   pGso            Pointer to a GSO context (only reference while in
     201     *                          this call).  NULL indicates no segmentation
     202     *                          offloading.  PDMSCATTERGATHER::pvUser is used to
     203     *                          indicate that a network SG uses GSO, usually by
     204     *                          pointing to a copy of @a pGso.
    199205     * @param   ppSgBuf         Where to return the buffer.  The buffer will be
    200206     *                          owned by the caller, designation owner number 1.
     
    202208     * @thread  Any, but normally EMT.
    203209     */
    204     DECLR3CALLBACKMEMBER(int, pfnAllocBuf,(PPDMINETWORKUP pInterface, size_t cbMin, PPPDMSCATTERGATHER ppSgBuf));
     210    DECLR3CALLBACKMEMBER(int, pfnAllocBuf,(PPDMINETWORKUP pInterface, size_t cbMin, PCPDMNETWORKGSO pGso,
     211                                           PPPDMSCATTERGATHER ppSgBuf));
    205212
    206213    /**
     
    278285} PDMINETWORKUP;
    279286/** PDMINETWORKUP interface ID. */
    280 #define PDMINETWORKUP_IID                       "f915243e-801a-4868-8979-b6b8594b09cc"
     287#define PDMINETWORKUP_IID                       "0e603bc1-3016-41b4-b521-15c038cda16a"
    281288
    282289
  • trunk/include/VBox/types.h

    r26137 r27973  
    738738
    739739/**
     740 * Forms of generic segment offloading.
     741 */
     742typedef enum PDMNETWORKGSOTYPE
     743{
     744    /** Invalid zero value. */
     745    PDMNETWORKGSOTYPE_INVALID = 0,
     746    /** TCP/IPv4. */
     747    PDMNETWORKGSOTYPE_IPV4_TCP,
     748#if 0 /* later */
     749    /** TCP/IPv6. */
     750    PDMNETWORKGSOTYPE_IPV6_TCP,
     751    /** UDP/IPv4. */
     752    PDMNETWORKGSOTYPE_IPV4_UDP,
     753    /** UDP/IPv6. */
     754    PDMNETWORKGSOTYPE_IPV6_UDP,
     755    /** IPv6 over IPv4 tunneling. */
     756    PDMNETWORKGSOTYPE_IPV4_TCPV6,
     757    /** TCP/IPv6 over IPv4 tunneling.
     758     * The header offsets and sizes relates to IPv4 and TCP, the IPv6 header is
     759     * figured out as needed.
     760     * @todo Needs checking against facts, this is just an outline of the idea. */
     761    PDMNETWORKGSOTYPE_IPV4_TCPV6_TCP,
     762    /** UDP/IPv6 over IPv4 tunneling.
     763     * The header offsets and sizes relates to IPv4 and UDP, the IPv6 header is
     764     * figured out as needed.
     765     * @todo Needs checking against facts, this is just an outline of the idea. */
     766    PDMNETWORKGSOTYPE_IPV4_TCPV6_UDP,
     767#endif
     768    /** The end of valid GSO types. */
     769    PDMNETWORKGSOTYPE_END
     770} PDMNETWORKGSOTYPE;
     771
     772
     773/**
     774 * Generic segment offloading context.
     775 *
     776 * We generally follow the E1000 specs wrt to which header fields we change.
     777 * However the GSO type implies where the checksum fields are and that they are
     778 * always updated from scratch (no half done pseudo checksums).
     779 *
     780 * @remarks This is part of the internal network GSO packets.  Take great care
     781 *          when making changes.  The size is expected to be exactly 8 bytes.
     782 */
     783typedef struct PDMNETWORKGSO
     784{
     785    /** The type of segmentation offloading we're performing (PDMNETWORKGSOTYPE). */
     786    uint8_t             u8Type;
     787    /** The total header size. */
     788    uint8_t             cbHdrs;
     789    /** The max segment size (MSS) to apply. */
     790    uint16_t            cbMaxSeg;
     791
     792    /** Offset of the first header (IPv4 / IPv6). */
     793    uint8_t             offHdr1;
     794    /** The size of the first header (IPv4 / IPv6). */
     795    uint8_t             cbHdr1;
     796
     797    /** Offset of the second header (TCP / UDP). */
     798    uint8_t             offHdr2;
     799    /** The size of the second header (TCP / UDP). */
     800    uint8_t             cbHdr2;
     801} PDMNETWORKGSO;
     802/** Pointer to a GSO context. */
     803typedef PDMNETWORKGSO *PPDMNETWORKGSO;
     804/** Pointer to a const GSO context. */
     805typedef PDMNETWORKGSO const *PCPDMNETWORKGSO;
     806
     807
     808/**
    740809 * The current ROM page protection.
    741810 *
  • trunk/src/VBox/Devices/Network/DevPCNet.cpp

    r27844 r27973  
    21102110        if (RT_LIKELY(pDrv))
    21112111        {
    2112             rc = pDrv->pfnAllocBuf(pDrv, cbMin, ppSgBuf);
     2112            rc = pDrv->pfnAllocBuf(pDrv, cbMin, NULL /*pGso*/, ppSgBuf);
    21132113            AssertMsg(rc == VINF_SUCCESS || rc == VERR_TRY_AGAIN || rc == VERR_NET_DOWN || rc == VERR_NO_MEMORY, ("%Rrc\n", rc));
    21142114            if (RT_FAILURE(rc))
  • trunk/src/VBox/Devices/Network/DevVirtioNet.cpp

    r26932 r27973  
    388388
    389389#ifdef IN_RING3
     390
    390391/**
    391392 * Wakeup the RX thread.
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r27840 r27973  
    190190 * @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
    191191 */
    192 static DECLCALLBACK(int) drvR3IntNetUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin, PPPDMSCATTERGATHER ppSgBuf)
     192static DECLCALLBACK(int) drvR3IntNetUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
     193                                                PCPDMNETWORKGSO pGso,  PPPDMSCATTERGATHER ppSgBuf)
    193194{
    194195    PDRVINTNET  pThis = RT_FROM_MEMBER(pInterface, DRVINTNET, INetworkUpR3);
    195196    int         rc    = VINF_SUCCESS;
    196197    Assert(cbMin < UINT32_MAX / 2);
     198AssertReturn(!pGso, VERR_NOT_IMPLEMENTED); /** @todo GSO buffer allocation. */
    197199
    198200    /*
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r27842 r27973  
    417417 * @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
    418418 */
    419 static DECLCALLBACK(int) drvNATNetworkUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin, PPPDMSCATTERGATHER ppSgBuf)
     419static DECLCALLBACK(int) drvNATNetworkUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
     420                                                  PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
    420421{
    421422    PDRVNAT pThis = RT_FROM_MEMBER(pInterface, DRVNAT, INetworkUp);
     423AssertReturn(!pGso, VERR_NOT_IMPLEMENTED); /** @todo GSO buffer allocation. */
    422424
    423425    /*
     
    506508{
    507509    PPDMSCATTERGATHER pSgBuf;
    508     int rc = drvNATNetworkUp_AllocBuf(pInterface, cb, &pSgBuf);
     510    int rc = drvNATNetworkUp_AllocBuf(pInterface, cb, NULL /*pGso*/, &pSgBuf);
    509511    if (RT_SUCCESS(rc))
    510512    {
  • trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp

    r27843 r27973  
    8585 * @interface_method_impl{PDMINETWORKUP,pfnAllocBuf}
    8686 */
    87 static DECLCALLBACK(int) drvNetSnifferUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin, PPPDMSCATTERGATHER ppSgBuf)
     87static DECLCALLBACK(int) drvNetSnifferUp_AllocBuf(PPDMINETWORKUP pInterface, size_t cbMin,
     88                                                  PCPDMNETWORKGSO pGso, PPPDMSCATTERGATHER ppSgBuf)
    8889{
    8990    PDRVNETSNIFFER pThis = RT_FROM_MEMBER(pInterface, DRVNETSNIFFER, INetworkUp);
    9091    if (RT_UNLIKELY(!pThis->pIBelowNet))
    9192        return VERR_NET_DOWN;
    92     return pThis->pIBelowNet->pfnAllocBuf(pThis->pIBelowNet, cbMin, ppSgBuf);
     93    return pThis->pIBelowNet->pfnAllocBuf(pThis->pIBelowNet, cbMin, pGso, ppSgBuf);
    9394}
    9495
     
    117118    /* output to sniffer */
    118119    RTCritSectEnter(&pThis->Lock);
     120    /** @todo Deal with GSO here. */
    119121    PcapFileFrame(pThis->File, pThis->StartNanoTS,
    120122                  pSgBuf->aSegs[0].pvSeg,
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