VirtualBox

Changeset 10126 in vbox


Ignore:
Timestamp:
Jul 3, 2008 12:50:07 AM (17 years ago)
Author:
vboxsync
Message:

Consolidated the Recv and Send methods to make it easier to share the SG. Implemented the missing darwin specific bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/intnet.h

    r10084 r10126  
    246246    /** Owner data, don't touch! */
    247247    void           *pvOwnerData;
     248    /** User data. */
     249    void           *pvUserData;
     250    /** User data 2 in case anyone needs it. */
     251    void           *pvUserData2;
    248252    /** The total length of the scatter gather list. */
    249253    uint32_t        cbTotal;
     
    297301
    298302
     303/** @name Direction (packet source or destination)
     304 * @{ */
     305/** To/From the wire. */
     306#define INTNETTRUNKDIR_WIRE             RT_BIT_32(1)
     307/** To/From the host. */
     308#define INTNETTRUNKDIR_HOST             RT_BIT_32(2)
     309/** Mask of valid bits. */
     310#define INTNETTRUNKDIR_VALID_MASK       UINT32_C(0x3)
     311/** @} */
     312
    299313
    300314/** Pointer to the switch side of a trunk port. */
     
    331345
    332346    /**
    333      * Frame from the host that's about to hit the wire.
     347     * Incoming frame.
    334348     *
    335349     * @returns true if we've handled it and it should be dropped.
     
    340354     *                      This will only be use during the call, so a temporary one can
    341355     *                      be used. The Phys member will not be used.
     356     * @param   fSrc        Where this frame comes from. Only one bit should be set!
    342357     *
    343358     * @remarks Will grab the network semaphore.
     
    345360     * @remark  NAT and TAP will use this interface.
    346361     */
    347     DECLR0CALLBACKMEMBER(bool, pfnRecvHost,(PINTNETTRUNKSWPORT pIfPort, PINTNETSG pSG));
    348 
    349     /**
    350      * Frame from the wire that's about to hit the network stack.
    351      *
    352      * @returns true if we've handled it and it should be dropped.
    353      *          false if it should hit the network stack.
    354      *
    355      * @param   pIfPort     Pointer to this structure.
    356      * @param   pSG         The (scatter /) gather structure for the frame.
    357      *                      This will only be use during the call, so a temporary one can
    358      *                      be used. The Phys member will not be used.
    359      *
    360      * @remarks Will grab the network semaphore.
    361      *
    362      * @remark  NAT and TAP will not this interface.
    363      */
    364     DECLR0CALLBACKMEMBER(bool, pfnRecvWire,(PINTNETTRUNKSWPORT pIfPort, PINTNETSG pSG));
    365 
    366     /**
    367      * This is called by the pfnSendToHost and pfnSendToWire code when they are
    368      * done with a SG.
    369      *
    370      * It may be called after they return if the frame was pushed in an
    371      * async manner.
     362    DECLR0CALLBACKMEMBER(bool, pfnRecv,(PINTNETTRUNKSWPORT pIfPort, PINTNETSG pSG, uint32_t fSrc));
     363
     364    /**
     365     * Retain a SG.
     366     *
     367     * @param   pIfPort     Pointer to this structure.
     368     * @param   pSG         Pointer to the (scatter /) gather structure.
     369     *
     370     * @remarks Will not grab any locks.
     371     */
     372    DECLR0CALLBACKMEMBER(void, pfnSGRetain,(PINTNETTRUNKSWPORT pIfPort, PINTNETSG pSG));
     373
     374    /**
     375     * Release a SG.
     376     *
     377     * This is called by the pfnXmit code when done with a SG. This may safe
     378     * be done in an asynchronous manner.
    372379     *
    373380     * @param   pIfPort     Pointer to this structure.
     
    483490    /**
    484491     * Tests if the mac address belongs to any of the host NICs
    485      * and should take the pfnSendToHost route.
     492     * and should take the host route.
    486493     *
    487494     * @returns true / false.
     
    493500     *
    494501     * @remarks TAP and NAT will compare with their own MAC address and let all their
    495      *          traffic go over the pfnSendToHost method.
     502     *          traffic take the host direction.
    496503     */
    497504    DECLR0CALLBACKMEMBER(bool, pfnIsHostMac,(PINTNETTRUNKIFPORT pIfPort, PCPDMMAC pMac));
     
    517524
    518525    /**
    519      * Send the frame to the host.
    520      *
    521      * This path is taken if pfnIsHostMac returns true and the trunk port on the
    522      * internal network is configured to let traffic thru to the host. It may also
    523      * be taken if the host is in promiscuous mode and the internal network is
    524      * configured to respect this for internal targets.
     526     * Transmit a frame.
    525527     *
    526528     * @return  VBox status code. Error generally means we'll drop the packet.
     
    530532     *                      do this asynchronously to save unnecessary buffer
    531533     *                      allocating and copying.
     534     * @param   fDst        The destination mask. At least one bit will be set.
    532535     *
    533536     * @remarks Called holding the out-bound trunk port lock.
     
    535538     * @remarks TAP and NAT will use this interface for all their traffic, see pfnIsHostMac.
    536539     */
    537     DECLR0CALLBACKMEMBER(int, pfnSendToHost,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG));
    538 
    539     /**
    540      * Put the frame on the wire.
    541      *
    542      * This path is taken if pfnIsHostMac returns false and the trunk port on the
    543      * internal network is configured to let traffic out on the wire. This may also
    544      * be taken for both internal and host traffic if the trunk port is configured
    545      * to be in promiscuous mode.
    546      *
    547      * @return  VBox status code. Error generally means we'll drop the packet.
    548      * @param   pIfPort     Pointer to this structure.
    549      * @param   pSG         Pointer to the (scatter /) gather structure for the frame.
    550      *                      This will never be a temporary one, so, it's safe to
    551      *                      do this asynchronously to save unnecessary buffer
    552      *                      allocating and copying.
    553      *
    554      * @remarks Called holding the out-bound trunk port lock.
    555      *
    556      * @remarks TAP and NAT will call pfnSGRelease and return successfully.
    557      */
    558     DECLR0CALLBACKMEMBER(int, pfnSendToWire,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG));
     540    DECLR0CALLBACKMEMBER(int, pfnXmit,(PINTNETTRUNKIFPORT pIfPort, PINTNETSG pSG, uint32_t fDst));
    559541
    560542    /** Structure version number. (INTNETTRUNKIFPORT_VERSION) */
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