⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ess.c

📁 h内核
💻 C
📖 第 1 页 / 共 2 页
字号:
	default:		/*		 * error in frame		 */		DB_ESS("ESS: ignoring RAF with bad sba_cmd\n",0,0) ;		break ;	}	return(fs) ;}/* * determines the synchronous bandwidth, set the TSYNC register and the * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG. */int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead){	/*	 * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,	 * if the payload is greater than zero.	 * For the SBAPayload and the SBAOverhead we have the following	 * unite quations 	 *		      _		  _	 *		     |	     bytes |	 *	SBAPayload = | 8000 ------ |	 *		     |		s  |	 *		      -		  - 	 *		       _       _	 *		      |	 bytes	|	 *	SBAOverhead = | ------	|	 *		      |	 T-NEG	|	 *		       -       - 	 *	 * T-NEG is discribed by the equation:	 *	 *		     (-) fddiMACT-NEG	 *	T-NEG =	    -------------------	 *			12500000 1/s	 *	 * The number of bytes we are able to send is the payload	 * plus the overhead.	 *	 *			  bytes    T-NEG SBAPayload 8000 bytes/s	 * sync_bw =  SBAOverhead ------ + -----------------------------	 *	   		  T-NEG		T-NEG	 *	 *	 *	      		     1	 * sync_bw =  SBAOverhead + ---- (-)fddiMACT-NEG * SBAPayload	 *	       		    1562	 *	 */	/*	 * set the mib attributes fddiPATHSbaOverhead, fddiPATHSbaPayload	 *//*	if (smt_set_obj(smc,SMT_P320F,payload,S_SET)) {		DB_ESS("ESS: SMT does not accept the payload value\n",0,0) ;		return(FALSE) ;	}	if (smt_set_obj(smc,SMT_P3210,overhead,S_SET)) {		DB_ESS("ESS: SMT does not accept the overhead value\n",0,0) ;		return(FALSE) ;	} */	/* premliminary */	if (payload > MAX_PAYLOAD || overhead > 5000) {		DB_ESS("ESS: payload / overhead not accepted\n",0,0) ;		return(FALSE) ;	}	/*	 * start the iterative allocation process if the payload or the overhead	 * are smaller than the parsed values	 */	if (smc->mib.fddiESSPayload &&		((u_long)payload != smc->mib.fddiESSPayload ||		(u_long)overhead != smc->mib.fddiESSOverhead)) {		smc->ess.raf_act_timer_poll = TRUE ;		smc->ess.timer_count = 0 ;	}	/*	 * evulate the Payload	 */	if (payload) {		DB_ESSN(2,"ESS: turn SMT_ST_SYNC_SERVICE bit on\n",0,0) ;		smc->ess.sync_bw_available = TRUE ;		smc->ess.sync_bw = overhead -			(long)smc->mib.m[MAC0].fddiMACT_Neg *			payload / 1562 ;	}	else {		DB_ESSN(2,"ESS: turn SMT_ST_SYNC_SERVICE bit off\n",0,0) ;		smc->ess.sync_bw_available = FALSE ;		smc->ess.sync_bw = 0 ;		overhead = 0 ;	}	smc->mib.a[PATH0].fddiPATHSbaPayload = payload ;	smc->mib.a[PATH0].fddiPATHSbaOverhead = overhead ;	DB_ESSN(2,"tsync = %lx\n",smc->ess.sync_bw,0) ;	ess_config_fifo(smc) ;	set_formac_tsync(smc,smc->ess.sync_bw) ;	return(TRUE) ;}static void ess_send_response(struct s_smc *smc, struct smt_header *sm,			      int sba_cmd){	struct smt_sba_chg	*chg ;	SMbuf			*mb ;	void			*p ;	/*	 * get and initialize the responce frame	 */	if (sba_cmd == CHANGE_ALLOCATION) {		if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,				sizeof(struct smt_sba_chg))))				return ;	}	else {		if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,				sizeof(struct smt_sba_rep_res))))				return ;	}	chg = smtod(mb,struct smt_sba_chg *) ;	chg->smt.smt_tid = sm->smt_tid ;	chg->smt.smt_dest = sm->smt_source ;	/* set P15 */	chg->s_type.para.p_type = SMT_P0015 ;	chg->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;	chg->s_type.res_type = SYNC_BW ;	/* set P16 */	chg->cmd.para.p_type = SMT_P0016 ;	chg->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;	chg->cmd.sba_cmd = sba_cmd ;	/* set P320B */	chg->path.para.p_type = SMT_P320B ;	chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;	chg->path.mib_index = SBAPATHINDEX ;	chg->path.path_pad = (u_short)NULL ;	chg->path.path_index = PRIMARY_RING ;	/* set P320F */	chg->payload.para.p_type = SMT_P320F ;	chg->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;	chg->payload.mib_index = SBAPATHINDEX ;	chg->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;	/* set P3210 */	chg->overhead.para.p_type = SMT_P3210 ;	chg->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;	chg->overhead.mib_index = SBAPATHINDEX ;	chg->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;	if (sba_cmd == CHANGE_ALLOCATION) {		/* set P1A */		chg->cat.para.p_type = SMT_P001A ;		chg->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;		p = (void *) sm_to_para(smc,sm,SMT_P001A) ;		chg->cat.category = ((struct smt_p_001a *)p)->category ;	}	dump_smt(smc,(struct smt_header *)chg,"RAF") ;	ess_send_frame(smc,mb) ;}void ess_timer_poll(struct s_smc *smc){	if (!smc->ess.raf_act_timer_poll)		return ;	DB_ESSN(2,"ESS: timer_poll\n",0,0) ;	smc->ess.timer_count++ ;	if (smc->ess.timer_count == 10) {		smc->ess.timer_count = 0 ;		ess_send_alc_req(smc) ;	}}static void ess_send_alc_req(struct s_smc *smc){	struct smt_sba_alc_req *req ;	SMbuf	*mb ;	/*	 * send never allocation request where the requested payload and	 * overhead is zero or deallocate bandwidht when no bandwidth is	 * parsed	 */	if (!smc->mib.fddiESSPayload) {		smc->mib.fddiESSOverhead = 0 ;	}	else {		if (!smc->mib.fddiESSOverhead)			smc->mib.fddiESSOverhead = DEFAULT_OV ;	}	if (smc->mib.fddiESSOverhead ==		smc->mib.a[PATH0].fddiPATHSbaOverhead &&		smc->mib.fddiESSPayload ==		smc->mib.a[PATH0].fddiPATHSbaPayload){		smc->ess.raf_act_timer_poll = FALSE ;		smc->ess.timer_count = 7 ;	/* next RAF alc req after 3 s */		return ;	}		/*	 * get and initialize the responce frame	 */	if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REQUEST,			sizeof(struct smt_sba_alc_req))))			return ;	req = smtod(mb,struct smt_sba_alc_req *) ;	req->smt.smt_tid = smc->ess.alloc_trans_id = smt_get_tid(smc) ;	req->smt.smt_dest = smt_sba_da ;	/* set P15 */	req->s_type.para.p_type = SMT_P0015 ;	req->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;	req->s_type.res_type = SYNC_BW ;	/* set P16 */	req->cmd.para.p_type = SMT_P0016 ;	req->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;	req->cmd.sba_cmd = REQUEST_ALLOCATION ;	/*	 * set the parameter type and parameter lenght of all used	 * parameters	 */	/* set P320B */	req->path.para.p_type = SMT_P320B ;	req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;	req->path.mib_index = SBAPATHINDEX ;	req->path.path_pad = (u_short)NULL ;	req->path.path_index = PRIMARY_RING ;	/* set P0017 */	req->pl_req.para.p_type = SMT_P0017 ;	req->pl_req.para.p_len = sizeof(struct smt_p_0017) - PARA_LEN ;	req->pl_req.sba_pl_req = smc->mib.fddiESSPayload -		smc->mib.a[PATH0].fddiPATHSbaPayload ;	/* set P0018 */	req->ov_req.para.p_type = SMT_P0018 ;	req->ov_req.para.p_len = sizeof(struct smt_p_0018) - PARA_LEN ;	req->ov_req.sba_ov_req = smc->mib.fddiESSOverhead -		smc->mib.a[PATH0].fddiPATHSbaOverhead ;	/* set P320F */	req->payload.para.p_type = SMT_P320F ;	req->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;	req->payload.mib_index = SBAPATHINDEX ;	req->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;	/* set P3210 */	req->overhead.para.p_type = SMT_P3210 ;	req->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;	req->overhead.mib_index = SBAPATHINDEX ;	req->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;	/* set P19 */	req->a_addr.para.p_type = SMT_P0019 ;	req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ;	req->a_addr.sba_pad = (u_short)NULL ;	req->a_addr.alloc_addr = null_addr ;	/* set P1A */	req->cat.para.p_type = SMT_P001A ;	req->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;	req->cat.category = smc->mib.fddiESSCategory ;	/* set P1B */	req->tneg.para.p_type = SMT_P001B ;	req->tneg.para.p_len = sizeof(struct smt_p_001b) - PARA_LEN ;	req->tneg.max_t_neg = smc->mib.fddiESSMaxTNeg ;	/* set P1C */	req->segm.para.p_type = SMT_P001C ;	req->segm.para.p_len = sizeof(struct smt_p_001c) - PARA_LEN ;	req->segm.min_seg_siz = smc->mib.fddiESSMinSegmentSize ;	dump_smt(smc,(struct smt_header *)req,"RAF") ;	ess_send_frame(smc,mb) ;}static void ess_send_frame(struct s_smc *smc, SMbuf *mb){	/*	 * check if the frame must be send to the own ESS	 */	if (smc->ess.local_sba_active) {		/*		 * Send the Change Reply to the local SBA		 */		DB_ESS("ESS:Send to the local SBA\n",0,0) ;		if (!smc->ess.sba_reply_pend)			smc->ess.sba_reply_pend = mb ;		else {			DB_ESS("Frame is lost - another frame was pending\n",0,0);			smt_free_mbuf(smc,mb) ;		}	}	else {		/*		 * Send the SBA RAF Change Reply to the network		 */		DB_ESS("ESS:Send to the network\n",0,0) ;		smt_send_frame(smc,mb,FC_SMT_INFO,0) ;	}}void ess_para_change(struct s_smc *smc){	(void)process_bw_alloc(smc,(long)smc->mib.a[PATH0].fddiPATHSbaPayload,		(long)smc->mib.a[PATH0].fddiPATHSbaOverhead) ;}static void ess_config_fifo(struct s_smc *smc){	/*	 * if nothing to do exit 	 */	if (smc->mib.a[PATH0].fddiPATHSbaPayload) {		if (smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON &&			(smc->hw.fp.fifo.fifo_config_mode&SEND_ASYNC_AS_SYNC) ==			smc->mib.fddiESSSynchTxMode) {			return ;		}	}	else {		if (!(smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON)) {			return ;		}	}	/*	 * split up the FIFO and reinitialize the queues	 */	formac_reinit_tx(smc) ;}#endif /* ESS */#endif	/* no SLIM_SMT */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -