Merge pull request #275 from OpenEtherCATsociety/fix/emptybuf_racecondition

Remove possible racecondition of set buf EMPTY
pull/276/head
ArthurKetels 2019-04-01 10:45:07 +02:00 committed by GitHub
commit 5a47e61f24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 36 deletions

View File

@ -554,11 +554,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)
osal_timer_start (&timer, timeout); osal_timer_start (&timer, timeout);
wkc = ecx_waitinframe_red(port, idx, &timer); wkc = ecx_waitinframe_red(port, idx, &timer);
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }
@ -598,11 +593,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2); wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */ /* wait for answer with WKC>=0 or otherwise retry until timeout */
} while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1)); } while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1));
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }

View File

@ -605,11 +605,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)
osal_timer_start (&timer, timeout); osal_timer_start (&timer, timeout);
wkc = ecx_waitinframe_red(port, idx, &timer); wkc = ecx_waitinframe_red(port, idx, &timer);
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }
@ -649,11 +644,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2); wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */ /* wait for answer with WKC>=0 or otherwise retry until timeout */
} while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1)); } while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1));
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }

View File

@ -541,11 +541,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)
osal_timer_start (&timer, timeout); osal_timer_start (&timer, timeout);
wkc = ecx_waitinframe_red(port, idx, timer); wkc = ecx_waitinframe_red(port, idx, timer);
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }
@ -579,11 +574,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, read_timer); wkc = ecx_waitinframe_red(port, idx, read_timer);
/* wait for answer with WKC>0 or otherwise retry until timeout */ /* wait for answer with WKC>0 or otherwise retry until timeout */
} while ((wkc <= EC_NOFRAME) && (osal_timer_is_expired(&timer) == FALSE)); } while ((wkc <= EC_NOFRAME) && (osal_timer_is_expired(&timer) == FALSE));
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }

View File

@ -519,7 +519,7 @@ int ecx_outframe_red(ecx_portt *port, int idx)
rval = ec_outfram_send(&(port->redport->pktDev), &(port->txbuf2), port->txbuflength2); rval = ec_outfram_send(&(port->redport->pktDev), &(port->txbuf2), port->txbuflength2);
if (rval <= 0) if (rval <= 0)
{ {
(*stack->rxbufstat)[idx] = EC_BUF_EMPTY; port->redport->rxbufstat[idx] = EC_BUF_EMPTY;
} }
} }

View File

@ -594,11 +594,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2); wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */ /* wait for answer with WKC>=0 or otherwise retry until timeout */
} while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1)); } while ((wkc <= EC_NOFRAME) && !osal_timer_is_expired (&timer1));
/* if nothing received, clear buffer index status so it can be used again */
if (wkc <= EC_NOFRAME)
{
ecx_setbufstat(port, idx, EC_BUF_EMPTY);
}
return wkc; return wkc;
} }