aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skfp/ess.c
blob: a85efcfd9d0ecd71839b6dafc6ca40c19d178818 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
/******************************************************************************
 *
 *	(C)Copyright 1998,1999 SysKonnect,
 *	a business unit of Schneider & Koch & Co. Datensysteme GmbH.
 *
 *	See the file "skfddi.c" for further information.
 *
 *	This program is free software; you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation; either version 2 of the License, or
 *	(at your option) any later version.
 *
 *	The information in this file is provided "AS IS" without warranty.
 *
 ******************************************************************************/

/*
 * *******************************************************************
 * This SBA code implements the Synchronous Bandwidth Allocation
 * functions described in the "FDDI Synchronous Forum Implementer's
 * Agreement" dated December 1th, 1993.
 * *******************************************************************
 *
 *	PURPOSE: The purpose of this function is to control
 *		 synchronous allocations on a single FDDI segment.
 *		 Allocations are limited to the primary FDDI ring.
 *		 The SBM provides recovery mechanisms to recover
 *		 unused bandwidth also resolves T_Neg and
 *		 reconfiguration changes. Many of the SBM state
 *		 machine inputs are sourced by the underlying
 *		 FDDI sub-system supporting the SBA application.
 *
 * *******************************************************************
 */

#include "h/types.h"
#include "h/fddi.h"
#include "h/smc.h"
#include "h/smt_p.h"


#ifndef	SLIM_SMT

#ifdef ESS

#ifndef lint
static const char ID_sccs[] = "@(#)ess.c	1.10 96/02/23 (C) SK" ;
#define LINT_USE(x)
#else
#define LINT_USE(x)	(x)=(x)
#endif
#define MS2BCLK(x)	((x)*12500L)

/*
	-------------------------------------------------------------
	LOCAL VARIABLES:
	-------------------------------------------------------------
*/

static const u_short plist_raf_alc_res[] = { SMT_P0012, SMT_P320B, SMT_P320F,
					SMT_P3210, SMT_P0019, SMT_P001A,
					SMT_P001D, 0 } ;

static const u_short plist_raf_chg_req[] = { SMT_P320B, SMT_P320F, SMT_P3210,
					SMT_P001A, 0 } ;

static const struct fddi_addr smt_sba_da = {{0x80,0x01,0x43,0x00,0x80,0x0C}} ;
static const struct fddi_addr null_addr = {{0,0,0,0,0,0}} ;

/*
	-------------------------------------------------------------
	GLOBAL VARIABLES:
	-------------------------------------------------------------
*/


/*
	-------------------------------------------------------------
	LOCAL FUNCTIONS:
	-------------------------------------------------------------
*/

static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
			      int sba_cmd);
static void ess_config_fifo(struct s_smc *smc);
static void ess_send_alc_req(struct s_smc *smc);
static void ess_send_frame(struct s_smc *smc, SMbuf *mb);

/*
	-------------------------------------------------------------
	EXTERNAL FUNCTIONS:
	-------------------------------------------------------------
*/

/*
	-------------------------------------------------------------
	PUBLIC FUNCTIONS:
	-------------------------------------------------------------
*/

void ess_timer_poll(struct s_smc *smc);
void ess_para_change(struct s_smc *smc);
int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
			  int fs);
static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead);


/*
 * --------------------------------------------------------------------------
 *	End Station Support	(ESS)
 * --------------------------------------------------------------------------
 */

/*
 * evaluate the RAF frame
 */
int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
			  int fs)
{
	void			*p ;		/* universal pointer */
	struct smt_p_0016	*cmd ;		/* para: command for the ESS */
	SMbuf			*db ;
	u_long			msg_res_type ;	/* recource type */
	u_long			payload, overhead ;
	int			local ;
	int			i ;

	/*
	 * Message Processing Code
	 */
	 local = ((fs & L_INDICATOR) != 0) ;

	/*
	 * get the resource type
	 */
	if (!(p = (void *) sm_to_para(smc,sm,SMT_P0015))) {
		DB_ESS("ESS: RAF frame error, parameter type not found\n",0,0) ;
		return(fs) ;
	}
	msg_res_type = ((struct smt_p_0015 *)p)->res_type ;

	/*
	 * get the pointer to the ESS command
	 */
	if (!(cmd = (struct smt_p_0016 *) sm_to_para(smc,sm,SMT_P0016))) {
		/*
		 * error in frame: para ESS command was not found
		 */
		 DB_ESS("ESS: RAF frame error, parameter command not found\n",0,0);
		 return(fs) ;
	}

	DB_ESSN(2,"fc %x	ft %x\n",sm->smt_class,sm->smt_type) ;
	DB_ESSN(2,"ver %x	tran %lx\n",sm->smt_version,sm->smt_tid) ;
	DB_ESSN(2,"stn_id %s\n",addr_to_string(&sm->smt_source),0) ;

	DB_ESSN(2,"infolen %x	res %x\n",sm->smt_len, msg_res_type) ;
	DB_ESSN(2,"sbacmd %x\n",cmd->sba_cmd,0) ;

	/*
	 * evaluate the ESS command
	 */
	switch (cmd->sba_cmd) {

	/*
	 * Process an ESS Allocation Request
	 */
	case REQUEST_ALLOCATION :
		/*
		 * check for an RAF Request (Allocation Request)
		 */
		if (sm->smt_type == SMT_REQUEST) {
			/*
			 * process the Allocation request only if the frame is
			 * local and no static allocation is used
			 */
			if (!local || smc->mib.fddiESSPayload)
				return(fs) ;
			
			p = (void *) sm_to_para(smc,sm,SMT_P0019)  ;
			for (i = 0; i < 5; i++) {
				if (((struct smt_p_0019 *)p)->alloc_addr.a[i]) {
					return(fs) ;
				}
			}

			/*
			 * Note: The Application should send a LAN_LOC_FRAME.
			 *	 The ESS do not send the Frame to the network!
			 */
			smc->ess.alloc_trans_id = sm->smt_tid ;
			DB_ESS("ESS: save Alloc Req Trans ID %lx\n",sm->smt_tid,0);
			p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
			((struct smt_p_320f *)p)->mib_payload =
				smc->mib.a[PATH0].fddiPATHSbaPayload ;
			p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
			((struct smt_p_3210 *)p)->mib_overhead =
				smc->mib.a[PATH0].fddiPATHSbaOverhead ;
			sm->smt_dest = smt_sba_da ;

			if (smc->ess.local_sba_active)
				return(fs | I_INDICATOR) ;

			if (!(db = smt_get_mbuf(smc)))
				return(fs) ;

			db->sm_len = mb->sm_len ;
			db->sm_off = mb->sm_off ;
			memcpy(((char *)(db->sm_data+db->sm_off)),(char *)sm,
				(int)db->sm_len) ;
			dump_smt(smc,
				(struct smt_header *)(db->sm_data+db->sm_off),
				"RAF") ;
			smt_send_frame(smc,db,FC_SMT_INFO,0) ;
			return(fs) ;
		}

		/*
		 * The RAF frame is an Allocation Response !
		 * check the parameters
		 */
		if (smt_check_para(smc,sm,plist_raf_alc_res)) {
			DB_ESS("ESS: RAF with para problem, ignoring\n",0,0) ;
			return(fs) ;
		}

		/*
		 * VERIFY THE FRAME IS WELL BUILT:
		 *
		 *	1. path index = primary ring only
		 *	2. resource type = sync bw only
		 *	3. trans action id = alloc_trans_id
		 *	4. reason code = success
		 *
		 * If any are violated, discard the RAF frame
		 */
		if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
			!= PRIMARY_RING) ||
			(msg_res_type != SYNC_BW) ||
		(((struct smt_p_reason *)sm_to_para(smc,sm,SMT_P0012))->rdf_reason
			!= SMT_RDF_SUCCESS) ||
			(sm->smt_tid != smc->ess.alloc_trans_id)) {

			DB_ESS("ESS: Allocation Responce not accepted\n",0,0) ;
			return(fs) ;
		}

		/*
		 * Extract message parameters
		 */
		p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
                if (!p) {
                        printk(KERN_ERR "ESS: sm_to_para failed");
                        return fs;
                }       
		payload = ((struct smt_p_320f *)p)->mib_payload ;
		p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
                if (!p) {
                        printk(KERN_ERR "ESS: sm_to_para failed");
                        return fs;
                }       
		overhead = ((struct smt_p_3210 *)p)->mib_overhead ;

		DB_ESSN(2,"payload= %lx	overhead= %lx\n",payload,overhead) ;

		/*
		 * process the bandwidth allocation
		 */
		(void)process_bw_alloc(smc,(long)payload,(long)overhead) ;

		return(fs) ;
		/* end of Process Allocation Request */

	/*
	 * Process an ESS Change Request
	 */
	case CHANGE_ALLOCATION :
		/*
		 * except only replies
		 */
		if (sm->smt_type != SMT_REQUEST) {
			DB_ESS("ESS: Do not process Change Responses\n",0,0) ;
			return(fs) ;
		}

		/*
		 * check the para for the Change Request
		 */
		if (smt_check_para(smc,sm,plist_raf_chg_req)) {
			DB_ESS("ESS: RAF with para problem, ignoring\n",0,0) ;
			return(fs) ;
		}

		/*
		 * Verify the path index and resource
		 * type are correct. If any of
		 * these are false, don't process this
		 * change request frame.
		 */
		if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
			!= PRIMARY_RING) || (msg_res_type != SYNC_BW)) {
			DB_ESS("ESS: RAF frame with para problem, ignoring\n",0,0) ;
			return(fs) ;
		}

		/*
		 * Extract message queue parameters
		 */
		p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
		payload = ((struct smt_p_320f *)p)->mib_payload ;
		p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
		overhead = ((struct smt_p_3210 *)p)->mib_overhead ;

		DB_ESSN(2,"ESS: Change Request from %s\n",
			addr_to_string(&sm->smt_source),0) ;
		DB_ESSN(2,"payload= %lx	overhead= %lx\n",payload,overhead) ;

		/*
		 * process the bandwidth allocation
		 */
		if(!process_bw_alloc(smc,(long)payload,(long)overhead))
			return(fs) ;

		/*
		 * send an RAF Change Reply
		 */
		ess_send_response(smc,sm,CHANGE_ALLOCATION) ;

		return(fs) ;
		/* end of Process Change Request */

	/*
	 * Process Report Response
	 */
	case REPORT_ALLOCATION :
		/*
		 * except only requests
		 */
		if (sm->smt_type != SMT_REQUEST) {
			DB_ESS("ESS: Do not process a Report Reply\n",0,0) ;
			return(fs) ;
		}

		DB_ESSN(2,"ESS: Report Request from %s\n",
			addr_to_string(&(sm->smt_source)),0) ;

		/*
		 * verify that the resource type is sync bw only
		 */
		if (msg_res_type != SYNC_BW) {
			DB_ESS("ESS: ignoring RAF with para problem\n",0,0) ;
			return(fs) ;
		}

		/*
		 * send an RAF Change Reply
		 */
		ess_send_response(smc,sm,REPORT_ALLOCATION) ;

		return(fs) ;
		/* end of Process Report Request */

	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.
 */
static 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 = 0;
	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 length 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 = 0;
	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 = 0;
	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 */