enhance coherence.
This commit is contained in:
@@ -620,25 +620,25 @@ int32_t Linklayer_Init(L2_INST** instPtr, const L2_CONFIG *config) {
|
||||
}
|
||||
|
||||
// Mpc buff Init
|
||||
(*instPtr)->mgmtMsgRecvBuff0 = calloc(MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
(*instPtr)->mgmtMsgRecvBuff0 = calloc(L2_MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
if((*instPtr)->mgmtMsgRecvBuff0 == NULL) {
|
||||
DBG_ERROR("Allocate memory for mgmtMsgRecvBuff0 failed.\n");
|
||||
Status = EALLOC;
|
||||
goto error;
|
||||
}
|
||||
(*instPtr)->svcMsgRecvBuff0 = calloc(MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
(*instPtr)->svcMsgRecvBuff0 = calloc(L2_MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
if((*instPtr)->svcMsgRecvBuff0 == NULL) {
|
||||
DBG_ERROR("Allocate memory for svcMsgRecvBuff0 failed.\n");
|
||||
Status = EALLOC;
|
||||
goto error;
|
||||
}
|
||||
(*instPtr)->mgmtMsgRecvBuff1 = calloc(MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
(*instPtr)->mgmtMsgRecvBuff1 = calloc(L2_MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
if((*instPtr)->mgmtMsgRecvBuff1 == NULL) {
|
||||
DBG_ERROR("Allocate memory for mgmtMsgRecvBuff1 failed.\n");
|
||||
Status = EALLOC;
|
||||
goto error;
|
||||
}
|
||||
(*instPtr)->svcMsgRecvBuff1 = calloc(MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
(*instPtr)->svcMsgRecvBuff1 = calloc(L2_MSG_STROAGE_BUFF_MAX/sizeof(uint64_t), sizeof(uint64_t));
|
||||
if((*instPtr)->svcMsgRecvBuff1 == NULL) {
|
||||
DBG_ERROR("Allocate memory for svcMsgRecvBuff1 failed.\n");
|
||||
Status = EALLOC;
|
||||
@@ -667,8 +667,8 @@ int32_t Linklayer_Init(L2_INST** instPtr, const L2_CONFIG *config) {
|
||||
(*instPtr)->tor.next = L2_TOR_SUSPEND;
|
||||
(*instPtr)->rtneConfig.rtneTable = initTable;
|
||||
(*instPtr)->rtneConfig.rtnePrd = ARRAY_SIZE(initTable);
|
||||
(*instPtr)->mainState = INIT_STATE;
|
||||
(*instPtr)->nextState = INIT_STATE;
|
||||
(*instPtr)->mainState = L2_INIT_STATE;
|
||||
(*instPtr)->nextState = L2_INIT_STATE;
|
||||
(*instPtr)->myInfo.nodeId = config->myId;
|
||||
(*instPtr)->myInfo.clustId = config->clustId;
|
||||
(*instPtr)->myInfo.headId = config->headId;
|
||||
@@ -761,8 +761,8 @@ int32_t Linklayer_Reconfig(L2_INST* instPtr, const L2_CONFIG *config) {
|
||||
instPtr->tor.next = L2_TOR_SUSPEND;
|
||||
instPtr->rtneConfig.rtneTable = initTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(initTable);
|
||||
instPtr->mainState = INIT_STATE;
|
||||
instPtr->nextState = INIT_STATE;
|
||||
instPtr->mainState = L2_INIT_STATE;
|
||||
instPtr->nextState = L2_INIT_STATE;
|
||||
instPtr->myInfo.nodeId = config->myId;
|
||||
instPtr->myInfo.clustId = config->clustId;
|
||||
instPtr->myInfo.headId = config->headId;
|
||||
@@ -863,11 +863,11 @@ int32_t Linklayer_EventHandler(L2_INST* instPtr, const L2_EVENT* l2Event) {
|
||||
}
|
||||
case L2_EV_NET_SETUP_DONE: {
|
||||
DBG_INFO("Event L2_EV_NETSETUP_DONE asserted....\n");
|
||||
if(L2_GetNodeType(instPtr) != HEAD_NODE){
|
||||
if(L2_GetNodeType(instPtr) != L2_NODE_HEAD){
|
||||
instPtr->cxn2Net = true;
|
||||
}
|
||||
else{ // Head node
|
||||
UpdateMainSate(instPtr, NORMAL_STATE);
|
||||
UpdateMainSate(instPtr, L2_NORMAL_STATE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -895,26 +895,26 @@ int32_t Linklayer_EventHandler(L2_INST* instPtr, const L2_EVENT* l2Event) {
|
||||
}
|
||||
case L2_ROUTINE_FINISH: {
|
||||
DBG_INFO("Event L2_ROUTINE_FINISH asserted....\n");
|
||||
if(instPtr->nextState == INIT_STATE){
|
||||
if(instPtr->nextState == L2_INIT_STATE){
|
||||
// Reset scan net FMS for next scan process.
|
||||
ScanNet_Reset(instPtr->scanNetFSM);
|
||||
UpdateMainSate(instPtr, NORMAL_STATE);
|
||||
UpdateMainSate(instPtr, L2_NORMAL_STATE);
|
||||
instPtr->rtneConfig.rtneTable = normalTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable);
|
||||
}
|
||||
else if(instPtr->nextState == NORMAL_STATE){
|
||||
else if(instPtr->nextState == L2_NORMAL_STATE){
|
||||
instPtr->rtneConfig.rtneTable = normalTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(normalTable);
|
||||
}
|
||||
else if(instPtr->nextState == SEEK_STATE){
|
||||
else if(instPtr->nextState == L2_SEEK_STATE){
|
||||
instPtr->rtneConfig.rtneTable = seekTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(seekTable);
|
||||
}
|
||||
else if(instPtr->nextState == INTRA_SEEK_STATE){
|
||||
else if(instPtr->nextState == L2_INTRA_SEEK_STATE){
|
||||
instPtr->rtneConfig.rtneTable = intraSeekTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(intraSeekTable);
|
||||
}
|
||||
else if(instPtr->nextState == INTER_SEEK_STATE){
|
||||
else if(instPtr->nextState == L2_INTER_SEEK_STATE){
|
||||
instPtr->rtneConfig.rtneTable = interSeekTable;
|
||||
instPtr->rtneConfig.rtnePrd = ARRAY_SIZE(interSeekTable);
|
||||
}
|
||||
@@ -1047,27 +1047,27 @@ static int32_t Linklayer_Routine (L2_INST* instPtr) {
|
||||
DBG_INFO("## Routine: %u-%u, Routine period: %u.\n", tableIndx, entryIndx, instPtr->rtneConfig.rtnePrd);
|
||||
|
||||
switch (rtneEntry.slotType) {
|
||||
case SLOT_IDLE:
|
||||
case L2_SLOT_IDLE:
|
||||
// Skip a 5ms slot.
|
||||
Status = SUCCESS;
|
||||
DBG_INFO("Skipping idle slot (5ms)...\n");
|
||||
break;
|
||||
case SLOT_INTER_SCAN_ACQ:
|
||||
case SLOT_INTRA_SCAN_ACQ:
|
||||
case SLOT_INTER_SCAN_BM:
|
||||
case SLOT_INTRA_SCAN_BM:
|
||||
case SLOT_INTER_SCAN_2W:
|
||||
case SLOT_INTRA_SCAN_2W:
|
||||
case L2_SLOT_INTER_SCAN_ACQ:
|
||||
case L2_SLOT_INTRA_SCAN_ACQ:
|
||||
case L2_SLOT_INTER_SCAN_BM:
|
||||
case L2_SLOT_INTRA_SCAN_BM:
|
||||
case L2_SLOT_INTER_SCAN_2W:
|
||||
case L2_SLOT_INTRA_SCAN_2W:
|
||||
Status = ScanNet_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
case SLOT_INTER_SVC:
|
||||
case SLOT_INTRA_SVC:
|
||||
case L2_SLOT_INTER_SVC:
|
||||
case L2_SLOT_INTRA_SVC:
|
||||
Status = ServiceNet_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
case SLOT_INTER_MGMT:
|
||||
case SLOT_INTRA_MGMT:
|
||||
case SLOT_INTER_TSYNC:
|
||||
case SLOT_INTRA_TSYNC:
|
||||
case L2_SLOT_INTER_MGMT:
|
||||
case L2_SLOT_INTRA_MGMT:
|
||||
case L2_SLOT_INTER_TSYNC:
|
||||
case L2_SLOT_INTRA_TSYNC:
|
||||
Status = MgmtNet_Routine(instPtr, &rtneEntry);
|
||||
break;
|
||||
default:
|
||||
@@ -1082,7 +1082,7 @@ static int32_t Linklayer_Routine (L2_INST* instPtr) {
|
||||
}
|
||||
|
||||
// FIXME: Increase TTL counter
|
||||
if (instPtr->mainState != INIT_STATE)
|
||||
if (instPtr->mainState != L2_INIT_STATE)
|
||||
{
|
||||
// if ( L2_isNodeInList (instPtr->nodeList, rtneEntry.src0) )
|
||||
// {
|
||||
@@ -1123,11 +1123,11 @@ int32_t Linklayer_Proc(L2_INST* instPtr) {
|
||||
}
|
||||
|
||||
// Run Link layer routine, setup next slot procedure.
|
||||
if (L2_GetNodeType(instPtr) == HEAD_NODE) {
|
||||
if (L2_GetNodeType(instPtr) == L2_NODE_HEAD) {
|
||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
||||
Status = Linklayer_Routine(instPtr);
|
||||
}
|
||||
else { //MEMBER_NODE
|
||||
else { //L2_NODE_MEMBER
|
||||
if (L2_isCxn2Net(instPtr)) {
|
||||
Phy_SetMode(instPtr->config.phyInstPtr, PHY_MODE_PULL);
|
||||
Status = Linklayer_Routine(instPtr);
|
||||
|
||||
Reference in New Issue
Block a user