VirtualBox

Changeset 85132 in vbox


Ignore:
Timestamp:
Jul 9, 2020 2:26:40 AM (4 years ago)
Author:
vboxsync
Message:

Network/DevVirtioNet_1_0 fixed accidental renaming of some constants

File:
1 edited

Legend:

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

    r85109 r85132  
    7777/** @name virtq related flags
    7878 * @{ */
    79 #define VIRTQUEUE_DESC_F_NEXT                               1        /**< Indicates this descriptor chains to next  */
    80 #define VIRTQUEUE_DESC_F_WRITE                              2        /**< Marks buffer as write-only (default ro)   */
    81 #define VIRTQUEUE_DESC_F_INDIRECT                           4        /**< Buffer is list of buffer descriptors      */
    82 
    83 #define VIRTQUEUE_USED_F_NO_NOTIFY                          1        /**< Dev to Drv: Don't notify when buf added   */
    84 #define VIRTQUEUE_AVAIL_F_NO_INTERRUPT                      1        /**< Drv to Dev: Don't notify when buf eaten   */
     79#define VIRTQ_DESC_F_NEXT                               1        /**< Indicates this descriptor chains to next  */
     80#define VIRTQ_DESC_F_WRITE                              2        /**< Marks buffer as write-only (default ro)   */
     81#define VIRTQ_DESC_F_INDIRECT                           4        /**< Buffer is list of buffer descriptors      */
     82
     83#define VIRTQ_USED_F_NO_NOTIFY                          1        /**< Dev to Drv: Don't notify when buf added   */
     84#define VIRTQ_AVAIL_F_NO_INTERRUPT                      1        /**< Drv to Dev: Don't notify when buf eaten   */
    8585/** @} */
    8686
     
    9595    uint16_t  fFlags;                                            /**< flags      Buffer specific flags          */
    9696    uint16_t  uDescIdxNext;                                      /**< next       Idx set if VIRTIO_DESC_F_NEXT  */
    97 } VIRTQUEUE_DESC_T, *PVIRTQUEUE_DESC_T;
     97} VIRTQ_DESC_T, *PVIRTQ_DESC_T;
    9898
    9999typedef struct virtq_avail
     
    103103    RT_FLEXIBLE_ARRAY_EXTENSION
    104104    uint16_t  auRing[RT_FLEXIBLE_ARRAY];                         /**< ring       Ring: avail drv to dev bufs    */
    105     //uint16_t  uUsedEventIdx;                                   /**< used_event (if VIRTQUEUE_USED_F_EVENT_IDX)    */
    106 } VIRTQUEUE_AVAIL_T, *PVIRTQUEUE_AVAIL_T;
     105    //uint16_t  uUsedEventIdx;                                   /**< used_event (if VIRTQ_USED_F_EVENT_IDX)    */
     106} VIRTQ_AVAIL_T, *PVIRTQ_AVAIL_T;
    107107
    108108typedef struct virtq_used_elem
     
    110110    uint32_t  uDescIdx;                                          /**< idx         Start of used desc chain      */
    111111    uint32_t  cbElem;                                            /**< len         Total len of used desc chain  */
    112 } VIRTQUEUE_USED_ELEM_T;
     112} VIRTQ_USED_ELEM_T;
    113113
    114114typedef struct virt_used
     
    117117    uint16_t  uIdx;                                              /**< idx         Index of next ring slot       */
    118118    RT_FLEXIBLE_ARRAY_EXTENSION
    119     VIRTQUEUE_USED_ELEM_T aRing[RT_FLEXIBLE_ARRAY];                  /**< ring        Ring: used dev to drv bufs    */
    120     //uint16_t  uAvailEventIdx;                                  /**< avail_event if (VIRTQUEUE_USED_F_EVENT_IDX)   */
    121 } VIRTQUEUE_USED_T, *PVIRTQUEUE_USED_T;
     119    VIRTQ_USED_ELEM_T aRing[RT_FLEXIBLE_ARRAY];                  /**< ring        Ring: used dev to drv bufs    */
     120    //uint16_t  uAvailEventIdx;                                  /**< avail_event if (VIRTQ_USED_F_EVENT_IDX)   */
     121} VIRTQ_USED_T, *PVIRTQ_USED_T;
    122122
    123123
     
    147147#ifdef IN_RING3
    148148DECLINLINE(void) virtioReadDesc(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, PVIRTQUEUE pVirtq,
    149                                 uint32_t idxDesc, PVIRTQUEUE_DESC_T pDesc)
     149                                uint32_t idxDesc, PVIRTQ_DESC_T pDesc)
    150150{
    151151    AssertMsg(pVirtio->fDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n"));
     
    153153    uint16_t const cVirtqItems = RT_MAX(pVirtq->uSize, 1); /* Make sure to avoid div-by-zero. */
    154154    PDMDevHlpPCIPhysRead(pDevIns,
    155                       pVirtq->GCPhysVirtqDesc + sizeof(VIRTQUEUE_DESC_T) * (idxDesc % cVirtqItems),
    156                       pDesc, sizeof(VIRTQUEUE_DESC_T));
     155                      pVirtq->GCPhysVirtqDesc + sizeof(VIRTQ_DESC_T) * (idxDesc % cVirtqItems),
     156                      pDesc, sizeof(VIRTQ_DESC_T));
    157157}
    158158#endif
     
    169169    uint16_t const cVirtqItems = RT_MAX(pVirtq->uSize, 1); /* Make sure to avoid div-by-zero. */
    170170    PDMDevHlpPCIPhysRead(pDevIns,
    171                          pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF_DYN(VIRTQUEUE_AVAIL_T, auRing[availIdx % cVirtqItems]),
     171                         pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF_DYN(VIRTQ_AVAIL_T, auRing[availIdx % cVirtqItems]),
    172172                         &uDescIdx, sizeof(uDescIdx));
    173173    return uDescIdx;
     
    181181    RT_NOREF(pVirtio);
    182182    PDMDevHlpPCIPhysRead(pDevIns,
    183                          pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF_DYN(VIRTQUEUE_AVAIL_T, auRing[pVirtq->uSize]),
     183                         pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF_DYN(VIRTQ_AVAIL_T, auRing[pVirtq->uSize]),
    184184                         &uUsedEventIdx, sizeof(uUsedEventIdx));
    185185    return uUsedEventIdx;
     
    193193    RT_NOREF(pVirtio);
    194194    PDMDevHlpPCIPhysRead(pDevIns,
    195                          pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF(VIRTQUEUE_AVAIL_T, uIdx),
     195                         pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF(VIRTQ_AVAIL_T, uIdx),
    196196                         &uIdx, sizeof(uIdx));
    197197    return uIdx;
     
    204204    RT_NOREF(pVirtio);
    205205    PDMDevHlpPCIPhysRead(pDevIns,
    206                          pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF(VIRTQUEUE_AVAIL_T, fFlags),
     206                         pVirtq->GCPhysVirtqAvail + RT_UOFFSETOF(VIRTQ_AVAIL_T, fFlags),
    207207                         &fFlags, sizeof(fFlags));
    208208    return fFlags;
     
    219219                                     uint32_t usedIdx, uint32_t uDescIdx, uint32_t uLen)
    220220{
    221     VIRTQUEUE_USED_ELEM_T elem = { uDescIdx,  uLen };
     221    VIRTQ_USED_ELEM_T elem = { uDescIdx,  uLen };
    222222    AssertMsg(pVirtio->fDeviceStatus & VIRTIO_STATUS_DRIVER_OK, ("Called with guest driver not ready\n"));
    223223    RT_NOREF(pVirtio);
     
    225225    PDMDevHlpPCIPhysWrite(pDevIns,
    226226                          pVirtq->GCPhysVirtqUsed
    227                         + RT_UOFFSETOF_DYN(VIRTQUEUE_USED_T, aRing[usedIdx % cVirtqItems]),
     227                        + RT_UOFFSETOF_DYN(VIRTQ_USED_T, aRing[usedIdx % cVirtqItems]),
    228228                          &elem, sizeof(elem));
    229229}
     
    235235    RT_UNTRUSTED_VALIDATED_FENCE(); /* VirtIO 1.0, Section 3.2.1.4.1 */
    236236    PDMDevHlpPCIPhysWrite(pDevIns,
    237                           pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQUEUE_USED_T, fFlags),
     237                          pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQ_USED_T, fFlags),
    238238                          &fFlags, sizeof(fFlags));
    239239}
     
    245245    RT_NOREF(pVirtio);
    246246    PDMDevHlpPCIPhysWrite(pDevIns,
    247                           pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQUEUE_USED_T, uIdx),
     247                          pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQ_USED_T, uIdx),
    248248                          &uIdx, sizeof(uIdx));
    249249}
     
    257257    RT_NOREF(pVirtio);
    258258    PDMDevHlpPCIPhysRead(pDevIns,
    259                          pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQUEUE_USED_T, uIdx),
     259                         pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQ_USED_T, uIdx),
    260260                         &uIdx, sizeof(uIdx));
    261261    return uIdx;
     
    268268    RT_NOREF(pVirtio);
    269269    PDMDevHlpPCIPhysRead(pDevIns,
    270                          pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQUEUE_USED_T, fFlags),
     270                         pVirtq->GCPhysVirtqUsed + RT_UOFFSETOF(VIRTQ_USED_T, fFlags),
    271271                         &fFlags, sizeof(fFlags));
    272272    return fFlags;
     
    280280    PDMDevHlpPCIPhysWrite(pDevIns,
    281281                          pVirtq->GCPhysVirtqUsed
    282                         + RT_UOFFSETOF_DYN(VIRTQUEUE_USED_T, aRing[pVirtq->uSize]),
     282                        + RT_UOFFSETOF_DYN(VIRTQ_USED_T, aRing[pVirtq->uSize]),
    283283                          &uAvailEventIdx, sizeof(uAvailEventIdx));
    284284}
     
    325325}
    326326
    327 
    328327/** @} */
    329328
     
    458457    } const s_aFeatures[] =
    459458    {
    460         { VIRTIO_F_RING_INDIRECT_DESC,      "   RING_INDIRECT_DESC   Driver can use descriptors with VIRTQUEUE_DESC_F_INDIRECT flag set\n" },
     459        { VIRTIO_F_RING_INDIRECT_DESC,      "   RING_INDIRECT_DESC   Driver can use descriptors with VIRTQ_DESC_F_INDIRECT flag set\n" },
    461460        { VIRTIO_F_RING_EVENT_IDX,          "   RING_EVENT_IDX       Enables use_event and avail_event fields described in 2.4.7, 2.4.8\n" },
    462461        { VIRTIO_F_VERSION_1,               "   VERSION              Used to detect legacy drivers.\n" },
     
    715714    }
    716715
    717     bool fAvailNoInterrupt   = virtioReadAvailRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQUEUE_AVAIL_F_NO_INTERRUPT;
    718     bool fUsedNoNotify       = virtioReadUsedRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQUEUE_USED_F_NO_NOTIFY;
     716    bool fAvailNoInterrupt   = virtioReadAvailRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQ_AVAIL_F_NO_INTERRUPT;
     717    bool fUsedNoNotify       = virtioReadUsedRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQ_USED_F_NO_NOTIFY;
    719718
    720719
     
    801800     * Gather segments.
    802801     */
    803     VIRTQUEUE_DESC_T desc;
     802    VIRTQ_DESC_T desc;
    804803
    805804    uint32_t cbIn = 0;
     
    837836        virtioReadDesc(pDevIns, pVirtio, pVirtq, uDescIdx, &desc);
    838837
    839         if (desc.fFlags & VIRTQUEUE_DESC_F_WRITE)
     838        if (desc.fFlags & VIRTQ_DESC_F_WRITE)
    840839        {
    841840            Log6Func(("%s IN  desc_idx=%u seg=%u addr=%RGp cb=%u\n", pVirtq->szName, uDescIdx, cSegsIn, desc.GCPhysBuf, desc.cb));
     
    859858
    860859        uDescIdx = desc.uDescIdxNext;
    861     } while (desc.fFlags & VIRTQUEUE_DESC_F_NEXT);
     860    } while (desc.fFlags & VIRTQ_DESC_F_NEXT);
    862861
    863862    /*
     
    935934
    936935        if (fEnable)
    937             fFlags &= ~ VIRTQUEUE_USED_F_NO_NOTIFY;
     936            fFlags &= ~ VIRTQ_USED_F_NO_NOTIFY;
    938937        else
    939             fFlags |= VIRTQUEUE_USED_F_NO_NOTIFY;
     938            fFlags |= VIRTQ_USED_F_NO_NOTIFY;
    940939
    941940        virtioWriteUsedRingFlags(pVirtio->pDevInsR3, pVirtio, pVirtq, fFlags);
     
    11991198    {
    12001199        /** If guest driver hasn't suppressed interrupts, interrupt  */
    1201         if (!(virtioReadAvailRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQUEUE_AVAIL_F_NO_INTERRUPT))
     1200        if (!(virtioReadAvailRingFlags(pDevIns, pVirtio, pVirtq) & VIRTQ_AVAIL_F_NO_INTERRUPT))
    12021201        {
    12031202            virtioKick(pDevIns, pVirtio, VIRTIO_ISR_VIRTQ_INTERRUPT, pVirtq->uMsix);
    12041203            return;
    12051204        }
    1206         Log6Func(("...skipping interrupt for %s (guest set VIRTQUEUE_AVAIL_F_NO_INTERRUPT)\n", pVirtq->szName));
     1205        Log6Func(("...skipping interrupt for %s (guest set VIRTQ_AVAIL_F_NO_INTERRUPT)\n", pVirtq->szName));
    12071206    }
    12081207}
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