IxAtmSch.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /**
  2. * @file IxAtmSch.h
  3. *
  4. * @date 23-NOV-2001
  5. *
  6. * @brief Header file for the IXP400 ATM Traffic Shaper
  7. *
  8. * This component demonstrates an ATM Traffic Shaper implementation. It
  9. * will perform shaping on upto 12 ports and total of 44 VCs accross all ports,
  10. * 32 are intended for AAL0/5 and 12 for OAM (1 per port).
  11. * The supported traffic types are;1 rt-VBR VC where PCR = SCR.
  12. * (Effectively CBR) and Up-to 44 VBR VCs.
  13. *
  14. * This component models the ATM ports and VCs and is capable of producing
  15. * a schedule of ATM cells per port which can be supplied to IxAtmdAcc
  16. * for execution on the data path.
  17. *
  18. * @par
  19. * IXP400 SW Release version 2.0
  20. *
  21. * -- Copyright Notice --
  22. *
  23. * @par
  24. * Copyright 2001-2005, Intel Corporation.
  25. * All rights reserved.
  26. *
  27. * @par
  28. * Redistribution and use in source and binary forms, with or without
  29. * modification, are permitted provided that the following conditions
  30. * are met:
  31. * 1. Redistributions of source code must retain the above copyright
  32. * notice, this list of conditions and the following disclaimer.
  33. * 2. Redistributions in binary form must reproduce the above copyright
  34. * notice, this list of conditions and the following disclaimer in the
  35. * documentation and/or other materials provided with the distribution.
  36. * 3. Neither the name of the Intel Corporation nor the names of its contributors
  37. * may be used to endorse or promote products derived from this software
  38. * without specific prior written permission.
  39. *
  40. * @par
  41. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
  42. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  43. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  44. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  45. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  46. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  47. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  48. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  49. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  50. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  51. * SUCH DAMAGE.
  52. *
  53. * @par
  54. * -- End of Copyright Notice --
  55. *
  56. * @sa IxAtmm.h
  57. *
  58. */
  59. /**
  60. * @defgroup IxAtmSch IXP400 ATM Transmit Scheduler (IxAtmSch) API
  61. *
  62. * @brief IXP400 ATM scheduler component Public API
  63. *
  64. * @{
  65. */
  66. #ifndef IXATMSCH_H
  67. #define IXATMSCH_H
  68. #include "IxOsalTypes.h"
  69. #include "IxAtmTypes.h"
  70. /*
  71. * #defines and macros used in this file.
  72. */
  73. /* Return codes */
  74. /**
  75. * @ingroup IxAtmSch
  76. *
  77. * @def IX_ATMSCH_RET_NOT_ADMITTED
  78. * @brief Indicates that CAC function has rejected VC registration due
  79. * to insufficient line capacity.
  80. */
  81. #define IX_ATMSCH_RET_NOT_ADMITTED 2
  82. /**
  83. * @ingroup IxAtmSch
  84. *
  85. * @def IX_ATMSCH_RET_QUEUE_FULL
  86. * @brief Indicates that the VC queue is full, no more demand can be
  87. * queued at this time.
  88. */
  89. #define IX_ATMSCH_RET_QUEUE_FULL 3
  90. /**
  91. * @ingroup IxAtmSch
  92. *
  93. * @def IX_ATMSCH_RET_QUEUE_EMPTY
  94. * @brief Indicates that all VC queues on this port are empty and
  95. * therefore there are no cells to be scheduled at this time.
  96. */
  97. #define IX_ATMSCH_RET_QUEUE_EMPTY 4
  98. /*
  99. * Function declarations
  100. */
  101. /**
  102. * @ingroup IxAtmSch
  103. *
  104. * @fn ixAtmSchInit(void)
  105. *
  106. * @brief This function is used to initialize the ixAtmSch component. It
  107. * should be called before any other IxAtmSch API function.
  108. *
  109. * @param None
  110. *
  111. * @return
  112. * - <b>IX_SUCCESS :</b> indicates that
  113. * -# The ATM scheduler component has been successfully initialized.
  114. * -# The scheduler is ready to accept Port modelling requests.
  115. * - <b>IX_FAIL :</b> Some internal error has prevented the scheduler component
  116. * from initialising.
  117. */
  118. PUBLIC IX_STATUS
  119. ixAtmSchInit(void);
  120. /**
  121. * @ingroup IxAtmSch
  122. *
  123. * @fn ixAtmSchPortModelInitialize( IxAtmLogicalPort port,
  124. unsigned int portRate,
  125. unsigned int minCellsToSchedule)
  126. *
  127. * @brief This function shall be called first to initialize an ATM port before
  128. * any other ixAtmSch API calls may be made for that port.
  129. *
  130. * @param port @ref IxAtmLogicalPort [in] - The specific port to initialize. Valid
  131. * values range from 0 to IX_UTOPIA_MAX_PORTS - 1, representing a
  132. * maximum of IX_UTOPIA_MAX_PORTS possible ports.
  133. *
  134. * @param portRate unsigned int [in] - Value indicating the upstream capacity
  135. * of the indicated port. The value should be supplied in
  136. * units of ATM (53 bytes) cells per second.
  137. * A port rate of 800Kbits/s is the equivalent
  138. * of 1886 cells per second
  139. *
  140. * @param minCellsToSchedule unsigned int [in] - This parameter specifies the minimum
  141. * number of cells which the scheduler will put in a schedule
  142. * table for this port. This value sets the worst case CDVT for VCs
  143. * on this port i.e. CDVT = 1*minCellsToSchedule/portRate.
  144. * @return
  145. * - <b>IX_SUCCESS :</b> indicates that
  146. * -# The ATM scheduler has been successfully initialized.
  147. * -# The requested port model has been established.
  148. * -# The scheduler is ready to accept VC modelling requests
  149. * on the ATM port.
  150. * - <b>IX_FAIL :</b> indicates the requested port could not be
  151. * initialized. */
  152. PUBLIC IX_STATUS
  153. ixAtmSchPortModelInitialize( IxAtmLogicalPort port,
  154. unsigned int portRate,
  155. unsigned int minCellsToSchedule);
  156. /**
  157. * @ingroup IxAtmSch
  158. *
  159. * @fn ixAtmSchPortRateModify( IxAtmLogicalPort port,
  160. unsigned int portRate)
  161. *
  162. * @brief This function is called to modify the portRate on a
  163. * previously initialized port, typically in the event that
  164. * the line condition of the port changes.
  165. *
  166. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port which is to be
  167. * modified.
  168. *
  169. * @param portRate unsigned int [in] - Value indicating the new upstream
  170. * capacity for this port in cells/second.
  171. * A port rate of 800Kbits/s is the equivalent
  172. * of 1886 cells per second
  173. *
  174. * @return
  175. * - <b>IX_SUCCESS :</b> The port rate has been successfully modified.<br>
  176. * - <b>IX_FAIL :</b> The port rate could not be modified, either
  177. * because the input data was invalid, or the new port rate is
  178. * insufficient to support established ATM VC contracts on this
  179. * port.
  180. *
  181. * @warning The IxAtmSch component will validate the supplied port
  182. * rate is sufficient to support all established VC
  183. * contracts on the port. If the new port rate is
  184. * insufficient to support all established contracts then
  185. * the request to modify the port rate will be rejected.
  186. * In this event, the user is expected to remove
  187. * established contracts using the ixAtmSchVcModelRemove
  188. * interface and then retry this interface.
  189. *
  190. * @sa ixAtmSchVcModelRemove() */
  191. PUBLIC IX_STATUS
  192. ixAtmSchPortRateModify( IxAtmLogicalPort port,
  193. unsigned int portRate);
  194. /**
  195. * @ingroup IxAtmSch
  196. *
  197. * @fn ixAtmSchVcModelSetup( IxAtmLogicalPort port,
  198. IxAtmTrafficDescriptor *trafficDesc,
  199. IxAtmSchedulerVcId *vcId)
  200. *
  201. * @brief A client calls this interface to set up an upstream
  202. * (transmitting) virtual connection model (VC) on the
  203. * specified ATM port. This function also provides the
  204. * virtual * connection admission control (CAC) service to the
  205. * client.
  206. *
  207. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the upstream
  208. * VC is to be established.
  209. *
  210. * @param *trafficDesc @ref IxAtmTrafficDescriptor [in] - Pointer to a structure
  211. * describing the requested traffic contract of the VC to be
  212. * established. This structure contains the typical ATM
  213. * traffic descriptor values (e.g. PCR, SCR, MBS, CDVT, etc.)
  214. * defined by the ATM standard.
  215. *
  216. * @param *vcId @ref IxAtmSchedulerVcId [out] - This value will be filled with the
  217. * port-unique identifier for this virtual connection. A
  218. * valid identification is a non-negative number.
  219. *
  220. * @return
  221. * - <b>IX_SUCCESS :</b> The VC has been successfully established on
  222. * this port. The client may begin to submit demand on this VC.
  223. * - <b>IX_ATMSCH_RET_NOT_ADMITTED :</b> The VC cannot be established
  224. * on this port because there is insufficient upstream capacity
  225. * available to support the requested traffic contract descriptor
  226. * - <b>IX_FAIL :</b>Input data are invalid. VC has not been
  227. * established.
  228. */
  229. PUBLIC IX_STATUS
  230. ixAtmSchVcModelSetup( IxAtmLogicalPort port,
  231. IxAtmTrafficDescriptor *trafficDesc,
  232. IxAtmSchedulerVcId *vcId);
  233. /**
  234. * @ingroup IxAtmSch
  235. *
  236. * @fn ixAtmSchVcConnIdSet( IxAtmLogicalPort port,
  237. IxAtmSchedulerVcId vcId,
  238. IxAtmConnId vcUserConnId)
  239. *
  240. * @brief A client calls this interface to set the vcUserConnId for a VC on
  241. * the specified ATM port. This vcUserConnId will default to
  242. * IX_ATM_IDLE_CELLS_CONNID if this function is not called for a VC.
  243. * Hence if the client does not call this function for a VC then only idle
  244. * cells will be scheduled for this VC.
  245. *
  246. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the upstream
  247. * VC is has been established.
  248. *
  249. * @param vcId @ref IxAtmSchedulerVcId [in] - This is the unique identifier for this virtual
  250. * connection. A valid identification is a non-negative number and is
  251. * all ports.
  252. *
  253. * @param vcUserConnId @ref IxAtmConnId [in] - The connId is used to refer to a VC in schedule
  254. * table entries. It is treated as the Id by which the scheduler client
  255. * knows the VC. It is used in any communicatations from the Scheduler
  256. * to the scheduler user e.g. schedule table entries.
  257. *
  258. * @return
  259. * - <b>IX_SUCCESS :</b> The id has successfully been set.
  260. * - <b>IX_FAIL :</b>Input data are invalid. connId id is not established.
  261. */
  262. PUBLIC IX_STATUS
  263. ixAtmSchVcConnIdSet( IxAtmLogicalPort port,
  264. IxAtmSchedulerVcId vcId,
  265. IxAtmConnId vcUserConnId);
  266. /**
  267. * @ingroup IxAtmSch
  268. *
  269. * @fn ixAtmSchVcModelRemove( IxAtmLogicalPort port,
  270. IxAtmSchedulerVcId vcId)
  271. *
  272. * @brief Interface called by the client to remove a previously
  273. * established VC on a particular port.
  274. *
  275. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
  276. * removed is established.
  277. *
  278. * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be removed. This is the
  279. * value returned by the @ref ixAtmSchVcModelSetup call which
  280. * established the relevant VC.
  281. *
  282. * @return
  283. * - <b>IX_SUCCESS :</b> The VC has been successfully removed from
  284. * this port. It is no longer modelled on this port.
  285. * - <b>IX_FAIL :</b>Input data are invalid. The VC is still being modeled
  286. * by the traffic shaper.
  287. *
  288. * @sa ixAtmSchVcModelSetup()
  289. */
  290. PUBLIC IX_STATUS
  291. ixAtmSchVcModelRemove( IxAtmLogicalPort port,
  292. IxAtmSchedulerVcId vcId);
  293. /**
  294. * @ingroup IxAtmSch
  295. *
  296. * @fn ixAtmSchVcQueueUpdate( IxAtmLogicalPort port,
  297. IxAtmSchedulerVcId vcId,
  298. unsigned int numberOfCells)
  299. *
  300. * @brief The client calls this function to notify IxAtmSch that the
  301. * user of a VC has submitted cells for transmission.
  302. *
  303. * This information is stored, aggregated from a number of calls to
  304. * ixAtmSchVcQueueUpdate and eventually used in the call to
  305. * ixAtmSchTableUpdate.
  306. *
  307. * Normally IxAtmSch will update the VC queue by adding the number of
  308. * cells to the current queue length. However, if IxAtmSch
  309. * determines that the user has over-submitted for the VC and
  310. * exceeded its transmission quota the queue request can be rejected.
  311. * The user should resubmit the request later when the queue has been
  312. * depleted.
  313. *
  314. * This implementation of ixAtmSchVcQueueUpdate uses no operating
  315. * system or external facilities, either directly or indirectly.
  316. * This allows clients to call this function form within an interrupt handler.
  317. *
  318. * This interface is structurally compatible with the
  319. * IxAtmdAccSchQueueUpdate callback type definition required for
  320. * IXP400 ATM scheduler interoperability.
  321. *
  322. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
  323. * updated is established.
  324. *
  325. * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be updated. This is the
  326. * value returned by the @ref ixAtmSchVcModelSetup call which
  327. * established the relevant VC.
  328. *
  329. * @param numberOfCells unsigned int [in] - Indicates how many ATM cells should
  330. * be added to the queue for this VC.
  331. *
  332. * @return
  333. * - <b>IX_SUCCESS :</b> The VC queue has been successfully updated.
  334. * - <b>IX_ATMSCH_RET_QUEUE_FULL :</b> The VC queue has reached a
  335. * preset limit. This indicates the client has over-submitted
  336. * and exceeded its transmission quota. The request is
  337. * rejected. The VC queue is not updated. The VC user is
  338. * advised to resubmit the request later.
  339. * - <b>IX_FAIL :</b> The input are invalid. No VC queue is updated.
  340. *
  341. * @warning IxAtmSch assumes that the calling software ensures that
  342. * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
  343. * ixAtmSchTableUpdate are both self and mutually exclusive
  344. * for the same port.
  345. *
  346. * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
  347. PUBLIC IX_STATUS
  348. ixAtmSchVcQueueUpdate( IxAtmLogicalPort port,
  349. IxAtmSchedulerVcId vcId,
  350. unsigned int numberOfCells);
  351. /**
  352. * @ingroup IxAtmSch
  353. *
  354. * @fn ixAtmSchVcQueueClear( IxAtmLogicalPort port,
  355. IxAtmSchedulerVcId vcId)
  356. *
  357. * @brief The client calls this function to remove all currently
  358. * queued cells from a registered VC. The pending cell count
  359. * for the specified VC is reset to zero.
  360. *
  361. * This interface is structurally compatible with the
  362. * IxAtmdAccSchQueueClear callback type definition required for
  363. * IXP400 ATM scheduler interoperability.
  364. *
  365. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port on which the VC to be
  366. * cleared is established.
  367. *
  368. * @param vcId @ref IxAtmSchedulerVcId [in] - Identifies the VC to be cleared. This is the
  369. * value returned by the @ref ixAtmSchVcModelSetup call which
  370. * established the relevant VC.
  371. *
  372. * @return
  373. * - <b>IX_SUCCESS :</b> The VC queue has been successfully cleared.
  374. * - <b>IX_FAIL :</b> The input are invalid. No VC queue is modified.
  375. *
  376. * @warning IxAtmSch assumes that the calling software ensures that
  377. * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
  378. * ixAtmSchTableUpdate are both self and mutually exclusive
  379. * for the same port.
  380. *
  381. * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
  382. PUBLIC IX_STATUS
  383. ixAtmSchVcQueueClear( IxAtmLogicalPort port,
  384. IxAtmSchedulerVcId vcId);
  385. /**
  386. * @ingroup IxAtmSch
  387. *
  388. * @fn ixAtmSchTableUpdate( IxAtmLogicalPort port,
  389. unsigned int maxCells,
  390. IxAtmScheduleTable **rettable)
  391. *
  392. * @brief The client calls this function to request an update of the
  393. * schedule table for a particular ATM port.
  394. *
  395. * This is called when the client decides it needs a new sequence of
  396. * cells to send (probably because the transmit queue is near to
  397. * empty for this ATM port). The scheduler will use its stored
  398. * information on the cells submitted for transmit (i.e. data
  399. * supplied via @ref ixAtmSchVcQueueUpdate function) with the traffic
  400. * descriptor information of all established VCs on the ATM port to
  401. * decide the sequence of cells to be sent and fill the schedule
  402. * table for a period of time into the future.
  403. *
  404. * IxAtmSch will guarantee a minimum of minCellsToSchedule if there
  405. * is at least one cell ready to send. If there are no cells then
  406. * IX_ATMSCH_RET_QUEUE_EMPTY is returned.
  407. *
  408. * This implementation of ixAtmSchTableUpdate uses no operating
  409. * system or external facilities, either directly or indirectly.
  410. * This allows clients to call this function form within an FIQ
  411. * interrupt handler.
  412. *
  413. * @param port @ref IxAtmLogicalPort [in] - Specifies the ATM port for which requested
  414. * schedule table is to be generated.
  415. *
  416. * @param maxCells unsigned [in] - Specifies the maximum number of cells
  417. * that must be scheduled in the supplied table during any
  418. * call to the interface.
  419. *
  420. * @param **table @ref IxAtmScheduleTable [out] - A pointer to an area of
  421. * storage is returned which contains the generated
  422. * schedule table. The client should not modify the
  423. * contents of this table.
  424. *
  425. * @return
  426. * - <b>IX_SUCCESS :</b> The schedule table has been published.
  427. * Currently there is at least one VC queue that is nonempty.
  428. * - <b>IX_ATMSCH_RET_QUEUE_EMPTY :</b> Currently all VC queues on
  429. * this port are empty. The schedule table returned is set to
  430. * NULL. The client is not expected to invoke this function
  431. * again until more cells have been submitted on this port
  432. * through the @ref ixAtmSchVcQueueUpdate function.
  433. * - <b>IX_FAIL :</b> The input are invalid. No action is taken.
  434. *
  435. * @warning IxAtmSch assumes that the calling software ensures that
  436. * calls to ixAtmSchVcQueueUpdate, ixAtmSchVcQueueClear and
  437. * ixAtmSchTableUpdate are both self and mutually exclusive
  438. * for the same port.
  439. *
  440. * @warning Subsequent calls to this function for the same port will
  441. * overwrite the contents of previously supplied schedule
  442. * tables. The client must be completely finished with the
  443. * previously supplied schedule table before calling this
  444. * function again for the same port.
  445. *
  446. * @sa ixAtmSchVcQueueUpdate(), ixAtmSchVcQueueClear(), ixAtmSchTableUpdate(). */
  447. PUBLIC IX_STATUS
  448. ixAtmSchTableUpdate( IxAtmLogicalPort port,
  449. unsigned int maxCells,
  450. IxAtmScheduleTable **rettable);
  451. /**
  452. * @ingroup IxAtmSch
  453. *
  454. * @fn ixAtmSchShow(void)
  455. *
  456. * @brief Utility function which will print statistics on the current
  457. * and accumulated state of VCs and traffic in the ATM
  458. * scheduler component. Output is sent to the default output
  459. * device.
  460. *
  461. * @param none
  462. * @return none
  463. */
  464. PUBLIC void
  465. ixAtmSchShow(void);
  466. /**
  467. * @ingroup IxAtmSch
  468. *
  469. * @fn ixAtmSchStatsClear(void)
  470. *
  471. * @brief Utility function which will reset all counter statistics in
  472. * the ATM scheduler to zero.
  473. *
  474. * @param none
  475. * @return none
  476. */
  477. PUBLIC void
  478. ixAtmSchStatsClear(void);
  479. #endif
  480. /* IXATMSCH_H */
  481. /** @} */