Commit 656d4535 authored by Michel Arruat's avatar Michel Arruat
Browse files

masterfip/lib diganostic module thread issue.



        RX error count is injected in the old shared memory in the field named
        "rx_bad_count". The old system requires to reset this counter if the
        rx_error count doesn't increase. Thus, wee need to compare the current
        rx_err counter to the previous one in order to publish the real number
        of errors or 0. This implementation was not supporting multiple segment
        in the same process, because the previous err counter was kept as a
        static variable. This counter is moved into masterfip device.
Signed-off-by: Michel Arruat's avatarMichel Arruat <michel.arruat@cern.ch>
parent 2d8f6db8
......@@ -253,12 +253,13 @@ static void* mstrfip_diag_run(void *arg)
int first_loop = 1;
int cycle_counter = 0;
struct mstrfip_report report;
static uint32_t prev_rx_err = 0;
mstrfip->ba.mcycle->diag.run = 1;
req.tv_sec = MSTRFIP_DIAG_PERIOD_SEC;
req.tv_nsec = 0;
/* init rx_error counter to 0 */
mstrfip->ba.mcycle->diag.prev_rx_err = 0;
while (mstrfip->ba.mcycle->diag.run) {
/*
* man 7 pthreads: according to POSIX.1-2001 and/or POSIX.1-2008
......@@ -301,10 +302,10 @@ static void* mstrfip_diag_run(void *arg)
* truncated which is admissible. If the rx_err didn't
* increase since the last update, it is reseted
*/
if (prev_rx_err == report.rx_err)
if (mstrfip->ba.mcycle->diag.prev_rx_err == report.rx_err)
shm->rx_bad_count = 0;
else {
prev_rx_err = report.rx_err;
mstrfip->ba.mcycle->diag.prev_rx_err = report.rx_err;
shm->rx_bad_count = report.rx_err;
}
}
......
......@@ -96,6 +96,7 @@ struct mstrfip_ba_diag {
/* bunch of variables required for diagnostic */
int last_hw_ustime; /*last diag irq hw time in us*/
int agt_missing; /*set if theoric-present differs from present list*/
int prev_rx_err; /* Required by old diagnostic */
};
struct mstrfip_ba_per_var_set {
......
......@@ -7,7 +7,7 @@ MFIP_GIT_USR = $(shell git config --get-all user.name)
# patch indicates bug fixes
# version of the library
MFIP_LIB_VERSION=0x10103
MFIP_LIB_VERSION=0x10104
# version of the RT software
MFIP_RT_VERSION=0x10101
# version of the FPGA
......
Supports Markdown
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