ess.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /******************************************************************************
  2. *
  3. * (C)Copyright 1998,1999 SysKonnect,
  4. * a business unit of Schneider & Koch & Co. Datensysteme GmbH.
  5. *
  6. * See the file "skfddi.c" for further information.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * The information in this file is provided "AS IS" without warranty.
  14. *
  15. ******************************************************************************/
  16. /*
  17. * *******************************************************************
  18. * This SBA code implements the Synchronous Bandwidth Allocation
  19. * functions described in the "FDDI Synchronous Forum Implementer's
  20. * Agreement" dated December 1th, 1993.
  21. * *******************************************************************
  22. *
  23. * PURPOSE: The purpose of this function is to control
  24. * synchronous allocations on a single FDDI segment.
  25. * Allocations are limited to the primary FDDI ring.
  26. * The SBM provides recovery mechanisms to recover
  27. * unused bandwidth also resolves T_Neg and
  28. * reconfiguration changes. Many of the SBM state
  29. * machine inputs are sourced by the underlying
  30. * FDDI sub-system supporting the SBA application.
  31. *
  32. * *******************************************************************
  33. */
  34. #include "h/types.h"
  35. #include "h/fddi.h"
  36. #include "h/smc.h"
  37. #include "h/smt_p.h"
  38. #ifndef SLIM_SMT
  39. #ifdef ESS
  40. #ifndef lint
  41. static const char ID_sccs[] = "@(#)ess.c 1.10 96/02/23 (C) SK" ;
  42. #define LINT_USE(x)
  43. #else
  44. #define LINT_USE(x) (x)=(x)
  45. #endif
  46. #define MS2BCLK(x) ((x)*12500L)
  47. /*
  48. -------------------------------------------------------------
  49. LOCAL VARIABLES:
  50. -------------------------------------------------------------
  51. */
  52. static const u_short plist_raf_alc_res[] = { SMT_P0012, SMT_P320B, SMT_P320F,
  53. SMT_P3210, SMT_P0019, SMT_P001A,
  54. SMT_P001D, 0 } ;
  55. static const u_short plist_raf_chg_req[] = { SMT_P320B, SMT_P320F, SMT_P3210,
  56. SMT_P001A, 0 } ;
  57. static const struct fddi_addr smt_sba_da = {{0x80,0x01,0x43,0x00,0x80,0x0C}} ;
  58. static const struct fddi_addr null_addr = {{0,0,0,0,0,0}} ;
  59. /*
  60. -------------------------------------------------------------
  61. GLOBAL VARIABLES:
  62. -------------------------------------------------------------
  63. */
  64. /*
  65. -------------------------------------------------------------
  66. LOCAL FUNCTIONS:
  67. -------------------------------------------------------------
  68. */
  69. static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
  70. int sba_cmd);
  71. static void ess_config_fifo(struct s_smc *smc);
  72. static void ess_send_alc_req(struct s_smc *smc);
  73. static void ess_send_frame(struct s_smc *smc, SMbuf *mb);
  74. /*
  75. -------------------------------------------------------------
  76. EXTERNAL FUNCTIONS:
  77. -------------------------------------------------------------
  78. */
  79. /*
  80. -------------------------------------------------------------
  81. PUBLIC FUNCTIONS:
  82. -------------------------------------------------------------
  83. */
  84. void ess_timer_poll(struct s_smc *smc);
  85. void ess_para_change(struct s_smc *smc);
  86. int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
  87. int fs);
  88. static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead);
  89. /*
  90. * --------------------------------------------------------------------------
  91. * End Station Support (ESS)
  92. * --------------------------------------------------------------------------
  93. */
  94. /*
  95. * evaluate the RAF frame
  96. */
  97. int ess_raf_received_pack(struct s_smc *smc, SMbuf *mb, struct smt_header *sm,
  98. int fs)
  99. {
  100. void *p ; /* universal pointer */
  101. struct smt_p_0016 *cmd ; /* para: command for the ESS */
  102. SMbuf *db ;
  103. u_long msg_res_type ; /* recource type */
  104. u_long payload, overhead ;
  105. int local ;
  106. int i ;
  107. /*
  108. * Message Processing Code
  109. */
  110. local = ((fs & L_INDICATOR) != 0) ;
  111. /*
  112. * get the resource type
  113. */
  114. if (!(p = (void *) sm_to_para(smc,sm,SMT_P0015))) {
  115. DB_ESS("ESS: RAF frame error, parameter type not found");
  116. return fs;
  117. }
  118. msg_res_type = ((struct smt_p_0015 *)p)->res_type ;
  119. /*
  120. * get the pointer to the ESS command
  121. */
  122. if (!(cmd = (struct smt_p_0016 *) sm_to_para(smc,sm,SMT_P0016))) {
  123. /*
  124. * error in frame: para ESS command was not found
  125. */
  126. DB_ESS("ESS: RAF frame error, parameter command not found");
  127. return fs;
  128. }
  129. DB_ESSN(2, "fc %x ft %x", sm->smt_class, sm->smt_type);
  130. DB_ESSN(2, "ver %x tran %x", sm->smt_version, sm->smt_tid);
  131. DB_ESSN(2, "stn_id %s", addr_to_string(&sm->smt_source));
  132. DB_ESSN(2, "infolen %x res %lx", sm->smt_len, msg_res_type);
  133. DB_ESSN(2, "sbacmd %x", cmd->sba_cmd);
  134. /*
  135. * evaluate the ESS command
  136. */
  137. switch (cmd->sba_cmd) {
  138. /*
  139. * Process an ESS Allocation Request
  140. */
  141. case REQUEST_ALLOCATION :
  142. /*
  143. * check for an RAF Request (Allocation Request)
  144. */
  145. if (sm->smt_type == SMT_REQUEST) {
  146. /*
  147. * process the Allocation request only if the frame is
  148. * local and no static allocation is used
  149. */
  150. if (!local || smc->mib.fddiESSPayload)
  151. return fs;
  152. p = (void *) sm_to_para(smc,sm,SMT_P0019) ;
  153. for (i = 0; i < 5; i++) {
  154. if (((struct smt_p_0019 *)p)->alloc_addr.a[i]) {
  155. return fs;
  156. }
  157. }
  158. /*
  159. * Note: The Application should send a LAN_LOC_FRAME.
  160. * The ESS do not send the Frame to the network!
  161. */
  162. smc->ess.alloc_trans_id = sm->smt_tid ;
  163. DB_ESS("ESS: save Alloc Req Trans ID %x", sm->smt_tid);
  164. p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
  165. ((struct smt_p_320f *)p)->mib_payload =
  166. smc->mib.a[PATH0].fddiPATHSbaPayload ;
  167. p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
  168. ((struct smt_p_3210 *)p)->mib_overhead =
  169. smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  170. sm->smt_dest = smt_sba_da ;
  171. if (smc->ess.local_sba_active)
  172. return fs | I_INDICATOR;
  173. if (!(db = smt_get_mbuf(smc)))
  174. return fs;
  175. db->sm_len = mb->sm_len ;
  176. db->sm_off = mb->sm_off ;
  177. memcpy(((char *)(db->sm_data+db->sm_off)),(char *)sm,
  178. (int)db->sm_len) ;
  179. dump_smt(smc,
  180. (struct smt_header *)(db->sm_data+db->sm_off),
  181. "RAF") ;
  182. smt_send_frame(smc,db,FC_SMT_INFO,0) ;
  183. return fs;
  184. }
  185. /*
  186. * The RAF frame is an Allocation Response !
  187. * check the parameters
  188. */
  189. if (smt_check_para(smc,sm,plist_raf_alc_res)) {
  190. DB_ESS("ESS: RAF with para problem, ignoring");
  191. return fs;
  192. }
  193. /*
  194. * VERIFY THE FRAME IS WELL BUILT:
  195. *
  196. * 1. path index = primary ring only
  197. * 2. resource type = sync bw only
  198. * 3. trans action id = alloc_trans_id
  199. * 4. reason code = success
  200. *
  201. * If any are violated, discard the RAF frame
  202. */
  203. if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
  204. != PRIMARY_RING) ||
  205. (msg_res_type != SYNC_BW) ||
  206. (((struct smt_p_reason *)sm_to_para(smc,sm,SMT_P0012))->rdf_reason
  207. != SMT_RDF_SUCCESS) ||
  208. (sm->smt_tid != smc->ess.alloc_trans_id)) {
  209. DB_ESS("ESS: Allocation Response not accepted");
  210. return fs;
  211. }
  212. /*
  213. * Extract message parameters
  214. */
  215. p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
  216. if (!p) {
  217. printk(KERN_ERR "ESS: sm_to_para failed");
  218. return fs;
  219. }
  220. payload = ((struct smt_p_320f *)p)->mib_payload ;
  221. p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
  222. if (!p) {
  223. printk(KERN_ERR "ESS: sm_to_para failed");
  224. return fs;
  225. }
  226. overhead = ((struct smt_p_3210 *)p)->mib_overhead ;
  227. DB_ESSN(2, "payload= %lx overhead= %lx",
  228. payload, overhead);
  229. /*
  230. * process the bandwidth allocation
  231. */
  232. (void)process_bw_alloc(smc,(long)payload,(long)overhead) ;
  233. return fs;
  234. /* end of Process Allocation Request */
  235. /*
  236. * Process an ESS Change Request
  237. */
  238. case CHANGE_ALLOCATION :
  239. /*
  240. * except only replies
  241. */
  242. if (sm->smt_type != SMT_REQUEST) {
  243. DB_ESS("ESS: Do not process Change Responses");
  244. return fs;
  245. }
  246. /*
  247. * check the para for the Change Request
  248. */
  249. if (smt_check_para(smc,sm,plist_raf_chg_req)) {
  250. DB_ESS("ESS: RAF with para problem, ignoring");
  251. return fs;
  252. }
  253. /*
  254. * Verify the path index and resource
  255. * type are correct. If any of
  256. * these are false, don't process this
  257. * change request frame.
  258. */
  259. if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
  260. != PRIMARY_RING) || (msg_res_type != SYNC_BW)) {
  261. DB_ESS("ESS: RAF frame with para problem, ignoring");
  262. return fs;
  263. }
  264. /*
  265. * Extract message queue parameters
  266. */
  267. p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
  268. payload = ((struct smt_p_320f *)p)->mib_payload ;
  269. p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
  270. overhead = ((struct smt_p_3210 *)p)->mib_overhead ;
  271. DB_ESSN(2, "ESS: Change Request from %s",
  272. addr_to_string(&sm->smt_source));
  273. DB_ESSN(2, "payload= %lx overhead= %lx",
  274. payload, overhead);
  275. /*
  276. * process the bandwidth allocation
  277. */
  278. if(!process_bw_alloc(smc,(long)payload,(long)overhead))
  279. return fs;
  280. /*
  281. * send an RAF Change Reply
  282. */
  283. ess_send_response(smc,sm,CHANGE_ALLOCATION) ;
  284. return fs;
  285. /* end of Process Change Request */
  286. /*
  287. * Process Report Response
  288. */
  289. case REPORT_ALLOCATION :
  290. /*
  291. * except only requests
  292. */
  293. if (sm->smt_type != SMT_REQUEST) {
  294. DB_ESS("ESS: Do not process a Report Reply");
  295. return fs;
  296. }
  297. DB_ESSN(2, "ESS: Report Request from %s",
  298. addr_to_string(&sm->smt_source));
  299. /*
  300. * verify that the resource type is sync bw only
  301. */
  302. if (msg_res_type != SYNC_BW) {
  303. DB_ESS("ESS: ignoring RAF with para problem");
  304. return fs;
  305. }
  306. /*
  307. * send an RAF Change Reply
  308. */
  309. ess_send_response(smc,sm,REPORT_ALLOCATION) ;
  310. return fs;
  311. /* end of Process Report Request */
  312. default:
  313. /*
  314. * error in frame
  315. */
  316. DB_ESS("ESS: ignoring RAF with bad sba_cmd");
  317. break ;
  318. }
  319. return fs;
  320. }
  321. /*
  322. * determines the synchronous bandwidth, set the TSYNC register and the
  323. * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG.
  324. */
  325. static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead)
  326. {
  327. /*
  328. * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,
  329. * if the payload is greater than zero.
  330. * For the SBAPayload and the SBAOverhead we have the following
  331. * unite quations
  332. * _ _
  333. * | bytes |
  334. * SBAPayload = | 8000 ------ |
  335. * | s |
  336. * - -
  337. * _ _
  338. * | bytes |
  339. * SBAOverhead = | ------ |
  340. * | T-NEG |
  341. * - -
  342. *
  343. * T-NEG is described by the equation:
  344. *
  345. * (-) fddiMACT-NEG
  346. * T-NEG = -------------------
  347. * 12500000 1/s
  348. *
  349. * The number of bytes we are able to send is the payload
  350. * plus the overhead.
  351. *
  352. * bytes T-NEG SBAPayload 8000 bytes/s
  353. * sync_bw = SBAOverhead ------ + -----------------------------
  354. * T-NEG T-NEG
  355. *
  356. *
  357. * 1
  358. * sync_bw = SBAOverhead + ---- (-)fddiMACT-NEG * SBAPayload
  359. * 1562
  360. *
  361. */
  362. /*
  363. * set the mib attributes fddiPATHSbaOverhead, fddiPATHSbaPayload
  364. */
  365. /* if (smt_set_obj(smc,SMT_P320F,payload,S_SET)) {
  366. DB_ESS("ESS: SMT does not accept the payload value");
  367. return FALSE;
  368. }
  369. if (smt_set_obj(smc,SMT_P3210,overhead,S_SET)) {
  370. DB_ESS("ESS: SMT does not accept the overhead value");
  371. return FALSE;
  372. } */
  373. /* premliminary */
  374. if (payload > MAX_PAYLOAD || overhead > 5000) {
  375. DB_ESS("ESS: payload / overhead not accepted");
  376. return FALSE;
  377. }
  378. /*
  379. * start the iterative allocation process if the payload or the overhead
  380. * are smaller than the parsed values
  381. */
  382. if (smc->mib.fddiESSPayload &&
  383. ((u_long)payload != smc->mib.fddiESSPayload ||
  384. (u_long)overhead != smc->mib.fddiESSOverhead)) {
  385. smc->ess.raf_act_timer_poll = TRUE ;
  386. smc->ess.timer_count = 0 ;
  387. }
  388. /*
  389. * evulate the Payload
  390. */
  391. if (payload) {
  392. DB_ESSN(2, "ESS: turn SMT_ST_SYNC_SERVICE bit on");
  393. smc->ess.sync_bw_available = TRUE ;
  394. smc->ess.sync_bw = overhead -
  395. (long)smc->mib.m[MAC0].fddiMACT_Neg *
  396. payload / 1562 ;
  397. }
  398. else {
  399. DB_ESSN(2, "ESS: turn SMT_ST_SYNC_SERVICE bit off");
  400. smc->ess.sync_bw_available = FALSE ;
  401. smc->ess.sync_bw = 0 ;
  402. overhead = 0 ;
  403. }
  404. smc->mib.a[PATH0].fddiPATHSbaPayload = payload ;
  405. smc->mib.a[PATH0].fddiPATHSbaOverhead = overhead ;
  406. DB_ESSN(2, "tsync = %lx", smc->ess.sync_bw);
  407. ess_config_fifo(smc) ;
  408. set_formac_tsync(smc,smc->ess.sync_bw) ;
  409. return TRUE;
  410. }
  411. static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
  412. int sba_cmd)
  413. {
  414. struct smt_sba_chg *chg ;
  415. SMbuf *mb ;
  416. void *p ;
  417. /*
  418. * get and initialize the response frame
  419. */
  420. if (sba_cmd == CHANGE_ALLOCATION) {
  421. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
  422. sizeof(struct smt_sba_chg))))
  423. return ;
  424. }
  425. else {
  426. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
  427. sizeof(struct smt_sba_rep_res))))
  428. return ;
  429. }
  430. chg = smtod(mb,struct smt_sba_chg *) ;
  431. chg->smt.smt_tid = sm->smt_tid ;
  432. chg->smt.smt_dest = sm->smt_source ;
  433. /* set P15 */
  434. chg->s_type.para.p_type = SMT_P0015 ;
  435. chg->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
  436. chg->s_type.res_type = SYNC_BW ;
  437. /* set P16 */
  438. chg->cmd.para.p_type = SMT_P0016 ;
  439. chg->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
  440. chg->cmd.sba_cmd = sba_cmd ;
  441. /* set P320B */
  442. chg->path.para.p_type = SMT_P320B ;
  443. chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
  444. chg->path.mib_index = SBAPATHINDEX ;
  445. chg->path.path_pad = 0;
  446. chg->path.path_index = PRIMARY_RING ;
  447. /* set P320F */
  448. chg->payload.para.p_type = SMT_P320F ;
  449. chg->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
  450. chg->payload.mib_index = SBAPATHINDEX ;
  451. chg->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
  452. /* set P3210 */
  453. chg->overhead.para.p_type = SMT_P3210 ;
  454. chg->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
  455. chg->overhead.mib_index = SBAPATHINDEX ;
  456. chg->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  457. if (sba_cmd == CHANGE_ALLOCATION) {
  458. /* set P1A */
  459. chg->cat.para.p_type = SMT_P001A ;
  460. chg->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
  461. p = (void *) sm_to_para(smc,sm,SMT_P001A) ;
  462. chg->cat.category = ((struct smt_p_001a *)p)->category ;
  463. }
  464. dump_smt(smc,(struct smt_header *)chg,"RAF") ;
  465. ess_send_frame(smc,mb) ;
  466. }
  467. void ess_timer_poll(struct s_smc *smc)
  468. {
  469. if (!smc->ess.raf_act_timer_poll)
  470. return ;
  471. DB_ESSN(2, "ESS: timer_poll");
  472. smc->ess.timer_count++ ;
  473. if (smc->ess.timer_count == 10) {
  474. smc->ess.timer_count = 0 ;
  475. ess_send_alc_req(smc) ;
  476. }
  477. }
  478. static void ess_send_alc_req(struct s_smc *smc)
  479. {
  480. struct smt_sba_alc_req *req ;
  481. SMbuf *mb ;
  482. /*
  483. * send never allocation request where the requested payload and
  484. * overhead is zero or deallocate bandwidth when no bandwidth is
  485. * parsed
  486. */
  487. if (!smc->mib.fddiESSPayload) {
  488. smc->mib.fddiESSOverhead = 0 ;
  489. }
  490. else {
  491. if (!smc->mib.fddiESSOverhead)
  492. smc->mib.fddiESSOverhead = DEFAULT_OV ;
  493. }
  494. if (smc->mib.fddiESSOverhead ==
  495. smc->mib.a[PATH0].fddiPATHSbaOverhead &&
  496. smc->mib.fddiESSPayload ==
  497. smc->mib.a[PATH0].fddiPATHSbaPayload){
  498. smc->ess.raf_act_timer_poll = FALSE ;
  499. smc->ess.timer_count = 7 ; /* next RAF alc req after 3 s */
  500. return ;
  501. }
  502. /*
  503. * get and initialize the response frame
  504. */
  505. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REQUEST,
  506. sizeof(struct smt_sba_alc_req))))
  507. return ;
  508. req = smtod(mb,struct smt_sba_alc_req *) ;
  509. req->smt.smt_tid = smc->ess.alloc_trans_id = smt_get_tid(smc) ;
  510. req->smt.smt_dest = smt_sba_da ;
  511. /* set P15 */
  512. req->s_type.para.p_type = SMT_P0015 ;
  513. req->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
  514. req->s_type.res_type = SYNC_BW ;
  515. /* set P16 */
  516. req->cmd.para.p_type = SMT_P0016 ;
  517. req->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
  518. req->cmd.sba_cmd = REQUEST_ALLOCATION ;
  519. /*
  520. * set the parameter type and parameter length of all used
  521. * parameters
  522. */
  523. /* set P320B */
  524. req->path.para.p_type = SMT_P320B ;
  525. req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
  526. req->path.mib_index = SBAPATHINDEX ;
  527. req->path.path_pad = 0;
  528. req->path.path_index = PRIMARY_RING ;
  529. /* set P0017 */
  530. req->pl_req.para.p_type = SMT_P0017 ;
  531. req->pl_req.para.p_len = sizeof(struct smt_p_0017) - PARA_LEN ;
  532. req->pl_req.sba_pl_req = smc->mib.fddiESSPayload -
  533. smc->mib.a[PATH0].fddiPATHSbaPayload ;
  534. /* set P0018 */
  535. req->ov_req.para.p_type = SMT_P0018 ;
  536. req->ov_req.para.p_len = sizeof(struct smt_p_0018) - PARA_LEN ;
  537. req->ov_req.sba_ov_req = smc->mib.fddiESSOverhead -
  538. smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  539. /* set P320F */
  540. req->payload.para.p_type = SMT_P320F ;
  541. req->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
  542. req->payload.mib_index = SBAPATHINDEX ;
  543. req->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
  544. /* set P3210 */
  545. req->overhead.para.p_type = SMT_P3210 ;
  546. req->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
  547. req->overhead.mib_index = SBAPATHINDEX ;
  548. req->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  549. /* set P19 */
  550. req->a_addr.para.p_type = SMT_P0019 ;
  551. req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ;
  552. req->a_addr.sba_pad = 0;
  553. req->a_addr.alloc_addr = null_addr ;
  554. /* set P1A */
  555. req->cat.para.p_type = SMT_P001A ;
  556. req->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
  557. req->cat.category = smc->mib.fddiESSCategory ;
  558. /* set P1B */
  559. req->tneg.para.p_type = SMT_P001B ;
  560. req->tneg.para.p_len = sizeof(struct smt_p_001b) - PARA_LEN ;
  561. req->tneg.max_t_neg = smc->mib.fddiESSMaxTNeg ;
  562. /* set P1C */
  563. req->segm.para.p_type = SMT_P001C ;
  564. req->segm.para.p_len = sizeof(struct smt_p_001c) - PARA_LEN ;
  565. req->segm.min_seg_siz = smc->mib.fddiESSMinSegmentSize ;
  566. dump_smt(smc,(struct smt_header *)req,"RAF") ;
  567. ess_send_frame(smc,mb) ;
  568. }
  569. static void ess_send_frame(struct s_smc *smc, SMbuf *mb)
  570. {
  571. /*
  572. * check if the frame must be send to the own ESS
  573. */
  574. if (smc->ess.local_sba_active) {
  575. /*
  576. * Send the Change Reply to the local SBA
  577. */
  578. DB_ESS("ESS:Send to the local SBA");
  579. if (!smc->ess.sba_reply_pend)
  580. smc->ess.sba_reply_pend = mb ;
  581. else {
  582. DB_ESS("Frame is lost - another frame was pending");
  583. smt_free_mbuf(smc,mb) ;
  584. }
  585. }
  586. else {
  587. /*
  588. * Send the SBA RAF Change Reply to the network
  589. */
  590. DB_ESS("ESS:Send to the network");
  591. smt_send_frame(smc,mb,FC_SMT_INFO,0) ;
  592. }
  593. }
  594. void ess_para_change(struct s_smc *smc)
  595. {
  596. (void)process_bw_alloc(smc,(long)smc->mib.a[PATH0].fddiPATHSbaPayload,
  597. (long)smc->mib.a[PATH0].fddiPATHSbaOverhead) ;
  598. }
  599. static void ess_config_fifo(struct s_smc *smc)
  600. {
  601. /*
  602. * if nothing to do exit
  603. */
  604. if (smc->mib.a[PATH0].fddiPATHSbaPayload) {
  605. if (smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON &&
  606. (smc->hw.fp.fifo.fifo_config_mode&SEND_ASYNC_AS_SYNC) ==
  607. smc->mib.fddiESSSynchTxMode) {
  608. return ;
  609. }
  610. }
  611. else {
  612. if (!(smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON)) {
  613. return ;
  614. }
  615. }
  616. /*
  617. * split up the FIFO and reinitialize the queues
  618. */
  619. formac_reinit_tx(smc) ;
  620. }
  621. #endif /* ESS */
  622. #endif /* no SLIM_SMT */