IxEthAcc.h 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488
  1. /** @file IxEthAcc.h
  2. *
  3. * @brief this file contains the public API of @ref IxEthAcc component
  4. *
  5. * Design notes:
  6. * The IX_OSAL_MBUF address is to be specified on bits [31-5] and must
  7. * be cache aligned (bits[4-0] cleared)
  8. *
  9. *
  10. * @par
  11. * IXP400 SW Release version 2.0
  12. *
  13. * -- Copyright Notice --
  14. *
  15. * @par
  16. * Copyright 2001-2005, Intel Corporation.
  17. * All rights reserved.
  18. *
  19. * @par
  20. * SPDX-License-Identifier: BSD-3-Clause
  21. * @par
  22. * -- End of Copyright Notice --
  23. *
  24. */
  25. #ifndef IxEthAcc_H
  26. #define IxEthAcc_H
  27. #include <IxOsBuffMgt.h>
  28. #include <IxTypes.h>
  29. /**
  30. * @defgroup IxEthAcc IXP400 Ethernet Access (IxEthAcc) API
  31. *
  32. * @brief ethAcc is a library that does provides access to the internal IXP400 10/100Bt Ethernet MACs.
  33. *
  34. *@{
  35. */
  36. /**
  37. * @ingroup IxEthAcc
  38. * @brief Definition of the Ethernet Access status
  39. */
  40. typedef enum /* IxEthAccStatus */
  41. {
  42. IX_ETH_ACC_SUCCESS = IX_SUCCESS, /**< return success*/
  43. IX_ETH_ACC_FAIL = IX_FAIL, /**< return fail*/
  44. IX_ETH_ACC_INVALID_PORT, /**< return invalid port*/
  45. IX_ETH_ACC_PORT_UNINITIALIZED, /**< return uninitialized*/
  46. IX_ETH_ACC_MAC_UNINITIALIZED, /**< return MAC uninitialized*/
  47. IX_ETH_ACC_INVALID_ARG, /**< return invalid arg*/
  48. IX_ETH_TX_Q_FULL, /**< return tx queue is full*/
  49. IX_ETH_ACC_NO_SUCH_ADDR /**< return no such address*/
  50. } IxEthAccStatus;
  51. /**
  52. * @ingroup IxEthAcc
  53. * @enum IxEthAccPortId
  54. * @brief Definition of the IXP400 Mac Ethernet device.
  55. */
  56. typedef enum
  57. {
  58. IX_ETH_PORT_1 = 0, /**< Ethernet Port 1 */
  59. IX_ETH_PORT_2 = 1 /**< Ethernet port 2 */
  60. ,IX_ETH_PORT_3 = 2 /**< Ethernet port 3 */
  61. } IxEthAccPortId;
  62. /**
  63. * @ingroup IxEthAcc
  64. *
  65. * @def IX_ETH_ACC_NUMBER_OF_PORTS
  66. *
  67. * @brief Definition of the number of ports
  68. *
  69. */
  70. #ifdef __ixp46X
  71. #define IX_ETH_ACC_NUMBER_OF_PORTS (3)
  72. #else
  73. #define IX_ETH_ACC_NUMBER_OF_PORTS (2)
  74. #endif
  75. /**
  76. * @ingroup IxEthAcc
  77. *
  78. * @def IX_IEEE803_MAC_ADDRESS_SIZE
  79. *
  80. * @brief Definition of the size of the MAC address
  81. *
  82. */
  83. #define IX_IEEE803_MAC_ADDRESS_SIZE (6)
  84. /**
  85. *
  86. * @brief Definition of the IEEE 802.3 Ethernet MAC address structure.
  87. *
  88. * The data should be packed with bytes xx:xx:xx:xx:xx:xx
  89. * @note
  90. * The data must be packed in network byte order.
  91. */
  92. typedef struct
  93. {
  94. UINT8 macAddress[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< MAC address */
  95. } IxEthAccMacAddr;
  96. /**
  97. * @ingroup IxEthAcc
  98. * @def IX_ETH_ACC_NUM_TX_PRIORITIES
  99. * @brief Definition of the number of transmit priorities
  100. *
  101. */
  102. #define IX_ETH_ACC_NUM_TX_PRIORITIES (8)
  103. /**
  104. * @ingroup IxEthAcc
  105. * @enum IxEthAccTxPriority
  106. * @brief Definition of the relative priority used to transmit a frame
  107. *
  108. */
  109. typedef enum
  110. {
  111. IX_ETH_ACC_TX_PRIORITY_0 = 0, /**<Lowest Priority submission */
  112. IX_ETH_ACC_TX_PRIORITY_1 = 1, /**<submission prority of 1 (0 is lowest)*/
  113. IX_ETH_ACC_TX_PRIORITY_2 = 2, /**<submission prority of 2 (0 is lowest)*/
  114. IX_ETH_ACC_TX_PRIORITY_3 = 3, /**<submission prority of 3 (0 is lowest)*/
  115. IX_ETH_ACC_TX_PRIORITY_4 = 4, /**<submission prority of 4 (0 is lowest)*/
  116. IX_ETH_ACC_TX_PRIORITY_5 = 5, /**<submission prority of 5 (0 is lowest)*/
  117. IX_ETH_ACC_TX_PRIORITY_6 = 6, /**<submission prority of 6 (0 is lowest)*/
  118. IX_ETH_ACC_TX_PRIORITY_7 = 7, /**<Highest priority submission */
  119. IX_ETH_ACC_TX_DEFAULT_PRIORITY = IX_ETH_ACC_TX_PRIORITY_0 /**< By default send all
  120. packets with lowest priority */
  121. } IxEthAccTxPriority;
  122. /**
  123. * @ingroup IxEthAcc
  124. * @enum IxEthAccRxFrameType
  125. * @brief Identify the type of a frame.
  126. *
  127. * @sa IX_ETHACC_NE_FLAGS
  128. * @sa IX_ETHACC_NE_LINKMASK
  129. */
  130. typedef enum
  131. {
  132. IX_ETHACC_RX_LLCTYPE = 0x00, /**< 802.3 - 8802, with LLC/SNAP */
  133. IX_ETHACC_RX_ETHTYPE = 0x10, /**< 802.3 (Ethernet) without LLC/SNAP */
  134. IX_ETHACC_RX_STATYPE = 0x20, /**< 802.11, AP <=> STA */
  135. IX_ETHACC_RX_APTYPE = 0x30 /**< 802.11, AP <=> AP */
  136. } IxEthAccRxFrameType;
  137. /**
  138. * @ingroup IxEthAcc
  139. * @enum IxEthAccDuplexMode
  140. * @brief Definition to provision the duplex mode of the MAC.
  141. *
  142. */
  143. typedef enum
  144. {
  145. IX_ETH_ACC_FULL_DUPLEX, /**< Full duplex operation of the MAC */
  146. IX_ETH_ACC_HALF_DUPLEX /**< Half duplex operation of the MAC */
  147. } IxEthAccDuplexMode;
  148. /**
  149. * @ingroup IxEthAcc
  150. * @struct IxEthAccNe
  151. * @brief Definition of service-specific informations.
  152. *
  153. * This structure defines the Ethernet service-specific informations
  154. * and enable QoS and VLAN features.
  155. */
  156. typedef struct
  157. {
  158. UINT32 ixReserved_next; /**< reserved for chaining */
  159. UINT32 ixReserved_lengths; /**< reserved for buffer lengths */
  160. UINT32 ixReserved_data; /**< reserved for buffer pointer */
  161. UINT8 ixDestinationPortId; /**< Destination portId for this packet, if known by NPE */
  162. UINT8 ixSourcePortId; /**< Source portId for this packet */
  163. UINT16 ixFlags; /**< BitField of option for this frame */
  164. UINT8 ixQoS; /**< QoS class of the frame */
  165. UINT8 ixReserved; /**< reserved */
  166. UINT16 ixVlanTCI; /**< Vlan TCI */
  167. UINT8 ixDestMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Destination MAC address */
  168. UINT8 ixSourceMac[IX_IEEE803_MAC_ADDRESS_SIZE]; /**< Source MAC address */
  169. } IxEthAccNe;
  170. /**
  171. * @ingroup IxEthAcc
  172. *
  173. * @def IX_ETHACC_NE_PORT_UNKNOWN
  174. *
  175. * @brief Contents of the field @a IX_ETHACC_NE_DESTPORTID when no
  176. * destination port can be found by the NPE for this frame.
  177. *
  178. */
  179. #define IX_ETHACC_NE_PORT_UNKNOWN (0xff)
  180. /**
  181. * @ingroup IxEthAcc
  182. *
  183. * @def IX_ETHACC_NE_DESTMAC
  184. *
  185. * @brief The location of the destination MAC address in the Mbuf header.
  186. *
  187. */
  188. #define IX_ETHACC_NE_DESTMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestMac
  189. /**
  190. * @ingroup IxEthAcc
  191. *
  192. * @def IX_ETHACC_NE_SOURCEMAC
  193. *
  194. * @brief The location of the source MAC address in the Mbuf header.
  195. *
  196. */
  197. #define IX_ETHACC_NE_SOURCEMAC(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourceMac
  198. /**
  199. * @ingroup IxEthAcc
  200. *
  201. * @def IX_ETHACC_NE_VLANTCI
  202. *
  203. * @brief The VLAN Tag Control Information associated with this frame
  204. *
  205. * The VLAN Tag Control Information associated with this frame. On Rx
  206. * path, this field is extracted from the packet header.
  207. * On Tx path, the value of this field is inserted in the frame when
  208. * the port is configured to insert or replace vlan tags in the
  209. * egress frames.
  210. *
  211. * @sa IX_ETHACC_NE_FLAGS
  212. */
  213. #define IX_ETHACC_NE_VLANTCI(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixVlanTCI
  214. /**
  215. * @ingroup IxEthAcc
  216. *
  217. * @def IX_ETHACC_NE_SOURCEPORTID
  218. *
  219. * @brief The port where this frame came from.
  220. *
  221. * The port where this frame came from. This field is set on receive
  222. * with the port information. This field is ignored on Transmit path.
  223. */
  224. #define IX_ETHACC_NE_SOURCEPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixSourcePortId
  225. /**
  226. * @ingroup IxEthAcc
  227. *
  228. * @def IX_ETHACC_NE_DESTPORTID
  229. *
  230. * @brief The destination port where this frame should be sent.
  231. *
  232. * The destination port where this frame should be sent.
  233. *
  234. * @li In the transmit direction, this field contains the destination port
  235. * and is ignored unless @a IX_ETHACC_NE_FLAG_DST is set.
  236. *
  237. * @li In the receive direction, this field contains the port where the
  238. * destination MAC addresses has been learned. If the destination
  239. * MAC address is unknown, then this value is set to the reserved value
  240. * @a IX_ETHACC_NE_PORT_UNKNOWN
  241. *
  242. */
  243. #define IX_ETHACC_NE_DESTPORTID(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixDestinationPortId
  244. /**
  245. * @ingroup IxEthAcc
  246. *
  247. * @def IX_ETHACC_NE_QOS
  248. *
  249. * @brief QualityOfService class (QoS) for this received frame.
  250. *
  251. */
  252. #define IX_ETHACC_NE_QOS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixQoS
  253. /**
  254. * @ingroup IxEthAcc
  255. *
  256. * @def IX_ETHACC_NE_FLAGS
  257. *
  258. * @brief Bit Mask of the different flags associated with a frame
  259. *
  260. * The flags are the bit-oring combination
  261. * of the following different fields :
  262. *
  263. * @li IP flag (Rx @a IX_ETHACC_NE_IPMASK)
  264. * @li Spanning Tree flag (Rx @a IX_ETHACC_NE_STMASK)
  265. * @li Link layer type (Rx and Tx @a IX_ETHACC_NE_LINKMASK)
  266. * @li VLAN Tagged Frame (Rx @a IX_ETHACC_NE_VLANMASK)
  267. * @li New source MAC address (Rx @a IX_ETHACC_NE_NEWSRCMASK)
  268. * @li Multicast flag (Rx @a IX_ETHACC_NE_MCASTMASK)
  269. * @li Broadcast flag (Rx @a IX_ETHACC_NE_BCASTMASK)
  270. * @li Destination port flag (Tx @a IX_ETHACC_NE_PORTMASK)
  271. * @li Tag/Untag Tx frame (Tx @a IX_ETHACC_NE_TAGMODEMASK)
  272. * @li Overwrite destination port (Tx @a IX_ETHACC_NE_PORTOVERMASK)
  273. * @li Filtered frame (Rx @a IX_ETHACC_NE_STMASK)
  274. * @li VLAN Enabled (Rx and Tx @a IX_ETHACC_NE_VLANENABLEMASK)
  275. */
  276. #define IX_ETHACC_NE_FLAGS(mBufPtr) ((IxEthAccNe *)&((mBufPtr)->ix_ne))->ixFlags
  277. /**
  278. * @ingroup IxEthAcc
  279. *
  280. * @def IX_ETHACC_NE_BCASTMASK
  281. *
  282. * @brief This mask defines if a received frame is a broadcast frame.
  283. *
  284. * This mask defines if a received frame is a broadcast frame.
  285. * The BCAST flag is set when the destination MAC address of
  286. * a frame is broadcast.
  287. *
  288. * @sa IX_ETHACC_NE_FLAGS
  289. *
  290. */
  291. #define IX_ETHACC_NE_BCASTMASK (0x1)
  292. /**
  293. * @ingroup IxEthAcc
  294. *
  295. * @def IX_ETHACC_NE_MCASTMASK
  296. *
  297. * @brief This mask defines if a received frame is a multicast frame.
  298. *
  299. * This mask defines if a received frame is a multicast frame.
  300. * The MCAST flag is set when the destination MAC address of
  301. * a frame is multicast.
  302. *
  303. * @sa IX_ETHACC_NE_FLAGS
  304. *
  305. */
  306. #define IX_ETHACC_NE_MCASTMASK (0x1 << 1)
  307. /**
  308. * @ingroup IxEthAcc
  309. *
  310. * @def IX_ETHACC_NE_IPMASK
  311. *
  312. * @brief This mask defines if a received frame is a IP frame.
  313. *
  314. * This mask applies to @a IX_ETHACC_NE_FLAGS and defines if a received
  315. * frame is a IP frame. The IP flag is set on Rx direction, depending on
  316. * the frame contents. The flag is set when the length/type field of a
  317. * received frame is 0x8000.
  318. *
  319. * @sa IX_ETHACC_NE_FLAGS
  320. *
  321. */
  322. #define IX_ETHACC_NE_IPMASK (0x1 << 2)
  323. /**
  324. * @ingroup IxEthAcc
  325. *
  326. * @def IX_ETHACC_NE_VLANMASK
  327. *
  328. * @brief This mask defines if a received frame is VLAN tagged.
  329. *
  330. * This mask defines if a received frame is VLAN tagged.
  331. * When set, the Rx frame is VLAN-tagged and the tag value
  332. * is available thru @a IX_ETHACC_NE_VLANID.
  333. * Note that when sending frames which are already tagged
  334. * this flag should be set, to avoid inserting another VLAN tag.
  335. *
  336. * @sa IX_ETHACC_NE_FLAGS
  337. * @sa IX_ETHACC_NE_VLANID
  338. *
  339. */
  340. #define IX_ETHACC_NE_VLANMASK (0x1 << 3)
  341. /**
  342. * @ingroup IxEthAcc
  343. *
  344. * @def IX_ETHACC_NE_LINKMASK
  345. *
  346. * @brief This mask is the link layer protocol indicator
  347. *
  348. * This mask applies to @a IX_ETHACC_NE_FLAGS.
  349. * It reflects the state of a frame as it exits an NPE on the Rx path
  350. * or enters an NPE on the Tx path. Its values are as follows:
  351. * @li 0x00 - IEEE802.3 - 8802 (Rx) / IEEE802.3 - 8802 (Tx)
  352. * @li 0x01 - IEEE802.3 - Ethernet (Rx) / IEEE802.3 - Ethernet (Tx)
  353. * @li 0x02 - IEEE802.11 AP -> STA (Rx) / IEEE802.11 STA -> AP (Tx)
  354. * @li 0x03 - IEEE802.11 AP -> AP (Rx) / IEEE802.11 AP->AP (Tx)
  355. *
  356. * @sa IX_ETHACC_NE_FLAGS
  357. *
  358. */
  359. #define IX_ETHACC_NE_LINKMASK (0x3 << 4)
  360. /**
  361. * @ingroup IxEthAcc
  362. *
  363. * @def IX_ETHACC_NE_STMASK
  364. *
  365. * @brief This mask defines if a received frame is a Spanning Tree frame.
  366. *
  367. * This mask applies to @a IX_ETHACC_NE_FLAGS.
  368. * On rx direction, it defines if a received if frame is a Spanning Tree frame.
  369. * Setting this fkag on transmit direction overrides the port settings
  370. * regarding the VLAN options and
  371. *
  372. * @sa IX_ETHACC_NE_FLAGS
  373. *
  374. */
  375. #define IX_ETHACC_NE_STMASK (0x1 << 6)
  376. /**
  377. * @ingroup IxEthAcc
  378. *
  379. * @def IX_ETHACC_NE_FILTERMASK
  380. *
  381. * @brief This bit indicates whether a frame has been filtered by the Rx service.
  382. *
  383. * This mask applies to @a IX_ETHACC_NE_FLAGS.
  384. * Certain frames, which should normally be fully filtered by the NPE to due
  385. * the destination MAC address being on the same segment as the Rx port are
  386. * still forwarded to the XScale (although the payload is invalid) in order
  387. * to learn the MAC address of the transmitting station, if this is unknown.
  388. * Normally EthAcc will filter and recycle these framess internally and no
  389. * frames with the FILTER bit set will be received by the client.
  390. *
  391. * @sa IX_ETHACC_NE_FLAGS
  392. *
  393. */
  394. #define IX_ETHACC_NE_FILTERMASK (0x1 << 7)
  395. /**
  396. * @ingroup IxEthAcc
  397. *
  398. * @def IX_ETHACC_NE_PORTMASK
  399. *
  400. * @brief This mask defines the rule to transmit a frame
  401. *
  402. * This mask defines the rule to transmit a frame. When set, a frame
  403. * is transmitted to the destination port as set by the macro
  404. * @a IX_ETHACC_NE_DESTPORTID. If not set, the destination port
  405. * is searched using the destination MAC address.
  406. *
  407. * @note This flag is meaningful only for multiport Network Engines.
  408. *
  409. * @sa IX_ETHACC_NE_FLAGS
  410. * @sa IX_ETHACC_NE_DESTPORTID
  411. *
  412. */
  413. #define IX_ETHACC_NE_PORTOVERMASK (0x1 << 8)
  414. /**
  415. * @ingroup IxEthAcc
  416. *
  417. * @def IX_ETHACC_NE_TAGMODEMASK
  418. *
  419. * @brief This mask defines the tagging rules to apply to a transmit frame.
  420. *
  421. * This mask defines the tagging rules to apply to a transmit frame
  422. * regardless of the default setting for a port. When used together
  423. * with @a IX_ETHACC_NE_TAGOVERMASK and when set, the
  424. * frame will be tagged prior to transmission. When not set,
  425. * the frame will be untagged prior to transmission. This is accomplished
  426. * irrespective of the Egress tagging rules, constituting a per-frame override.
  427. *
  428. * @sa IX_ETHACC_NE_FLAGS
  429. * @sa IX_ETHACC_NE_TAGOVERMASK
  430. *
  431. */
  432. #define IX_ETHACC_NE_TAGMODEMASK (0x1 << 9)
  433. /**
  434. * @ingroup IxEthAcc
  435. *
  436. * @def IX_ETHACC_NE_TAGOVERMASK
  437. *
  438. * @brief This mask defines the rule to transmit a frame
  439. *
  440. * This mask defines the rule to transmit a frame. When set, the
  441. * default transmit rules of a port are overriden.
  442. * When not set, the default rules as set by @ref IxEthDB should apply.
  443. *
  444. * @sa IX_ETHACC_NE_FLAGS
  445. * @sa IX_ETHACC_NE_TAGMODEMASK
  446. *
  447. */
  448. #define IX_ETHACC_NE_TAGOVERMASK (0x1 << 10)
  449. /**
  450. * @ingroup IxEthAcc
  451. *
  452. * @def IX_ETHACC_NE_VLANENABLEMASK
  453. *
  454. * @brief This mask defines if a frame is a VLAN frame or not
  455. *
  456. * When set, frames undergo normal VLAN processing on the Tx path
  457. * (membership filtering, tagging, tag removal etc). If this flag is
  458. * not set, the frame is considered to be a regular non-VLAN frame
  459. * and no VLAN processing will be performed.
  460. *
  461. * Note that VLAN-enabled NPE images will always set this flag in all
  462. * Rx frames, and images which are not VLAN enabled will clear this
  463. * flag for all received frames.
  464. *
  465. * @sa IX_ETHACC_NE_FLAGS
  466. *
  467. */
  468. #define IX_ETHACC_NE_VLANENABLEMASK (0x1 << 14)
  469. /**
  470. * @ingroup IxEthAcc
  471. *
  472. * @def IX_ETHACC_NE_NEWSRCMASK
  473. *
  474. * @brief This mask defines if a received frame has been learned.
  475. *
  476. * This mask defines if the source MAC address of a frame is
  477. * already known. If the bit is set, the source MAC address was
  478. * unknown to the NPE at the time the frame was received.
  479. *
  480. * @sa IX_ETHACC_NE_FLAGS
  481. *
  482. */
  483. #define IX_ETHACC_NE_NEWSRCMASK (0x1 << 15)
  484. /**
  485. * @ingroup IxEthAcc
  486. *
  487. * @brief This defines the recommanded minimum size of MBUF's submitted
  488. * to the frame receive service.
  489. *
  490. */
  491. #define IX_ETHACC_RX_MBUF_MIN_SIZE (2048)
  492. /**
  493. * @ingroup IxEthAcc
  494. *
  495. * @brief This defines the highest MII address of any attached PHYs
  496. *
  497. * The maximum number for PHY address is 31, add on for range checking.
  498. *
  499. */
  500. #define IXP425_ETH_ACC_MII_MAX_ADDR 32
  501. /**
  502. * @ingroup IxEthAcc
  503. *
  504. * @fn ixEthAccInit(void)
  505. *
  506. * @brief Initializes the IXP400 Ethernet Access Service.
  507. *
  508. * @li Reentrant - no
  509. * @li ISR Callable - no
  510. *
  511. * This should be called once per module initialization.
  512. * @pre
  513. * The NPE must first be downloaded with the required microcode which supports all
  514. * required features.
  515. *
  516. * @return IxEthAccStatus
  517. * @li @a IX_ETH_ACC_SUCCESS
  518. * @li @a IX_ETH_ACC_FAIL : Service has failed to initialize.
  519. *
  520. * <hr>
  521. */
  522. PUBLIC IxEthAccStatus ixEthAccInit(void);
  523. /**
  524. * @ingroup IxEthAcc
  525. *
  526. * @fn ixEthAccUnload(void)
  527. *
  528. * @brief Unload the Ethernet Access Service.
  529. *
  530. * @li Reentrant - no
  531. * @li ISR Callable - no
  532. *
  533. * @return void
  534. *
  535. * <hr>
  536. */
  537. PUBLIC void ixEthAccUnload(void);
  538. /**
  539. * @ingroup IxEthAcc
  540. *
  541. * @fn ixEthAccPortInit( IxEthAccPortId portId)
  542. *
  543. * @brief Initializes an NPE/Ethernet MAC Port.
  544. *
  545. * The NPE/Ethernet port initialisation includes the following steps
  546. * @li Initialize the NPE/Ethernet MAC hardware.
  547. * @li Verify NPE downloaded and operational.
  548. * @li The NPE shall be available for usage once this API returns.
  549. * @li Verify that the Ethernet port is present before initializing
  550. *
  551. * @li Reentrant - no
  552. * @li ISR Callable - no
  553. *
  554. * This should be called once per mac device.
  555. * The NPE/MAC shall be in disabled state after init.
  556. *
  557. * @pre
  558. * The component must be initialized via @a ixEthAccInit
  559. * The NPE must first be downloaded with the required microcode which supports all
  560. * required features.
  561. *
  562. * Dependant on Services: (Must be initialized before using this service may be initialized)
  563. * ixNPEmh - NPE Message handling service.
  564. * ixQmgr - Queue Manager component.
  565. *
  566. * @param portId @ref IxEthAccPortId [in]
  567. *
  568. * @return IxEthAccStatus
  569. * @li @a IX_ETH_ACC_SUCCESS: if the ethernet port is not present, a warning is issued.
  570. * @li @a IX_ETH_ACC_FAIL : The NPE processor has failed to initialize.
  571. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  572. *
  573. * <hr>
  574. */
  575. PUBLIC IxEthAccStatus ixEthAccPortInit(IxEthAccPortId portId);
  576. /*************************************************************************
  577. ##### ## ##### ## ##### ## ##### # #
  578. # # # # # # # # # # # # # #
  579. # # # # # # # # # # # # ######
  580. # # ###### # ###### ##### ###### # # #
  581. # # # # # # # # # # # # #
  582. ##### # # # # # # # # # # #
  583. *************************************************************************/
  584. /**
  585. * @ingroup IxEthAcc
  586. *
  587. * @fn ixEthAccPortTxFrameSubmit(
  588. IxEthAccPortId portId,
  589. IX_OSAL_MBUF *buffer,
  590. IxEthAccTxPriority priority)
  591. *
  592. * @brief This function shall be used to submit MBUFs buffers for transmission on a particular MAC device.
  593. *
  594. * When the frame is transmitted, the buffer shall be returned thru the
  595. * callback @a IxEthAccPortTxDoneCallback.
  596. *
  597. * In case of over-submitting, the order of the frames on the
  598. * network may be modified.
  599. *
  600. * Buffers shall be not queued for transmission if the port is disabled.
  601. * The port can be enabled using @a ixEthAccPortEnable
  602. *
  603. *
  604. * @li Reentrant - yes
  605. * @li ISR Callable - yes
  606. *
  607. *
  608. * @pre
  609. * @a ixEthAccPortTxDoneCallbackRegister must be called to register a function to allow this service to
  610. * return the buffer to the calling service.
  611. *
  612. * @note
  613. * If the buffer submit fails for any reason the user has retained ownership of the buffer.
  614. *
  615. * @param portId @ref IxEthAccPortId [in] - MAC port ID to transmit Ethernet frame on.
  616. * @param buffer @ref IX_OSAL_MBUF [in] - pointer to an MBUF formatted buffer. Chained buffers are supported for transmission.
  617. * Chained packets are not supported and the field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is ignored.
  618. * @param priority @ref IxEthAccTxPriority [in]
  619. *
  620. * @return IxEthAccStatus
  621. * @li @a IX_ETH_ACC_SUCCESS
  622. * @li @a IX_ETH_ACC_FAIL : Failed to queue frame for transmission.
  623. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  624. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  625. *
  626. * <hr>
  627. */
  628. PUBLIC IxEthAccStatus ixEthAccPortTxFrameSubmit(
  629. IxEthAccPortId portId,
  630. IX_OSAL_MBUF *buffer,
  631. IxEthAccTxPriority priority);
  632. /**
  633. * @ingroup IxEthAcc
  634. *
  635. * @brief Function prototype for Ethernet Tx Buffer Done callback. Registered
  636. * via @a ixEthAccTxBufferDoneCallbackRegister
  637. *
  638. * This function is called once the previously submitted buffer is no longer required by this service.
  639. * It may be returned upon successful transmission of the frame or during the shutdown of
  640. * the port prior to the transmission of a queued frame.
  641. * The calling of this registered function is not a guarantee of successful transmission of the buffer.
  642. *
  643. *
  644. * @li Reentrant - yes , The user provided function should be reentrant.
  645. * @li ISR Callable - yes , The user provided function must be callable from an ISR.
  646. *
  647. *
  648. * <b>Calling Context </b>:
  649. * @par
  650. * This callback is called in the context of the queue manager dispatch loop @a ixQmgrgrDispatcherLoopRun
  651. * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
  652. * The decision is system specific.
  653. *
  654. * @param callbackTag UINT32 [in] - This tag is that provided when the callback was registered for a particular MAC
  655. * via @a ixEthAccPortTxDoneCallbackRegister. It allows the same callback to be used for multiple MACs.
  656. * @param mbuf @ref IX_OSAL_MBUF [in] - Pointer to the Tx mbuf descriptor.
  657. *
  658. * @return void
  659. *
  660. * @note
  661. * The field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is modified by the access layer and reset to NULL.
  662. *
  663. * <hr>
  664. */
  665. typedef void (*IxEthAccPortTxDoneCallback) ( UINT32 callbackTag, IX_OSAL_MBUF *buffer );
  666. /**
  667. * @ingroup IxEthAcc
  668. *
  669. * @fn ixEthAccPortTxDoneCallbackRegister( IxEthAccPortId portId,
  670. IxEthAccPortTxDoneCallback txCallbackFn,
  671. UINT32 callbackTag)
  672. *
  673. * @brief Register a callback function to allow
  674. * the transmitted buffers to return to the user.
  675. *
  676. * This function registers the transmit buffer done function callback for a particular port.
  677. *
  678. * The registered callback function is called once the previously submitted buffer is no longer required by this service.
  679. * It may be returned upon successful transmission of the frame or shutdown of port prior to submission.
  680. * The calling of this registered function is not a guarantee of successful transmission of the buffer.
  681. *
  682. * If called several times the latest callback shall be registered for a particular port.
  683. *
  684. * @li Reentrant - yes
  685. * @li ISR Callable - yes
  686. *
  687. * @pre
  688. * The port must be initialized via @a ixEthAccPortInit
  689. *
  690. *
  691. * @param portId @ref IxEthAccPortId [in] - Register callback for a particular MAC device.
  692. * @param txCallbackFn @ref IxEthAccPortTxDoneCallback [in] - Function to be called to return transmit buffers to the user.
  693. * @param callbackTag UINT32 [in] - This tag shall be provided to the callback function.
  694. *
  695. * @return IxEthAccStatus
  696. * @li @a IX_ETH_ACC_SUCCESS
  697. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  698. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  699. * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
  700. *
  701. * <hr>
  702. */
  703. PUBLIC IxEthAccStatus
  704. ixEthAccPortTxDoneCallbackRegister(IxEthAccPortId portId,
  705. IxEthAccPortTxDoneCallback txCallbackFn,
  706. UINT32 callbackTag);
  707. /**
  708. * @ingroup IxEthAcc
  709. *
  710. * @brief Function prototype for Ethernet Frame Rx callback. Registered via @a ixEthAccPortRxCallbackRegister
  711. *
  712. * It is the responsibility of the user function to free any MBUF's which it receives.
  713. *
  714. * @li Reentrant - yes , The user provided function should be reentrant.
  715. * @li ISR Callable - yes , The user provided function must be callable from an ISR.
  716. * @par
  717. *
  718. * This function dispatches frames to the user level
  719. * via the provided function. The invocation shall be made for each
  720. * frame dequeued from the Ethernet QM queue. The user is required to free any MBUF's
  721. * supplied via this callback. In addition the registered callback must free up MBUF's
  722. * from the receive free queue when the port is disabled
  723. *
  724. * If called several times the latest callback shall be registered for a particular port.
  725. *
  726. * <b>Calling Context </b>:
  727. * @par
  728. * This callback is called in the context of the queue manager dispatch loop @a ixQmgrgrDispatcherLoopRun
  729. * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
  730. * The decision is system specific.
  731. *
  732. *
  733. * @param callbackTag UINT32 [in] - This tag is that provided when the callback was registered for a particular MAC
  734. * via @a ixEthAccPortRxCallbackRegister. It allows the same callback to be used for multiple MACs.
  735. * @param mbuf @ref IX_OSAL_MBUF [in] - Pointer to the Rx mbuf header. Mbufs may be chained if
  736. * the frame length is greater than the supplied mbuf length.
  737. * @param reserved [in] - deprecated parameter The information is passed
  738. * thru the IxEthAccNe header destination port ID field
  739. * (@sa IX_ETHACC_NE_DESTPORTID). For backward
  740. * compatibility,the value is equal to IX_ETH_DB_UNKNOWN_PORT (0xff).
  741. *
  742. * @return void
  743. *
  744. * @note
  745. * Buffers may not be filled up to the length supplied in
  746. * @a ixEthAccPortRxFreeReplenish(). The firmware fills
  747. * them to the previous 64 bytes boundary. The user has to be aware
  748. * that the length of the received mbufs may be smaller than the length
  749. * of the supplied mbufs.
  750. * The mbuf header contains the following modified field
  751. * @li @a IX_OSAL_MBUF_PKT_LEN is set in the header of the first mbuf and indicates
  752. * the total frame size
  753. * @li @a IX_OSAL_MBUF_MLEN is set each mbuf header and indicates the payload length
  754. * @li @a IX_OSAL_MBUF_NEXT_BUFFER_IN_PKT_PTR contains a pointer to the next
  755. * mbuf, or NULL at the end of a chain.
  756. * @li @a IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR is modified. Its value is reset to NULL
  757. * @li @a IX_OSAL_MBUF_FLAGS contains the bit 4 set for a broadcast packet and the bit 5
  758. * set for a multicast packet. Other bits are unmodified.
  759. *
  760. * <hr>
  761. */
  762. typedef void (*IxEthAccPortRxCallback) (UINT32 callbackTag, IX_OSAL_MBUF *buffer, UINT32 reserved);
  763. /**
  764. * @ingroup IxEthAcc
  765. *
  766. * @brief Function prototype for Ethernet Frame Rx callback. Registered via @a ixEthAccPortMultiBufferRxCallbackRegister
  767. *
  768. * It is the responsibility of the user function to free any MBUF's which it receives.
  769. *
  770. * @li Reentrant - yes , The user provided function should be reentrant.
  771. * @li ISR Callable - yes , The user provided function must be callable from an ISR.
  772. * @par
  773. *
  774. * This function dispatches many frames to the user level
  775. * via the provided function. The invocation shall be made for multiple frames
  776. * dequeued from the Ethernet QM queue. The user is required to free any MBUF's
  777. * supplied via this callback. In addition the registered callback must free up MBUF's
  778. * from the receive free queue when the port is disabled
  779. *
  780. * If called several times the latest callback shall be registered for a particular port.
  781. *
  782. * <b>Calling Context </b>:
  783. * @par
  784. * This callback is called in the context of the queue manager dispatch loop @a ixQmgrDispatcherLoopRun
  785. * within the @ref IxQMgrAPI component. The calling context may be from interrupt or high priority thread.
  786. * The decision is system specific.
  787. *
  788. *
  789. * @param callbackTag - This tag is that provided when the callback was registered for a particular MAC
  790. * via @a ixEthAccPortMultiBufferRxCallbackRegister. It allows the same callback to be used for multiple MACs.
  791. * @param mbuf - Pointer to an array of Rx mbuf headers. Mbufs
  792. * may be chained if
  793. * the frame length is greater than the supplied mbuf length.
  794. * The end of the array contains a zeroed entry (NULL pointer).
  795. *
  796. * @return void
  797. *
  798. * @note The mbufs passed to this callback have the same structure than the
  799. * buffers passed to @a IxEthAccPortRxCallback interfac.
  800. *
  801. * @note The usage of this callback is exclusive with the usage of
  802. * @a ixEthAccPortRxCallbackRegister and @a IxEthAccPortRxCallback
  803. *
  804. * @sa ixEthAccPortMultiBufferRxCallbackRegister
  805. * @sa IxEthAccPortMultiBufferRxCallback
  806. * @sa ixEthAccPortRxCallbackRegister
  807. * @sa IxEthAccPortRxCallback
  808. * <hr>
  809. */
  810. typedef void (*IxEthAccPortMultiBufferRxCallback) (UINT32 callbackTag, IX_OSAL_MBUF **buffer);
  811. /**
  812. * @ingroup IxEthAcc
  813. *
  814. * @fn ixEthAccPortRxCallbackRegister( IxEthAccPortId portId, IxEthAccPortRxCallback rxCallbackFn, UINT32 callbackTag)
  815. *
  816. * @brief Register a callback function to allow
  817. * the reception of frames.
  818. *
  819. * The registered callback function is called once a frame is received by this service.
  820. *
  821. * If called several times the latest callback shall be registered for a particular port.
  822. *
  823. *
  824. * @li Reentrant - yes
  825. * @li ISR Callable - yes
  826. *
  827. *
  828. * @param portId @ref IxEthAccPortId [in] - Register callback for a particular MAC device.
  829. * @param rxCallbackFn @ref IxEthAccPortRxCallback [in] - Function to be called when Ethernet frames are availble.
  830. * @param callbackTag UINT32 [in] - This tag shall be provided to the callback function.
  831. *
  832. * @return IxEthAccStatus
  833. * @li @a IX_ETH_ACC_SUCCESS
  834. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  835. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  836. * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
  837. *
  838. * <hr>
  839. */
  840. PUBLIC IxEthAccStatus
  841. ixEthAccPortRxCallbackRegister(IxEthAccPortId portId,
  842. IxEthAccPortRxCallback rxCallbackFn,
  843. UINT32 callbackTag);
  844. /**
  845. * @ingroup IxEthAcc
  846. *
  847. * @fn ixEthAccPortMultiBufferRxCallbackRegister( IxEthAccPortId portId, IxEthAccPortMultiBufferRxCallback rxCallbackFn, UINT32 callbackTag)
  848. *
  849. * @brief Register a callback function to allow
  850. * the reception of frames.
  851. *
  852. * The registered callback function is called once a frame is
  853. * received by this service. If many frames are already received,
  854. * the function is called once.
  855. *
  856. * If called several times the latest callback shall be registered for a particular port.
  857. *
  858. * @li Reentrant - yes
  859. * @li ISR Callable - yes
  860. *
  861. *
  862. * @param portId - Register callback for a particular MAC device.
  863. * @param rxCallbackFn - @a IxEthAccMultiBufferRxCallbackFn - Function to be called when Ethernet frames are availble.
  864. * @param callbackTag - This tag shall be provided to the callback function.
  865. *
  866. * @return IxEthAccStatus
  867. * @li @a IX_ETH_ACC_SUCCESS
  868. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  869. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  870. * @li @a IX_ETH_ACC_INVALID_ARG : An argument other than portId is invalid.
  871. *
  872. * @sa ixEthAccPortMultiBufferRxCallbackRegister
  873. * @sa IxEthAccPortMultiBufferRxCallback
  874. * @sa ixEthAccPortRxCallbackRegister
  875. * @sa IxEthAccPortRxCallback
  876. * <hr>
  877. */
  878. PUBLIC IxEthAccStatus
  879. ixEthAccPortMultiBufferRxCallbackRegister(IxEthAccPortId portId,
  880. IxEthAccPortMultiBufferRxCallback rxCallbackFn,
  881. UINT32 callbackTag);
  882. /**
  883. * @ingroup IxEthAcc
  884. *
  885. * @fn ixEthAccPortRxFreeReplenish( IxEthAccPortId portId, IX_OSAL_MBUF *buffer)
  886. *
  887. * @brief This function provides buffers for the Ethernet receive path.
  888. *
  889. * This component does not have a buffer management mechanisms built in. All Rx buffers must be supplied to it
  890. * via this interface.
  891. *
  892. * @li Reentrant - yes
  893. * @li ISR Callable - yes
  894. *
  895. * @param portId @ref IxEthAccPortId [in] - Provide buffers only to specific Rx MAC.
  896. * @param buffer @ref IX_OSAL_MBUF [in] - Provide an MBUF to the Ethernet receive mechanism.
  897. * Buffers size smaller than IX_ETHACC_RX_MBUF_MIN_SIZE may result in poor
  898. * performances and excessive buffer chaining. Buffers
  899. * larger than this size may be suitable for jumbo frames.
  900. * Chained packets are not supported and the field IX_OSAL_MBUF_NEXT_PKT_IN_CHAIN_PTR must be NULL.
  901. *
  902. * @return IxEthAccStatus
  903. * @li @a IX_ETH_ACC_SUCCESS
  904. * @li @a IX_ETH_ACC_FAIL : Buffer has was not able to queue the
  905. * buffer in the receive service.
  906. * @li @a IX_ETH_ACC_FAIL : Buffer size is less than IX_ETHACC_RX_MBUF_MIN_SIZE
  907. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  908. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  909. *
  910. * @note
  911. * If the buffer replenish operation fails it is the responsibility
  912. * of the user to free the buffer.
  913. *
  914. * @note
  915. * Sufficient buffers must be supplied to the component to maintain
  916. * receive throughput and avoid rx buffer underflow conditions.
  917. * To meet this goal, It is expected that the user preload the
  918. * component with a sufficent number of buffers prior to enabling the
  919. * NPE Ethernet receive path. The recommended minimum number of
  920. * buffers is 8.
  921. *
  922. * @note
  923. * For maximum performances, the mbuf size should be greater
  924. * than the maximum frame size (Ethernet header, payload and FCS) + 64.
  925. * Supplying smaller mbufs to the service results in mbuf
  926. * chaining and degraded performances. The recommended size
  927. * is @a IX_ETHACC_RX_MBUF_MIN_SIZE, which is
  928. * enough to take care of 802.3 frames and "baby jumbo" frames without
  929. * chaining, and "jumbo" frame within chaining.
  930. *
  931. * @note
  932. * Buffers may not be filled up to their length. The firware fills
  933. * them up to the previous 64 bytes boundary. The user has to be aware
  934. * that the length of the received mbufs may be smaller than the length
  935. * of the supplied mbufs.
  936. *
  937. * @warning This function checks the parameters if the NDEBUG
  938. * flag is not defined. Turning on the argument checking (disabled by
  939. * default) results in a lower EthAcc performance as this function
  940. * is part of the data path.
  941. *
  942. * <hr>
  943. */
  944. PUBLIC IxEthAccStatus
  945. ixEthAccPortRxFreeReplenish( IxEthAccPortId portId, IX_OSAL_MBUF *buffer);
  946. /***************************************************************
  947. #### #### # # ##### ##### #### #
  948. # # # # ## # # # # # # #
  949. # # # # # # # # # # # #
  950. # # # # # # # ##### # # #
  951. # # # # # ## # # # # # #
  952. #### #### # # # # # #### ######
  953. ##### # ## # # ######
  954. # # # # # ## # #
  955. # # # # # # # # #####
  956. ##### # ###### # # # #
  957. # # # # # ## #
  958. # ###### # # # # ######
  959. ***************************************************************/
  960. /**
  961. * @ingroup IxEthAcc
  962. *
  963. * @fn ixEthAccPortEnable(IxEthAccPortId portId)
  964. *
  965. * @brief This enables an Ethernet port for both Tx and Rx.
  966. *
  967. * @li Reentrant - yes
  968. * @li ISR Callable - no
  969. *
  970. * @pre The port must first be initialized via @a ixEthAccPortInit and the MAC address
  971. * must be set using @a ixEthAccUnicastMacAddressSet before enabling it
  972. * The rx and Tx Done callbacks registration via @a
  973. * ixEthAccPortTxDoneCallbackRegister amd @a ixEthAccPortRxCallbackRegister
  974. * has to be done before enabling the traffic.
  975. *
  976. * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
  977. *
  978. * @return IxEthAccStatus
  979. * @li @a IX_ETH_ACC_SUCCESS
  980. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  981. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is not initialized
  982. * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized
  983. *
  984. * <hr>
  985. */
  986. PUBLIC IxEthAccStatus ixEthAccPortEnable(IxEthAccPortId portId);
  987. /**
  988. * @ingroup IxEthAcc
  989. *
  990. * @fn ixEthAccPortDisable(IxEthAccPortId portId)
  991. *
  992. * @brief This disables an Ethernet port for both Tx and Rx.
  993. *
  994. * Free MBufs are returned to the user via the registered callback when the port is disabled
  995. *
  996. * @li Reentrant - yes
  997. * @li ISR Callable - no
  998. *
  999. * @pre The port must be enabled with @a ixEthAccPortEnable, otherwise this
  1000. * function has no effect
  1001. *
  1002. * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
  1003. *
  1004. * @return IxEthAccStatus
  1005. * @li @a IX_ETH_ACC_SUCCESS
  1006. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1007. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is not initialized
  1008. * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized
  1009. *
  1010. * <hr>
  1011. */
  1012. PUBLIC IxEthAccStatus ixEthAccPortDisable(IxEthAccPortId portId);
  1013. /**
  1014. * @ingroup IxEthAcc
  1015. *
  1016. * @fn ixEthAccPortEnabledQuery(IxEthAccPortId portId, BOOL *enabled)
  1017. *
  1018. * @brief Get the enabled state of a port.
  1019. *
  1020. * @li Reentrant - yes
  1021. * @li ISR Callable - yes
  1022. *
  1023. * @pre The port must first be initialized via @a ixEthAccPortInit
  1024. *
  1025. * @param portId @ref IxEthAccPortId [in] - Port id to act upon.
  1026. * @param enabled BOOL [out] - location to store the state of the port
  1027. *
  1028. * @return IxEthAccStatus
  1029. * @li @a IX_ETH_ACC_SUCCESS
  1030. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid
  1031. *
  1032. * <hr>
  1033. */
  1034. PUBLIC IxEthAccStatus
  1035. ixEthAccPortEnabledQuery(IxEthAccPortId portId, BOOL *enabled);
  1036. /**
  1037. * @ingroup IxEthAcc
  1038. *
  1039. * @fn ixEthAccPortPromiscuousModeClear(IxEthAccPortId portId)
  1040. *
  1041. * @brief Put the Ethernet MAC device in non-promiscuous mode.
  1042. *
  1043. * In non-promiscuous mode the MAC filters all frames other than
  1044. * destination MAC address which matches the following criteria:
  1045. * @li Unicast address provisioned via @a ixEthAccUnicastMacAddressSet
  1046. * @li All broadcast frames.
  1047. * @li Multicast addresses provisioned via @a ixEthAccMulticastAddressJoin
  1048. *
  1049. * Other functions modify the MAC filtering
  1050. *
  1051. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1052. * frames are forwarded to the application
  1053. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1054. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1055. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1056. * filtering address
  1057. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1058. * filtering address
  1059. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1060. * forwarded to the application regardless of the multicast
  1061. * address provisioned
  1062. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1063. * to the application following the multicast address provisioned
  1064. *
  1065. * In all cases, unicast and broadcast addresses are forwarded to
  1066. * the application.
  1067. *
  1068. * @li Reentrant - yes
  1069. * @li ISR Callable - no
  1070. *
  1071. * @sa ixEthAccPortPromiscuousModeSet
  1072. *
  1073. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1074. *
  1075. * @return IxEthAccStatus
  1076. * @li @a IX_ETH_ACC_SUCCESS
  1077. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1078. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1079. *
  1080. * <hr>
  1081. */
  1082. PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeClear(IxEthAccPortId portId);
  1083. /**
  1084. * @ingroup IxEthAcc
  1085. *
  1086. * @fn ixEthAccPortPromiscuousModeSet(IxEthAccPortId portId)
  1087. *
  1088. * @brief Put the MAC device in promiscuous mode.
  1089. *
  1090. * If the device is in promiscuous mode then all all received frames shall be forwared
  1091. * to the NPE for processing.
  1092. *
  1093. * Other functions modify the MAC filtering
  1094. *
  1095. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1096. * frames are forwarded to the application
  1097. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1098. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1099. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1100. * filtering address
  1101. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1102. * filtering address
  1103. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1104. * forwarded to the application regardless of the multicast
  1105. * address provisioned
  1106. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1107. * to the application following the multicast address provisioned
  1108. *
  1109. * In all cases, unicast and broadcast addresses are forwarded to
  1110. * the application.
  1111. *
  1112. * @li Reentrant - yes
  1113. * @li ISR Callable - no
  1114. *
  1115. * @sa ixEthAccPortPromiscuousModeClear
  1116. *
  1117. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1118. *
  1119. * @return IxEthAccStatus
  1120. * @li @a IX_ETH_ACC_SUCCESS
  1121. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1122. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1123. *
  1124. * <hr>
  1125. */
  1126. PUBLIC IxEthAccStatus ixEthAccPortPromiscuousModeSet(IxEthAccPortId portId);
  1127. /**
  1128. * @ingroup IxEthAcc
  1129. *
  1130. * @fn ixEthAccPortUnicastMacAddressSet( IxEthAccPortId portId,
  1131. IxEthAccMacAddr *macAddr)
  1132. *
  1133. * @brief Configure unicast MAC address for a particular port
  1134. *
  1135. *
  1136. * @li Reentrant - yes
  1137. * @li ISR Callable - no
  1138. *
  1139. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1140. * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
  1141. *
  1142. * @return IxEthAccStatus
  1143. * @li @a IX_ETH_ACC_SUCCESS
  1144. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1145. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1146. *
  1147. * <hr>
  1148. */
  1149. PUBLIC IxEthAccStatus ixEthAccPortUnicastMacAddressSet(IxEthAccPortId portId,
  1150. IxEthAccMacAddr *macAddr);
  1151. /**
  1152. * @ingroup IxEthAcc
  1153. *
  1154. * @fn ixEthAccPortUnicastMacAddressGet( IxEthAccPortId portId,
  1155. IxEthAccMacAddr *macAddr)
  1156. *
  1157. * @brief Get unicast MAC address for a particular MAC port
  1158. *
  1159. * @pre
  1160. * The MAC address must first be set via @a ixEthAccMacPromiscuousModeSet
  1161. * If the MAC address has not been set, the function returns a
  1162. * IX_ETH_ACC_MAC_UNINITIALIZED status
  1163. *
  1164. * @li Reentrant - yes
  1165. * @li ISR Callable - no
  1166. *
  1167. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1168. * @param *macAddr @ref IxEthAccMacAddr [out] - Ethernet MAC address.
  1169. *
  1170. * @return IxEthAccStatus
  1171. * @li @a IX_ETH_ACC_SUCCESS
  1172. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1173. * @li @a IX_ETH_ACC_MAC_UNINITIALIZED : port MAC address is not initialized.
  1174. * @li @a IX_ETH_ACC_FAIL : macAddr is invalid.
  1175. *
  1176. * <hr>
  1177. */
  1178. PUBLIC IxEthAccStatus
  1179. ixEthAccPortUnicastMacAddressGet(IxEthAccPortId portId,
  1180. IxEthAccMacAddr *macAddr);
  1181. /**
  1182. * @ingroup IxEthAcc
  1183. *
  1184. * @fn ixEthAccPortMulticastAddressJoin( IxEthAccPortId portId,
  1185. IxEthAccMacAddr *macAddr)
  1186. *
  1187. * @brief Add a multicast address to the MAC address table.
  1188. *
  1189. * @note
  1190. * Due to the operation of the Ethernet MAC multicast filtering mechanism, frames which do not
  1191. * have a multicast destination address which were provisioned via this API may be forwarded
  1192. * to the NPE's. This is a result of the hardware comparison algorithm used in the destination mac address logic
  1193. * within the Ethernet MAC.
  1194. *
  1195. * See Also: IXP425 hardware development manual.
  1196. *
  1197. * Other functions modify the MAC filtering
  1198. *
  1199. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1200. * frames are forwarded to the application
  1201. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1202. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1203. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1204. * filtering address
  1205. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1206. * filtering address
  1207. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1208. * forwarded to the application regardless of the multicast
  1209. * address provisioned
  1210. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1211. * to the application following the multicast address provisioned
  1212. *
  1213. * In all cases, unicast and broadcast addresses are forwarded to
  1214. * the application.
  1215. *
  1216. * @li Reentrant - yes
  1217. * @li ISR Callable - no
  1218. *
  1219. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1220. * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
  1221. *
  1222. * @return IxEthAccStatus
  1223. * @li @a IX_ETH_ACC_SUCCESS
  1224. * @li @a IX_ETH_ACC_FAIL : Error writing to the MAC registers
  1225. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1226. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1227. *
  1228. * <hr>
  1229. */
  1230. PUBLIC IxEthAccStatus
  1231. ixEthAccPortMulticastAddressJoin(IxEthAccPortId portId,
  1232. IxEthAccMacAddr *macAddr);
  1233. /**
  1234. * @ingroup IxEthAcc
  1235. *
  1236. * @fn ixEthAccPortMulticastAddressJoinAll( IxEthAccPortId portId)
  1237. *
  1238. * @brief Filter all frames with multicast dest.
  1239. *
  1240. * This function clears the MAC address table, and then sets
  1241. * the MAC to forward ALL multicast frames to the NPE.
  1242. * Specifically, it forwards all frames whose destination address
  1243. * has the LSB of the highest byte set (01:00:00:00:00:00). This
  1244. * bit is commonly referred to as the "multicast bit".
  1245. * Broadcast frames will still be forwarded.
  1246. *
  1247. * Other functions modify the MAC filtering
  1248. *
  1249. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1250. * frames are forwarded to the application
  1251. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1252. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1253. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1254. * filtering address
  1255. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1256. * filtering address
  1257. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1258. * forwarded to the application regardless of the multicast
  1259. * address provisioned
  1260. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1261. * to the application following the multicast address provisioned
  1262. *
  1263. * In all cases, unicast and broadcast addresses are forwarded to
  1264. * the application.
  1265. *
  1266. * @li Reentrant - yes
  1267. * @li ISR Callable - no
  1268. *
  1269. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1270. *
  1271. * @return IxEthAccStatus
  1272. * @li @a IX_ETH_ACC_SUCCESS
  1273. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1274. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1275. *
  1276. * <hr>
  1277. */
  1278. PUBLIC IxEthAccStatus
  1279. ixEthAccPortMulticastAddressJoinAll(IxEthAccPortId portId);
  1280. /**
  1281. * @ingroup IxEthAcc
  1282. *
  1283. * @fn ixEthAccPortMulticastAddressLeave( IxEthAccPortId portId,
  1284. IxEthAccMacAddr *macAddr)
  1285. *
  1286. * @brief Remove a multicast address from the MAC address table.
  1287. *
  1288. * Other functions modify the MAC filtering
  1289. *
  1290. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1291. * frames are forwarded to the application
  1292. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1293. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1294. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1295. * filtering address
  1296. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1297. * filtering address
  1298. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1299. * forwarded to the application regardless of the multicast
  1300. * address provisioned
  1301. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1302. * to the application following the multicast address provisioned
  1303. *
  1304. * In all cases, unicast and broadcast addresses are forwarded to
  1305. * the application.
  1306. *
  1307. * @li Reentrant - yes
  1308. * @li ISR Callable - no
  1309. *
  1310. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1311. * @param *macAddr @ref IxEthAccMacAddr [in] - Ethernet Mac address.
  1312. *
  1313. * @return IxEthAccStatus
  1314. * @li @a IX_ETH_ACC_SUCCESS
  1315. * @li @a IX_ETH_ACC_NO_SUCH_ADDR : Failed if MAC address was not in the table.
  1316. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1317. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1318. *
  1319. * <hr>
  1320. */
  1321. PUBLIC IxEthAccStatus
  1322. ixEthAccPortMulticastAddressLeave(IxEthAccPortId portId,
  1323. IxEthAccMacAddr *macAddr);
  1324. /**
  1325. * @ingroup IxEthAcc
  1326. *
  1327. * @fn ixEthAccPortMulticastAddressLeaveAll( IxEthAccPortId portId)
  1328. *
  1329. * @brief This function unconfigures the multicast filtering settings
  1330. *
  1331. * This function first clears the MAC address table, and then sets
  1332. * the MAC as configured by the promiscuous mode current settings.
  1333. *
  1334. * Other functions modify the MAC filtering
  1335. *
  1336. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1337. * frames are forwarded to the application
  1338. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1339. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1340. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1341. * filtering address
  1342. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1343. * filtering address
  1344. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1345. * forwarded to the application regardless of the multicast
  1346. * address provisioned
  1347. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1348. * to the application following the multicast address provisioned
  1349. *
  1350. * In all cases, unicast and broadcast addresses are forwarded to
  1351. * the application.
  1352. *
  1353. * @li Reentrant - yes
  1354. * @li ISR Callable - no
  1355. *
  1356. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1357. *
  1358. * @return IxEthAccStatus
  1359. * @li @a IX_ETH_ACC_SUCCESS
  1360. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1361. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1362. *
  1363. * <hr>
  1364. */
  1365. PUBLIC IxEthAccStatus
  1366. ixEthAccPortMulticastAddressLeaveAll(IxEthAccPortId portId);
  1367. /**
  1368. * @ingroup IxEthAcc
  1369. *
  1370. * @fn ixEthAccPortUnicastAddressShow(IxEthAccPortId portId)
  1371. *
  1372. * @brief Displays unicast MAC address
  1373. *
  1374. * Displays unicast address which is configured using
  1375. * @a ixEthAccUnicastMacAddressSet. This function also displays the MAC filter used
  1376. * to filter multicast frames.
  1377. *
  1378. * Other functions modify the MAC filtering
  1379. *
  1380. * @li @a ixEthAccPortMulticastAddressJoinAll() - all multicast
  1381. * frames are forwarded to the application
  1382. * @li @a ixEthAccPortMulticastAddressLeaveAll() - rollback the
  1383. * effects of @a ixEthAccPortMulticastAddressJoinAll()
  1384. * @li @a ixEthAccPortMulticastAddressLeave() - unprovision a new
  1385. * filtering address
  1386. * @li @a ixEthAccPortMulticastAddressJoin() - provision a new
  1387. * filtering address
  1388. * @li @a ixEthAccPortPromiscuousModeSet() - all frames are
  1389. * forwarded to the application regardless of the multicast
  1390. * address provisioned
  1391. * @li @a ixEthAccPortPromiscuousModeClear() - frames are forwarded
  1392. * to the application following the multicast address provisioned
  1393. *
  1394. * In all cases, unicast and broadcast addresses are forwarded to
  1395. * the application.
  1396. *
  1397. * @li Reentrant - yes
  1398. * @li ISR Callable - no
  1399. *
  1400. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1401. *
  1402. * @return void
  1403. *
  1404. * <hr>
  1405. */
  1406. PUBLIC IxEthAccStatus ixEthAccPortUnicastAddressShow(IxEthAccPortId portId);
  1407. /**
  1408. * @ingroup IxEthAcc
  1409. *
  1410. * @fn ixEthAccPortMulticastAddressShow( IxEthAccPortId portId)
  1411. *
  1412. * @brief Displays multicast MAC address
  1413. *
  1414. * Displays multicast address which have been configured using @a ixEthAccMulticastAddressJoin
  1415. *
  1416. * @li Reentrant - yes
  1417. * @li ISR Callable - no
  1418. *
  1419. * @param portId @ref IxEthAccPortId [in] - Ethernet port id.
  1420. *
  1421. * @return void
  1422. *
  1423. * <hr>
  1424. */
  1425. PUBLIC void ixEthAccPortMulticastAddressShow( IxEthAccPortId portId);
  1426. /**
  1427. * @ingroup IxEthAcc
  1428. *
  1429. * @fn ixEthAccPortDuplexModeSet( IxEthAccPortId portId, IxEthAccDuplexMode mode )
  1430. *
  1431. * @brief Set the duplex mode for the MAC.
  1432. *
  1433. * Configure the IXP400 MAC to either full or half duplex.
  1434. *
  1435. * @note
  1436. * The configuration should match that provisioned on the PHY.
  1437. *
  1438. * @li Reentrant - yes
  1439. * @li ISR Callable - no
  1440. *
  1441. * @param portId @ref IxEthAccPortId [in]
  1442. * @param mode @ref IxEthAccDuplexMode [in]
  1443. *
  1444. * @return IxEthAccStatus
  1445. * @li @a IX_ETH_ACC_SUCCESS
  1446. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1447. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1448. *
  1449. * <hr>
  1450. */
  1451. PUBLIC IxEthAccStatus
  1452. ixEthAccPortDuplexModeSet(IxEthAccPortId portId,IxEthAccDuplexMode mode);
  1453. /**
  1454. * @ingroup IxEthAcc
  1455. *
  1456. * @fn ixEthAccPortDuplexModeGet( IxEthAccPortId portId, IxEthAccDuplexMode *mode )
  1457. *
  1458. * @brief Get the duplex mode for the MAC.
  1459. *
  1460. * return the duplex configuration of the IXP400 MAC.
  1461. *
  1462. * @note
  1463. * The configuration should match that provisioned on the PHY.
  1464. * See @a ixEthAccDuplexModeSet
  1465. *
  1466. * @li Reentrant - yes
  1467. * @li ISR Callable - no
  1468. *
  1469. * @param portId @ref IxEthAccPortId [in]
  1470. * @param *mode @ref IxEthAccDuplexMode [out]
  1471. *
  1472. * @return IxEthAccStatus
  1473. * @li @a IX_ETH_ACC_SUCCESS
  1474. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1475. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1476. *
  1477. * <hr>
  1478. *
  1479. */
  1480. PUBLIC IxEthAccStatus
  1481. ixEthAccPortDuplexModeGet(IxEthAccPortId portId,IxEthAccDuplexMode *mode );
  1482. /**
  1483. * @ingroup IxEthAcc
  1484. *
  1485. * @fn ixEthAccPortTxFrameAppendPaddingEnable( IxEthAccPortId portId)
  1486. *
  1487. * @brief Enable padding bytes to be appended to runt frames submitted to
  1488. * this port
  1489. *
  1490. * Enable up to 60 null-bytes padding bytes to be appended to runt frames
  1491. * submitted to this port. This is the default behavior of the access
  1492. * component.
  1493. *
  1494. * @warning Do not change this behaviour while the port is enabled.
  1495. *
  1496. * @note When Tx padding is enabled, Tx FCS generation is turned on
  1497. *
  1498. * @li Reentrant - yes
  1499. * @li ISR Callable - no
  1500. *
  1501. * @sa ixEthAccPortTxFrameAppendFCSDusable
  1502. *
  1503. * @param portId @ref IxEthAccPortId [in]
  1504. *
  1505. * @return IxEthAccStatus
  1506. * @li @a IX_ETH_ACC_SUCCESS
  1507. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1508. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1509. *
  1510. * <hr>
  1511. */
  1512. PUBLIC IxEthAccStatus
  1513. ixEthAccPortTxFrameAppendPaddingEnable(IxEthAccPortId portId);
  1514. /**
  1515. * @ingroup IxEthAcc
  1516. *
  1517. * @fn ixEthAccPortTxFrameAppendPaddingDisable( IxEthAccPortId portId)
  1518. *
  1519. * @brief Disable padding bytes to be appended to runt frames submitted to
  1520. * this port
  1521. *
  1522. * Disable padding bytes to be appended to runt frames
  1523. * submitted to this port. This is not the default behavior of the access
  1524. * component.
  1525. *
  1526. * @warning Do not change this behaviour while the port is enabled.
  1527. *
  1528. * @li Reentrant - yes
  1529. * @li ISR Callable - no
  1530. *
  1531. * @param portId @ref IxEthAccPortId [in]
  1532. *
  1533. * @return IxEthAccStatus
  1534. * @li @a IX_ETH_ACC_SUCCESS
  1535. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1536. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1537. *
  1538. * <hr>
  1539. */
  1540. PUBLIC IxEthAccStatus
  1541. ixEthAccPortTxFrameAppendPaddingDisable(IxEthAccPortId portId);
  1542. /**
  1543. * @ingroup IxEthAcc
  1544. *
  1545. * @fn ixEthAccPortTxFrameAppendFCSEnable( IxEthAccPortId portId)
  1546. *
  1547. * @brief Enable the appending of Ethernet FCS to all frames submitted to this port
  1548. *
  1549. * When enabled, the FCS is added to the submitted frames. This is the default
  1550. * behavior of the access component.
  1551. * Do not change this behaviour while the port is enabled.
  1552. *
  1553. * @li Reentrant - yes
  1554. * @li ISR Callable - no
  1555. *
  1556. * @param portId @ref IxEthAccPortId [in]
  1557. *
  1558. * @return IxEthAccStatus
  1559. * @li @a IX_ETH_ACC_SUCCESS
  1560. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1561. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1562. *
  1563. * <hr>
  1564. */
  1565. PUBLIC IxEthAccStatus
  1566. ixEthAccPortTxFrameAppendFCSEnable(IxEthAccPortId portId);
  1567. /**
  1568. * @ingroup IxEthAcc
  1569. *
  1570. * @fn ixEthAccPortTxFrameAppendFCSDisable( IxEthAccPortId portId)
  1571. *
  1572. * @brief Disable the appending of Ethernet FCS to all frames submitted to this port.
  1573. *
  1574. * When disabled, the Ethernet FCS is not added to the submitted frames.
  1575. * This is not the default
  1576. * behavior of the access component.
  1577. *
  1578. * @note Since the FCS is not appended to the frame it is expected that the frame submitted to the
  1579. * component includes a valid FCS at the end of the data, although this will not be validated.
  1580. *
  1581. * The component shall forward the frame to the Ethernet MAC WITHOUT modification.
  1582. *
  1583. * Do not change this behaviour while the port is enabled.
  1584. *
  1585. * @note Tx FCS append is not disabled while Tx padding is enabled.
  1586. *
  1587. * @li Reentrant - yes
  1588. * @li ISR Callable - no
  1589. *
  1590. * @sa ixEthAccPortTxFrameAppendPaddingEnable
  1591. *
  1592. * @param portId @ref IxEthAccPortId [in]
  1593. *
  1594. * @return IxEthAccStatus
  1595. * @li @a IX_ETH_ACC_SUCCESS
  1596. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1597. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1598. *
  1599. * <hr>
  1600. */
  1601. PUBLIC IxEthAccStatus
  1602. ixEthAccPortTxFrameAppendFCSDisable(IxEthAccPortId portId);
  1603. /**
  1604. * @ingroup IxEthAcc
  1605. *
  1606. * @fn ixEthAccPortRxFrameAppendFCSEnable( IxEthAccPortId portId)
  1607. *
  1608. * @brief Forward frames with FCS included in the receive buffer.
  1609. *
  1610. * The FCS is not striped from the receive buffer.
  1611. * The received frame length includes the FCS size (4 bytes). ie.
  1612. * A minimum sized ethernet frame shall have a length of 64bytes.
  1613. *
  1614. * Frame FCS validity checks are still carried out on all received frames.
  1615. *
  1616. * This is not the default
  1617. * behavior of the access component.
  1618. *
  1619. * @li Reentrant - yes
  1620. * @li ISR Callable - no
  1621. *
  1622. * @param portId @ref IxEthAccPortId [in]
  1623. *
  1624. * @return IxEthAccStatus
  1625. * @li @a IX_ETH_ACC_SUCCESS
  1626. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1627. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1628. *
  1629. * <hr>
  1630. */
  1631. PUBLIC IxEthAccStatus
  1632. ixEthAccPortRxFrameAppendFCSEnable(IxEthAccPortId portId);
  1633. /**
  1634. * @ingroup IxEthAcc
  1635. *
  1636. * @fn ixEthAccPortRxFrameAppendFCSDisable( IxEthAccPortId portId)
  1637. *
  1638. * @brief Do not forward the FCS portion of the received Ethernet frame to the user.
  1639. * The FCS is striped from the receive buffer.
  1640. * The received frame length does not include the FCS size (4 bytes).
  1641. * Frame FCS validity checks are still carried out on all received frames.
  1642. *
  1643. * This is the default behavior of the component.
  1644. * Do not change this behaviour while the port is enabled.
  1645. *
  1646. * @li Reentrant - yes
  1647. * @li ISR Callable - no
  1648. *
  1649. * @param portId @ref IxEthAccPortId [in]
  1650. *
  1651. * @return IxEthAccStatus
  1652. * @li @a IX_ETH_ACC_SUCCESS
  1653. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1654. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1655. *
  1656. * <hr>
  1657. */
  1658. PUBLIC IxEthAccStatus
  1659. ixEthAccPortRxFrameAppendFCSDisable(IxEthAccPortId portId);
  1660. /**
  1661. * @ingroup IxEthAcc
  1662. *
  1663. * @enum IxEthAccSchedulerDiscipline
  1664. *
  1665. * @brief Definition for the port scheduling discipline
  1666. *
  1667. * Select the port scheduling discipline on receive and transmit path
  1668. * @li FIFO : No Priority : In this configuration all frames are processed
  1669. * in the access component in the strict order in which
  1670. * the component received them.
  1671. * @li FIFO : Priority : This shall be a very simple priority mechanism.
  1672. * Higher prior-ity frames shall be forwarded
  1673. * before lower priority frames. There shall be no
  1674. * fairness mechanisms applied across different
  1675. * priorities. Higher priority frames could starve
  1676. * lower priority frames indefinitely.
  1677. */
  1678. typedef enum
  1679. {
  1680. FIFO_NO_PRIORITY, /**<frames submitted with no priority*/
  1681. FIFO_PRIORITY /**<higher prority frames submitted before lower priority*/
  1682. }IxEthAccSchedulerDiscipline;
  1683. /**
  1684. * @ingroup IxEthAcc
  1685. *
  1686. * @def IxEthAccTxSchedulerDiscipline
  1687. *
  1688. * @brief Deprecated definition for the port transmit scheduling discipline
  1689. */
  1690. #define IxEthAccTxSchedulerDiscipline IxEthAccSchedulerDiscipline
  1691. /**
  1692. * @ingroup IxEthAcc
  1693. *
  1694. * @fn ixEthAccTxSchedulingDisciplineSet( IxEthAccPortId portId, IxEthAccSchedulerDiscipline sched)
  1695. *
  1696. * @brief Set the port scheduling to one of @a IxEthAccSchedulerDiscipline
  1697. *
  1698. * The default behavior of the component is @a FIFO_NO_PRIORITY.
  1699. *
  1700. * @li Reentrant - yes
  1701. * @li ISR Callable - no
  1702. *
  1703. * @pre
  1704. *
  1705. *
  1706. * @param portId @ref IxEthAccPortId [in]
  1707. * @param sched @ref IxEthAccSchedulerDiscipline [in]
  1708. *
  1709. * @return IxEthAccStatus
  1710. * @li @a IX_ETH_ACC_SUCCESS : Set appropriate discipline.
  1711. * @li @a IX_ETH_ACC_FAIL : Invalid/unsupported discipline.
  1712. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  1713. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  1714. *
  1715. * <hr>
  1716. */
  1717. PUBLIC IxEthAccStatus
  1718. ixEthAccTxSchedulingDisciplineSet(IxEthAccPortId portId,
  1719. IxEthAccSchedulerDiscipline sched);
  1720. /**
  1721. * @ingroup IxEthAcc
  1722. *
  1723. * @fn ixEthAccRxSchedulingDisciplineSet(IxEthAccSchedulerDiscipline sched)
  1724. *
  1725. * @brief Set the Rx scheduling to one of @a IxEthAccSchedulerDiscipline
  1726. *
  1727. * The default behavior of the component is @a FIFO_NO_PRIORITY.
  1728. *
  1729. * @li Reentrant - yes
  1730. * @li ISR Callable - no
  1731. *
  1732. * @pre
  1733. *
  1734. * @param sched : @a IxEthAccSchedulerDiscipline
  1735. *
  1736. * @return IxEthAccStatus
  1737. * @li @a IX_ETH_ACC_SUCCESS : Set appropriate discipline.
  1738. * @li @a IX_ETH_ACC_FAIL : Invalid/unsupported discipline.
  1739. *
  1740. * <hr>
  1741. */
  1742. PUBLIC IxEthAccStatus
  1743. ixEthAccRxSchedulingDisciplineSet(IxEthAccSchedulerDiscipline sched);
  1744. /**
  1745. * @ingroup IxEthAcc
  1746. *
  1747. * @fn IxEthAccStatus ixEthAccNpeLoopbackEnable(IxEthAccPortId portId)
  1748. *
  1749. * @brief Enable NPE loopback
  1750. *
  1751. * When this loopback mode is enabled all the transmitted frames are
  1752. * received on the same port, without payload.
  1753. *
  1754. * This function is recommended for power-up diagnostic checks and
  1755. * should never be used under normal Ethernet traffic operations.
  1756. *
  1757. * @li Reentrant - yes
  1758. * @li ISR Callable - no
  1759. *
  1760. * @pre
  1761. *
  1762. * @param portId : ID of the port
  1763. *
  1764. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1765. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1766. *
  1767. * @return IxEthAccStatus
  1768. * @li @a IX_ETH_ACC_SUCCESS : NPE loopback mode enabled
  1769. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1770. *
  1771. * <hr>
  1772. */
  1773. PUBLIC IxEthAccStatus
  1774. ixEthAccPortNpeLoopbackEnable(IxEthAccPortId portId);
  1775. /**
  1776. * @ingroup IxEthAcc
  1777. *
  1778. * @fn IxEthAccStatus ixEthAccPortNpeLoopbackDisable(IxEthAccPortId portId)
  1779. *
  1780. * @brief Disable NPE loopback
  1781. *
  1782. * This function is used to disable the NPE loopback if previously
  1783. * enabled using ixEthAccNpeLoopbackEnable.
  1784. *
  1785. * This function is recommended for power-up diagnostic checks and
  1786. * should never be used under normal Ethernet traffic operations.
  1787. *
  1788. * @li Reentrant - yes
  1789. * @li ISR Callable - no
  1790. *
  1791. * @pre
  1792. *
  1793. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1794. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1795. *
  1796. * @param portId : ID of the port
  1797. *
  1798. * @return IxEthAccStatus
  1799. * @li @a IX_ETH_ACC_SUCCESS : NPE loopback successfully disabled
  1800. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1801. *
  1802. * <hr>
  1803. */
  1804. PUBLIC IxEthAccStatus
  1805. ixEthAccPortNpeLoopbackDisable(IxEthAccPortId portId);
  1806. /**
  1807. * @ingroup IxEthAcc
  1808. *
  1809. * @fn IxEthAccStatus ixEthAccPortTxEnable(IxEthAccPortId portId)
  1810. *
  1811. * @brief Enable Tx on the port
  1812. *
  1813. * This function is the complement of ixEthAccPortTxDisable and should
  1814. * be used only after Tx was disabled. A MAC core reset is required before
  1815. * this function is called (see @a ixEthAccPortMacReset).
  1816. *
  1817. * This function is the recommended usage scenario for emergency security
  1818. * shutdown and hardware failure recovery and should never be used for throttling
  1819. * traffic.
  1820. *
  1821. * @li Reentrant - yes
  1822. * @li ISR Callable - no
  1823. *
  1824. * @pre
  1825. *
  1826. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1827. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1828. *
  1829. * @param portId : ID of the port
  1830. *
  1831. * @return IxEthAccStatus
  1832. * @li @a IX_ETH_ACC_SUCCESS : Tx successfully enabled
  1833. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1834. *
  1835. * <hr>
  1836. */
  1837. PUBLIC IxEthAccStatus
  1838. ixEthAccPortTxEnable(IxEthAccPortId portId);
  1839. /**
  1840. * @ingroup IxEthAcc
  1841. *
  1842. * @fn IxEthAccStatus ixEthAccPortTxDisable(IxEthAccPortId portId)
  1843. *
  1844. * @brief Disable Tx on the port
  1845. *
  1846. * This function can be used to disable Tx in the MAC core.
  1847. * Tx can be re-enabled, although this is not guaranteed, by performing
  1848. * a MAC core reset (@a ixEthAccPortMacReset) and calling ixEthAccPortTxEnable.
  1849. * Note that using this function is not recommended, except for shutting
  1850. * down Tx for emergency reasons. For proper port shutdown and re-enabling
  1851. * see ixEthAccPortEnable and ixEthAccPortDisable.
  1852. *
  1853. * This function is the recommended usage scenario for emergency security
  1854. * shutdown and hardware failure recovery and should never be used for throttling
  1855. * traffic.
  1856. *
  1857. * @li Reentrant - yes
  1858. * @li ISR Callable - no
  1859. *
  1860. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1861. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1862. *
  1863. * @pre
  1864. *
  1865. * @param portId : ID of the port
  1866. *
  1867. * @return IxEthAccStatus
  1868. * @li @a IX_ETH_ACC_SUCCESS : Tx successfully disabled
  1869. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1870. *
  1871. * <hr>
  1872. */
  1873. PUBLIC IxEthAccStatus
  1874. ixEthAccPortTxDisable(IxEthAccPortId portId);
  1875. /**
  1876. * @ingroup IxEthAcc
  1877. *
  1878. * @fn IxEthAccStatus ixEthAccPortRxEnable(IxEthAccPortId portId)
  1879. *
  1880. * @brief Enable Rx on the port
  1881. *
  1882. * This function is the complement of ixEthAccPortRxDisable and should
  1883. * be used only after Rx was disabled.
  1884. *
  1885. * This function is the recommended usage scenario for emergency security
  1886. * shutdown and hardware failure recovery and should never be used for throttling
  1887. * traffic.
  1888. *
  1889. * @li Reentrant - yes
  1890. * @li ISR Callable - no
  1891. *
  1892. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1893. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1894. *
  1895. * @pre
  1896. *
  1897. * @param portId : ID of the port
  1898. *
  1899. * @return IxEthAccStatus
  1900. * @li @a IX_ETH_ACC_SUCCESS : Rx successfully enabled
  1901. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1902. *
  1903. * <hr>
  1904. */
  1905. PUBLIC IxEthAccStatus
  1906. ixEthAccPortRxEnable(IxEthAccPortId portId);
  1907. /**
  1908. * @ingroup IxEthAcc
  1909. *
  1910. * @fn IxEthAccStatus ixEthAccPortRxDisable(IxEthAccPortId portId)
  1911. *
  1912. * @brief Disable Rx on the port
  1913. *
  1914. * This function can be used to disable Rx in the MAC core.
  1915. * Rx can be re-enabled, although this is not guaranteed, by performing
  1916. * a MAC core reset (@a ixEthAccPortMacReset) and calling ixEthAccPortRxEnable.
  1917. * Note that using this function is not recommended, except for shutting
  1918. * down Rx for emergency reasons. For proper port shutdown and re-enabling
  1919. * see ixEthAccPortEnable and ixEthAccPortDisable.
  1920. *
  1921. * This function is the recommended usage scenario for emergency security
  1922. * shutdown and hardware failure recovery and should never be used for throttling
  1923. * traffic.
  1924. *
  1925. * @li Reentrant - yes
  1926. * @li ISR Callable - no
  1927. *
  1928. * @pre
  1929. *
  1930. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1931. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1932. *
  1933. * @param portId : ID of the port
  1934. *
  1935. * @return IxEthAccStatus
  1936. * @li @a IX_ETH_ACC_SUCCESS : Rx successfully disabled
  1937. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1938. *
  1939. * <hr>
  1940. */
  1941. PUBLIC IxEthAccStatus
  1942. ixEthAccPortRxDisable(IxEthAccPortId portId);
  1943. /**
  1944. * @ingroup IxEthAcc
  1945. *
  1946. * @fn IxEthAccStatus ixEthAccPortMacReset(IxEthAccPortId portId)
  1947. *
  1948. * @brief Reset MAC core on the port
  1949. *
  1950. * This function will perform a MAC core reset (NPE Ethernet coprocessor).
  1951. * This function is inherently unsafe and the NPE recovery is not guaranteed
  1952. * after this function is called. The proper manner of performing port disable
  1953. * and enable (which will reset the MAC as well) is ixEthAccPortEnable/ixEthAccPortDisable.
  1954. *
  1955. * This function is the recommended usage scenario for hardware failure recovery
  1956. * and should never be used for throttling traffic.
  1957. *
  1958. * @li Reentrant - yes
  1959. * @li ISR Callable - no
  1960. *
  1961. * @pre
  1962. *
  1963. * @note Calling ixEthAccPortDisable followed by ixEthAccPortEnable is
  1964. * guaranteed to restore correct Ethernet Tx/Rx operation.
  1965. *
  1966. * @param portId : ID of the port
  1967. *
  1968. * @return IxEthAccStatus
  1969. * @li @a IX_ETH_ACC_SUCCESS : MAC core reset
  1970. * @li @a IX_ETH_ACC_FAIL : Invalid port or Ethernet service not initialized
  1971. *
  1972. * <hr>
  1973. */
  1974. PUBLIC IxEthAccStatus
  1975. ixEthAccPortMacReset(IxEthAccPortId portId);
  1976. /*********************************************************************************
  1977. #### ##### ## ##### # #### ##### # #### ####
  1978. # # # # # # # # # # # #
  1979. #### # # # # # #### # # # ####
  1980. # # ###### # # # # # # #
  1981. # # # # # # # # # # # # # # #
  1982. #### # # # # # #### # # #### ####
  1983. **********************************************************************************/
  1984. /**
  1985. *
  1986. * @brief This struct defines the statistics returned by this component.
  1987. *
  1988. * The component returns MIB2 EthObj variables which are obtained from the
  1989. * hardware or maintained by this component.
  1990. *
  1991. *
  1992. */
  1993. typedef struct
  1994. {
  1995. UINT32 dot3StatsAlignmentErrors; /**< link error count (rx) */
  1996. UINT32 dot3StatsFCSErrors; /**< link error count (rx) */
  1997. UINT32 dot3StatsInternalMacReceiveErrors; /**< link error count (rx) */
  1998. UINT32 RxOverrunDiscards; /**< NPE: discarded frames count (rx) */
  1999. UINT32 RxLearnedEntryDiscards; /**< NPE: discarded frames count(rx) */
  2000. UINT32 RxLargeFramesDiscards; /**< NPE: discarded frames count(rx) */
  2001. UINT32 RxSTPBlockedDiscards; /**< NPE: discarded frames count(rx) */
  2002. UINT32 RxVLANTypeFilterDiscards; /**< NPE: discarded frames count (rx) */
  2003. UINT32 RxVLANIdFilterDiscards; /**< NPE: discarded frames count (rx) */
  2004. UINT32 RxInvalidSourceDiscards; /**< NPE: discarded frames count (rx) */
  2005. UINT32 RxBlackListDiscards; /**< NPE: discarded frames count (rx) */
  2006. UINT32 RxWhiteListDiscards; /**< NPE: discarded frames count (rx) */
  2007. UINT32 RxUnderflowEntryDiscards; /**< NPE: discarded frames count (rx) */
  2008. UINT32 dot3StatsSingleCollisionFrames; /**< link error count (tx) */
  2009. UINT32 dot3StatsMultipleCollisionFrames; /**< link error count (tx) */
  2010. UINT32 dot3StatsDeferredTransmissions; /**< link error count (tx) */
  2011. UINT32 dot3StatsLateCollisions; /**< link error count (tx) */
  2012. UINT32 dot3StatsExcessiveCollsions; /**< link error count (tx) */
  2013. UINT32 dot3StatsInternalMacTransmitErrors; /**< link error count (tx) */
  2014. UINT32 dot3StatsCarrierSenseErrors; /**< link error count (tx) */
  2015. UINT32 TxLargeFrameDiscards; /**< NPE: discarded frames count (tx) */
  2016. UINT32 TxVLANIdFilterDiscards; /**< NPE: discarded frames count (tx) */
  2017. }IxEthEthObjStats;
  2018. /**
  2019. * @ingroup IxEthAcc
  2020. *
  2021. * @fn ixEthAccMibIIStatsGet(IxEthAccPortId portId ,IxEthEthObjStats *retStats )
  2022. *
  2023. * @brief Returns the statistics maintained for a port.
  2024. *
  2025. * @li Reentrant - yes
  2026. * @li ISR Callable - no
  2027. *
  2028. * @pre
  2029. *
  2030. *
  2031. * @param portId @ref IxEthAccPortId [in]
  2032. * @param retStats @ref IxEthEthObjStats [out]
  2033. * @note Please note the user is responsible for cache coheriency of the retStat
  2034. * buffer. The data is actually populated via the NPE's. As such cache safe
  2035. * memory should be used in the retStats argument.
  2036. *
  2037. * @return IxEthAccStatus
  2038. * @li @a IX_ETH_ACC_SUCCESS
  2039. * @li @a IX_ETH_ACC_FAIL : Invalid arguments.
  2040. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  2041. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  2042. *
  2043. * <hr>
  2044. */
  2045. PUBLIC IxEthAccStatus
  2046. ixEthAccMibIIStatsGet(IxEthAccPortId portId, IxEthEthObjStats *retStats );
  2047. /**
  2048. * @ingroup IxEthAcc
  2049. *
  2050. * @fn ixEthAccMibIIStatsGetClear(IxEthAccPortId portId, IxEthEthObjStats *retStats)
  2051. *
  2052. * @brief Returns and clears the statistics maintained for a port.
  2053. *
  2054. * @li Reentrant - yes
  2055. * @li ISR Callable - yes
  2056. *
  2057. * @pre
  2058. *
  2059. * @param portId @ref IxEthAccPortId [in]
  2060. * @param retStats @ref IxEthEthObjStats [out]
  2061. * @note Please note the user is responsible for cache coheriency of the retStats
  2062. * buffer. The data is actually populated via the NPE's. As such cache safe
  2063. * memory should be used in the retStats argument.
  2064. *
  2065. * @return IxEthAccStatus
  2066. * @li @a IX_ETH_ACC_SUCCESS
  2067. * @li @a IX_ETH_ACC_FAIL : invalid arguments.
  2068. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  2069. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  2070. *
  2071. * <hr>
  2072. */
  2073. PUBLIC IxEthAccStatus
  2074. ixEthAccMibIIStatsGetClear(IxEthAccPortId portId, IxEthEthObjStats *retStats);
  2075. /**
  2076. * @ingroup IxEthAcc
  2077. *
  2078. * @fn ixEthAccMibIIStatsClear(IxEthAccPortId portId)
  2079. *
  2080. * @brief Clears the statistics maintained for a port.
  2081. *
  2082. * @li Reentrant - yes
  2083. * @li ISR Callable - no
  2084. *
  2085. * @pre
  2086. *
  2087. * @param portId @ref IxEthAccPortId [in]
  2088. *
  2089. * @return IxEthAccStatus
  2090. * @li @a IX_ETH_ACC_SUCCESS
  2091. * @li @a IX_ETH_ACC_FAIL : Invalid arguments.
  2092. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  2093. * @li @a IX_ETH_ACC_PORT_UNINITIALIZED : portId is un-initialized
  2094. *
  2095. * <hr>
  2096. */
  2097. PUBLIC IxEthAccStatus ixEthAccMibIIStatsClear(IxEthAccPortId portId);
  2098. /**
  2099. * @ingroup IxEthAcc
  2100. *
  2101. * @fn ixEthAccMacInit(IxEthAccPortId portId)
  2102. *
  2103. * @brief Initializes the ethernet MAC settings
  2104. *
  2105. * @li Reentrant - no
  2106. * @li ISR Callable - no
  2107. *
  2108. * @param portId @ref IxEthAccPortId [in]
  2109. *
  2110. * @return IxEthAccStatus
  2111. * @li @a IX_ETH_ACC_SUCCESS
  2112. * @li @a IX_ETH_ACC_INVALID_PORT : portId is invalid.
  2113. *
  2114. * <hr>
  2115. */
  2116. PUBLIC IxEthAccStatus ixEthAccMacInit(IxEthAccPortId portId);
  2117. /**
  2118. * @ingroup IxEthAcc
  2119. *
  2120. * @fn ixEthAccStatsShow(IxEthAccPortId portId)
  2121. *
  2122. *
  2123. * @brief Displays a ports statistics on the standard io console using printf.
  2124. *
  2125. * @li Reentrant - no
  2126. * @li ISR Callable - no
  2127. *
  2128. * @pre
  2129. *
  2130. * @param portId @ref IxEthAccPortId [in]
  2131. *
  2132. * @return void
  2133. *
  2134. * <hr>
  2135. */
  2136. PUBLIC void ixEthAccStatsShow(IxEthAccPortId portId);
  2137. /*************************************************************************
  2138. # # # # # # ##### # ####
  2139. ## ## # # ## ## # # # # #
  2140. # ## # # # # ## # # # # # #
  2141. # # # # # # # # # # #
  2142. # # # # # # # # # # #
  2143. # # # # # # ##### # ####
  2144. *************************************************************************/
  2145. /**
  2146. * @ingroup IxEthAcc
  2147. *
  2148. * @fn ixEthAccMiiReadRtn (UINT8 phyAddr,
  2149. UINT8 phyReg,
  2150. UINT16 *value)
  2151. *
  2152. *
  2153. * @brief Reads a 16 bit value from a PHY
  2154. *
  2155. * Reads a 16-bit word from a register of a MII-compliant PHY. Reading
  2156. * is performed through the MII management interface. This function returns
  2157. * when the read operation has successfully completed, or when a timeout has elapsed.
  2158. *
  2159. * @li Reentrant - no
  2160. * @li ISR Callable - no
  2161. *
  2162. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  2163. *
  2164. * @param phyAddr UINT8 [in] - the address of the Ethernet PHY (0-31)
  2165. * @param phyReg UINT8 [in] - the number of the MII register to read (0-31)
  2166. * @param value UINT16 [in] - the value read from the register
  2167. *
  2168. * @return IxEthAccStatus
  2169. * @li @a IX_ETH_ACC_SUCCESS
  2170. * @li @a IX_ETH_ACC_FAIL : failed to read the register.
  2171. *
  2172. * <hr>
  2173. */
  2174. PUBLIC IxEthAccStatus
  2175. ixEthAccMiiReadRtn (UINT8 phyAddr, UINT8 phyReg, UINT16 *value);
  2176. /**
  2177. * @ingroup IxEthAcc
  2178. *
  2179. * @fn ixEthAccMiiWriteRtn (UINT8 phyAddr,
  2180. UINT8 phyReg,
  2181. UINT16 value)
  2182. *
  2183. *
  2184. * @brief Writes a 16 bit value to a PHY
  2185. *
  2186. * Writes a 16-bit word from a register of a MII-compliant PHY. Writing
  2187. * is performed through the MII management interface. This function returns
  2188. * when the write operation has successfully completed, or when a timeout has elapsed.
  2189. *
  2190. * @li Reentrant - no
  2191. * @li ISR Callable - no
  2192. *
  2193. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and generating the MDIO clock.
  2194. *
  2195. * @param phyAddr UINT8 [in] - the address of the Ethernet PHY (0-31)
  2196. * @param phyReg UINT8 [in] - the number of the MII register to write (0-31)
  2197. * @param value UINT16 [out] - the value to write to the register
  2198. *
  2199. * @return IxEthAccStatus
  2200. * @li @a IX_ETH_ACC_SUCCESS
  2201. * @li @a IX_ETH_ACC_FAIL : failed to write register.
  2202. *
  2203. * <hr>
  2204. */
  2205. PUBLIC IxEthAccStatus
  2206. ixEthAccMiiWriteRtn (UINT8 phyAddr, UINT8 phyReg, UINT16 value);
  2207. /**
  2208. * @ingroup IxEthAcc
  2209. *
  2210. * @fn ixEthAccMiiAccessTimeoutSet(UINT32 timeout)
  2211. *
  2212. * @brief Overrides the default timeout value and retry count when reading or
  2213. * writing MII registers using ixEthAccMiiWriteRtn or ixEthAccMiiReadRtn
  2214. *
  2215. * The default behavior of the component is to use a IX_ETH_ACC_MII_10TH_SEC_IN_MILLIS ms
  2216. * timeout (declared as 100 in IxEthAccMii_p.h) and a retry count of IX_ETH_ACC_MII_TIMEOUT_10TH_SECS
  2217. * (declared as 5 in IxEthAccMii_p.h).
  2218. *
  2219. * The MII read and write functions will attempt to read the status of the register up
  2220. * to the retry count times, delaying between each attempt with the timeout value.
  2221. *
  2222. * @li Reentrant - no
  2223. * @li ISR Callable - no
  2224. *
  2225. * @pre
  2226. *
  2227. * @param timeout UINT32 [in] - new timeout value, in milliseconds
  2228. * @param timeout UINT32 [in] - new retry count (a minimum value of 1 must be used)
  2229. *
  2230. * @return IxEthAccStatus
  2231. * @li @a IX_ETH_ACC_SUCCESS
  2232. * @li @a IX_ETH_ACC_FAIL : invalid parameter(s)
  2233. *
  2234. * <hr>
  2235. */
  2236. PUBLIC IxEthAccStatus
  2237. ixEthAccMiiAccessTimeoutSet(UINT32 timeout, UINT32 retryCount);
  2238. /**
  2239. * @ingroup IxEthAcc
  2240. *
  2241. * @fn ixEthAccMiiStatsShow (UINT32 phyAddr)
  2242. *
  2243. *
  2244. * @brief Displays detailed information on a specified PHY
  2245. *
  2246. * Displays the current values of the first eigth MII registers for a PHY,
  2247. *
  2248. * @li Reentrant - no
  2249. * @li ISR Callable - no
  2250. *
  2251. * @pre The MAC on Ethernet Port 2 (NPE C) must be initialised, and
  2252. * generating the MDIO clock.
  2253. *
  2254. * @param phyAddr UINT32 [in] - the address of the Ethernet PHY (0-31)
  2255. *
  2256. * @return IxEthAccStatus
  2257. * @li @a IX_ETH_ACC_SUCCESS
  2258. * @li @a IX_ETH_ACC_FAIL : invalid arguments.
  2259. *
  2260. * <hr>
  2261. */
  2262. PUBLIC IxEthAccStatus ixEthAccMiiStatsShow (UINT32 phyAddr);
  2263. /******* BOARD SPECIFIC DEPRECATED API *********/
  2264. /* The following functions are high level functions which rely
  2265. * on the properties and interface of some Ethernet PHYs. The
  2266. * implementation is hardware specific and has been moved to
  2267. * the hardware-specific component IxEthMii.
  2268. */
  2269. #include "IxEthMii.h"
  2270. /**
  2271. * @ingroup IxEthAcc
  2272. *
  2273. * @def ixEthAccMiiPhyScan
  2274. *
  2275. * @brief : deprecated API entry point. This definition
  2276. * ensures backward compatibility
  2277. *
  2278. * See @ref ixEthMiiPhyScan
  2279. *
  2280. * @note this feature is board specific
  2281. *
  2282. */
  2283. #define ixEthAccMiiPhyScan(phyPresent) ixEthMiiPhyScan(phyPresent,IXP425_ETH_ACC_MII_MAX_ADDR)
  2284. /**
  2285. * @ingroup IxEthAcc
  2286. *
  2287. * @def ixEthAccMiiPhyConfig
  2288. *
  2289. * @brief : deprecated API entry point. This definition
  2290. * ensures backward compatibility
  2291. *
  2292. * See @ref ixEthMiiPhyConfig
  2293. *
  2294. * @note this feature is board specific
  2295. */
  2296. #define ixEthAccMiiPhyConfig(phyAddr,speed100,fullDuplex,autonegotiate) \
  2297. ixEthMiiPhyConfig(phyAddr,speed100,fullDuplex,autonegotiate)
  2298. /**
  2299. * @ingroup IxEthAcc
  2300. *
  2301. * @def ixEthAccMiiPhyReset
  2302. *
  2303. * @brief : deprecated API entry point. This definition
  2304. * ensures backward compatibility
  2305. *
  2306. * See @ref ixEthMiiPhyReset
  2307. *
  2308. * @note this feature is board specific
  2309. */
  2310. #define ixEthAccMiiPhyReset(phyAddr) \
  2311. ixEthMiiPhyReset(phyAddr)
  2312. /**
  2313. * @ingroup IxEthAcc
  2314. *
  2315. * @def ixEthAccMiiLinkStatus
  2316. *
  2317. * @brief : deprecated API entry point. This definition
  2318. * ensures backward compatibility
  2319. *
  2320. * See @ref ixEthMiiLinkStatus
  2321. *
  2322. * @note this feature is board specific
  2323. */
  2324. #define ixEthAccMiiLinkStatus(phyAddr,linkUp,speed100,fullDuplex,autoneg) \
  2325. ixEthMiiLinkStatus(phyAddr,linkUp,speed100,fullDuplex,autoneg)
  2326. /**
  2327. * @ingroup IxEthAcc
  2328. *
  2329. * @def ixEthAccMiiShow
  2330. *
  2331. * @brief : deprecated API entry point. This definition
  2332. * ensures backward compatibility
  2333. *
  2334. * See @ref ixEthMiiPhyShow
  2335. *
  2336. * @note this feature is board specific
  2337. */
  2338. #define ixEthAccMiiShow(phyAddr) \
  2339. ixEthMiiPhyShow(phyAddr)
  2340. #endif /* ndef IxEthAcc_H */
  2341. /**
  2342. *@}
  2343. */