47 static const char ID_sccs[] =
"@(#)ess.c 1.10 96/02/23 (C) SK" ;
50 #define LINT_USE(x) (x)=(x)
52 #define MS2BCLK(x) ((x)*12500L)
67 static const struct fddi_addr smt_sba_da = {{0x80,0x01,0x43,0x00,0x80,0x0C}} ;
85 static void ess_config_fifo(
struct s_smc *
smc);
86 static void ess_send_alc_req(
struct s_smc *
smc);
101 void ess_timer_poll(
struct s_smc *
smc);
102 void ess_para_change(
struct s_smc *
smc);
105 static int process_bw_alloc(
struct s_smc *
smc,
long int payload,
long int overhead);
137 DB_ESS(
"ESS: RAF frame error, parameter type not found\n",0,0) ;
140 msg_res_type = ((
struct smt_p_0015 *)p)->res_type ;
149 DB_ESS(
"ESS: RAF frame error, parameter command not found\n",0,0);
177 if (!local || smc->
mib.fddiESSPayload)
181 for (i = 0; i < 5; i++) {
191 smc->ess.alloc_trans_id = sm->
smt_tid ;
195 smc->
mib.a[
PATH0].fddiPATHSbaPayload ;
198 smc->
mib.a[
PATH0].fddiPATHSbaOverhead ;
201 if (smc->ess.local_sba_active)
223 DB_ESS(
"ESS: RAF with para problem, ignoring\n",0,0) ;
242 (sm->
smt_tid != smc->ess.alloc_trans_id)) {
244 DB_ESS(
"ESS: Allocation Response not accepted\n",0,0) ;
256 payload = ((
struct smt_p_320f *)p)->mib_payload ;
262 overhead = ((
struct smt_p_3210 *)p)->mib_overhead ;
264 DB_ESSN(2,
"payload= %lx overhead= %lx\n",payload,overhead) ;
282 DB_ESS(
"ESS: Do not process Change Responses\n",0,0) ;
290 DB_ESS(
"ESS: RAF with para problem, ignoring\n",0,0) ;
302 DB_ESS(
"ESS: RAF frame with para problem, ignoring\n",0,0) ;
310 payload = ((
struct smt_p_320f *)p)->mib_payload ;
312 overhead = ((
struct smt_p_3210 *)p)->mib_overhead ;
314 DB_ESSN(2,
"ESS: Change Request from %s\n",
316 DB_ESSN(2,
"payload= %lx overhead= %lx\n",payload,overhead) ;
321 if(!process_bw_alloc(smc,(
long)payload,(
long)overhead))
340 DB_ESS(
"ESS: Do not process a Report Reply\n",0,0) ;
344 DB_ESSN(2,
"ESS: Report Request from %s\n",
351 DB_ESS(
"ESS: ignoring RAF with para problem\n",0,0) ;
367 DB_ESS(
"ESS: ignoring RAF with bad sba_cmd\n",0,0) ;
378 static int process_bw_alloc(
struct s_smc *smc,
long int payload,
long int overhead)
430 DB_ESS(
"ESS: payload / overhead not accepted\n",0,0) ;
438 if (smc->
mib.fddiESSPayload &&
439 ((
u_long)payload != smc->
mib.fddiESSPayload ||
440 (
u_long)overhead != smc->
mib.fddiESSOverhead)) {
441 smc->ess.raf_act_timer_poll =
TRUE ;
442 smc->ess.timer_count = 0 ;
449 DB_ESSN(2,
"ESS: turn SMT_ST_SYNC_SERVICE bit on\n",0,0) ;
450 smc->ess.sync_bw_available =
TRUE ;
452 smc->ess.sync_bw = overhead -
457 DB_ESSN(2,
"ESS: turn SMT_ST_SYNC_SERVICE bit off\n",0,0) ;
458 smc->ess.sync_bw_available =
FALSE ;
459 smc->ess.sync_bw = 0 ;
464 smc->
mib.a[
PATH0].fddiPATHSbaOverhead = overhead ;
467 DB_ESSN(2,
"tsync = %lx\n",smc->ess.sync_bw,0) ;
469 ess_config_fifo(smc) ;
474 static void ess_send_response(
struct s_smc *smc,
struct smt_header *sm,
513 chg->
path.path_pad = 0;
536 ess_send_frame(smc,mb) ;
539 void ess_timer_poll(
struct s_smc *smc)
541 if (!smc->ess.raf_act_timer_poll)
544 DB_ESSN(2,
"ESS: timer_poll\n",0,0) ;
546 smc->ess.timer_count++ ;
547 if (smc->ess.timer_count == 10) {
548 smc->ess.timer_count = 0 ;
549 ess_send_alc_req(smc) ;
553 static void ess_send_alc_req(
struct s_smc *smc)
563 if (!smc->
mib.fddiESSPayload) {
564 smc->
mib.fddiESSOverhead = 0 ;
567 if (!smc->
mib.fddiESSOverhead)
571 if (smc->
mib.fddiESSOverhead ==
572 smc->
mib.a[
PATH0].fddiPATHSbaOverhead &&
573 smc->
mib.fddiESSPayload ==
574 smc->
mib.a[
PATH0].fddiPATHSbaPayload){
575 smc->ess.raf_act_timer_poll =
FALSE ;
576 smc->ess.timer_count = 7 ;
588 req->
smt.smt_dest = smt_sba_da ;
609 req->
path.path_pad = 0;
615 req->
pl_req.sba_pl_req = smc->
mib.fddiESSPayload -
616 smc->
mib.a[
PATH0].fddiPATHSbaPayload ;
621 req->
ov_req.sba_ov_req = smc->
mib.fddiESSOverhead -
622 smc->
mib.a[
PATH0].fddiPATHSbaOverhead ;
645 req->
cat.category = smc->
mib.fddiESSCategory ;
650 req->
tneg.max_t_neg = smc->
mib.fddiESSMaxTNeg ;
655 req->
segm.min_seg_siz = smc->
mib.fddiESSMinSegmentSize ;
658 ess_send_frame(smc,mb) ;
661 static void ess_send_frame(
struct s_smc *smc,
SMbuf *mb)
666 if (smc->ess.local_sba_active) {
670 DB_ESS(
"ESS:Send to the local SBA\n",0,0) ;
671 if (!smc->ess.sba_reply_pend)
672 smc->ess.sba_reply_pend =
mb ;
674 DB_ESS(
"Frame is lost - another frame was pending\n",0,0);
682 DB_ESS(
"ESS:Send to the network\n",0,0) ;
687 void ess_para_change(
struct s_smc *smc)
689 (
void)process_bw_alloc(smc,(
long)smc->
mib.a[
PATH0].fddiPATHSbaPayload,
693 static void ess_config_fifo(
struct s_smc *smc)
698 if (smc->
mib.a[
PATH0].fddiPATHSbaPayload) {
701 smc->
mib.fddiESSSynchTxMode) {