VirtualBox

Ignore:
Timestamp:
Oct 8, 2008 12:36:37 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
37555
Message:

Solaris/VBoxNetFlt: small optimization for unplumbed interfaces.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxNetFlt/solaris/VBoxNetFlt-solaris.c

    r13068 r13076  
    21422142 * Initializes a packet identifier.
    21432143 *
    2144  * @param   pMsg        Pointer to the message.
     2144 * @param   pTag        Pointer to the packed identifier.
     2145 * @param   pMsg        Pointer to the message to be identified.
    21452146 *
    21462147 * @remarks Warning!!! This function assumes 'pMsg' is an unchained message.
     
    27562757        if (RT_SUCCESS(rc))
    27572758            return rc;
    2758    
     2759
    27592760        LogRel((DEVICE_NAME ":vboxNetFltSolarisAttachToInterface failed. rc=%Vrc\n", rc));
    27602761        RTSemFastMutexDestroy(pThis->u.s.hFastMtx);
     
    28082809                putnext(WR(pPromiscStream->Stream.pReadQueue), pMsg);
    28092810            }
    2810         }
    2811     }
    2812 
    2813     /*
    2814      * Create a message block and send it up the host stack (upstream).
    2815      */
     2811            else
     2812            {
     2813                LogRel((DEVICE_NAME ":vboxNetFltPortOsXmit vboxNetFltSolarisMBlkFromSG failed.\n"));
     2814                rc = VERR_NO_MEMORY;
     2815            }
     2816        }
     2817    }
     2818
    28162819    if (fDst & INTNETTRUNKDIR_HOST)
    28172820    {
     2821        /*
     2822         * For unplumbed interfaces we would not be bound to IP or ARP.
     2823         * We either bind to both or neither; so atomic reading one should be sufficient.
     2824         */
     2825        vboxnetflt_stream_t *pIpStream  = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIpStream);
     2826        if (!pIpStream)
     2827            return rc;
     2828
     2829        /*
     2830         * Create a message block and send it up the host stack (upstream).
     2831         */
    28182832        mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst);
    28192833        if (RT_LIKELY(pMsg))
     
    28292843                LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST ARP\n"));
    28302844
    2831                 /*
    2832                  * Construct a DL_UNITDATA_IND style message for ARP as it doesn't understand fast path.
    2833                  */
    2834                 mblk_t *pDlpiMsg;
    2835                 int rc = vboxNetFltSolarisRawToUnitData(pMsg, &pDlpiMsg);
    2836                 if (RT_SUCCESS(rc))
     2845                vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvArpStream);
     2846                if (pArpStream)
    28372847                {
    2838                     pMsg = pDlpiMsg;
    2839 
    2840                     vboxnetflt_stream_t *pArpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvArpStream);
    2841                     if (pArpStream)
     2848                    /*
     2849                     * Construct a DL_UNITDATA_IND style message for ARP as it doesn't understand fast path.
     2850                     */
     2851                    mblk_t *pDlpiMsg;
     2852                    int rc = vboxNetFltSolarisRawToUnitData(pMsg, &pDlpiMsg);
     2853                    if (RT_SUCCESS(rc))
    28422854                    {
     2855                        pMsg = pDlpiMsg;
     2856
    28432857                        queue_t *pArpReadQueue = pArpStream->pReadQueue;
    28442858                        putnext(pArpReadQueue, pMsg);
     
    28462860                    else
    28472861                    {
    2848                         /*
    2849                          * For unplumbed interfaces we may not be bound to ARP.
    2850                          */
     2862                        LogRel((DEVICE_NAME ":vboxNetFltSolarisRawToUnitData failed!\n"));
    28512863                        freemsg(pMsg);
     2864                        rc = VERR_NO_MEMORY;
    28522865                    }
    28532866                }
    28542867                else
    2855                 {
    2856                     LogRel((DEVICE_NAME ":vboxNetFltSolarisRawToUnitData failed! rc=%d\n", rc));
    2857                     freemsg(pMsg);
    2858                     rc = VERR_NO_MEMORY;
    2859                 }
     2868                    freemsg(pMsg);  /* Should really never happen... */
    28602869            }
    28612870            else
     
    28662875                LogFlow((DEVICE_NAME ":vboxNetFltPortOsXmit INTNETTRUNKDIR_HOST\n"));
    28672876
    2868                 vboxnetflt_stream_t *pIpStream = ASMAtomicUoReadPtr((void * volatile *)&pThis->u.s.pvIpStream);
    2869                 if (pIpStream)
     2877                mblk_t *pMsg = vboxNetFltSolarisMBlkFromSG(pThis, pSG, fDst);
     2878                if (RT_LIKELY(pMsg))
    28702879                {
    28712880                    pMsg->b_rptr += sizeof(RTNETETHERHDR);
     
    28752884                else
    28762885                {
    2877                     /*
    2878                      * For unplumbed interfaces we may not be bound to IP.
    2879                      */
     2886                    LogRel((DEVICE_NAME ":vboxNetFltSolarisRawToUnitData failed!\n"));
    28802887                    freemsg(pMsg);
     2888                    rc = VERR_NO_MEMORY;
    28812889                }
    28822890            }
    28832891        }
    28842892        else
    2885             rc = VERR_NO_MEMORY;
     2893        {
     2894            LogRel((DEVICE_NAME ":vboxNetFltSolarisMBlkFromSG failed.\n"));
     2895            rc = VERR_NO_MEMORY;               
     2896        }
    28862897    }
    28872898
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette