ess.c 18 KB

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