#IxEthAcc.h# 79 KB

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