VirtualBox

Changeset 560 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Feb 2, 2007 3:49:04 PM (18 years ago)
Author:
vboxsync
Message:

Implemented drvTAPW32SendEx

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/DrvTAPWin32.cpp

    r559 r560  
    176176static DECLCALLBACK(int) drvTAPW32SendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    177177{
    178     int rc = VERR_INVALID_PARAMETER;
    179 
    180     for (uint32_t i=0;i<cPackets;i++)
    181     {
    182         rc = drvTAPW32Send(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    183         if (VBOX_FAILURE(rc))
    184             break;
     178    PDRVTAP pData = PDMINETWORKCONNECTOR_2_DRVTAP(pInterface);
     179    int     rc = VERR_INVALID_PARAMETER;
     180
     181    if (pData->tapVersion.minor > 1)
     182    {
     183        TAP_SCATTER_GATHER_LIST_MAX list;
     184        BOOL                        ret;
     185        DWORD                       length;
     186
     187        list.cPackets = RT_MIN(cPackets, TAP_SCATTER_GATHER_MAX_PACKETS);
     188        cPackets     -= list.cPackets;
     189
     190        ret = DeviceIoControl(pData->hFile, TAP_IOCTL_TRANSFER_ETHPACKETS, &list, RT_OFFSETOF(TAP_SCATTER_GATHER_LIST_MAX, aPacket[list.cPackets]),
     191                              NULL, 0, &length, NULL);
     192        if (ret == FALSE)
     193            return RTErrConvertFromWin32(GetLastError());
     194
     195        if (cPackets)
     196            return drvTAPW32SendEx(pInterface, cPackets, &paPacket[list.cPackets]);
     197    }
     198    else
     199    {
     200        for (uint32_t i=0;i<cPackets;i++)
     201        {
     202            rc = drvTAPW32Send(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
     203            if (VBOX_FAILURE(rc))
     204                break;
     205        }
    185206    }
    186207    return rc;
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