6 * @brief IxAtmdAcc Public API
8 * This file contains the public API of IxAtmdAcc, related to the
9 * data functions of the component
13 * IXP400 SW Release version 2.0
15 * -- Copyright Notice --
18 * Copyright 2001-2005, Intel Corporation.
19 * All rights reserved.
22 * SPDX-License-Identifier: BSD-3-Clause
24 * -- End of Copyright Notice --
27 /* ------------------------------------------------------
28 Doxygen group definitions
29 ------------------------------------------------------ */
33 * @defgroup IxAtmdAccAPI IXP400 ATM Driver Access (IxAtmdAcc) API
35 * @brief The public API for the IXP400 Atm Driver Data component
37 * IxAtmdAcc is the low level interface by which AAL0/AAL5 and
38 * OAM data gets transmitted to,and received from the Utopia bus.
40 * For AAL0/AAL5 services transmit and receive connections may
41 * be established independantly for unique combinations of
44 * Two AAL0 services supporting 48 or 52 byte cell data are provided.
45 * Submitted AAL0 PDUs must be a multiple of the cell data size (48/52).
46 * AAL0_52 is a raw cell service the client must format
47 * the PDU with an ATM cell header (excluding HEC) at the start of
48 * each cell, note that AtmdAcc does not validate the cell headers in
51 * OAM cells cannot be received over the AAL0 service but instead
52 * are received over a dedicated OAM service.
54 * For the OAM service an "OAM Tx channel" may be enabled for a port
55 * by establishing a single dedicated OAM Tx connection on that port.
56 * A single "OAM Rx channel" for all ports may be enabled by
57 * establishing a dedicated OAM Rx connection.
59 * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
60 * to be transmitted and received over the dedicated OAM channels.
61 * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
62 * service offered by AtmdAcc is a raw cell transport service.
63 * It is assumed that ITU I.610 procedures that make use of this
64 * service are implemented above AtmdAcc.
66 * Note that the dedicated OAM connections are established on
67 * reserved VPI,VCI, and (in the case of Rx) port values defined below.
68 * These values are used purely to descriminate the dedicated OAM channels
69 * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
70 * realised for particluar VPI/VCIs by manipulating the VPI,VCI
71 * fields of the ATM cell headers of cells in the buffers passed
72 * to AtmdAcc. Note that AtmdAcc does not validate the cell headers
73 * in a submitted OAM PDU.
77 * This part is related to the User datapath processing
85 #include "IxAtmTypes.h"
87 /* ------------------------------------------------------
88 AtmdAcc Data Types definition
89 ------------------------------------------------------ */
93 * @ingroup IxAtmdAccAPI
95 * @def IX_ATMDACC_WARNING
97 * @brief Warning return code
99 * This constant is used to tell IxAtmDAcc user about a special case.
102 #define IX_ATMDACC_WARNING 2
106 * @ingroup IxAtmdAccAPI
108 * @def IX_ATMDACC_BUSY
110 * @brief Busy return code
112 * This constant is used to tell IxAtmDAcc user that the request
113 * is correct, but cannot be processed because the IxAtmAcc resources
114 * are already used. The user has to retry its request later
117 #define IX_ATMDACC_BUSY 3
121 * @ingroup IxAtmdAccAPI
123 * @def IX_ATMDACC_RESOURCES_STILL_ALLOCATED
125 * @brief Disconnect return code
127 * This constant is used to tell IxAtmDAcc user that the disconnect
128 * functions are not complete because the resources used by the driver
129 * are not yet released. The user has to retry the disconnect call
133 #define IX_ATMDACC_RESOURCES_STILL_ALLOCATED 4
137 * @ingroup IxAtmdAccAPI
139 * @def IX_ATMDACC_DEFAULT_REPLENISH_COUNT
141 * @brief Default resources usage for RxVcFree replenish mechanism
143 * This constant is used to tell IxAtmDAcc to allocate and use
144 * the minimum of resources for rx free replenish.
146 * @sa ixAtmdAccRxVcConnect
148 #define IX_ATMDACC_DEFAULT_REPLENISH_COUNT 0
152 * @ingroup IxAtmdAccAPI
154 * @def IX_ATMDACC_OAM_TX_VPI
156 * @brief The reserved value used for the dedicated OAM
157 * Tx connection. This "well known" value is used by atmdAcc and
158 * its clients to dsicriminate the OAM channel, and should be chosen so
159 * that it does not coencide with the VPI value used in an AAL0/AAL5 connection.
160 * Any attempt to connect a service type other than OAM on this VPI will fail.
164 #define IX_ATMDACC_OAM_TX_VPI 0
167 * @ingroup IxAtmdAccAPI
169 * @def IX_ATMDACC_OAM_TX_VCI
171 * @brief The reserved value used for the dedicated OAM
172 * Tx connection. This "well known" value is used by atmdAcc and
173 * its clients to dsicriminate the OAM channel, and should be chosen so
174 * that it does not coencide with the VCI value used in an AAL0/AAL5 connection.
175 * Any attempt to connect a service type other than OAM on this VCI will fail.
177 #define IX_ATMDACC_OAM_TX_VCI 0
181 * @ingroup IxAtmdAccAPI
183 * @def IX_ATMDACC_OAM_RX_PORT
185 * @brief The reserved dummy PORT used for all dedicated OAM
186 * Rx connections. Note that this is not a real port but must
187 * have a value that lies within the valid range of port values.
189 #define IX_ATMDACC_OAM_RX_PORT IX_UTOPIA_PORT_0
192 * @ingroup IxAtmdAccAPI
194 * @def IX_ATMDACC_OAM_RX_VPI
196 * @brief The reserved value value used for the dedicated OAM
197 * Rx connection. This value should be chosen so that it does not
198 * coencide with the VPI value used in an AAL0/AAL5 connection.
199 * Any attempt to connect a service type other than OAM on this VPI will fail.
201 #define IX_ATMDACC_OAM_RX_VPI 0
204 * @ingroup IxAtmdAccAPI
206 * @def IX_ATMDACC_OAM_RX_VCI
208 * @brief The reserved value value used for the dedicated OAM
209 * Rx connection. This value should be chosen so that it does not
210 * coencide with the VCI value used in an AAL0/AAL5 connection.
211 * Any attempt to connect a service type other than OAM on this VCI will fail.
213 #define IX_ATMDACC_OAM_RX_VCI 0
217 * @enum IxAtmdAccPduStatus
219 * @ingroup IxAtmdAccAPI
221 * @brief IxAtmdAcc Pdu status :
223 * IxAtmdAccPduStatus is used during a RX operation to indicate
224 * the status of the received PDU
230 IX_ATMDACC_AAL0_VALID = 0, /**< aal0 pdu */
231 IX_ATMDACC_OAM_VALID, /**< OAM pdu */
232 IX_ATMDACC_AAL2_VALID, /**< aal2 pdu @b reserved for future use */
233 IX_ATMDACC_AAL5_VALID, /**< aal5 pdu complete and trailer is valid */
234 IX_ATMDACC_AAL5_PARTIAL, /**< aal5 pdu not complete, trailer is missing */
235 IX_ATMDACC_AAL5_CRC_ERROR, /**< aal5 pdu not complete, crc error/length error */
236 IX_ATMDACC_MBUF_RETURN /**< empty buffer returned to the user */
237 } IxAtmdAccPduStatus;
242 * @enum IxAtmdAccAalType
244 * @ingroup IxAtmdAccAPI
246 * @brief IxAtmdAcc AAL Service Type :
248 * IxAtmdAccAalType defines the type of traffic to run on this VC
253 IX_ATMDACC_AAL5, /**< ITU-T AAL5 */
254 IX_ATMDACC_AAL2, /**< ITU-T AAL2 @b reserved for future use */
255 IX_ATMDACC_AAL0_48, /**< AAL0 48 byte payloads (cell header is added by NPE)*/
256 IX_ATMDACC_AAL0_52, /**< AAL0 52 byte cell data (HEC is added by NPE) */
257 IX_ATMDACC_OAM, /**< OAM cell transport service (HEC is added by NPE)*/
258 IX_ATMDACC_MAX_SERVICE_TYPE /**< not a service, used for parameter validation */
263 * @enum IxAtmdAccClpStatus
265 * @ingroup IxAtmdAccAPI
267 * @brief IxAtmdAcc CLP indication
269 * IxAtmdAccClpStatus defines the CLP status of the current PDU
274 IX_ATMDACC_CLP_NOT_SET = 0, /**< CLP indication is not set */
275 IX_ATMDACC_CLP_SET = 1 /**< CLP indication is set */
276 } IxAtmdAccClpStatus;
279 * @typedef IxAtmdAccUserId
281 * @ingroup IxAtmdAccAPI
283 * @brief User-supplied Id
285 * IxAtmdAccUserId is passed through callbacks and allows the
286 * IxAtmdAcc user to identify the source of a call back. The range of
287 * this user-owned Id is [0...2^32-1)].
289 * The user provides this own Ids on a per-channel basis as a parameter
290 * in a call to @a ixAtmdAccRxVcConnect() or @a ixAtmdAccRxVcConnect()
292 * @sa ixAtmdAccRxVcConnect
293 * @sa ixAtmdAccTxVcConnect
296 typedef unsigned int IxAtmdAccUserId;
298 /* ------------------------------------------------------
299 Part of the IxAtmdAcc interface related to RX traffic
300 ------------------------------------------------------ */
304 * @ingroup IxAtmdAccAPI
306 * @brief Rx callback prototype
308 * IxAtmdAccRxVcRxCallback is the prototype of the Rx callback user
309 * function called once per PDU to pass a receive Pdu to a user on a
310 * partilcular connection. The callback is likely to push the mbufs
311 * to a protocol layer, and recycle the mbufs for a further use.
313 * @note -This function is called ONLY in the context of
314 * the @a ixAtmdAccRxDispatch() function
316 * @sa ixAtmdAccRxDispatch
317 * @sa ixAtmdAccRxVcConnect
319 * @param port @ref IxAtmLogicalPort [in] - the port on which this PDU was received
320 * a logical PHY port [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
321 * @param userId @ref IxAtmdAccUserId [in] - user Id provided in the call
322 * to @a ixAtmdAccRxVcConnect()
323 * @param status @ref IxAtmdAccPduStatus [in] - an indication about the PDU validity.
324 * In the case of AAL0 the only possibile value is
325 * AAL0_VALID, in this case the client may optionally determine
326 * that an rx timeout occured by checking if the mbuf is
327 * compleletly or only partially filled, the later case
328 * indicating a timeout.
329 * In the case of OAM the only possible value is OAM valid.
330 * The status is set to @a IX_ATMDACC_MBUF_RETURN when
331 * the mbuf is released during a disconnect process.
332 * @param clp @ref IxAtmdAccClpStatus [in] - clp indication for this PDU.
333 * For AAL5/AAL0_48 this information
334 * is set if the clp bit of any rx cell is set
335 * For AAL0-52/OAM the client may inspect the CLP in individual
336 * cell headers in the PDU, and this parameter is set to 0.
337 * @param *mbufPtr @ref IX_OSAL_MBUF [in] - depending on the servive type a pointer to
338 * an mbuf (AAL5/AAL0/OAM) or mbuf chain (AAL5 only),
339 * that comprises the complete PDU data.
341 * This parameter is guaranteed not to be a null pointer.
344 typedef void (*IxAtmdAccRxVcRxCallback) (IxAtmLogicalPort port,
345 IxAtmdAccUserId userId,
346 IxAtmdAccPduStatus status,
347 IxAtmdAccClpStatus clp,
348 IX_OSAL_MBUF * mbufPtr);
352 * @ingroup IxAtmdAccAPI
354 * @brief Callback prototype for free buffer level is low.
356 * IxAtmdAccRxVcFreeLowCallback is the prototype of the user function
357 * which get called on a per-VC basis, when more mbufs are needed to
358 * continue the ATM data reception. This function is likely to supply
359 * more available mbufs by one or many calls to the replenish function
360 * @a ixAtmdAccRxVcFreeReplenish()
362 * This function is called when the number of available buffers for
363 * reception is going under the threshold level as defined
364 * in @a ixAtmdAccRxVcFreeLowCallbackRegister()
366 * This function is called inside an Qmgr dispatch context. No system
367 * resource or interrupt-unsafe feature should be used inside this
370 * @sa ixAtmdAccRxVcFreeLowCallbackRegister
371 * @sa IxAtmdAccRxVcFreeLowCallback
372 * @sa ixAtmdAccRxVcFreeReplenish
373 * @sa ixAtmdAccRxVcFreeEntriesQuery
374 * @sa ixAtmdAccRxVcConnect
376 * @param userId @ref IxAtmdAccUserId [in] - user Id provided in the call
377 * to @a ixAtmdAccRxVcConnect()
382 typedef void (*IxAtmdAccRxVcFreeLowCallback) (IxAtmdAccUserId userId);
384 /* ------------------------------------------------------
385 Part of the IxAtmdAcc interface related to TX traffic
386 ------------------------------------------------------ */
390 * @ingroup IxAtmdAccAPI
392 * @brief Buffer callback prototype.
394 * This function is called to relinguish ownership of a transmitted
395 * buffer chain to the user.
397 * @note -In the case of a chained mbuf the AmtdAcc component can
398 * chain many user buffers together and pass ownership to the user in
401 * @param userId @ref IxAtmdAccUserId [in] - user If provided at registration of this
403 * @param mbufPtr @ref IX_OSAL_MBUF [in] - a pointer to mbufs or chain of mbufs and is
404 * guaranteed not to be a null pointer.
407 typedef void (*IxAtmdAccTxVcBufferReturnCallback) (IxAtmdAccUserId userId,
408 IX_OSAL_MBUF * mbufPtr);
410 /* ------------------------------------------------------
411 Part of the IxAtmdAcc interface related to Initialisation
412 ------------------------------------------------------ */
416 * @ingroup IxAtmdAccAPI
418 * @fn ixAtmdAccInit (void)
420 * @brief Initialise the IxAtmdAcc Component
422 * This function initialise the IxAtmdAcc component. This function shall
423 * be called before any other function of the API. Its role is to
424 * initialise all internal resources of the IxAtmdAcc component.
426 * The ixQmgr component needs to be initialized prior the use of
431 * Failing to initilialize the IxAtmdAcc API before any use of it will
432 * result in a failed status.
433 * If the specified component is not present, a success status will still be
434 * returned, however, a warning indicating the NPE to download to is not
435 * present will be issued.
437 * @return @li IX_SUCCESS initialisation is complete (in case of component not
438 * being present, a warning is clearly indicated)
439 * @return @li IX_FAIL unable to process this request either
440 * because this IxAtmdAcc is already initialised
441 * or some unspecified error has occrred.
443 PUBLIC IX_STATUS ixAtmdAccInit (void);
447 * @ingroup IxAtmdAccAPI
449 * @fn ixAtmdAccShow (void)
451 * @brief Show IxAtmdAcc configuration on a per port basis
457 * @note - Display use printf() and are redirected to stdout
460 ixAtmdAccShow (void);
464 * @ingroup IxAtmdAccAPI
466 * @fn ixAtmdAccStatsShow (void)
468 * @brief Show all IxAtmdAcc stats
474 * @note - Stats display use printf() and are redirected to stdout
477 ixAtmdAccStatsShow (void);
481 * @ingroup IxAtmdAccAPI
483 * @fn ixAtmdAccStatsReset (void)
485 * @brief Reset all IxAtmdAcc stats
493 ixAtmdAccStatsReset (void);
495 /* ------------------------------------------------------
496 Part of the IxAtmdAcc interface related to RX traffic
497 ------------------------------------------------------ */
501 * @ingroup IxAtmdAccAPI
503 * @fn ixAtmdAccRxVcConnect (IxAtmLogicalPort port,
506 IxAtmdAccAalType aalServiceType,
507 IxAtmRxQueueId rxQueueId,
508 IxAtmdAccUserId userCallbackId,
509 IxAtmdAccRxVcRxCallback rxCallback,
510 unsigned int minimumReplenishCount,
511 IxAtmConnId * connIdPtr,
512 IxAtmNpeRxVcId * npeVcIdPtr )
514 * @brief Connect to a Aal Pdu receive service for a particular
515 * port/vpi/vci, and service type.
517 * This function allows a user to connect to an Aal5/Aal0/OAM Pdu receive service
518 * for a particular port/vpi/vci. It registers the callback and allocates
519 * internal resources and a Connection Id to be used in further API calls
520 * related to this VCC.
522 * The function will setup VC receive service on the specified rx queue.
524 * This function is blocking and makes use internal locks, and hence
525 * should not be called from an interrupt context.
527 * On return from @a ixAtmdAccRxVcConnect() with a failure status, the
528 * connection Id parameter is unspecified. Its value cannot be used.
529 * A connId is the reference by which IxAtmdAcc refers to a
530 * connected VC. This identifier is the result of a succesful call
531 * to a connect function. This identifier is invalid after a
532 * sucessful call to a disconnect function.
534 * Calling this function for the same combination of Vpi, Vci and more
535 * than once without calling @a ixAtmdAccRxVcTryDisconnect() will result in a
538 * If this function returns success the user should supply receive
539 * buffers by calling @a ixAtmdAccRxVcFreeReplenish() and then call
540 * @a ixAtmdAccRxVcEnable() to begin receiving pdus.
542 * There is a choice of two receive Qs on which the VC pdus could be
543 * receive. The user must associate the VC with one of these. Essentially
544 * having two qs allows more flexible system configuration such as have
545 * high prioriy traffic on one q (e.g. voice) and low priority traffic on
546 * the other (e.g. data). The high priority Q could be serviced in
547 * preference to the low priority Q. One queue may be configured to be
548 * serviced as soon as there is traffic, the other queue may be configured
549 * to be serviced by a polling mechanism running at idle time.
551 * Two AAL0 services supporting 48 or 52 byte cell data are provided.
552 * Received AAL0 PDUs will be be a multiple of the cell data size (48/52).
553 * AAL0_52 is a raw cell service and includes an ATM cell header
554 * (excluding HEC) at the start of each cell.
556 * A single "OAM Rx channel" for all ports may be enabled by
557 * establishing a dedicated OAM Rx connection.
559 * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
560 * to be transmitted and received over the dedicated OAM channels.
561 * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
562 * service offered by AtmdAcc is a raw cell transport service.
563 * It is assumed that ITU I.610 procedures that make use of this
564 * service are implemented above AtmdAcc.
566 * Note that the dedicated OAM connections are established on
567 * reserved VPI,VCI, and (in the case of Rx) port values.
568 * These values are used purely to descriminate the dedicated OAM channels
569 * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
570 * realised for particluar VPI/VCIs by manipulating the VPI,VCI
571 * fields of the ATM cell headers of cells in the buffers passed
574 * Calling this function prior to enable the port will fail.
576 * @sa ixAtmdAccRxDispatch
577 * @sa ixAtmdAccRxVcEnable
578 * @sa ixAtmdAccRxVcDisable
579 * @sa ixAtmdAccRxVcTryDisconnect
580 * @sa ixAtmdAccPortEnable
582 * @param port @ref IxAtmLogicalPort [in] - VC identification : logical PHY port
583 * [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
584 * @param vpi unsigned int [in] - VC identification : ATM Vpi [0..255] or IX_ATMDACC_OAM_VPI
585 * @param vci unsigned int [in] - VC identification : ATM Vci [0..65535] or IX_ATMDACC_OAM_VCI
586 * @param aalServiceType @ref IxAtmdAccAalType [in] - type of service: AAL5, AAL0_48, AAL0_52, or OAM
587 * @param rxQueueId @ref IxAtmRxQueueId [in] - this identifieds which of two Qs the VC
588 * should use.when icoming traffic is processed
589 * @param userCallbackId @ref IxAtmdAccUserId [in] - user Id used later as a parameter to
590 * the supplied rxCallback.
591 * @param rxCallback [in] @ref IxAtmdAccRxVxRxCallback - function called when mbufs are received.
592 * This parameter cannot be a null pointer.
593 * @param bufferFreeCallback [in] - function to be called to return
594 * ownership of buffers to IxAtmdAcc user.
595 * @param minimumReplenishCount unsigned int [in] - For AAL5/AAL0 the number of free mbufs
596 * to be used with this channel. Use a high number when the expected traffic
597 * rate on this channel is high, or when the user's mbufs are small, or when
598 * the RxVcFreeLow Notification has to be invoked less often. When this
599 * value is IX_ATMDACC_DEFAULT_REPLENISH_COUNT, the minimum of
600 * resources will be used. Depending on traffic rate, pdu
601 * size and mbuf size, rxfree queue size, polling/interrupt rate, this value may
602 * require to be replaced by a different value in the range 1-128
603 * For OAM the rxFree queue size is fixed by atmdAcc and this parameter is ignored.
604 * @param connIdPtr @ref IxAtmConnId [out] - pointer to a connection Id
605 * This parameter cannot be a null pointer.
606 * @param npeVcIdPtr @ref IxAtmNpeRxVcId [out] - pointer to an npe Vc Id
607 * This parameter cannot be a null pointer.
609 * @return @li IX_SUCCESS successful call to IxAtmdAccRxVcConnect
610 * @return @li IX_ATMDACC_BUSY cannot process this request :
612 * @return @li IX_FAIL
615 * attempt to connect AAL service on reserved OAM VPI/VCI,
616 * attempt to connect OAM service on VPI/VCI other than the reserved OAM VPI/VCI,
617 * port is not initialised,
618 * or some other error occurs during processing.
621 PUBLIC IX_STATUS ixAtmdAccRxVcConnect (IxAtmLogicalPort port,
624 IxAtmdAccAalType aalServiceType,
625 IxAtmRxQueueId rxQueueId,
626 IxAtmdAccUserId userCallbackId,
627 IxAtmdAccRxVcRxCallback rxCallback,
628 unsigned int minimumReplenishCount,
629 IxAtmConnId * connIdPtr,
630 IxAtmNpeRxVcId * npeVcIdPtr );
634 * @ingroup IxAtmdAccAPI
636 * @fn ixAtmdAccRxVcFreeReplenish (IxAtmConnId connId,
637 IX_OSAL_MBUF * mbufPtr)
639 * @brief Provide free mbufs for data reception on a connection.
641 * This function provides mbufs for data reception by the hardware. This
642 * function needs to be called by the user on a regular basis to ensure
643 * no packet loss. Providing free buffers is a connection-based feature;
644 * each connection can have different requirements in terms of buffer size
645 * number of buffers, recycling rate. This function could be invoked from
646 * within the context of a @a IxAtmdAccRxVcFreeLowCallback() callback
647 * for a particular VC
649 * Mbufs provided through this function call can be chained. They will be
650 * unchained internally. A call to this function with chained mbufs or
651 * multiple calls with unchained mbufs are equivalent, but calls with
652 * unchained mbufs are more efficients.
654 * Mbufs provided to this interface need to be able to hold at least one
655 * full cell payload (48/52 bytes, depending on service type).
656 * Chained buffers with a size less than the size supported by the hardware
657 * will be returned through the rx callback provided during the connect step.
659 * Failing to invoke this function prior to enabling the RX traffic
660 * can result in packet loss.
662 * This function is not reentrant for the same connId.
664 * This function does not use system resources and can be
665 * invoked from an interrupt context.
667 * @note - Over replenish is detected, and extra mbufs are returned through
668 * the rx callback provided during the connect step.
670 * @note - Mbuf provided to the replenish function should have a length greater or
671 * equal to 48/52 bytes according to service type.
673 * @note - The memory cache of mMbuf payload should be invalidated prior to Mbuf
674 * submission. Flushing the Mbuf headers is handled by IxAtmdAcc.
676 * @note - When a chained mbuf is provided, this function process the mbufs
677 * up to the hardware limit and invokes the user-supplied callback
678 * to release extra buffers.
680 * @sa ixAtmdAccRxVcFreeLowCallbackRegister
681 * @sa IxAtmdAccRxVcFreeLowCallback
682 * @sa ixAtmdAccRxVcConnect
684 * @param connId @ref IxAtmConnId [in] - connection Id as returned from a succesfull call to
685 * @a IxAtmdAccRxVcConnect()
686 * @param mbufPtr @ref IX_OSAL_MBUF [in] - pointer to a mbuf structure to be used for data
687 * reception. The mbuf pointed to by this parameter can be chained
690 * @return @li IX_SUCCESS successful call to @a ixAtmdAccRxVcFreeReplenish()
691 * and the mbuf is now ready to use for incoming traffic.
692 * @return @li IX_ATMDACC_BUSY cannot process this request because
693 * the max number of outstanding free buffers has been reached
694 * or the internal resources have exhausted for this VC.
695 * The user is responsible for retrying this request later.
696 * @return @li IX_FAIL cannot process this request because of parameter
697 * errors or some unspecified internal error has occurred.
699 * @note - It is not always guaranteed the replenish step to be as fast as the
700 * hardware is consuming Rx Free mbufs. There is nothing in IxAtmdAcc to
701 * guarantee that replenish reaches the rxFree threshold level. If the
702 * threshold level is not reached, the next rxFree low notification for
703 * this channel will not be triggered.
704 * The preferred ways to replenish can be as follows (depending on
705 * applications and implementations) :
706 * @li Replenish in a rxFree low notification until the function
707 * ixAtmdAccRxVcFreeReplenish() returns IX_ATMDACC_BUSY
708 * @li Query the queue level using @sa ixAtmdAccRxVcFreeEntriesQuery, then
709 * , replenish using @a ixAtmdAccRxVcFreeReplenish(), then query the queue
710 * level again, and replenish if the threshold is still not reached.
711 * @li Trigger replenish from an other event source and use rxFree starvation
712 * to throttle the Rx traffic.
715 PUBLIC IX_STATUS ixAtmdAccRxVcFreeReplenish (IxAtmConnId connId,
716 IX_OSAL_MBUF * mbufPtr);
720 * @ingroup IxAtmdAccAPI
722 * @fn ixAtmdAccRxVcFreeLowCallbackRegister (IxAtmConnId connId,
723 unsigned int numberOfMbufs,
724 IxAtmdAccRxVcFreeLowCallback callback)
726 * @brief Configure the RX Free threshold value and register a callback
727 * to handle threshold notifications.
729 * The function ixAtmdAccRxVcFreeLowCallbackRegister sets the threshold value for
730 * a particular RX VC. When the number of buffers reaches this threshold
731 * the callback is invoked.
733 * This function should be called once per VC before RX traffic is
734 * enabled.This function will fail if the curent level of the free buffers
735 * is equal or less than the threshold value.
737 * @sa ixAtmdAccRxVcFreeLowCallbackRegister
738 * @sa IxAtmdAccRxVcFreeLowCallback
739 * @sa ixAtmdAccRxVcFreeReplenish
740 * @sa ixAtmdAccRxVcFreeEntriesQuery
741 * @sa ixAtmdAccRxVcConnect
743 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
744 * to @a IxAtmdAccRxVcConnect()
745 * @param numberOfMbufs unsigned int [in] - threshold number of buffers. This number
746 * has to be a power of 2, one of the values 0,1,2,4,8,16,32....
747 * The maximum value cannot be more than half of the rxFree queue
748 * size (which can be retrieved using @a ixAtmdAccRxVcFreeEntriesQuery()
749 * before any use of the @a ixAtmdAccRxVcFreeReplenish() function)
750 * @param callback @ref IxAtmdAccRxVcFreeLowCallback [in] - function telling the user that the number of
751 * free buffers has reduced to the threshold value.
753 * @return @li IX_SUCCESS Threshold set successfully.
754 * @return @li IX_FAIL parameter error or the current number of free buffers
755 * is less than or equal to the threshold supplied or some
756 * unspecified error has occrred.
758 * @note - the callback will be called when the threshold level will drop from
759 * exactly (numberOfMbufs + 1) to (numberOfMbufs).
762 PUBLIC IX_STATUS ixAtmdAccRxVcFreeLowCallbackRegister (IxAtmConnId connId,
763 unsigned int numberOfMbufs,
764 IxAtmdAccRxVcFreeLowCallback callback);
768 * @ingroup IxAtmdAccAPI
770 * @fn ixAtmdAccRxVcFreeEntriesQuery (IxAtmConnId connId,
771 unsigned int *numberOfMbufsPtr)
773 * @brief Get the number of rx mbufs the system can accept to replenish the
774 * the rx reception mechanism on a particular channel
776 * The ixAtmdAccRxVcFreeEntriesQuery function is used to retrieve the current
777 * number of available mbuf entries for reception, on a per-VC basis. This
778 * function can be used to know the number of mbufs which can be provided
779 * using @a ixAtmdAccRxVcFreeReplenish().
781 * This function can be used from a timer context, or can be associated
782 * with a threshold event, or can be used inside an active polling
783 * mechanism which is under user control.
785 * This function is reentrant and does not use system resources and can
786 * be invoked from an interrupt context.
788 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
789 * to @a IxAtmdAccRxVcConnect()
790 * @param numberOfMbufsPtr unsigned int [out] - Pointer to the number of available entries.
791 * . This parameter cannot be a null pointer.
793 * @return @li IX_SUCCESS the current number of mbufs not yet used for incoming traffic
794 * @return @li IX_FAIL invalid parameter
796 * @sa ixAtmdAccRxVcFreeReplenish
799 PUBLIC IX_STATUS ixAtmdAccRxVcFreeEntriesQuery (IxAtmConnId connId,
800 unsigned int *numberOfMbufsPtr);
804 * @ingroup IxAtmdAccAPI
806 * @fn ixAtmdAccRxVcEnable (IxAtmConnId connId)
808 * @brief Start the RX service on a VC.
810 * This functions kicks-off the traffic reception for a particular VC.
811 * Once invoked, incoming PDUs will be made available by the hardware
812 * and are eventually directed to the @a IxAtmdAccRxVcRxCallback() callback
813 * registered for the connection.
815 * If the traffic is already running, this function returns IX_SUCCESS.
816 * This function can be invoked many times.
818 * IxAtmdAccRxVcFreeLowCallback event will occur only after
819 * @a ixAtmdAccRxVcEnable() function is invoked.
821 * Before using this function, the @a ixAtmdAccRxVcFreeReplenish() function
822 * has to be used to replenish the RX Free queue. If not, incoming traffic
823 * may be discarded.and in the case of interrupt driven reception the
824 * @a IxAtmdAccRxVcFreeLowCallback() callback may be invoked as a side effect
825 * during a replenish action.
827 * This function is not reentrant and should not be used inside an
830 * For an VC connection this function can be called after a call to
831 * @a ixAtmdAccRxVcDisable() and should not be called after
832 * @a ixAtmdAccRxVcTryDisconnect()
834 * @sa ixAtmdAccRxVcDisable
835 * @sa ixAtmdAccRxVcConnect
836 * @sa ixAtmdAccRxVcFreeReplenish
838 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call
839 * to @a IxAtmdAccRxVcConnect()
841 * @return @li IX_SUCCESS successful call to ixAtmdAccRxVcEnable
842 * @return @li IX_ATMDACC_WARNING the channel is already enabled
843 * @return @li IX_FAIL invalid parameters or some unspecified internal
847 PUBLIC IX_STATUS ixAtmdAccRxVcEnable (IxAtmConnId connId);
851 * @ingroup IxAtmdAccAPI
853 * @fn ixAtmdAccRxVcDisable (IxAtmConnId connId)
855 * @brief Stop the RX service on a VC.
857 * This functions stops the traffic reception for a particular VC connection.
859 * Once invoked, incoming Pdus are discarded by the hardware. Any Pdus
860 * pending will be freed to the user
862 * Hence once this function returns no more receive callbacks will be
863 * called for that VC. However, buffer free callbacks will be invoked
864 * until such time as all buffers supplied by the user have been freed
867 * Calling this function doe not invalidate the connId.
868 * @a ixAtmdAccRxVcEnable() can be invoked to enable Pdu reception again.
870 * If the traffic is already stopped, this function returns IX_SUCCESS.
872 * This function is not reentrant and should not be used inside an
875 * @sa ixAtmdAccRxVcConnect
876 * @sa ixAtmdAccRxVcEnable
877 * @sa ixAtmdAccRxVcDisable
879 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to @a
880 * IxAtmdAccRxVcConnect()
882 * @return @li IX_SUCCESS successful call to @a ixAtmdAccRxVcDisable().
883 * @return @li IX_ATMDACC_WARNING the channel is already disabled
884 * @return @li IX_FAIL invalid parameters or some unspecified internal error occured
887 PUBLIC IX_STATUS ixAtmdAccRxVcDisable (IxAtmConnId connId);
891 * @ingroup IxAtmdAccAPI
893 * @fn ixAtmdAccRxVcTryDisconnect (IxAtmConnId connId)
895 * @brief Disconnect a VC from the RX service.
897 * This function deregisters the VC and guarantees that all resources
898 * associated with this VC are free. After its execution, the connection
899 * Id is not available.
901 * This function will fail until such time as all resources allocated to
902 * the VC connection have been freed. The user is responsible to delay and
903 * call again this function many times until a success status is returned.
905 * This function needs internal locks and should not be called from an
908 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
909 * @a IxAtmdAccRxVcConnect()
911 * @return @li IX_SUCCESS successful call to ixAtmdAccRxVcDisable
912 * @return @li IX_ATMDACC_RESOURCES_STILL_ALLOCATED not all resources
913 * associated with the connection have been freed.
914 * @return @li IX_FAIL cannot process this request because of a parameter
918 PUBLIC IX_STATUS ixAtmdAccRxVcTryDisconnect (IxAtmConnId connId);
920 /* ------------------------------------------------------
921 Part of the IxAtmdAcc interface related to TX traffic
922 ------------------------------------------------------ */
926 * @ingroup IxAtmdAccAPI
928 * @fn ixAtmdAccTxVcConnect (IxAtmLogicalPort port,
931 IxAtmdAccAalType aalServiceType,
932 IxAtmdAccUserId userId,
933 IxAtmdAccTxVcBufferReturnCallback bufferFreeCallback,
934 IxAtmConnId * connIdPtr)
936 * @brief Connect to a Aal Pdu transmit service for a particular
937 * port/vpi/vci and service type.
939 * This function allows a user to connect to an Aal5/Aal0/OAM Pdu transmit service
940 * for a particular port/vpi/vci. It registers the callback and allocates
941 * internal resources and a Connection Id to be used in further API calls
942 * related to this VC.
944 * The function will setup VC transmit service on the specified on the
945 * specified port. A connId is the reference by which IxAtmdAcc refers to a
946 * connected VC. This identifier is the result of a succesful call
947 * to a connect function. This identifier is invalid after a
948 * sucessful call to a disconnect function.
950 * This function needs internal locks, and hence should not be called
951 * from an interrupt context.
953 * On return from @a ixAtmdAccTxVcConnect() with a failure status, the
954 * connection Id parameter is unspecified. Its value cannot be used.
956 * Calling this function for the same combination of port, Vpi, Vci and
957 * more than once without calling @a ixAtmdAccTxVcTryDisconnect() will result
958 * in a failure status.
960 * Two AAL0 services supporting 48 or 52 byte cell data are provided.
961 * Submitted AAL0 PDUs must be a multiple of the cell data size (48/52).
962 * AAL0_52 is a raw cell service the client must format
963 * the PDU with an ATM cell header (excluding HEC) at the start of
964 * each cell, note that AtmdAcc does not validate the cell headers in
967 * For the OAM service an "OAM Tx channel" may be enabled for a port
968 * by establishing a single dedicated OAM Tx connection on that port.
970 * The OAM service allows buffers containing 52 byte OAM F4/F5 cells
971 * to be transmitted and received over the dedicated OAM channels.
972 * HEC is appended/removed, and CRC-10 performed by the NPE. The OAM
973 * service offered by AtmdAcc is a raw cell transport service.
974 * It is assumed that ITU I.610 procedures that make use of this
975 * service are implemented above AtmdAcc.
977 * Note that the dedicated OAM connections are established on
978 * reserved VPI,VCI, and (in the case of Rx) port values.
979 * These values are used purely to descriminate the dedicated OAM channels
980 * and do not identify a particular OAM F4/F5 flow. F4/F5 flows may be
981 * realised for particluar VPI/VCIs by manipulating the VPI,VCI
982 * fields of the ATM cell headers of cells in the buffers passed
985 * Calling this function before enabling the port will fail.
987 * @sa ixAtmdAccTxVcTryDisconnect
988 * @sa ixAtmdAccPortTxScheduledModeEnable
989 * @sa ixAtmdAccPortEnable
991 * @param port @ref IxAtmLogicalPort [in] - VC identification : logical PHY port
992 * [@a IX_UTOPIA_PORT_0 .. @a IX_UTOPIA_MAX_PORTS - 1]
993 * @param vpi unsigned int [in] - VC identification : ATM Vpi [0..255] or IX_ATMDACC_OAM_VPI
994 * @param vci unsigned int [in] - VC identification : ATM Vci [0..65535] or IX_ATMDACC_OAM_VCI
995 * @param aalServiceType @ref IxAtmdAccAalType [in] - type of service AAL5, AAL0_48, AAL0_52, or OAM
996 * @param userId @ref IxAtmdAccUserId [in] - user id to be used later during callbacks related
998 * @param bufferFreeCallback @ref IxAtmdAccTxVcBufferReturnCallback [in] - function called when mbufs
999 * transmission is complete. This parameter cannot be a null
1001 * @param connIdPtr @ref IxAtmConnId [out] - Pointer to a connection Id.
1002 * This parameter cannot be a null pointer.
1004 * @return @li IX_SUCCESS successful call to @a IxAtmdAccRxVcConnect().
1005 * @return @li IX_ATMDACC_BUSY cannot process this request
1006 * because no VC is available
1007 * @return @li IX_FAIL
1009 * VC already in use,
1010 * attempt to connect AAL service on reserved OAM VPI/VCI,
1011 * attempt to connect OAM service on VPI/VCI other than the reserved OAM VPI/VCI,
1012 * port is not initialised,
1013 * or some other error occurs during processing.
1015 * @note - Unscheduled mode is not supported in ixp425 1.0. Therefore, the
1016 * function @a ixAtmdAccPortTxScheduledModeEnable() need to be called
1017 * for this port before any establishing a Tx Connection
1019 PUBLIC IX_STATUS ixAtmdAccTxVcConnect (IxAtmLogicalPort port,
1022 IxAtmdAccAalType aalServiceType,
1023 IxAtmdAccUserId userId,
1024 IxAtmdAccTxVcBufferReturnCallback bufferFreeCallback,
1025 IxAtmConnId * connIdPtr);
1029 * @ingroup IxAtmdAccAPI
1031 * @fn ixAtmdAccTxVcPduSubmit (IxAtmConnId connId,
1032 IX_OSAL_MBUF * mbufPtr,
1033 IxAtmdAccClpStatus clp,
1034 unsigned int numberOfCells)
1036 * @brief Submit a Pdu for transmission on connection.
1038 * A data user calls this function to submit an mbufs containing a Pdu
1039 * to be transmitted. The buffer supplied can be chained and the Pdu it
1040 * contains must be complete.
1042 * The transmission behavior of this call depends on the operational mode
1043 * of the port on which the connection is made.
1045 * In unscheduled mode the mbuf will be submitted to the hardware
1046 * immediately if sufficent resource is available. Otherwise the function
1047 * will return failure.
1049 * In scheduled mode the buffer is queued internally in IxAtmdAcc. The cell
1050 * demand is made known to the traffic shaping entity. Cells from the
1051 * buffers are MUXed onto the port some time later as dictated by the
1052 * traffic shaping entity. The traffic shaping entity does this by sending
1053 * transmit schedules to IxAtmdAcc via @a ixAtmdAccPortTxProcess() function call.
1055 * Note that the dedicated OAM channel is scheduled just like any
1056 * other channel. This means that any OAM traffic relating to an
1057 * active AAL0/AAL5 connection will be scheduled independantly of the
1058 * AAL0/AAL5 traffic for that connection.
1060 * When transmission is complete, the TX Done mechanism will give the
1061 * owmnership of these buffers back to the customer. The tx done mechanism
1062 * must be in operation before transmission is attempted.
1064 * For AAL0/OAM submitted AAL0 PDUs must be a multiple of the cell data
1065 * size (48/52). AAL0_52 and OAM are raw cell services, and the client
1066 * must format the PDU with an ATM cell header (excluding HEC) at the
1067 * start of each cell, note that AtmdAcc does not validate the cell headers in
1071 * @sa IxAtmdAccTxVcBufferReturnCallback
1072 * @sa ixAtmdAccTxDoneDispatch
1074 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
1075 * @a ixAtmdAccTxVcConnect()
1076 * @param mbufPtr @ref IX_OSAL_MBUF [in] - pointer to a chained structure of mbufs to transmit.
1077 * This parameter cannot be a null pointer.
1078 * @param clp @ref IxAtmdAccClpStatus [in] - clp indication for this PDU. All cells of this pdu
1079 * will be sent with the clp bit set
1080 * @param numberOfCells unsigned int [in] - number of cells in the PDU.
1082 * @return @li IX_SUCCESS successful call to @a ixAtmdAccTxVcPduSubmit()
1083 * The pdu pointed by the mbufPtr parameter will be
1085 * @return @li IX_ATMDACC_BUSY unable to process this request because
1086 * internal resources are all used. The caller is responsible
1087 * for retrying this request later.
1088 * @return @li IX_FAIL unable to process this request because of error
1089 * in the parameters (wrong connId supplied,
1090 * or wrong mbuf pointer supplied), the total length of all buffers
1091 * in the chain should be a multiple of the cell size
1092 * ( 48/52 depending on the service type ),
1093 * or unspecified error during processing
1095 * @note - This function in not re-entrant for the same VC (e.g. : two
1096 * thread cannot send PDUs for the same VC). But two threads can
1097 * safely call this function with a different connection Id
1099 * @note - In unscheduled mode, this function is not re-entrant on a per
1100 * port basis. The size of pdus is limited to 8Kb.
1102 * @note - 0-length mbufs should be removed from the chain before submission.
1103 * The total length of the pdu (sdu + padding +trailer) has to be
1104 * updated in the header of the first mbuf of a chain of mbufs.
1106 * @note - Aal5 trailer information (UUI, CPI, SDU length) has to be supplied
1107 * before submission.
1109 * @note - The payload memory cache should be flushed, if needed, prior to
1110 * transmission. Mbuf headers are flushed by IxAtmdAcc
1112 * @note - This function does not use system resources and can be used
1113 * inside an interrupt context
1115 PUBLIC IX_STATUS ixAtmdAccTxVcPduSubmit (IxAtmConnId connId,
1116 IX_OSAL_MBUF * mbufPtr,
1117 IxAtmdAccClpStatus clp,
1118 unsigned int numberOfCells);
1122 * @ingroup IxAtmdAccAPI
1124 * @fn ixAtmdAccTxVcTryDisconnect (IxAtmConnId connId)
1126 * @brief Disconnect from a Aal Pdu transmit service for a particular
1129 * This function deregisters the VC and guarantees that all resources
1130 * associated with this VC are free. After its execution, the connection
1131 * Id is not available.
1133 * This function will fail until such time as all resources allocated to
1134 * the VC connection have been freed. The user is responsible to delay
1135 * and call again this function many times until a success status is
1138 * After its execution, the connection Id is not available.
1140 * @param connId @ref IxAtmConnId [in] - connection Id as resulted from a succesfull call to
1141 * @a ixAtmdAccTxVcConnect()
1143 * @return @li IX_SUCCESS successful call to @a ixAtmdAccTxVcTryDisconnect()
1144 * @return @li IX_ATMDACC_RESOURCES_STILL_ALLOCATED not all resources
1145 * associated with the connection have been freed. This condition will
1146 * disappear after Tx and TxDone is complete for this channel.
1147 * @return @li IX_FAIL unable to process this request because of errors
1148 * in the parameters (wrong connId supplied)
1150 * @note - This function needs internal locks and should not be called
1151 * from an interrupt context
1153 * @note - If the @a IX_ATMDACC_RESOURCES_STILL_ALLOCATED error does not
1154 * clear after a while, this may be linked to a previous problem
1155 * of cell overscheduling. Diabling the port and retry a disconnect
1156 * will free the resources associated with this channel.
1158 * @sa ixAtmdAccPortTxProcess
1161 PUBLIC IX_STATUS ixAtmdAccTxVcTryDisconnect (IxAtmConnId connId);
1163 #endif /* IXATMDACC_H */
1166 * @} defgroup IxAtmdAccAPI