Commit ce8485bf authored by Alessandro Rubini's avatar Alessandro Rubini

bmc: remove field ppi->frgn_rec_i

The field is a duplicate of ppi->frgn_rec_num, and got out of sync.
This removal fixes WR syncronization as a slave.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 93830146
......@@ -159,7 +159,6 @@ struct pp_instance {
* foreignMasterDS data set for the purposes of qualifying Announce
* messages */
UInteger16 frgn_rec_num;
Integer16 frgn_rec_i;
Integer16 frgn_rec_best;
struct pp_frgn_master frgn_master[PP_NR_FOREIGN_RECORDS];
......
......@@ -49,7 +49,6 @@ int st_com_execute_slave(struct pp_instance *ppi)
if (pp_timeout_z(ppi, PP_TO_ANN_RECEIPT)) {
ppi->frgn_rec_num = 0;
ppi->frgn_rec_i = 0;
if (DSDEF(ppi)->clockQuality.clockClass != PP_CLASS_SLAVE_ONLY
&& !ppi->slave_only) {
m1(ppi);
......@@ -85,7 +84,7 @@ static void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
ppi->frgn_rec_num++;
/* FIXME: replace the worst */
i = ppi->frgn_rec_i;
i = ppi->frgn_rec_num - 1;
/* Copy new foreign master data set from announce message */
memcpy(&ppi->frgn_master[i].port_id,
......@@ -98,10 +97,7 @@ static void st_com_add_foreign(struct pp_instance *ppi, unsigned char *buf)
msg_copy_header(&ppi->frgn_master[i].hdr, hdr);
msg_unpack_announce(buf, &ppi->frgn_master[i].ann);
pp_diag(ppi, bmc, 2, "New foreign Master added\n");
ppi->frgn_rec_i = (ppi->frgn_rec_i+1) %
PP_NR_FOREIGN_RECORDS;
pp_diag(ppi, bmc, 1, "New foreign Master %i added\n", i);
}
......
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