Commit 48dd0215 authored by Adam Wujek's avatar Adam Wujek Committed by Adam Wujek

[BUG: #29] copy activePeer when in slave mode

Before this commit activePeer was filled when the siwtch was in master
mode or when the external port configuration was active.
This commit adds storing the MAC of each foreign master, the MAC of
the chosen foreign master is copied to activePeer.

IMHO: activePeer (or peer in general) should not be the MAC but
the portIdentity of a port on the master.
Signed-off-by: 's avatarAdam Wujek <adam.wujek@creotech.pl>
parent f828887e
......@@ -10,7 +10,7 @@
#define __WRH_H__
/* Please increment WRS_PPSI_SHMEM_VERSION if you change any exported data structure */
#define WRS_PPSI_SHMEM_VERSION 34
#define WRS_PPSI_SHMEM_VERSION 35
/* Don't include the Following when this file is included in assembler. */
#ifndef __ASSEMBLY__
......
......@@ -95,6 +95,7 @@ struct pp_frgn_master {
unsigned long lastAnnounceMsgMs; // Last time in ms when the announce message was received
/* used by extension */
UInteger16 ext_specific[4]; /* Extension specific. Must be UInteger16 to align it in the structure*/
unsigned char peer_mac[6];
};
/*
......
......@@ -850,6 +850,7 @@ void bmc_store_frgn_master(struct pp_instance *ppi,
frgn_master->qualified=
frgn_master->lastAnnounceMsgMs=0;
memcpy(frgn_master->ext_specific,ann.ext_specific,sizeof(frgn_master->ext_specific));
memcpy(frgn_master->peer_mac, ppi->peer, sizeof(ppi->peer));
}
......@@ -1222,6 +1223,11 @@ static void bmc_update_erbest_inst(struct pp_instance *ppi) {
ppi->frgn_rec_best = -1;
}
/* Store MAC of a peer */
if (ppi->frgn_rec_best >= 0)
memcpy(&ppi->activePeer,
&ppi->frgn_master[ppi->frgn_rec_best].peer_mac,
sizeof(ppi->activePeer));
}
/* Find Erbest, 9.3.2.2 */
......
......@@ -310,6 +310,7 @@ struct dump_info dump_ppsi_info[] = {
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(yes_no_Boolean, qualified),
DUMP_FIELD(unsigned_long, lastAnnounceMsgMs),
DUMP_FIELD_SIZE(bina, peer_mac, 6),
#if CONFIG_HAS_EXT_WR == 1
#undef DUMP_STRUCT
......
......@@ -228,6 +228,7 @@ struct dump_info dsfm_info [] = {
DUMP_FIELD(Integer16, currentUtcOffset),
DUMP_FIELD(yes_no_Boolean, qualified),
DUMP_FIELD(unsigned_long, lastAnnounceMsgMs),
DUMP_FIELD_SIZE(bina, peer_mac, 6),
};
#undef DUMP_STRUCT
......
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