VirtualBox

Changeset 82961 in vbox for trunk/src/VBox/Devices/VirtIO


Ignore:
Timestamp:
Feb 3, 2020 4:59:10 PM (5 years ago)
Author:
vboxsync
Message:

Network/DevVirtioNet_1_0.cpp: Device appears and is doing transactions over VirtIO but snags when client setups MAC filter. See BugRef(#8651) Comment #53

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/VirtIO/Virtio_1_0.cpp

    r82864 r82961  
    4040*********************************************************************************************************************************/
    4141#define INSTANCE(a_pVirtio)                 ((a_pVirtio)->szInstance)
    42 #define QUEUE_NAME(a_pVirtio, a_idxQueue)   ((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName)
     42#define VIRTQNAME(a_pVirtio, a_idxQueue)    ((a_pVirtio)->virtqState[(a_idxQueue)].szVirtqName)
    4343#define IS_DRIVER_OK(a_pVirtio)             ((a_pVirtio)->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK)
    4444
     
    174174DECLINLINE(bool) virtqIsEmpty(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t idxQueue)
    175175{
    176     uint16_t uAvailGst = virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue);
    177     bool fEmpty = uAvailGst == pVirtio->virtqState[idxQueue].uAvailIdx;
    178 
    179     Log6Func(("Q<%u>: uAvailGst=%u uAvailIdx=%u -> fEmpty=%RTbool\n",
    180              idxQueue, uAvailGst, pVirtio->virtqState[idxQueue].uAvailIdx, fEmpty));
     176    uint16_t uAvailGuest = virtioReadAvailRingIdx(pDevIns, pVirtio, idxQueue);
     177    bool fEmpty = uAvailGuest == pVirtio->virtqState[idxQueue].uAvailIdx;
     178
     179    Log6Func(("%s: uAvailGuest=%u uAvailIdx=%u. (%s)\n",
     180             VIRTQNAME(pVirtio, idxQueue), uAvailGuest, pVirtio->virtqState[idxQueue].uAvailIdx,
     181             fEmpty ? "Queue empty" : "Queue has available descriptors"));
    181182    return fEmpty;
    182183}
     
    618619        if (desc.fFlags & VIRTQ_DESC_F_WRITE)
    619620        {
    620             Log3Func(("%s IN  desc_idx=%u seg=%u addr=%RGp cb=%u\n", QUEUE_NAME(pVirtio, idxQueue), uDescIdx, cSegsIn, desc.GCPhysBuf, desc.cb));
     621            Log3Func(("%s IN  desc_idx=%u seg=%u addr=%RGp cb=%u\n", VIRTQNAME(pVirtio, idxQueue), uDescIdx, cSegsIn, desc.GCPhysBuf, desc.cb));
    621622            cbIn += desc.cb;
    622623            pSeg = &(paSegsIn[cSegsIn++]);
     
    624625        else
    625626        {
    626             Log3Func(("%s OUT desc_idx=%u seg=%u addr=%RGp cb=%u\n", QUEUE_NAME(pVirtio, idxQueue), uDescIdx, cSegsOut, desc.GCPhysBuf, desc.cb));
     627            Log3Func(("%s OUT desc_idx=%u seg=%u addr=%RGp cb=%u\n", VIRTQNAME(pVirtio, idxQueue), uDescIdx, cSegsOut, desc.GCPhysBuf, desc.cb));
    627628            cbOut += desc.cb;
    628629            pSeg = &(paSegsOut[cSegsOut++]);
     
    668669{
    669670    virtioKick(pVirtio->pDevIns, pVirtio, VIRTIO_ISR_DEVICE_CONFIG, pVirtio->uMsixConfig, false);
    670 
    671671}
    672672
     
    680680void virtioCoreQueueSetNotify(PVIRTIOCORE pVirtio, uint16_t idxQueue, bool fEnabled)
    681681{
    682     uint16_t fFlags = virtioReadUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue);
    683 
    684     if (fEnabled)
    685         fFlags &= ~ VIRTQ_USED_F_NO_NOTIFY;
    686     else
    687         fFlags |= VIRTQ_USED_F_NO_NOTIFY;
    688 
    689     virtioWriteUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue, fFlags);
     682    if (pVirtio->uDeviceStatus & VIRTIO_STATUS_DRIVER_OK)
     683    {
     684        uint16_t fFlags = virtioReadUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue);
     685
     686        if (fEnabled)
     687            fFlags &= ~ VIRTQ_USED_F_NO_NOTIFY;
     688        else
     689            fFlags |= VIRTQ_USED_F_NO_NOTIFY;
     690
     691        virtioWriteUsedFlags(pVirtio->pDevIns, pVirtio, idxQueue, fFlags);
     692    }
    690693}
    691694
     
    858861
    859862    Log3Func(("Copying client data to %s, desc chain (head desc_idx %d)\n",
    860               QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));
     863              VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));
    861864
    862865    /*
     
    906909
    907910    Log6Func(("Write ahead used_idx=%u, %s used_idx=%u\n",
    908               pVirtq->uUsedIdx, QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));
     911              pVirtq->uUsedIdx, VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue)));
    909912
    910913    RTMemFree((void *)pDescChain->pSgPhysSend->paSegs);
     
    946949
    947950    Log6Func(("Updating %s used_idx from %u to %u\n",
    948               QUEUE_NAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue), pVirtq->uUsedIdx));
     951              VIRTQNAME(pVirtio, idxQueue), virtioReadUsedRingIdx(pDevIns, pVirtio, idxQueue), pVirtq->uUsedIdx));
    949952
    950953    virtioWriteUsedRingIdx(pDevIns, pVirtio, idxQueue, pVirtq->uUsedIdx);
     
    11621165#ifdef LOG_ENABLED
    11631166# define LOG_COMMON_CFG_ACCESS(member, a_offIntra) \
    1164     virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \
    1165                            pv, cb, a_offIntra, fWrite, false, 0);
     1167    if (LogIs7Enabled()) { \
     1168        virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \
     1169                                   pv, cb, a_offIntra, fWrite, false, 0); \
     1170    }
    11661171# define LOG_COMMON_CFG_ACCESS_INDEXED(member, idx, a_offIntra) \
    1167     virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \
    1168                            pv, cb, a_offIntra, fWrite, true, idx);
     1172    if (LogIs7Enabled()) { \
     1173        virtioCoreLogMappedIoValue(__FUNCTION__, #member, RT_SIZEOFMEMB(VIRTIO_PCI_COMMON_CFG_T, member), \
     1174                                   pv, cb, a_offIntra, fWrite, true, idx); \
     1175    }
    11691176#else
    11701177# define LOG_COMMON_CFG_ACCESS(member, a_offIntra)              do { } while (0)
     
    13101317        {
    13111318            uint8_t const fNewStatus = *(uint8_t *)pv;
    1312             Log6Func(("Guest wrote uDeviceStatus (%#x, was %#x, change #%x) ................ (",
     1319            Log7Func(("Guest wrote uDeviceStatus (%#x, was %#x, change #%x) ................ (",
    13131320                      fNewStatus, pVirtio->uDeviceStatus, fNewStatus ^ pVirtio->uDeviceStatus));
    1314             virtioLogDeviceStatus(fNewStatus);
    1315             Log6((")\n"));
     1321            if (LogIs7Enabled())
     1322                virtioLogDeviceStatus(fNewStatus);
     1323            Log7((")\n"));
    13161324
    13171325            /* If the status changed or we were reset, we need to go to ring-3 as
     
    13441352        else /* Guest READ pCommonCfg->uDeviceStatus */
    13451353        {
    1346             Log6Func(("Guest read  uDeviceStatus ................ ("));
     1354            Log7Func(("Guest read  uDeviceStatus ................ ("));
    13471355            *(uint8_t *)pv = pVirtio->uDeviceStatus;
    1348             virtioLogDeviceStatus(pVirtio->uDeviceStatus);
    1349             Log6((")\n"));
     1356            if (LogIs7Enabled())
     1357                virtioLogDeviceStatus(pVirtio->uDeviceStatus);
     1358            Log7((")\n"));
    13501359        }
    13511360    }
     
    14511460        }
    14521461
    1453         if (pVirtio->fMsiSupport)
    1454             PDMDevHlpPCISetIrq(pDevIns, pVirtio->uMsixConfig, PDM_IRQ_LEVEL_LOW);
    1455 
     1462        virtioLowerInterrupt(pDevIns, 0);
    14561463        return rcStrict;
    14571464#else
     
    15461553    RT_NOREF(pPciDev);
    15471554
    1548     LogFlowFunc(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u pu32Value=%p\n",
     1555    Log7Func(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u pu32Value=%p\n",
    15491556                 pDevIns, pPciDev, uAddress, cb, pu32Value));
    15501557    if (uAddress == pVirtio->uPciCfgDataOff)
     
    15861593    RT_NOREF(pPciDev);
    15871594
    1588     LogFlowFunc(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u u32Value=%#x\n", pDevIns, pPciDev, uAddress, cb, u32Value));
     1595    Log7Func(("pDevIns=%p pPciDev=%p uAddress=%#x cb=%u u32Value=%#x\n", pDevIns, pPciDev, uAddress, cb, u32Value));
    15891596    if (uAddress == pVirtio->uPciCfgDataOff)
    15901597    {
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