VirtualBox

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


Ignore:
Timestamp:
Feb 4, 2007 11:42:27 AM (18 years ago)
Author:
vboxsync
Message:

Removed multiple packet code. Failed experiment.

Location:
trunk/src/VBox/Devices/Network
Files:
6 edited

Legend:

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

    r575 r587  
    8080/* Enable to handle frequent io reads in the guest context */
    8181#define PCNET_GC_ENABLED
    82 
    83 /* Enable to send multiple packets with one system call */
    84 /* #define PCNET_SEND_MULTIPLE_PACKETS */
    8582
    8683/* Enable to delay setting the TX interrupt until packets have been sent. */
     
    18261823    pData->fTransmitting = true;
    18271824
    1828 #ifdef PCNET_SEND_MULTIPLE_PACKETS
    1829     if (pData->iFrame)
    1830     {
    1831         if (pData->iFrame > 1)
    1832         {
    1833             /** @todo Tip, use alloca() or a fixed sized stack array to save time and avoid the heap and it's locks. */
    1834             PPDMINETWORKPACKET paPacket = (PPDMINETWORKPACKET)RTMemTmpAlloc(sizeof(PDMINETWORKPACKET)*pData->iFrame);
    1835             unsigned           i;
    1836 
    1837             Assert(paPacket);
    1838             if (paPacket)
    1839             {
    1840                 for (i = 0; i < pData->iFrame; i++)
    1841                 {
    1842                     paPacket[i].pvBuf = pData->aFrames[i].pvR3 != NIL_RTR3PTR
    1843                                       ? pData->aFrames[i].pvR3
    1844                                       : &pData->abFrameBuf[pData->aFrames[i].off];
    1845                     paPacket[i].cb    = pData->aFrames[i].cb;
    1846 
    1847                     if (pData->aFrames[i].cb > 70) /* unqualified guess */
    1848                         pData->Led.Asserted.s.fWriting = pData->Led.Actual.s.fWriting = 1;
    1849                 }
    1850 
    1851                 if (pcnetIsLinkUp(pData))
    1852                     pData->pDrv->pfnSendEx(pData->pDrv, pData->iFrame, paPacket);
    1853 
    1854                 RTMemTmpFree(paPacket);
    1855             }
    1856         }
    1857         else
    1858         {
    1859             RTR3PTR pv = pData->aFrames[0].pvR3 != NIL_RTR3PTR
    1860                        ? pData->aFrames[0].pvR3
    1861                        : &pData->abFrameBuf[pData->aFrames[0].off];
    1862             if (pData->aFrames[0].cb > 70) /* unqualified guess */
    1863                 pData->Led.Asserted.s.fWriting = pData->Led.Actual.s.fWriting = 1;
    1864             if (pcnetIsLinkUp(pData))
    1865             {
    1866                 pData->pDrv->pfnSend(pData->pDrv, pv, pData->aFrames[0].cb);
    1867                 LOG_PACKET("xmit", pv, pData->aFrames[0].cb);
    1868             }
    1869         }
    1870 
    1871 #ifdef PCNET_DELAY_INT
    1872         /* Update TXSTRT and TINT. */
    1873         pData->aCSR[4] |=  0x0004;       /* set TXSTRT */
    1874         pData->aCSR[0] |= 0x0200;    /* set TINT */
    1875         pcnetUpdateIrq(pData);
    1876 #endif
    1877     }
    1878 
    1879 #else /* PCNET_SEND_MULTIPLE_PACKETS */
    1880 
    18811825    for (unsigned i = 0; i < pData->iFrame; i++)
    18821826    {
     
    19021846    }
    19031847#endif
    1904 
    1905 #endif /* PCNET_SEND_MULTIPLE_PACKETS */
    19061848
    19071849    pData->fTransmitting = false;
  • trunk/src/VBox/Devices/Network/DrvIntNet.cpp

    r574 r587  
    154154}
    155155
    156 
    157 /**
    158  * Send multiple data packets to the network.
    159  *
    160  * @returns VBox status code.
    161  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    162  * @param   cPackets        Number of packets
    163  * @param   paPacket        Packet description array
    164  * @thread  EMT
    165  */
    166 static DECLCALLBACK(int) drvIntNetSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    167 {
    168     int rc = VERR_INVALID_PARAMETER;
    169 
    170     for (uint32_t i = 0; i < cPackets; i++)
    171     {
    172         rc = drvIntNetSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    173         if (VBOX_FAILURE(rc))
    174             break;
    175     }
    176     return rc;
    177 }
    178156
    179157/**
     
    633611    /* INetwork */
    634612    pThis->INetworkConnector.pfnSend                = drvIntNetSend;
    635     pThis->INetworkConnector.pfnSendEx              = drvIntNetSendEx;
    636613    pThis->INetworkConnector.pfnSetPromiscuousMode  = drvIntNetSetPromiscuousMode;
    637614    pThis->INetworkConnector.pfnNotifyLinkChanged   = drvIntNetNotifyLinkChanged;
  • trunk/src/VBox/Devices/Network/DrvNAT.cpp

    r570 r587  
    9797}
    9898
    99 
    100 /**
    101  * Send multiple data packets to the network.
    102  *
    103  * @returns VBox status code.
    104  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    105  * @param   cPackets        Number of packets
    106  * @param   paPacket        Packet description array
    107  * @thread  EMT
    108  */
    109 static DECLCALLBACK(int) drvNATSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    110 {
    111     int rc = VERR_INVALID_PARAMETER;
    112 
    113     for (uint32_t i = 0; i < cPackets; i++)
    114     {
    115         rc = drvNATSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    116         if (VBOX_FAILURE(rc))
    117             break;
    118     }
    119     return rc;
    120 }
    12199
    122100/**
     
    378356    /* INetwork */
    379357    pData->INetworkConnector.pfnSend               = drvNATSend;
    380     pData->INetworkConnector.pfnSendEx             = drvNATSendEx;
    381358    pData->INetworkConnector.pfnSetPromiscuousMode = drvNATSetPromiscuousMode;
    382359    pData->INetworkConnector.pfnNotifyLinkChanged  = drvNATNotifyLinkChanged;
  • trunk/src/VBox/Devices/Network/DrvNetSniffer.cpp

    r571 r587  
    147147
    148148/**
    149  * Send multiple data packets to the network.
    150  *
    151  * @returns VBox status code.
    152  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    153  * @param   cPackets        Number of packets
    154  * @param   paPacket        Packet description array
    155  * @thread  EMT
    156  */
    157 static DECLCALLBACK(int) drvNetSnifferSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    158 {
    159     int rc = VERR_INVALID_PARAMETER;
    160 
    161     for (uint32_t i = 0; i < cPackets; i++)
    162     {
    163         rc = drvNetSnifferSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    164         if (VBOX_FAILURE(rc))
    165             break;
    166     }
    167     return rc;
    168 }
    169 
    170 
    171 /**
    172149 * Set promiscuous mode.
    173150 *
     
    355332    /* INetworkConnector */
    356333    pData->INetworkConnector.pfnSend                = drvNetSnifferSend;
    357     pData->INetworkConnector.pfnSendEx              = drvNetSnifferSendEx;
    358334    pData->INetworkConnector.pfnSetPromiscuousMode  = drvNetSnifferSetPromiscuousMode;
    359335    pData->INetworkConnector.pfnNotifyLinkChanged   = drvNetSnifferNotifyLinkChanged;
  • trunk/src/VBox/Devices/Network/DrvTAP.cpp

    r572 r587  
    157157}
    158158
    159 /**
    160  * Send multiple data packets to the network.
    161  *
    162  * @returns VBox status code.
    163  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    164  * @param   cPackets        Number of packets
    165  * @param   paPacket        Packet description array
    166  * @thread  EMT
    167  */
    168 static DECLCALLBACK(int) drvTAPSendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    169 {
    170     int rc = VERR_INVALID_PARAMETER;
    171 
    172     for (uint32_t i = 0; i < cPackets; i++)
    173     {
    174         rc = drvTAPSend(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    175         if (VBOX_FAILURE(rc))
    176             break;
    177     }
    178     return rc;
    179 }
    180159
    181160/**
     
    530509    /* INetwork */
    531510    pData->INetworkConnector.pfnSend                = drvTAPSend;
    532     pData->INetworkConnector.pfnSendEx              = drvTAPSendEx;
    533511    pData->INetworkConnector.pfnSetPromiscuousMode  = drvTAPSetPromiscuousMode;
    534512    pData->INetworkConnector.pfnNotifyLinkChanged   = drvTAPNotifyLinkChanged;
  • trunk/src/VBox/Devices/Network/DrvTAPWin32.cpp

    r575 r587  
    165165}
    166166
    167 /**
    168  * Send multiple data packets to the network.
    169  *
    170  * @returns VBox status code.
    171  * @param   pInterface      Pointer to the interface structure containing the called function pointer.
    172  * @param   cPackets        Number of packets
    173  * @param   paPacket        Packet description array
    174  * @thread  EMT
    175  */
    176 static DECLCALLBACK(int) drvTAPW32SendEx(PPDMINETWORKCONNECTOR pInterface, uint32_t cPackets, PPDMINETWORKPACKET paPacket)
    177 {
    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         for (uint32_t i=0;i<list.cPackets;i++)
    191         {
    192             list.aPacket[i].pPacket = paPacket[i].pvBuf;
    193             list.aPacket[i].cb      = paPacket[i].cb;
    194         }
    195 
    196         ret = DeviceIoControl(pData->hFile, TAP_IOCTL_TRANSFER_ETHPACKETS, &list, RT_OFFSETOF(TAP_SCATTER_GATHER_LIST_MAX, aPacket[list.cPackets]),
    197                               NULL, 0, &length, NULL);
    198         if (ret == FALSE)
    199             return RTErrConvertFromWin32(GetLastError());
    200 
    201         if (cPackets)
    202             return drvTAPW32SendEx(pInterface, cPackets, &paPacket[list.cPackets]);
    203     }
    204     else
    205     {
    206         for (uint32_t i=0;i<cPackets;i++)
    207         {
    208             rc = drvTAPW32Send(pInterface, paPacket[i].pvBuf, paPacket[i].cb);
    209             if (VBOX_FAILURE(rc))
    210                 break;
    211         }
    212     }
    213     return rc;
    214 }
    215 
    216167
    217168/**
     
    515466    /* INetwork */
    516467    pData->INetworkConnector.pfnSend                = drvTAPW32Send;
    517     pData->INetworkConnector.pfnSendEx              = drvTAPW32SendEx;
    518468    pData->INetworkConnector.pfnSetPromiscuousMode  = drvTAPW32SetPromiscuousMode;
    519469    pData->INetworkConnector.pfnNotifyLinkChanged   = drvTAPW32NotifyLinkChanged;
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