Skip to content

Commit

Permalink
Merge pull request OpenEtherCATsociety#275 from OpenEtherCATsociety/f…
Browse files Browse the repository at this point in the history
…ix/emptybuf_racecondition

Remove possible racecondition of set buf EMPTY
  • Loading branch information
ArthurKetels authored Apr 1, 2019
2 parents 828b898 + aed0f81 commit 5a47e61
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 36 deletions.
10 changes: 0 additions & 10 deletions oshw/linux/nicdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)

osal_timer_start (&timer, timeout);
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;
}
Expand Down Expand Up @@ -598,11 +593,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */
} 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;
}
Expand Down
10 changes: 0 additions & 10 deletions oshw/rtems/nicdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,11 +605,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)

osal_timer_start (&timer, timeout);
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;
}
Expand Down Expand Up @@ -649,11 +644,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */
} 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;
}
Expand Down
10 changes: 0 additions & 10 deletions oshw/rtk/nicdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,6 @@ int ecx_waitinframe(ecx_portt *port, int idx, int timeout)

osal_timer_start (&timer, timeout);
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;
}
Expand Down Expand Up @@ -579,11 +574,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, read_timer);
/* wait for answer with WKC>0 or otherwise retry until timeout */
} 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;
}
Expand Down
2 changes: 1 addition & 1 deletion oshw/vxworks/nicdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ int ecx_outframe_red(ecx_portt *port, int idx)
rval = ec_outfram_send(&(port->redport->pktDev), &(port->txbuf2), port->txbuflength2);
if (rval <= 0)
{
(*stack->rxbufstat)[idx] = EC_BUF_EMPTY;
port->redport->rxbufstat[idx] = EC_BUF_EMPTY;
}
}

Expand Down
5 changes: 0 additions & 5 deletions oshw/win32/nicdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,6 @@ int ecx_srconfirm(ecx_portt *port, int idx, int timeout)
wkc = ecx_waitinframe_red(port, idx, &timer2);
/* wait for answer with WKC>=0 or otherwise retry until timeout */
} 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;
}
Expand Down

0 comments on commit 5a47e61

Please sign in to comment.