third_party/virtualbox/src/VBox/Devices/Network/DevE1000.cpp
/**
 * Write handler for Receive Control register.
 *
 * @param   pThis       The device state structure.
 * @param   offset      Register offset in memory-mapped frame.
 * @param   index       Register index in register array.
 * @param   value       The value to store.
 * @param   mask        Used to implement partial writes (8 and 16-bit).
 * @thread  EMT
 */
Write handler for Receive Control register.
@param   pThis       The device state structure.
@param   offset      Register offset in memory-mapped frame.
@param   index       Register index in register array.
@param   value       The value to store.
@param   mask        Used to implement partial writes (8 and 16-bit).
@thread  EMT
Write handler for Receive Control register . @param pThis The device state structure . @param offset Register offset in memory - mapped frame . @param index Register index in register array . @param value The value to store . @param mask Used to implement partial writes ( 8 and 16 - bit ) . @thread EMT
static int e1kRegWriteRCTL(PE1KSTATE pThis, uint32_t offset, uint32_t index, uint32_t value)
{
    bool fBecomePromiscous = !!(value & (RCTL_UPE | RCTL_MPE));
    if (fBecomePromiscous != !!( RCTL & (RCTL_UPE | RCTL_MPE)))
    {
#ifndef IN_RING3
        return VINF_IOM_R3_MMIO_WRITE;
#else
        if (pThis->pDrvR3)
            pThis->pDrvR3->pfnSetPromiscuousMode(pThis->pDrvR3, fBecomePromiscous);
#endif
    }
    unsigned cbRxBuf = 2048 >> GET_BITS_V(value, RCTL, BSIZE);
    if (value & RCTL_BSEX)
        cbRxBuf *= 16;
    if (cbRxBuf > E1K_MAX_RX_PKT_SIZE)
        cbRxBuf = E1K_MAX_RX_PKT_SIZE;
    if (cbRxBuf != pThis->u16RxBSize)
        E1kLog2(("%s e1kRegWriteRCTL: Setting receive buffer size to %d (old %d)\n",
                 pThis->szPrf, cbRxBuf, pThis->u16RxBSize));
    pThis->u16RxBSize = cbRxBuf;
    e1kRegWriteDefault(pThis, offset, index, value);
    return VINF_SUCCESS;
}
static int e1kRegWriteRCTL ( PE1KSTATE pThis , uint32_t offset , uint32_t index , uint32_t value ) { bool fBecomePromiscous = ! ! ( value & ( RCTL_UPE | RCTL_MPE ) ) ; if ( fBecomePromiscous != ! ! ( RCTL & ( RCTL_UPE | RCTL_MPE ) ) ) { #ifndef IN_RING3 return VINF_IOM_R3_MMIO_WRITE ; #else if ( pThis -> pDrvR3 ) pThis -> pDrvR3 -> pfnSetPromiscuousMode ( pThis -> pDrvR3 , fBecomePromiscous ) ; #endif } unsigned cbRxBuf = 2048 >> GET_BITS_V ( value , RCTL , BSIZE ) ; if ( value & RCTL_BSEX ) cbRxBuf *= 16 ; if ( cbRxBuf > E1K_MAX_RX_PKT_SIZE ) cbRxBuf = E1K_MAX_RX_PKT_SIZE ; if ( cbRxBuf != pThis -> u16RxBSize ) E1kLog2 ( ( " \n " , pThis -> szPrf , cbRxBuf , pThis -> u16RxBSize ) ) ; pThis -> u16RxBSize = cbRxBuf ; e1kRegWriteDefault ( pThis , offset , index , value ) ; return VINF_SUCCESS ; }
Write handler for Receive Control register.
Write handler for Receive Control register .
/* Update promiscuous mode */ /* Promiscuity has changed, pass the knowledge on. */ /* Adjust receive buffer size */ /* Update the register */