ess.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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\n",0,0) ;
  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\n",0,0);
  127. return fs;
  128. }
  129. DB_ESSN(2,"fc %x ft %x\n",sm->smt_class,sm->smt_type) ;
  130. DB_ESSN(2,"ver %x tran %lx\n",sm->smt_version,sm->smt_tid) ;
  131. DB_ESSN(2,"stn_id %s\n",addr_to_string(&sm->smt_source),0) ;
  132. DB_ESSN(2,"infolen %x res %x\n",sm->smt_len, msg_res_type) ;
  133. DB_ESSN(2,"sbacmd %x\n",cmd->sba_cmd,0) ;
  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 %lx\n",sm->smt_tid,0);
  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\n",0,0) ;
  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\n",0,0) ;
  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\n",payload,overhead) ;
  228. /*
  229. * process the bandwidth allocation
  230. */
  231. (void)process_bw_alloc(smc,(long)payload,(long)overhead) ;
  232. return fs;
  233. /* end of Process Allocation Request */
  234. /*
  235. * Process an ESS Change Request
  236. */
  237. case CHANGE_ALLOCATION :
  238. /*
  239. * except only replies
  240. */
  241. if (sm->smt_type != SMT_REQUEST) {
  242. DB_ESS("ESS: Do not process Change Responses\n",0,0) ;
  243. return fs;
  244. }
  245. /*
  246. * check the para for the Change Request
  247. */
  248. if (smt_check_para(smc,sm,plist_raf_chg_req)) {
  249. DB_ESS("ESS: RAF with para problem, ignoring\n",0,0) ;
  250. return fs;
  251. }
  252. /*
  253. * Verify the path index and resource
  254. * type are correct. If any of
  255. * these are false, don't process this
  256. * change request frame.
  257. */
  258. if ((((struct smt_p_320b *)sm_to_para(smc,sm,SMT_P320B))->path_index
  259. != PRIMARY_RING) || (msg_res_type != SYNC_BW)) {
  260. DB_ESS("ESS: RAF frame with para problem, ignoring\n",0,0) ;
  261. return fs;
  262. }
  263. /*
  264. * Extract message queue parameters
  265. */
  266. p = (void *) sm_to_para(smc,sm,SMT_P320F) ;
  267. payload = ((struct smt_p_320f *)p)->mib_payload ;
  268. p = (void *) sm_to_para(smc,sm,SMT_P3210) ;
  269. overhead = ((struct smt_p_3210 *)p)->mib_overhead ;
  270. DB_ESSN(2,"ESS: Change Request from %s\n",
  271. addr_to_string(&sm->smt_source),0) ;
  272. DB_ESSN(2,"payload= %lx overhead= %lx\n",payload,overhead) ;
  273. /*
  274. * process the bandwidth allocation
  275. */
  276. if(!process_bw_alloc(smc,(long)payload,(long)overhead))
  277. return fs;
  278. /*
  279. * send an RAF Change Reply
  280. */
  281. ess_send_response(smc,sm,CHANGE_ALLOCATION) ;
  282. return fs;
  283. /* end of Process Change Request */
  284. /*
  285. * Process Report Response
  286. */
  287. case REPORT_ALLOCATION :
  288. /*
  289. * except only requests
  290. */
  291. if (sm->smt_type != SMT_REQUEST) {
  292. DB_ESS("ESS: Do not process a Report Reply\n",0,0) ;
  293. return fs;
  294. }
  295. DB_ESSN(2,"ESS: Report Request from %s\n",
  296. addr_to_string(&(sm->smt_source)),0) ;
  297. /*
  298. * verify that the resource type is sync bw only
  299. */
  300. if (msg_res_type != SYNC_BW) {
  301. DB_ESS("ESS: ignoring RAF with para problem\n",0,0) ;
  302. return fs;
  303. }
  304. /*
  305. * send an RAF Change Reply
  306. */
  307. ess_send_response(smc,sm,REPORT_ALLOCATION) ;
  308. return fs;
  309. /* end of Process Report Request */
  310. default:
  311. /*
  312. * error in frame
  313. */
  314. DB_ESS("ESS: ignoring RAF with bad sba_cmd\n",0,0) ;
  315. break ;
  316. }
  317. return fs;
  318. }
  319. /*
  320. * determines the synchronous bandwidth, set the TSYNC register and the
  321. * mib variables SBAPayload, SBAOverhead and fddiMACT-NEG.
  322. */
  323. static int process_bw_alloc(struct s_smc *smc, long int payload, long int overhead)
  324. {
  325. /*
  326. * determine the synchronous bandwidth (sync_bw) in bytes per T-NEG,
  327. * if the payload is greater than zero.
  328. * For the SBAPayload and the SBAOverhead we have the following
  329. * unite quations
  330. * _ _
  331. * | bytes |
  332. * SBAPayload = | 8000 ------ |
  333. * | s |
  334. * - -
  335. * _ _
  336. * | bytes |
  337. * SBAOverhead = | ------ |
  338. * | T-NEG |
  339. * - -
  340. *
  341. * T-NEG is described by the equation:
  342. *
  343. * (-) fddiMACT-NEG
  344. * T-NEG = -------------------
  345. * 12500000 1/s
  346. *
  347. * The number of bytes we are able to send is the payload
  348. * plus the overhead.
  349. *
  350. * bytes T-NEG SBAPayload 8000 bytes/s
  351. * sync_bw = SBAOverhead ------ + -----------------------------
  352. * T-NEG T-NEG
  353. *
  354. *
  355. * 1
  356. * sync_bw = SBAOverhead + ---- (-)fddiMACT-NEG * SBAPayload
  357. * 1562
  358. *
  359. */
  360. /*
  361. * set the mib attributes fddiPATHSbaOverhead, fddiPATHSbaPayload
  362. */
  363. /* if (smt_set_obj(smc,SMT_P320F,payload,S_SET)) {
  364. DB_ESS("ESS: SMT does not accept the payload value\n",0,0) ;
  365. return FALSE;
  366. }
  367. if (smt_set_obj(smc,SMT_P3210,overhead,S_SET)) {
  368. DB_ESS("ESS: SMT does not accept the overhead value\n",0,0) ;
  369. return FALSE;
  370. } */
  371. /* premliminary */
  372. if (payload > MAX_PAYLOAD || overhead > 5000) {
  373. DB_ESS("ESS: payload / overhead not accepted\n",0,0) ;
  374. return FALSE;
  375. }
  376. /*
  377. * start the iterative allocation process if the payload or the overhead
  378. * are smaller than the parsed values
  379. */
  380. if (smc->mib.fddiESSPayload &&
  381. ((u_long)payload != smc->mib.fddiESSPayload ||
  382. (u_long)overhead != smc->mib.fddiESSOverhead)) {
  383. smc->ess.raf_act_timer_poll = TRUE ;
  384. smc->ess.timer_count = 0 ;
  385. }
  386. /*
  387. * evulate the Payload
  388. */
  389. if (payload) {
  390. DB_ESSN(2,"ESS: turn SMT_ST_SYNC_SERVICE bit on\n",0,0) ;
  391. smc->ess.sync_bw_available = TRUE ;
  392. smc->ess.sync_bw = overhead -
  393. (long)smc->mib.m[MAC0].fddiMACT_Neg *
  394. payload / 1562 ;
  395. }
  396. else {
  397. DB_ESSN(2,"ESS: turn SMT_ST_SYNC_SERVICE bit off\n",0,0) ;
  398. smc->ess.sync_bw_available = FALSE ;
  399. smc->ess.sync_bw = 0 ;
  400. overhead = 0 ;
  401. }
  402. smc->mib.a[PATH0].fddiPATHSbaPayload = payload ;
  403. smc->mib.a[PATH0].fddiPATHSbaOverhead = overhead ;
  404. DB_ESSN(2,"tsync = %lx\n",smc->ess.sync_bw,0) ;
  405. ess_config_fifo(smc) ;
  406. set_formac_tsync(smc,smc->ess.sync_bw) ;
  407. return TRUE;
  408. }
  409. static void ess_send_response(struct s_smc *smc, struct smt_header *sm,
  410. int sba_cmd)
  411. {
  412. struct smt_sba_chg *chg ;
  413. SMbuf *mb ;
  414. void *p ;
  415. /*
  416. * get and initialize the response frame
  417. */
  418. if (sba_cmd == CHANGE_ALLOCATION) {
  419. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
  420. sizeof(struct smt_sba_chg))))
  421. return ;
  422. }
  423. else {
  424. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REPLY,
  425. sizeof(struct smt_sba_rep_res))))
  426. return ;
  427. }
  428. chg = smtod(mb,struct smt_sba_chg *) ;
  429. chg->smt.smt_tid = sm->smt_tid ;
  430. chg->smt.smt_dest = sm->smt_source ;
  431. /* set P15 */
  432. chg->s_type.para.p_type = SMT_P0015 ;
  433. chg->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
  434. chg->s_type.res_type = SYNC_BW ;
  435. /* set P16 */
  436. chg->cmd.para.p_type = SMT_P0016 ;
  437. chg->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
  438. chg->cmd.sba_cmd = sba_cmd ;
  439. /* set P320B */
  440. chg->path.para.p_type = SMT_P320B ;
  441. chg->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
  442. chg->path.mib_index = SBAPATHINDEX ;
  443. chg->path.path_pad = 0;
  444. chg->path.path_index = PRIMARY_RING ;
  445. /* set P320F */
  446. chg->payload.para.p_type = SMT_P320F ;
  447. chg->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
  448. chg->payload.mib_index = SBAPATHINDEX ;
  449. chg->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
  450. /* set P3210 */
  451. chg->overhead.para.p_type = SMT_P3210 ;
  452. chg->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
  453. chg->overhead.mib_index = SBAPATHINDEX ;
  454. chg->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  455. if (sba_cmd == CHANGE_ALLOCATION) {
  456. /* set P1A */
  457. chg->cat.para.p_type = SMT_P001A ;
  458. chg->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
  459. p = (void *) sm_to_para(smc,sm,SMT_P001A) ;
  460. chg->cat.category = ((struct smt_p_001a *)p)->category ;
  461. }
  462. dump_smt(smc,(struct smt_header *)chg,"RAF") ;
  463. ess_send_frame(smc,mb) ;
  464. }
  465. void ess_timer_poll(struct s_smc *smc)
  466. {
  467. if (!smc->ess.raf_act_timer_poll)
  468. return ;
  469. DB_ESSN(2,"ESS: timer_poll\n",0,0) ;
  470. smc->ess.timer_count++ ;
  471. if (smc->ess.timer_count == 10) {
  472. smc->ess.timer_count = 0 ;
  473. ess_send_alc_req(smc) ;
  474. }
  475. }
  476. static void ess_send_alc_req(struct s_smc *smc)
  477. {
  478. struct smt_sba_alc_req *req ;
  479. SMbuf *mb ;
  480. /*
  481. * send never allocation request where the requested payload and
  482. * overhead is zero or deallocate bandwidth when no bandwidth is
  483. * parsed
  484. */
  485. if (!smc->mib.fddiESSPayload) {
  486. smc->mib.fddiESSOverhead = 0 ;
  487. }
  488. else {
  489. if (!smc->mib.fddiESSOverhead)
  490. smc->mib.fddiESSOverhead = DEFAULT_OV ;
  491. }
  492. if (smc->mib.fddiESSOverhead ==
  493. smc->mib.a[PATH0].fddiPATHSbaOverhead &&
  494. smc->mib.fddiESSPayload ==
  495. smc->mib.a[PATH0].fddiPATHSbaPayload){
  496. smc->ess.raf_act_timer_poll = FALSE ;
  497. smc->ess.timer_count = 7 ; /* next RAF alc req after 3 s */
  498. return ;
  499. }
  500. /*
  501. * get and initialize the response frame
  502. */
  503. if (!(mb=smt_build_frame(smc,SMT_RAF,SMT_REQUEST,
  504. sizeof(struct smt_sba_alc_req))))
  505. return ;
  506. req = smtod(mb,struct smt_sba_alc_req *) ;
  507. req->smt.smt_tid = smc->ess.alloc_trans_id = smt_get_tid(smc) ;
  508. req->smt.smt_dest = smt_sba_da ;
  509. /* set P15 */
  510. req->s_type.para.p_type = SMT_P0015 ;
  511. req->s_type.para.p_len = sizeof(struct smt_p_0015) - PARA_LEN ;
  512. req->s_type.res_type = SYNC_BW ;
  513. /* set P16 */
  514. req->cmd.para.p_type = SMT_P0016 ;
  515. req->cmd.para.p_len = sizeof(struct smt_p_0016) - PARA_LEN ;
  516. req->cmd.sba_cmd = REQUEST_ALLOCATION ;
  517. /*
  518. * set the parameter type and parameter length of all used
  519. * parameters
  520. */
  521. /* set P320B */
  522. req->path.para.p_type = SMT_P320B ;
  523. req->path.para.p_len = sizeof(struct smt_p_320b) - PARA_LEN ;
  524. req->path.mib_index = SBAPATHINDEX ;
  525. req->path.path_pad = 0;
  526. req->path.path_index = PRIMARY_RING ;
  527. /* set P0017 */
  528. req->pl_req.para.p_type = SMT_P0017 ;
  529. req->pl_req.para.p_len = sizeof(struct smt_p_0017) - PARA_LEN ;
  530. req->pl_req.sba_pl_req = smc->mib.fddiESSPayload -
  531. smc->mib.a[PATH0].fddiPATHSbaPayload ;
  532. /* set P0018 */
  533. req->ov_req.para.p_type = SMT_P0018 ;
  534. req->ov_req.para.p_len = sizeof(struct smt_p_0018) - PARA_LEN ;
  535. req->ov_req.sba_ov_req = smc->mib.fddiESSOverhead -
  536. smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  537. /* set P320F */
  538. req->payload.para.p_type = SMT_P320F ;
  539. req->payload.para.p_len = sizeof(struct smt_p_320f) - PARA_LEN ;
  540. req->payload.mib_index = SBAPATHINDEX ;
  541. req->payload.mib_payload = smc->mib.a[PATH0].fddiPATHSbaPayload ;
  542. /* set P3210 */
  543. req->overhead.para.p_type = SMT_P3210 ;
  544. req->overhead.para.p_len = sizeof(struct smt_p_3210) - PARA_LEN ;
  545. req->overhead.mib_index = SBAPATHINDEX ;
  546. req->overhead.mib_overhead = smc->mib.a[PATH0].fddiPATHSbaOverhead ;
  547. /* set P19 */
  548. req->a_addr.para.p_type = SMT_P0019 ;
  549. req->a_addr.para.p_len = sizeof(struct smt_p_0019) - PARA_LEN ;
  550. req->a_addr.sba_pad = 0;
  551. req->a_addr.alloc_addr = null_addr ;
  552. /* set P1A */
  553. req->cat.para.p_type = SMT_P001A ;
  554. req->cat.para.p_len = sizeof(struct smt_p_001a) - PARA_LEN ;
  555. req->cat.category = smc->mib.fddiESSCategory ;
  556. /* set P1B */
  557. req->tneg.para.p_type = SMT_P001B ;
  558. req->tneg.para.p_len = sizeof(struct smt_p_001b) - PARA_LEN ;
  559. req->tneg.max_t_neg = smc->mib.fddiESSMaxTNeg ;
  560. /* set P1C */
  561. req->segm.para.p_type = SMT_P001C ;
  562. req->segm.para.p_len = sizeof(struct smt_p_001c) - PARA_LEN ;
  563. req->segm.min_seg_siz = smc->mib.fddiESSMinSegmentSize ;
  564. dump_smt(smc,(struct smt_header *)req,"RAF") ;
  565. ess_send_frame(smc,mb) ;
  566. }
  567. static void ess_send_frame(struct s_smc *smc, SMbuf *mb)
  568. {
  569. /*
  570. * check if the frame must be send to the own ESS
  571. */
  572. if (smc->ess.local_sba_active) {
  573. /*
  574. * Send the Change Reply to the local SBA
  575. */
  576. DB_ESS("ESS:Send to the local SBA\n",0,0) ;
  577. if (!smc->ess.sba_reply_pend)
  578. smc->ess.sba_reply_pend = mb ;
  579. else {
  580. DB_ESS("Frame is lost - another frame was pending\n",0,0);
  581. smt_free_mbuf(smc,mb) ;
  582. }
  583. }
  584. else {
  585. /*
  586. * Send the SBA RAF Change Reply to the network
  587. */
  588. DB_ESS("ESS:Send to the network\n",0,0) ;
  589. smt_send_frame(smc,mb,FC_SMT_INFO,0) ;
  590. }
  591. }
  592. void ess_para_change(struct s_smc *smc)
  593. {
  594. (void)process_bw_alloc(smc,(long)smc->mib.a[PATH0].fddiPATHSbaPayload,
  595. (long)smc->mib.a[PATH0].fddiPATHSbaOverhead) ;
  596. }
  597. static void ess_config_fifo(struct s_smc *smc)
  598. {
  599. /*
  600. * if nothing to do exit
  601. */
  602. if (smc->mib.a[PATH0].fddiPATHSbaPayload) {
  603. if (smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON &&
  604. (smc->hw.fp.fifo.fifo_config_mode&SEND_ASYNC_AS_SYNC) ==
  605. smc->mib.fddiESSSynchTxMode) {
  606. return ;
  607. }
  608. }
  609. else {
  610. if (!(smc->hw.fp.fifo.fifo_config_mode & SYNC_TRAFFIC_ON)) {
  611. return ;
  612. }
  613. }
  614. /*
  615. * split up the FIFO and reinitialize the queues
  616. */
  617. formac_reinit_tx(smc) ;
  618. }
  619. #endif /* ESS */
  620. #endif /* no SLIM_SMT */