VirtualBox

Changeset 35717 in vbox for trunk/src


Ignore:
Timestamp:
Jan 25, 2011 5:01:58 PM (14 years ago)
Author:
vboxsync
Message:

dev/serial: better char lost handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Serial/DevSerial.cpp

    r35353 r35717  
    138138#define XMIT_FIFO           0
    139139#define RECV_FIFO           1
    140 #define MAX_XMIT_RETRY      8
     140#define MAX_XMIT_RETRY      16
    141141
    142142/*******************************************************************************
     
    273273    if (f->count < UART_FIFO_LENGTH)
    274274        f->count++;
     275    else if (fifo == XMIT_FIFO) /* need to at least adjust tail to maintain pipe state consistency */
     276        ++f->tail;
    275277    else if (fifo == RECV_FIFO)
    276278        s->lsr |= UART_LSR_OE;
     
    371373}
    372374
    373 static void serial_xmit(void *opaque)
     375static void serial_xmit(void *opaque, bool bRetryXmit)
    374376{
    375377    SerialState *s = (SerialState*)opaque;
    376     uint64_t new_xmit_ts = TMTimerGet(CTX_SUFF(s->transmit_timer));
    377378
    378379    if (s->tsr_retry <= 0) {
     
    392393    } else if (   RT_LIKELY(s->pDrvChar)
    393394               && RT_FAILURE(s->pDrvChar->pfnWrite(s->pDrvChar, &s->tsr, 1))) {
    394         if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
    395             s->tsr_retry++;
    396             TMTimerSet(CTX_SUFF(s->transmit_timer), new_xmit_ts + s->char_transmit_time);
     395        if ((s->tsr_retry >= 0) && ((!bRetryXmit) || (s->tsr_retry <= MAX_XMIT_RETRY))) {
     396            if (!s->tsr_retry)
     397                s->tsr_retry = 1; /* make sure the retry state is always set */
     398            else if (bRetryXmit) /* do not increase the retry count if the retry is actually caused by next char write */
     399                s->tsr_retry++;
     400
     401            TMTimerSet(CTX_SUFF(s->transmit_timer), TMTimerGet(CTX_SUFF(s->transmit_timer)) + s->char_transmit_time * 4);
    397402            return;
    398403        } else {
     
    445450                serial_update_irq(s);
    446451            }
    447             serial_xmit(s);
     452            serial_xmit(s, false);
    448453        }
    449454        break;
     
    810815{
    811816    SerialState *s = (SerialState*)pvUser;
    812     serial_xmit(s);
     817    serial_xmit(s, true);
    813818}
    814819
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