4 * @author Intel Corporation
7 * @brief Internal Header file for IXP425 Ethernet Access component.
13 * IXP400 SW Release version 2.0
15 * -- Copyright Notice --
18 * Copyright 2001-2005, Intel Corporation.
19 * All rights reserved.
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
25 * 1. Redistributions of source code must retain the above copyright
26 * notice, this list of conditions and the following disclaimer.
27 * 2. Redistributions in binary form must reproduce the above copyright
28 * notice, this list of conditions and the following disclaimer in the
29 * documentation and/or other materials provided with the distribution.
30 * 3. Neither the name of the Intel Corporation nor the names of its contributors
31 * may be used to endorse or promote products derived from this software
32 * without specific prior written permission.
35 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
36 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
38 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
39 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
40 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48 * -- End of Copyright Notice --
52 * @addtogroup IxEthAccPri
60 * Os/System dependancies.
65 * Intermodule dependancies
73 * Intra module dependancies
76 #include "IxEthAccDataPlane_p.h"
77 #include "IxEthAccMac_p.h"
80 #define INLINE __inline__
84 #define IX_ETH_ACC_PRIVATE static
88 #define IX_ETH_ACC_PRIVATE
90 #endif /* ndef NDEBUG */
92 #define IX_ETH_ACC_PUBLIC
95 #define IX_ETH_ACC_IS_PORT_VALID(port) ((port) < IX_ETH_ACC_NUMBER_OF_PORTS ? TRUE : FALSE )
100 #define IX_ETH_ACC_FATAL_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
101 #define IX_ETH_ACC_WARNING_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_WARNING,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
102 #define IX_ETH_ACC_DEBUG_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
104 #define IX_ETH_ACC_FATAL_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_FATAL,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
105 #define IX_ETH_ACC_WARNING_LOG(a,b,c,d,e,f,g) { ixOsalLog ( IX_OSAL_LOG_LVL_WARNING,IX_OSAL_LOG_DEV_STDOUT,a,b,c,d,e,f,g);}
106 #define IX_ETH_ACC_DEBUG_LOG(a,b,c,d,e,f,g) {}
109 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccInitDataPlane(void);
110 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccQMgrQueuesConfig(void);
111 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccQMgrRxCallbacksRegister(IxQMgrCallback ixQMgrCallback
);
112 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccSingleEthNpeCheck(IxEthAccPortId portId
);
113 IX_ETH_ACC_PUBLIC
void ixEthAccQMgrRxQEntryGet(UINT32
*numRxQueueEntries
);
115 /* prototypes for the private control plane functions (used by the control interface wrapper) */
116 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortEnablePriv(IxEthAccPortId portId
);
117 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortDisablePriv(IxEthAccPortId portId
);
118 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortEnabledQueryPriv(IxEthAccPortId portId
, BOOL
*enabled
);
119 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortPromiscuousModeClearPriv(IxEthAccPortId portId
);
120 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortPromiscuousModeSetPriv(IxEthAccPortId portId
);
121 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortUnicastMacAddressSetPriv(IxEthAccPortId portId
, IxEthAccMacAddr
*macAddr
);
122 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortUnicastMacAddressGetPriv(IxEthAccPortId portId
, IxEthAccMacAddr
*macAddr
);
123 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortMulticastAddressJoinPriv(IxEthAccPortId portId
, IxEthAccMacAddr
*macAddr
);
124 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortMulticastAddressJoinAllPriv(IxEthAccPortId portId
);
125 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortMulticastAddressLeavePriv(IxEthAccPortId portId
, IxEthAccMacAddr
*macAddr
);
126 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortMulticastAddressLeaveAllPriv(IxEthAccPortId portId
);
127 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortUnicastAddressShowPriv(IxEthAccPortId portId
);
128 IX_ETH_ACC_PUBLIC
void ixEthAccPortMulticastAddressShowPriv(IxEthAccPortId portId
);
129 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortDuplexModeSetPriv(IxEthAccPortId portId
, IxEthAccDuplexMode mode
);
130 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortDuplexModeGetPriv(IxEthAccPortId portId
, IxEthAccDuplexMode
*mode
);
131 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortTxFrameAppendPaddingEnablePriv(IxEthAccPortId portId
);
132 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortTxFrameAppendPaddingDisablePriv(IxEthAccPortId portId
);
133 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortTxFrameAppendFCSEnablePriv(IxEthAccPortId portId
);
134 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortTxFrameAppendFCSDisablePriv(IxEthAccPortId portId
);
135 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortRxFrameAppendFCSEnablePriv(IxEthAccPortId portId
);
136 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccPortRxFrameAppendFCSDisablePriv(IxEthAccPortId portId
);
137 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccTxSchedulingDisciplineSetPriv(IxEthAccPortId portId
, IxEthAccSchedulerDiscipline sched
);
138 IX_ETH_ACC_PUBLIC IxEthAccStatus
ixEthAccRxSchedulingDisciplineSetPriv(IxEthAccSchedulerDiscipline sched
);
141 * @struct ixEthAccRxDataStats
142 * @brief Stats data structures for data path. - Not obtained from h/w
147 UINT32 rxFrameClientCallback
;
149 UINT32 rxFreeRepDelayed
;
150 UINT32 rxFreeRepFromSwQOK
;
151 UINT32 rxFreeRepFromSwQDelayed
;
152 UINT32 rxFreeLateNotificationEnabled
;
153 UINT32 rxFreeLowCallback
;
154 UINT32 rxFreeOverflow
;
156 UINT32 rxDuringDisable
;
157 UINT32 rxSwQDuringDisable
;
158 UINT32 rxUnlearnedMacAddress
;
159 UINT32 rxPriority
[IX_ETH_ACC_TX_PRIORITY_7
+ 1];
160 UINT32 rxUnexpectedError
;
162 } IxEthAccRxDataStats
;
165 * @struct IxEthAccTxDataStats
166 * @brief Stats data structures for data path. - Not obtained from h/w
174 UINT32 txFromSwQDelayed
;
175 UINT32 txLowThreshCallback
;
176 UINT32 txDoneClientCallback
;
177 UINT32 txDoneClientCallbackDisable
;
180 UINT32 txPriority
[IX_ETH_ACC_TX_PRIORITY_7
+ 1];
181 UINT32 txLateNotificationEnabled
;
182 UINT32 txDoneDuringDisable
;
183 UINT32 txDoneSwQDuringDisable
;
184 UINT32 txUnexpectedError
;
185 } IxEthAccTxDataStats
;
187 /* port Disable state machine : list of states */
190 /* general port states */
194 /* particular Tx/Rx states */
199 } IxEthAccPortDisableState
;
210 IxOsalMutex ackMIBStatsLock
;
211 IxOsalMutex ackMIBStatsResetLock
;
212 IxOsalMutex MIBStatsGetAccessLock
;
213 IxOsalMutex MIBStatsGetResetAccessLock
;
214 IxOsalMutex npeLoopbackMessageLock
;
215 IxEthAccMacAddr mcastAddrsTable
[IX_ETH_ACC_MAX_MULTICAST_ADDRESSES
];
216 UINT32 mcastAddrIndex
;
217 IX_OSAL_MBUF
*portDisableTxMbufPtr
;
218 IX_OSAL_MBUF
*portDisableRxMbufPtr
;
220 volatile IxEthAccPortDisableState portDisableState
;
221 volatile IxEthAccPortDisableState rxState
;
222 volatile IxEthAccPortDisableState txState
;
229 * @struct IxEthAccRxInfo
230 * @brief System-wide data structures associated with the data plane.
235 IxQMgrQId higherPriorityQueue
[IX_QMGR_MAX_NUM_QUEUES
]; /**< higher priority queue list */
236 IxEthAccSchedulerDiscipline schDiscipline
; /**< Receive Xscale QoS type */
240 * @struct IxEthAccRxDataInfo
241 * @brief Per Port data structures associated with the receive data plane.
246 IxQMgrQId rxFreeQueue
; /**< rxFree Queue for this port */
247 IxEthAccPortRxCallback rxCallbackFn
;
248 UINT32 rxCallbackTag
;
249 IxEthAccDataPlaneQList freeBufferList
;
250 IxEthAccPortMultiBufferRxCallback rxMultiBufferCallbackFn
;
251 UINT32 rxMultiBufferCallbackTag
;
252 BOOL rxMultiBufferCallbackInUse
;
253 IxEthAccRxDataStats stats
; /**< Receive s/w stats */
254 } IxEthAccRxDataInfo
;
257 * @struct IxEthAccTxDataInfo
258 * @brief Per Port data structures associated with the transmit data plane.
263 IxEthAccPortTxDoneCallback txBufferDoneCallbackFn
;
264 UINT32 txCallbackTag
;
265 IxEthAccDataPlaneQList txQ
[IX_ETH_ACC_NUM_TX_PRIORITIES
]; /**< Transmit Q */
266 IxEthAccSchedulerDiscipline schDiscipline
; /**< Transmit Xscale QoS */
267 IxQMgrQId txQueue
; /**< txQueue for this port */
268 IxEthAccTxDataStats stats
; /**< Transmit s/w stats */
269 } IxEthAccTxDataInfo
;
273 * @struct IxEthAccPortDataInfo
274 * @brief Per Port data structures associated with the port data plane.
279 BOOL portInitialized
;
280 UINT32 npeId
; /**< NpeId for this port */
281 IxEthAccTxDataInfo ixEthAccTxData
; /**< Transmit data control structures */
282 IxEthAccRxDataInfo ixEthAccRxData
; /**< Recieve data control structures */
283 } IxEthAccPortDataInfo
;
285 extern IxEthAccPortDataInfo ixEthAccPortData
[];
286 #define IX_ETH_IS_PORT_INITIALIZED(port) (ixEthAccPortData[port].portInitialized)
288 extern BOOL ixEthAccServiceInit
;
289 #define IX_ETH_ACC_IS_SERVICE_INITIALIZED() (ixEthAccServiceInit == TRUE )
292 * Maximum number of frames to consume from the Rx Frame Q.
295 #define IX_ETH_ACC_MAX_RX_FRAME_CONSUME_PER_CALLBACK (128)
298 * Max number of times to load the Rx Free Q from callback.
300 #define IX_ETH_ACC_MAX_RX_FREE_BUFFERS_LOAD (256) /* Set greater than depth of h/w Q + drain time at line rate */
303 * Max number of times to read from the Tx Done Q in one sitting.
306 #define IX_ETH_ACC_MAX_TX_FRAME_DONE_CONSUME_PER_CALLBACK (256)
309 * Max number of times to take buffers from S/w queues and write them to the H/w Tx
310 * queues on receipt of a Tx low threshold callback
313 #define IX_ETH_ACC_MAX_TX_FRAME_TX_CONSUME_PER_CALLBACK (16)
316 #define IX_ETH_ACC_FLUSH_CACHE(addr,size) IX_OSAL_CACHE_FLUSH((addr),(size))
317 #define IX_ETH_ACC_INVALIDATE_CACHE(addr,size) IX_OSAL_CACHE_INVALIDATE((addr),(size))
320 #define IX_ETH_ACC_MEMSET(start,value,size) memset(start,value,size)
322 #endif /* ndef IxEthAcc_p_H */