📄 ldpque.c
字号:
printf("====H_MODULE:%d,H_PORT:%d,H_vpi:%d,H_vci:%d====\n",
req_index->union_req.rlspvc_req.H_module,req_index->union_req.rlspvc_req.H_port,req_index->union_req.rlspvc_req.H_vpi,req_index->union_req.rlspvc_req.H_vci);
printf("====L_MODULE:%d,L_PORT:%d,L_vpi:%d,L_vci:%d====\n",
req_index->union_req.rlspvc_req.L_module,req_index->union_req.rlspvc_req.L_port,req_index->union_req.rlspvc_req.L_vpi,req_index->union_req.rlspvc_req.L_vci);*/
Realfail++;
if(g_relpvc_list.num !=0)
mpls_insert_into_relpvc_tab(&rel_ack);
else
{
mpls_insert_into_relpvc_tab(&rel_ack);
ASEND(MPLS_RELPVC,&rel_ack,sizeof(STRUC_AD_MPLS_RLSPVC_ACK),FixBugPid);
}
}
}
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"peer card offline,ldp process next request in queue\n");
printf("peer card offline,ldp process next request in queue");
mpls_xcreq_next();
}
return;
}
/**PROC+********************************************************************/
/* Name: mpls_xc_req_confirm */
/* Author: hu.yonghong */
/* Purpose: process request information for mpls cross-connect request. */
/* Returns: Nothing. */
/* Params: None. */
/* Note: insert the req in the queue tail,do processing */
/* 2003-11-21 lixia mod for NOLSPCB when create pvc successfully */
/**PROC-********************************************************************/
void mpls_xc_req_confirm(void *in,unsigned char ack_type)
{
short rtcode = 0;
STRUC_AD_MPLS_BANDWIDTH_ACK *bw_ack;
STRUC_AD_MPLS_RLSBW_ACK *rlsbw_ack;
STRUC_AD_MPLS_CRPVC_ACK *crpvc_ack;
STRUC_AD_MPLS_RLSPVC_ACK *rlspvc_ack;
PID FixBugPid;
GET_PID("Fix_Bug",&FixBugPid);
/* 将响应与对头请求匹配,如匹配不上,表示响应有误,不理会,返回 */
switch(ack_type)
{
case BANDWIDTH_ACK:
bw_ack = (STRUC_AD_MPLS_BANDWIDTH_ACK *)in;
/* 将响应与对头请求匹配,如匹配不上,表示响应有误,不理会,返回 */
if(match_queue_head(bw_ack->localLspId,
bw_ack->IngressId,
bw_ack->LspCBNo,
BANDWIDTH_ACK) == 0)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_CR,"BANDWIDTH_ACK not match queue head \n");
return ;
}
rtcode = ProcBandwithAck(bw_ack);
if(rtcode == NOLSPCB)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_CR,"BANDWIDTH_ACK return NOLSPCB \n");
RlsBW_noCB(bw_ack);
return;
}
break;
case CRPVC_ACK:
crpvc_ack = (STRUC_AD_MPLS_CRPVC_ACK *)in;
if(match_queue_head(crpvc_ack->localLspId,
crpvc_ack->IngressId,
crpvc_ack->LspCBNo,
CRPVC_ACK) == 0)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"CRPVC_ACK not match queue head \n");
return ;
}
rtcode = ProcCreatePvcAck(crpvc_ack);
if(rtcode == NOLSPCB)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"CRPVC_ACK return NOLSPCB \n");
rtcode = RlsPVC_noCB(crpvc_ack);
if(rtcode == LDP_FALSE)
{
rlspvc_ack = (STRUC_AD_MPLS_RLSPVC_ACK *)in;
rlspvc_ack->reflag = 0x04;
if(g_relpvc_list.num !=0)
mpls_insert_into_relpvc_tab(rlspvc_ack);
else
{
mpls_insert_into_relpvc_tab(rlspvc_ack);
ASEND(MPLS_RELPVC,rlspvc_ack,sizeof(STRUC_AD_MPLS_RLSPVC_ACK),FixBugPid);
}
mpls_reset_xc_req();
mpls_process_xc_req();
return;
}
else
return;
}
break;
case RLSBW_ACK:
rlsbw_ack = (STRUC_AD_MPLS_RLSBW_ACK *)in;
if(match_queue_head(rlsbw_ack->localLspId,
rlsbw_ack->IngressId,
rlsbw_ack->LspCBNo,
RLSBW_ACK) == 0)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_CR,"RLSBW_ACK not match queue head \n");
return ;
}
#ifdef __BGS10_MPLS_DEBUG
printf("==== Mpls receive RLSBW_ACK message.Ack %d====",
rlsbw_ack->LsrAck);
#endif
break;
case RLSPVC_ACK:
rlspvc_ack = (STRUC_AD_MPLS_RLSPVC_ACK *)in;
if(match_queue_head(rlspvc_ack->localLspId,
rlspvc_ack->IngressId,
rlspvc_ack->LspCBNo,
RLSPVC_ACK) == 0)
{
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP,"RLSPVC_ACK not match queue head \n");
return ;
}
#ifdef __BGS10_MPLS_DEBUG
printf("==== Mpls receive RLSPVC_ACK message.Ack %d====",
rlspvc_ack->LsrAck);
#endif
#ifdef RELPVC_DEBUG
rlspvc_ack->reflag = rlspvc_ack->reflag&0xFE;
rlspvc_ack->renum = 0;
ProcReleasePvcAck(rlspvc_ack); /*lixia add for rel fail 2003-9-22 */
#endif
break;
default:
break;
}
/* hyh 2003.3.27 ldp在收到C会响应时判断是否拷版本,拷版本则延时500ms处理下一请求,
否则直接处理下一请求 */
if(WritingFileFlag == 0)
mpls_xcreq_next();
else
{
/* 取消定时器 */
if(xc_req.timerid > 0)
{
MPLS_CLEAR_TIMER(xc_req.timerid,ldptime_q,rtcode);
MPLS_ASSERT(rtcode == 1);
if(rtcode)
xc_req.timerid = 0;
}
MPLS_SET_TIMER(5,(void *)mpls_xcreq_next,0,ldptime_q,xc_req.timerid);
}
return ;
}
int match_queue_head(unsigned short localLspId,
unsigned long IngressId,
unsigned long LspCBNo,
unsigned char ack_type)
{
XC_REQ *req_index;
MPLS_BANDWIDTH_REQ bw_req;
MPLS_CRPVC_REQ crpvc_req;
MPLS_RLSBW_REQ rlsbw_req;
MPLS_RLSPVC_REQ rlspvc_req;
int rtcode;
/* 取对头请求*/
if((xc_req.req_in_progress == 0)||
((req_index = (XC_REQ *)MPLS_NEXT_IN_LIST(xc_req.req_queue)) == MPLS_NULL))
return 0;
/*判断回的响应是否与对头请求相符 */
switch(ack_type)
{
case BANDWIDTH_ACK:
if((req_index->req_type == BANDWIDTH_ACK)&&
(req_index->union_req.bw_req.localLspId == localLspId)&&
(req_index->union_req.bw_req.IngressId == IngressId)&&
(req_index->union_req.bw_req.LspCBNo == LspCBNo))
rtcode = 1;
else
rtcode = 0;
break;
case CRPVC_ACK:
if((req_index->req_type == CRPVC_ACK)&&
(req_index->union_req.crpvc_req.localLspId == localLspId)&&
(req_index->union_req.crpvc_req.IngressId == IngressId)&&
(req_index->union_req.crpvc_req.LspCBNo == LspCBNo))
rtcode = 1;
else
rtcode = 0;
break;
case RLSBW_ACK:
if((req_index->req_type == RLSBW_ACK)&&
(req_index->union_req.rlsbw_req.localLspId == localLspId)&&
(req_index->union_req.rlsbw_req.IngressId == IngressId)&&
(req_index->union_req.rlsbw_req.LspCBNo == LspCBNo))
rtcode = 1;
else
rtcode = 0;
break;
case RLSPVC_ACK:
if((req_index->req_type == RLSPVC_ACK)&&
(req_index->union_req.rlspvc_req.localLspId == localLspId)&&
(req_index->union_req.rlspvc_req.IngressId == IngressId)&&
(req_index->union_req.rlspvc_req.LspCBNo == LspCBNo))
rtcode = 1;
else
rtcode = 0;
break;
default:
rtcode = 0;
break;
}
return rtcode;
}
/**PROC+********************************************************************/
/* Name: mpls_xcreq_queue_timeout */
/* Author: hu.yonghong */
/* Purpose: process when timeout. */
/* Returns: Nothing. */
/* Params: None. */
/**PROC-********************************************************************/
/* if bandwidrh req timeout,send release bandwidth req;
* if crpvc timeout,send rlspvc req ;
* else if release,send untill C response,hyh modify 2003.2.20 */
#if 0
void mpls_xcreq_queue_timeout()
{
MPLS_LQE *xc_lqe;
int rtcode;
XC_REQ *req_index;
unsigned long lspIndex;
printf(" === mpls_xcreq_queue_timeout,timerid %u === ",xc_req.timerid);
xc_req.timerid = 0;
/* 将对头请求出队列,释放空间 */
if(!MPLS_EMPTY_LIST(xc_req.req_queue))
{
xc_lqe = MPLS_GET_FIRST_LQE(xc_req.req_queue);
MPLS_ASSERT(xc_lqe != MPLS_NULL);
req_index = (XC_REQ *)(xc_lqe->self);
lspIndex = ldp_get_crque_num(req_index);
/* if bandwidth or crpvc req timeout,release it */
switch(req_index->req_type)
{
case BANDWIDTH_REQ:
printf(" === BANDWIDTH_REQ mpls_xcreq_queue_timeout === ");
bandwidth_to_release(&(req_index->union_req.bw_req));
return;
case CRPVC_REQ:
printf(" === CRPVC_REQ mpls_xcreq_queue_timeout === ");
crpvc_to_release(&(req_index->union_req.crpvc_req));
return;
default:
break;
}
MPLS_REMOVE_FROM_LIST(*xc_lqe);
MPLS_MEM_FREE((xc_lqe->self),mem_mgr[IUMEM_LDP_XC_QUE]);
MPLS_MEM_FREE((xc_lqe),mem_mgr[IUMEM_LDP_XC_QUE_LQE]);
/* 队列请求个数减一 */
xc_req.req_num--;
MPLS_ASSERT(xc_req.req_num >= 0);
if(!(lspIndex & 0x80000000))
cur_crreq_num--;
MPLS_ASSERT(cur_crreq_num >= 0);
/* 继续处理队列中的对头请求 */
mpls_reset_xc_req();
mpls_process_xc_req();
}
return;
}
#endif
#if 1
void mpls_xcreq_queue_timeout()
{
MPLS_LQE *xc_lqe;
int rtcode;
XC_REQ *req_index;
unsigned long lspIndex;
printf(" === mpls_xcreq_queue_timeout,timerid %u === ",xc_req.timerid);
xc_req.timerid = 0;
if(!MPLS_EMPTY_LIST(xc_req.req_queue))
{
xc_lqe = MPLS_GET_FIRST_LQE(xc_req.req_queue);
MPLS_ASSERT(xc_lqe != MPLS_NULL);
req_index = (XC_REQ *)(xc_lqe->self);
lspIndex = ldp_get_crque_num(req_index);
/* if bandwidth or crpvc req timeout,release it;
if release timeout,resend it to ensure C process it */
switch(req_index->req_type)
{
case BANDWIDTH_REQ:
DEBUG_OUT(DEBUG_OWNER_MPLS, DEBUG_LEVEL_MPLS_LSP," === BANDWIDTH_REQ mpls_xcreq_queue_timeout === \n");
printf(" === BANDWIDTH_REQ mpls_xcreq_queue_timeout === ");
bandwidth_to_release(&(req_index->union_req.bw_req));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -