VirtualBox

Changeset 88529 in vbox


Ignore:
Timestamp:
Apr 15, 2021 12:01:54 PM (3 years ago)
Author:
vboxsync
Message:

Dev/E1000: Use a dedicated array instead of DD bit to store TX descriptor validity.

File:
1 edited

Legend:

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

    r88490 r88529  
    11231123    /** TX: Fetched TX descriptors. */
    11241124    E1KTXDESC   aTxDescriptors[E1K_TXD_CACHE_SIZE];
     1125    /** TX: Validity of TX descriptors. Set by e1kLocateTxPacket, used by e1kXmitPacket. */
     1126    bool        afTxDValid[E1K_TXD_CACHE_SIZE];
    11251127    /** TX: Actual number of fetched TX descriptors. */
    11261128    uint8_t     nTxDFetched;
     
    51485150    e1kPrintTDesc(pThis, pDesc, "vvv");
    51495151
    5150     if (pDesc->legacy.dw3.fDD)
    5151     {
    5152         E1kLog(("%s e1kXmitDesc: skipping bad descriptor ^^^\n", pThis->szPrf));
    5153         e1kDescReport(pDevIns, pThis, pDesc, addr);
    5154         return VINF_SUCCESS;
    5155     }
    5156 
    51575152//#ifdef E1K_USE_TX_TIMERS
    51585153    if (pThis->fTidEnabled)
     
    51775172            if (pDesc->data.cmd.u20DTALEN == 0 || pDesc->data.u64BufAddr == 0)
    51785173            {
    5179                 E1kLog2(("% Empty data descriptor, skipped.\n", pThis->szPrf));
     5174                E1kLog2(("%s Empty data descriptor, skipped.\n", pThis->szPrf));
    51805175                if (pDesc->data.cmd.fEOP)
    51815176                {
     
    53035298}
    53045299
    5305 DECLINLINE(void) e1kUpdateTxContext(PE1KSTATE pThis, E1KTXDESC *pDesc)
     5300DECLINLINE(bool) e1kUpdateTxContext(PE1KSTATE pThis, E1KTXDESC *pDesc)
    53065301{
    53075302    if (pDesc->context.dw2.fTSE)
     
    53345329             pDesc->context.tu.u8CSO,
    53355330             pDesc->context.tu.u16CSE));
     5331    return true; /* TODO: Consider returning false for invalid descriptors */
    53365332}
    53375333
     
    53515347    uint32_t cbPacket = 0;
    53525348
     5349    /* Since we process one packet at a time we will only mark current packet's descriptors as valid */
     5350    memset(pThis->afTxDValid, 0, sizeof(pThis->afTxDValid));
    53535351    for (int i = pThis->iTxDCurrent; i < pThis->nTxDFetched; ++i)
    53545352    {
    53555353        E1KTXDESC *pDesc = &pThis->aTxDescriptors[i];
     5354        /* Assume the descriptor valid until proven otherwise. */
     5355        pThis->afTxDValid[i] = true;
    53565356        switch (e1kGetDescType(pDesc))
    53575357        {
    53585358            case E1K_DTYP_CONTEXT:
    53595359                if (cbPacket == 0)
    5360                     e1kUpdateTxContext(pThis, pDesc);
     5360                    pThis->afTxDValid[i] = e1kUpdateTxContext(pThis, pDesc);
    53615361                else
    53625362                    E1kLog(("%s e1kLocateTxPacket: ignoring a context descriptor in the middle of a packet, cbPacket=%d\n",
     
    53695369                    E1kLog(("%s e1kLocateTxPacket: ignoring a legacy descriptor in the segmentation context, cbPacket=%d\n",
    53705370                            pThis->szPrf, cbPacket));
    5371                     pDesc->legacy.dw3.fDD = true; /* Make sure it is skipped by processing */
     5371                    pThis->afTxDValid[i] = false; /* Make sure it is skipped by processing */
    53725372                    continue;
    53735373                }
     
    53845384                    E1kLog(("%s e1kLocateTxPacket: ignoring %sTSE descriptor in the %ssegmentation context, cbPacket=%d\n",
    53855385                            pThis->szPrf, pDesc->data.cmd.fTSE ? "" : "non-", fTSE ? "" : "non-", cbPacket));
    5386                     pDesc->data.dw3.fDD = true; /* Make sure it is skipped by processing */
     5386                    pThis->afTxDValid[i] = false; /* Make sure it is skipped by processing */
    53875387                    continue;
    53885388                }
     
    54695469        E1kLog3(("%s About to process new TX descriptor at %08x%08x, TDLEN=%08x, TDH=%08x, TDT=%08x\n",
    54705470                 pThis->szPrf, TDBAH, TDBAL + pTxdc->tdh * sizeof(E1KTXDESC), pTxdc->tdlen, pTxdc->tdh, pTxdc->tdt));
    5471         rc = e1kXmitDesc(pDevIns, pThis, pThisCC, pDesc, e1kDescAddr(TDBAH, TDBAL, pTxdc->tdh), fOnWorkerThread);
     5471        if (!pThis->afTxDValid[pThis->iTxDCurrent])
     5472        {
     5473            e1kPrintTDesc(pThis, pDesc, "vvv");
     5474            E1kLog(("%s e1kXmitDesc: skipping bad descriptor ^^^\n", pThis->szPrf));
     5475            e1kDescReport(pDevIns, pThis, pDesc, e1kDescAddr(TDBAH, TDBAL, pTxdc->tdh));
     5476            rc = VINF_SUCCESS;
     5477        }
     5478        else
     5479            rc = e1kXmitDesc(pDevIns, pThis, pThisCC, pDesc, e1kDescAddr(TDBAH, TDBAL, pTxdc->tdh), fOnWorkerThread);
    54725480        if (RT_FAILURE(rc))
    54735481            break;
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