Commit 7850f87a authored by Alessandro Rubini's avatar Alessandro Rubini

Revert "general: is_new_state is a flag (makes it larger)"

This reverts commit 9a3e00784afea6ab46510315b9c50cb510175f2d.
parent a1fce7e8
......@@ -49,7 +49,7 @@ void sim_main_loop(struct pp_globals *ppg)
/* Initialize each link's state machine */
for (j = 0; j < ppg->nlinks; j++) {
ppi = INST(ppg, j);
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
delay_ns = run_all_state_machines(ppg) * 1000LL * 1000LL;
......@@ -67,7 +67,7 @@ void sim_main_loop(struct pp_globals *ppg)
new_state = bmc(ppi);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
}
ppg->ebest_updated = 0;
......
......@@ -60,7 +60,7 @@ void unix_main_loop(struct pp_globals *ppg)
* doing anything else but the protocol, this allows extra stuff
* to fit.
*/
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
delay_ms = run_all_state_machines(ppg);
......@@ -80,7 +80,7 @@ void unix_main_loop(struct pp_globals *ppg)
new_state = bmc(ppi);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
}
ppg->ebest_updated = 0;
......
......@@ -96,7 +96,7 @@ void wrs_main_loop(struct pp_globals *ppg)
* doing anything else but the protocol, this allows extra stuff
* to fit.
*/
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
delay_ms = run_all_state_machines(ppg);
......@@ -118,7 +118,7 @@ void wrs_main_loop(struct pp_globals *ppg)
new_state = bmc(ppi);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
}
}
ppg->ebest_updated = 0;
......
......@@ -108,7 +108,7 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* found: handle this state */
ppi->next_state = state;
ppi->next_delay = 0;
if (pp_is_new_state(ppi))
if (ppi->is_new_state)
pp_diag_fsm(ppi, ip->name, STATE_ENTER, plen);
err = ip->f1(ppi, packet, plen);
if (err)
......@@ -118,11 +118,11 @@ int pp_state_machine(struct pp_instance *ppi, uint8_t *packet, int plen)
/* done: if new state mark it, and enter it now (0 ms) */
if (ppi->state != ppi->next_state) {
ppi->state = ppi->next_state;
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
pp_diag_fsm(ppi, ip->name, STATE_LEAVE, 0);
return 0; /* next_delay unused: go to new state now */
}
ppi->flags &= ~PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 0;
pp_diag_fsm(ppi, ip->name, STATE_LOOP, 0);
return ppi->next_delay;
}
......
......@@ -137,7 +137,7 @@ struct pp_instance_cfg {
*/
struct pp_instance {
int state;
int next_state, next_delay; /* set by state processing */
int next_state, next_delay, is_new_state; /* set by state processing */
void *arch_data; /* if arch needs it */
void *ext_data; /* if protocol ext needs it */
unsigned long d_flags; /* diagnostics, ppi-specific flags */
......@@ -195,8 +195,6 @@ struct pp_instance {
#define PPI_FLAG_MASTER_ONLY 0x0020
#define PPI_FLAG_FROM_CURRENT_PARENT 0x0100
#define PPI_FLAG_WAITING_FOR_F_UP 0x0200
#define PPI_FLAG_IS_NEW_STATE 0x0400
#define pp_is_new_state(ppi) ((ppi)->flags & PPI_FLAG_IS_NEW_STATE)
struct pp_globals_cfg {
......
......@@ -30,7 +30,7 @@ void bare_main_loop(struct pp_instance *ppi)
* doing anything else but the protocol, this allows extra stuff
* to fit.
*/
ppi->flags |= PPI_FLAG_IS_NEW_STATE;
ppi->is_new_state = 1;
delay_ms = pp_state_machine(ppi, NULL, 0);
while (1) {
struct bare_fd_set set;
......
......@@ -18,7 +18,7 @@ int wr_calibrated(struct pp_instance *ppi, unsigned char *pkt, int plen)
struct wr_dsport *wrp = WR_DSPOR(ppi);
MsgSignaling wrsig_msg;
if (pp_is_new_state(ppi))
if (ppi->is_new_state)
pp_timeout_set(ppi, PP_TO_EXT_0, wrp->wrStateTimeout);
if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -19,7 +19,7 @@ int wr_calibration(struct pp_instance *ppi, unsigned char *pkt, int plen)
int e = 0, sendmsg = 0;
uint32_t delta;
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -19,7 +19,7 @@ int wr_locked(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling wrsig_msg;
struct wr_dsport *wrp = WR_DSPOR(ppi);
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -19,7 +19,7 @@ int wr_m_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling wrsig_msg;
struct wr_dsport *wrp = WR_DSPOR(ppi);
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -23,7 +23,7 @@ int wr_present(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgSignaling wrsig_msg;
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
sendmsg = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -16,7 +16,7 @@ int wr_resp_calib_req(struct pp_instance *ppi, unsigned char *pkt, int plen)
int e = 0, enable = 0;
int send_pattern = (wrp->otherNodeCalSendPattern != 0);
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
enable = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
......
......@@ -14,8 +14,8 @@ int wr_s_lock(struct pp_instance *ppi, unsigned char *pkt, int plen)
struct wr_dsport *wrp = WR_DSPOR(ppi);
int enable = 0;
if (pp_is_new_state(ppi)) {
wrp->wrStateRetry = WR_STATE_RETRY;
if (ppi->is_new_state) {
wrp->wrStateRetry = WR_STATE_RETRY;
enable = 1;
} else if (pp_timeout_z(ppi, PP_TO_EXT_0)) {
wrp->ops->locking_disable(ppi);
......
......@@ -15,7 +15,7 @@
int pp_faulty(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
pp_timeout_set(ppi, PP_TO_FAULTY, 4000);
}
......
......@@ -18,7 +18,7 @@ int pp_listening(struct pp_instance *ppi, unsigned char *pkt, int plen)
if (e)
goto out;
if (pp_is_new_state(ppi))
if (ppi->is_new_state)
pp_timeout_restart_annrec(ppi);
if (plen == 0)
......
......@@ -15,7 +15,7 @@ int pp_master(struct pp_instance *ppi, unsigned char *pkt, int plen)
int msgtype, d1, d2;
int e = 0; /* error var, to check errors in msg handling */
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
pp_timeout_rand(ppi, PP_TO_SYNC, DSPOR(ppi)->logSyncInterval);
pp_timeout_rand(ppi, PP_TO_ANN_INTERVAL,
DSPOR(ppi)->logAnnounceInterval);
......
......@@ -13,7 +13,7 @@ int pp_passive(struct pp_instance *ppi, unsigned char *pkt, int plen)
{
int e = 0; /* error var, to check errors in msg handling */
if (pp_is_new_state(ppi))
if (ppi->is_new_state)
pp_timeout_restart_annrec(ppi);
if (plen == 0)
......
......@@ -16,7 +16,7 @@ int pp_slave(struct pp_instance *ppi, unsigned char *pkt, int plen)
MsgDelayResp resp;
int d1, d2;
if (pp_is_new_state(ppi)) {
if (ppi->is_new_state) {
pp_servo_init(ppi);
if (pp_hooks.new_slave)
......
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