Commit 10315b89 authored by Maciej Lipinski's avatar Maciej Lipinski

[fix issue #25] set doRestart flag when servo is resetted on link down

When link goes down, the servo_reset function is called, this is
the perfect place to force the restart of WR link Setup. Yet, this
function is called also when WR link setup times out. In this case,
we do not want to force its re-running. Thus, the doRestart flag is
set only on link down detection.
parent f7d54404
......@@ -30,6 +30,7 @@ static int wrh_tracking_enabled = 1;
/* prototypes */
static int __wrh_servo_update(struct pp_instance *ppi);
static void setState(struct pp_instance *ppi, int newState);
static void setDoRestart(struct pp_instance *ppi, Boolean state);
/* External data */
extern struct wrs_shm_head *ppsi_head;
......@@ -106,6 +107,7 @@ int wrh_servo_init(struct pp_instance *ppi)
void wrh_servo_reset(struct pp_instance *ppi)
{
if ( ppi->extState==PP_EXSTATE_ACTIVE ) {
pp_diag(ppi, servo, 1, "%s: reset active extension\n", __func__);
/* shmem lock */
wrs_shm_write(ppsi_head, WRS_SHM_WRITE_BEGIN);
ppi->flags = 0;
......@@ -114,6 +116,14 @@ void wrh_servo_reset(struct pp_instance *ppi)
setState(ppi,WRH_UNINITIALIZED);
/* The reset function is called when the wr handshake fails
(i.e. WR Link Setup times out) or link goes down. We want to
force reset of the WR Link Setup (by setting doRestart flag)
only when the link goes down. Otherwise, the WR Link Setup
would be caleld again when it fails. */
if(! ppi->link_up)
setDoRestart(ppi, TRUE);
/* shmem unlock */
wrs_shm_write(ppsi_head, WRS_SHM_WRITE_END);
}
......@@ -206,6 +216,11 @@ static void setState(struct pp_instance *ppi, int newState) {
}
}
static void setDoRestart(struct pp_instance *ppi, Boolean state) {
wrh_servo_t *s=WRH_SRV(ppi);
s->doRestart = state;
}
static int __wrh_servo_update(struct pp_instance *ppi)
{
struct pp_servo *gs=SRV(ppi);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment