VirtualBox

Ignore:
Timestamp:
Jul 5, 2023 7:47:33 AM (19 months ago)
Author:
vboxsync
Message:

Devices/VirtIO,DevVirtioNet,DevVirtioSCSI: Get rid of VIRTIO_VBUF_ON_STACK which is the default for quite some time now to make the code more straight forward, bugref:10459

File:
1 edited

Legend:

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

    r99739 r100371  
    3232# pragma once
    3333#endif
    34 
    35 /* Do not allocate VIRTQBUF from the heap when possible */
    36 #define VIRTIO_VBUF_ON_STACK 1
    3734
    3835#include <iprt/ctype.h>
     
    698695uint16_t virtioCoreVirtqAvailBufCount(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr);
    699696
    700 #ifdef VIRTIO_VBUF_ON_STACK
    701697/**
    702698 * This function is identical to virtioCoreR3VirtqAvailBufGet(), *except* it doesn't consume
     
    767763int virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,
    768764                                  uint16_t uHeadIdx, PVIRTQBUF pVirtqBuf);
    769 #else /* !VIRTIO_VBUF_ON_STACK */
    770 /**
    771  * This function is identical to virtioCoreR3VirtqAvailBufGet(), *except* it doesn't consume
    772  * peeked buffer from avail ring of the virtq. The function *becomes* identical to the
    773  * virtioCoreR3VirtqAvailBufGet() only if virtioCoreR3VirtqAvailRingNext() is invoked to
    774  * consume buf from the queue's avail ring, followed by invocation of virtioCoreR3VirtqUsedBufPut(),
    775  * to hand host-processed buffer back to guest, which completes guest-initiated virtq buffer circuit.
    776  *
    777  * @param   pDevIns     The device instance.
    778  * @param   pVirtio     Pointer to the shared virtio state.
    779  * @param   uVirtqNbr   Virtq number
    780  * @param   ppVirtqBuf  Address to store pointer to descriptor chain that contains the
    781  *                      pre-processed transaction information pulled from the virtq.
    782  *
    783  * @returns VBox status code:
    784  * @retval  VINF_SUCCESS         Success
    785  * @retval  VERR_INVALID_STATE   VirtIO not in ready state (asserted).
    786  * @retval  VERR_NOT_AVAILABLE   If the queue is empty.
    787  */
    788 int  virtioCoreR3VirtqAvailBufPeek(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,
    789                                    PPVIRTQBUF ppVirtqBuf);
    790 
    791 /**
    792  * This function fetches the next buffer (descriptor chain) from the VirtIO "avail" ring of
    793  * indicated queue, separating the buf's s/g vectors into OUT (e.g. guest-to-host)
    794  * components and and IN (host-to-guest) components.
    795  *
    796  * Caller is responsible for GCPhys to host virtual memory conversions. If the
    797  * virtq buffer being peeked at is "consumed", virtioCoreR3VirtqAvailRingNext() must
    798  * be called, and after that virtioCoreR3VirtqUsedBufPut() must be called to
    799  * complete the buffer transfer cycle with the guest.
    800  *
    801  * @param   pDevIns     The device instance.
    802  * @param   pVirtio     Pointer to the shared virtio state.
    803  * @param   uVirtqNbr   Virtq number
    804  * @param   ppVirtqBuf  Address to store pointer to descriptor chain that contains the
    805  *                      pre-processed transaction information pulled from the virtq.
    806  *                      Returned reference must be released by calling
    807  *                      virtioCoreR3VirtqBufRelease().
    808  * @param   fRemove     flags whether to remove desc chain from queue (false = peek)
    809  *
    810  * @returns VBox status code:
    811  * @retval  VINF_SUCCESS         Success
    812  * @retval  VERR_INVALID_STATE   VirtIO not in ready state (asserted).
    813  * @retval  VERR_NOT_AVAILABLE   If the queue is empty.
    814  */
    815 int  virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,
    816                                   PPVIRTQBUF ppVirtqBuf, bool fRemove);
    817 
    818 /**
    819  * Fetches a specific descriptor chain using avail ring of indicated queue and converts the
    820  * descriptor chain into its OUT (to device) and IN (to guest) components.
    821  *
    822  * The caller is responsible for GCPhys to host virtual memory conversions and *must*
    823  * return the virtq buffer using virtioCoreR3VirtqUsedBufPut() to complete the roundtrip
    824  * virtq transaction.
    825  * *
    826  * @param   pDevIns     The device instance.
    827  * @param   pVirtio     Pointer to the shared virtio state.
    828  * @param   uVirtqNbr   Virtq number
    829  * @param   ppVirtqBuf  Address to store pointer to descriptor chain that contains the
    830  *                      pre-processed transaction information pulled from the virtq.
    831  *                      Returned reference must be released by calling
    832  *                      virtioCoreR3VirtqBufRelease().
    833  * @param   fRemove     flags whether to remove desc chain from queue (false = peek)
    834  *
    835  * @returns VBox status code:
    836  * @retval  VINF_SUCCESS         Success
    837  * @retval  VERR_INVALID_STATE   VirtIO not in ready state (asserted).
    838  * @retval  VERR_NOT_AVAILABLE   If the queue is empty.
    839  */
    840 int virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,
    841                                   uint16_t uHeadIdx, PPVIRTQBUF ppVirtqBuf);
    842 #endif /* !VIRTIO_VBUF_ON_STACK */
    843765
    844766/**
     
    11851107int  virtioCoreVirtqUsedRingSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr);
    11861108
    1187 #ifdef VIRTIO_VBUF_ON_STACK
    11881109/**
    11891110 * Allocates a descriptor chain object with the reference count of one. Copying the reference
     
    12001121 */
    12011122PVIRTQBUF virtioCoreR3VirtqBufAlloc(void);
    1202 #endif /* VIRTIO_VBUF_ON_STACK */
    12031123
    12041124/**
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