IxEthDBVlan.c 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155
  1. /**
  2. * @file IxEthDBVlan.c
  3. *
  4. * @brief Implementation of the VLAN API
  5. *
  6. * @par
  7. * IXP400 SW Release version 2.0
  8. *
  9. * -- Copyright Notice --
  10. *
  11. * @par
  12. * Copyright 2001-2005, Intel Corporation.
  13. * All rights reserved.
  14. *
  15. * @par
  16. * SPDX-License-Identifier: BSD-3-Clause
  17. * @par
  18. * -- End of Copyright Notice --
  19. */
  20. #include "IxEthDB.h"
  21. #include "IxEthDB_p.h"
  22. /* forward prototypes */
  23. IX_ETH_DB_PUBLIC
  24. IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex);
  25. IX_ETH_DB_PUBLIC
  26. IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet);
  27. /* contants used by various functions as "action" parameter */
  28. #define ADD_VLAN (0x1)
  29. #define REMOVE_VLAN (0x2)
  30. /**
  31. * @brief adds or removes a VLAN from a VLAN set
  32. *
  33. * @param vlanID VLAN ID to add or remove
  34. * @param table VLAN set to add into or remove from
  35. * @param action ADD_VLAN or REMOVE_VLAN
  36. *
  37. * @internal
  38. */
  39. IX_ETH_DB_PRIVATE
  40. void ixEthDBLocalVlanMembershipChange(UINT32 vlanID, IxEthDBVlanSet table, UINT32 action)
  41. {
  42. UINT32 setOffset;
  43. /* add/remove VID to membership table */
  44. setOffset = VLAN_SET_OFFSET(vlanID); /* we need 9 bits to index the 512 byte membership array */
  45. if (action == ADD_VLAN)
  46. {
  47. table[setOffset] |= 1 << VLAN_SET_MASK(vlanID);
  48. }
  49. else if (action == REMOVE_VLAN)
  50. {
  51. table[setOffset] &= ~(1 << VLAN_SET_MASK(vlanID));
  52. }
  53. }
  54. /**
  55. * @brief updates a set of 8 VLANs in an NPE
  56. *
  57. * @param portID ID of the port
  58. * @param setOffset offset of the 8 VLANs
  59. *
  60. * This function updates the VLAN membership table
  61. * and Transmit Tagging Info table for 8 consecutive
  62. * VLAN IDs indexed by setOffset.
  63. *
  64. * For example, a setOffset of 0 indexes VLAN IDs 0
  65. * through 7, 1 indexes VLAN IDs 8 through 9 etc.
  66. *
  67. * @return IX_ETH_DB_SUCCESS if the operation completed
  68. * successfully or an appropriate error message otherwise
  69. *
  70. * @internal
  71. */
  72. IX_ETH_DB_PRIVATE
  73. IxEthDBStatus ixEthDBVlanTableEntryUpdate(IxEthDBPortId portID, UINT32 setOffset)
  74. {
  75. PortInfo *portInfo = &ixEthDBPortInfo[portID];
  76. IxNpeMhMessage message;
  77. IX_STATUS result;
  78. FILL_SETPORTVLANTABLEENTRY_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
  79. 2 * setOffset,
  80. portInfo->vlanMembership[setOffset],
  81. portInfo->transmitTaggingInfo[setOffset]);
  82. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  83. return result;
  84. }
  85. /**
  86. * @brief updates a VLAN range in an NPE
  87. *
  88. * @param portID ID of the port
  89. *
  90. * This function is similar to @ref ixEthDBVlanTableEntryUpdate
  91. * except that it can update more than one VLAN set (up to
  92. * the entire VLAN membership and TTI tables if the offset is 0
  93. * and length is sizeof (IxEthDBVlanSet) (512 bytes).
  94. *
  95. * Updating the NPE via this method is slower as it requires
  96. * a memory copy from SDRAM, hence it is recommended that the
  97. * ixEthDBVlanTableEntryUpdate function is used where possible.
  98. *
  99. * @return IX_ETH_DB_SUCCESS if the operation completed
  100. * successfully or an appropriate error message otherwise
  101. *
  102. * @internal
  103. */
  104. IX_ETH_DB_PRIVATE
  105. IxEthDBStatus ixEthDBVlanTableRangeUpdate(IxEthDBPortId portID)
  106. {
  107. PortInfo *portInfo = &ixEthDBPortInfo[portID];
  108. UINT8 *vlanUpdateZone = (UINT8 *) portInfo->updateMethod.vlanUpdateZone;
  109. IxNpeMhMessage message;
  110. UINT32 setIndex;
  111. IX_STATUS result;
  112. /* copy membership info and transmit tagging into into exchange area */
  113. for (setIndex = 0 ; setIndex < sizeof (portInfo->vlanMembership) ; setIndex++)
  114. {
  115. /* membership and TTI data are interleaved */
  116. vlanUpdateZone[setIndex * 2] = portInfo->vlanMembership[setIndex];
  117. vlanUpdateZone[setIndex * 2 + 1] = portInfo->transmitTaggingInfo[setIndex];
  118. }
  119. IX_OSAL_CACHE_FLUSH(vlanUpdateZone, FULL_VLAN_BYTE_SIZE);
  120. /* build NPE message */
  121. FILL_SETPORTVLANTABLERANGE_MSG(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), 0, 0,
  122. IX_OSAL_MMU_VIRT_TO_PHYS(vlanUpdateZone));
  123. /* send message */
  124. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  125. return result;
  126. }
  127. /**
  128. * @brief adds or removes a VLAN from a port's VLAN membership table
  129. * or Transmit Tagging Information table
  130. *
  131. * @param portID ID of the port
  132. * @param vlanID VLAN ID to add or remove
  133. * @param table to add or remove from
  134. * @param action ADD_VLAN or REMOVE_VLAN
  135. *
  136. * @return IX_ETH_DB_SUCCESS if the operation completed
  137. * successfully or an appropriate error message otherwise
  138. *
  139. * @internal
  140. */
  141. IX_ETH_DB_PRIVATE
  142. IxEthDBStatus ixEthDBPortVlanMembershipChange(IxEthDBPortId portID, IxEthDBVlanId vlanID, IxEthDBVlanSet table, UINT32 action)
  143. {
  144. /* change VLAN in local membership table */
  145. ixEthDBLocalVlanMembershipChange(vlanID, table, action);
  146. /* send updated entry to NPE */
  147. return ixEthDBVlanTableEntryUpdate(portID, VLAN_SET_OFFSET(vlanID));
  148. }
  149. /**
  150. * @brief sets the default port VLAN tag (the lower 3 bytes are the PVID)
  151. *
  152. * @param portID ID of the port
  153. * @param vlanTag port VLAN tag (802.1Q tag)
  154. *
  155. * Note that this function is documented in the main component
  156. * header file, IxEthDB.h.
  157. *
  158. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  159. * or an appropriate error message otherwise
  160. */
  161. IX_ETH_DB_PUBLIC
  162. IxEthDBStatus ixEthDBPortVlanTagSet(IxEthDBPortId portID, IxEthDBVlanTag vlanTag)
  163. {
  164. IxNpeMhMessage message;
  165. IX_STATUS result;
  166. IX_ETH_DB_CHECK_PORT(portID);
  167. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  168. IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
  169. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  170. /* add VLAN ID to local membership table */
  171. ixEthDBPortVlanMembershipChange(portID,
  172. vlanTag & IX_ETH_DB_802_1Q_VLAN_MASK,
  173. ixEthDBPortInfo[portID].vlanMembership,
  174. ADD_VLAN);
  175. /* set tag in portInfo */
  176. ixEthDBPortInfo[portID].vlanTag = vlanTag;
  177. /* build VLAN_SetDefaultRxVID message */
  178. FILL_SETDEFAULTRXVID_MSG(message,
  179. IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID),
  180. IX_IEEE802_1Q_VLAN_TPID,
  181. vlanTag);
  182. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  183. return result;
  184. }
  185. /**
  186. * @brief retrieves the default port VLAN tag (the lower 3 bytes are the PVID)
  187. *
  188. * @param portID ID of the port
  189. * @param vlanTag address to write the port VLAN tag (802.1Q tag) into
  190. *
  191. * Note that this function is documented in the main component
  192. * header file, IxEthDB.h.
  193. *
  194. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  195. * or an appropriate error message otherwise
  196. */
  197. IX_ETH_DB_PUBLIC
  198. IxEthDBStatus ixEthDBPortVlanTagGet(IxEthDBPortId portID, IxEthDBVlanTag *vlanTag)
  199. {
  200. IX_ETH_DB_CHECK_PORT(portID);
  201. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  202. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  203. IX_ETH_DB_CHECK_REFERENCE(vlanTag);
  204. *vlanTag = ixEthDBPortInfo[portID].vlanTag;
  205. return IX_ETH_DB_SUCCESS;
  206. }
  207. /**
  208. * @brief sets the VLAN tag (the lower 3 bytes are the PVID) of a
  209. * database filtering record
  210. *
  211. * @param portID ID of the port
  212. * @param vlanTag VLAN tag (802.1Q tag)
  213. *
  214. * Important: filtering records are automatically converted to
  215. * IX_ETH_DB_FILTERING_VLAN record when added a VLAN tag.
  216. *
  217. * Note that this function is documented in the main component
  218. * header file, IxEthDB.h.
  219. *
  220. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  221. * or an appropriate error message otherwise
  222. */
  223. IX_ETH_DB_PUBLIC
  224. IxEthDBStatus ixEthDBVlanTagSet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag vlanTag)
  225. {
  226. HashNode *searchResult;
  227. MacDescriptor *descriptor;
  228. IX_ETH_DB_CHECK_REFERENCE(macAddr);
  229. IX_ETH_DB_CHECK_VLAN_TAG(vlanTag);
  230. searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_ALL_FILTERING_RECORDS);
  231. if (searchResult == NULL)
  232. {
  233. return IX_ETH_DB_NO_SUCH_ADDR;
  234. }
  235. descriptor = (MacDescriptor *) searchResult->data;
  236. /* set record type to VLAN if not already set */
  237. descriptor->type = IX_ETH_DB_FILTERING_VLAN_RECORD;
  238. /* add vlan tag */
  239. descriptor->recordData.filteringVlanData.ieee802_1qTag = vlanTag;
  240. /* transaction completed */
  241. ixEthDBReleaseHashNode(searchResult);
  242. return IX_ETH_DB_SUCCESS;
  243. }
  244. /**
  245. * @brief retrieves the VLAN tag (the lower 3 bytes are the PVID) from a
  246. * database VLAN filtering record
  247. *
  248. * @param portID ID of the port
  249. * @param vlanTag address to write the VLAN tag (802.1Q tag) into
  250. *
  251. * Note that this function is documented in the main component
  252. * header file, IxEthDB.h.
  253. *
  254. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  255. * or an appropriate error message otherwise
  256. */
  257. IX_ETH_DB_PUBLIC
  258. IxEthDBStatus ixEthDBVlanTagGet(IxEthDBMacAddr *macAddr, IxEthDBVlanTag *vlanTag)
  259. {
  260. HashNode *searchResult;
  261. MacDescriptor *descriptor;
  262. IX_ETH_DB_CHECK_REFERENCE(macAddr);
  263. IX_ETH_DB_CHECK_REFERENCE(vlanTag);
  264. searchResult = ixEthDBSearch(macAddr, IX_ETH_DB_FILTERING_VLAN_RECORD);
  265. if (searchResult == NULL)
  266. {
  267. return IX_ETH_DB_NO_SUCH_ADDR;
  268. }
  269. descriptor = (MacDescriptor *) searchResult->data;
  270. /* get vlan tag */
  271. *vlanTag = descriptor->recordData.filteringVlanData.ieee802_1qTag;
  272. /* transaction completed */
  273. ixEthDBReleaseHashNode(searchResult);
  274. return IX_ETH_DB_SUCCESS;
  275. }
  276. /**
  277. * @brief adds a VLAN to a port's VLAN membership table
  278. *
  279. * @param portID ID of the port
  280. * @param vlanID VLAN ID to add
  281. *
  282. * Note that this function is documented in the main component
  283. * header file, IxEthDB.h.
  284. *
  285. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  286. * or an appropriate error message otherwise
  287. */
  288. IX_ETH_DB_PUBLIC
  289. IxEthDBStatus ixEthDBPortVlanMembershipAdd(IxEthDBPortId portID, IxEthDBVlanId vlanID)
  290. {
  291. IX_ETH_DB_CHECK_PORT(portID);
  292. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  293. IX_ETH_DB_CHECK_VLAN_ID(vlanID);
  294. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  295. return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
  296. }
  297. /**
  298. * @brief removes a VLAN from a port's VLAN membership table
  299. *
  300. * @param portID ID of the port
  301. * @param vlanID VLAN ID to remove
  302. *
  303. * Note that this function is documented in the main component
  304. * header file, IxEthDB.h.
  305. *
  306. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  307. * or an appropriate error message otherwise
  308. */
  309. IX_ETH_DB_PUBLIC
  310. IxEthDBStatus ixEthDBPortVlanMembershipRemove(IxEthDBPortId portID, IxEthDBVlanId vlanID)
  311. {
  312. IX_ETH_DB_CHECK_PORT(portID);
  313. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  314. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  315. IX_ETH_DB_CHECK_VLAN_ID(vlanID);
  316. /* for safety isolate only the VLAN ID in the tag (the lower 12 bits) */
  317. vlanID = vlanID & IX_ETH_DB_802_1Q_VLAN_MASK;
  318. /* check we're not asked to remove the default port VID */
  319. if (vlanID == IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag))
  320. {
  321. return IX_ETH_DB_NO_PERMISSION;
  322. }
  323. return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
  324. }
  325. /**
  326. * @brief adds or removes a VLAN range from a port's
  327. * VLAN membership table or TTI table
  328. *
  329. * @param portID ID of the port
  330. * @param vlanIDMin start of the VLAN range
  331. * @param vlanIDMax end of the VLAN range
  332. * @param table VLAN set to add or remove from
  333. * @param action ADD_VLAN or REMOVE_VLAN
  334. *
  335. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  336. * or an appropriate error message otherwise
  337. *
  338. * @internal
  339. */
  340. IX_ETH_DB_PRIVATE
  341. IxEthDBStatus ixEthDBPortVlanMembershipRangeChange(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, IxEthDBVlanSet table, UINT32 action)
  342. {
  343. UINT32 setOffsetMin, setOffsetMax;
  344. IX_ETH_DB_CHECK_PORT(portID);
  345. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  346. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  347. IX_ETH_DB_CHECK_VLAN_ID(vlanIDMin);
  348. IX_ETH_DB_CHECK_VLAN_ID(vlanIDMax);
  349. /* for safety isolate only the VLAN ID in the tags (the lower 12 bits) */
  350. vlanIDMin = vlanIDMin & IX_ETH_DB_802_1Q_VLAN_MASK;
  351. vlanIDMax = vlanIDMax & IX_ETH_DB_802_1Q_VLAN_MASK;
  352. /* is this a range? */
  353. if (vlanIDMax < vlanIDMin)
  354. {
  355. return IX_ETH_DB_INVALID_VLAN;
  356. }
  357. /* check that we're not specifically asked to remove the default port VID */
  358. if (action == REMOVE_VLAN && vlanIDMax == vlanIDMin && IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag) == vlanIDMin)
  359. {
  360. return IX_ETH_DB_NO_PERMISSION;
  361. }
  362. /* compute set offsets */
  363. setOffsetMin = VLAN_SET_OFFSET(vlanIDMin);
  364. setOffsetMax = VLAN_SET_OFFSET(vlanIDMax);
  365. /* change VLAN range */
  366. for (; vlanIDMin <= vlanIDMax ; vlanIDMin++)
  367. {
  368. /* change vlan in local membership table */
  369. ixEthDBLocalVlanMembershipChange(vlanIDMin, table, action);
  370. }
  371. /* if the range is within one set (max 8 VLANs in one table byte) we can just update that entry in the NPE */
  372. if (setOffsetMin == setOffsetMax)
  373. {
  374. /* send updated entry to NPE */
  375. return ixEthDBVlanTableEntryUpdate(portID, setOffsetMin);
  376. }
  377. else
  378. {
  379. /* update a zone of the membership/transmit tag info table */
  380. return ixEthDBVlanTableRangeUpdate(portID);
  381. }
  382. }
  383. /**
  384. * @brief adds a VLAN range to a port's VLAN membership table
  385. *
  386. * @param portID ID of the port
  387. * @param vlanIDMin start of the VLAN range
  388. * @param vlanIDMax end of the VLAN range
  389. *
  390. * Note that this function is documented in the main component
  391. * header file, IxEthDB.h.
  392. *
  393. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  394. * or an appropriate error message otherwise
  395. */
  396. IX_ETH_DB_PUBLIC
  397. IxEthDBStatus ixEthDBPortVlanMembershipRangeAdd(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
  398. {
  399. IX_ETH_DB_CHECK_PORT(portID);
  400. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  401. return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, ADD_VLAN);
  402. }
  403. /**
  404. * @brief removes a VLAN range from a port's VLAN membership table
  405. *
  406. * @param portID ID of the port
  407. * @param vlanIDMin start of the VLAN range
  408. * @param vlanIDMax end of the VLAN range
  409. *
  410. * Note that this function is documented in the main component
  411. * header file, IxEthDB.h.
  412. *
  413. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  414. * or an appropriate error message otherwise
  415. */
  416. IX_ETH_DB_PUBLIC
  417. IxEthDBStatus ixEthDBPortVlanMembershipRangeRemove(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax)
  418. {
  419. IX_ETH_DB_CHECK_PORT(portID);
  420. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  421. return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].vlanMembership, REMOVE_VLAN);
  422. }
  423. /**
  424. * @brief sets a port's VLAN membership table or TTI table and
  425. * updates the NPE VLAN configuration
  426. *
  427. * @param portID ID of the port
  428. * @param portVlanTable port VLAN table to set
  429. * @param vlanSet new set contents
  430. *
  431. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  432. * or an appropriate error message otherwise
  433. *
  434. * @internal
  435. */
  436. IX_ETH_DB_PUBLIC
  437. IxEthDBStatus ixEthDBPortVlanTableSet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
  438. {
  439. IX_ETH_DB_CHECK_PORT(portID);
  440. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  441. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  442. IX_ETH_DB_CHECK_REFERENCE(vlanSet);
  443. memcpy(portVlanTable, vlanSet, sizeof (IxEthDBVlanSet));
  444. return ixEthDBVlanTableRangeUpdate(portID);
  445. }
  446. /**
  447. * @brief retireves a port's VLAN membership table or TTI table
  448. *
  449. * @param portID ID of the port
  450. * @param portVlanTable port VLAN table to retrieve
  451. * @param vlanSet address to
  452. *
  453. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  454. * or an appropriate error message otherwise
  455. *
  456. * @internal
  457. */
  458. IX_ETH_DB_PUBLIC
  459. IxEthDBStatus ixEthDBVlanTableGet(IxEthDBPortId portID, IxEthDBVlanSet portVlanTable, IxEthDBVlanSet vlanSet)
  460. {
  461. IX_ETH_DB_CHECK_PORT(portID);
  462. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  463. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  464. IX_ETH_DB_CHECK_REFERENCE(vlanSet);
  465. memcpy(vlanSet, portVlanTable, sizeof (IxEthDBVlanSet));
  466. return IX_ETH_DB_SUCCESS;
  467. }
  468. /**
  469. * @brief sets a port's VLAN membership table
  470. *
  471. * @param portID ID of the port
  472. * @param vlanSet new VLAN membership table
  473. *
  474. * Note that this function is documented in the main component
  475. * header file, IxEthDB.h.
  476. *
  477. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  478. * or an appropriate error message otherwise
  479. */
  480. IX_ETH_DB_PUBLIC
  481. IxEthDBStatus ixEthDBPortVlanMembershipSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
  482. {
  483. IxEthDBVlanId vlanID;
  484. IX_ETH_DB_CHECK_PORT(portID);
  485. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  486. IX_ETH_DB_CHECK_REFERENCE(vlanSet);
  487. /* set the bit corresponding to the PVID just in case */
  488. vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
  489. vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
  490. return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
  491. }
  492. /**
  493. * @brief retrieves a port's VLAN membership table
  494. *
  495. * @param portID ID of the port
  496. * @param vlanSet location to store the port's VLAN membership table
  497. *
  498. * Note that this function is documented in the main component
  499. * header file, IxEthDB.h.
  500. *
  501. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  502. * or an appropriate error message otherwise
  503. */
  504. IX_ETH_DB_PUBLIC
  505. IxEthDBStatus ixEthDBPortVlanMembershipGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
  506. {
  507. IX_ETH_DB_CHECK_PORT(portID);
  508. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  509. return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].vlanMembership, vlanSet);
  510. }
  511. /**
  512. * @brief enables or disables Egress tagging for one VLAN ID
  513. *
  514. * @param portID ID of the port
  515. * @param vlanID VLAN ID to enable or disable Egress tagging on
  516. * @param enabled true to enable and false to disable tagging
  517. *
  518. * Note that this function is documented in the main component
  519. * header file, IxEthDB.h.
  520. *
  521. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  522. * or an appropriate error message otherwise
  523. */
  524. IX_ETH_DB_PUBLIC
  525. IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL enabled)
  526. {
  527. IX_ETH_DB_CHECK_PORT(portID);
  528. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  529. IX_ETH_DB_CHECK_VLAN_ID(vlanID);
  530. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  531. return ixEthDBPortVlanMembershipChange(portID, vlanID, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
  532. }
  533. /**
  534. * @brief retrieves the Egress tagging status for one VLAN ID
  535. *
  536. * @param portID ID of the port
  537. * @param vlanID VLAN ID to retrieve the tagging status for
  538. * @param enabled location to store the tagging status
  539. * (true - tagging enabled, false - tagging disabled)
  540. *
  541. * Note that this function is documented in the main component
  542. * header file, IxEthDB.h.
  543. *
  544. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  545. * or an appropriate error message otherwise
  546. */
  547. IX_ETH_DB_PUBLIC
  548. IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
  549. {
  550. IX_ETH_DB_CHECK_PORT(portID);
  551. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  552. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  553. IX_ETH_DB_CHECK_REFERENCE(enabled);
  554. IX_ETH_DB_CHECK_VLAN_ID(vlanID);
  555. *enabled = ((ixEthDBPortInfo[portID].transmitTaggingInfo[VLAN_SET_OFFSET(vlanID)] & (1 << VLAN_SET_MASK(vlanID))) != 0);
  556. return IX_ETH_DB_SUCCESS;
  557. }
  558. /**
  559. * @brief enables or disables Egress VLAN tagging for a VLAN range
  560. *
  561. * @param portID ID of the port
  562. * @param vlanIDMin start of VLAN range
  563. * @param vlanIDMax end of VLAN range
  564. * @param enabled true to enable or false to disable VLAN tagging
  565. *
  566. * Note that this function is documented in the main component
  567. * header file, IxEthDB.h.
  568. *
  569. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  570. * or an appropriate error message otherwise
  571. */
  572. IX_ETH_DB_PUBLIC
  573. IxEthDBStatus ixEthDBEgressVlanRangeTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanId vlanIDMin, IxEthDBVlanId vlanIDMax, BOOL enabled)
  574. {
  575. IX_ETH_DB_CHECK_PORT(portID);
  576. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  577. return ixEthDBPortVlanMembershipRangeChange(portID, vlanIDMin, vlanIDMax, ixEthDBPortInfo[portID].transmitTaggingInfo, enabled? ADD_VLAN : REMOVE_VLAN);
  578. }
  579. /**
  580. * @brief sets the Egress VLAN tagging table (the Transmit Tagging
  581. * Information table)
  582. *
  583. * @param portID ID of the port
  584. * @param vlanSet new TTI table
  585. *
  586. * Note that this function is documented in the main component
  587. * header file, IxEthDB.h.
  588. *
  589. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  590. * or an appropriate error message otherwise
  591. */
  592. IX_ETH_DB_PUBLIC
  593. IxEthDBStatus ixEthDBEgressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
  594. {
  595. IxEthDBVlanId vlanID;
  596. IX_ETH_DB_CHECK_PORT(portID);
  597. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  598. IX_ETH_DB_CHECK_REFERENCE(vlanSet);
  599. /* set the PVID bit just in case */
  600. vlanID = IX_ETH_DB_GET_VLAN_ID(ixEthDBPortInfo[portID].vlanTag);
  601. vlanSet[VLAN_SET_OFFSET(vlanID)] |= 1 << VLAN_SET_MASK(vlanID);
  602. return ixEthDBPortVlanTableSet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
  603. }
  604. /**
  605. * @brief retrieves the Egress VLAN tagging table (the Transmit
  606. * Tagging Information table)
  607. *
  608. * @param portID ID of the port
  609. * @param vlanSet location to store the port's TTI table
  610. *
  611. * Note that this function is documented in the main component
  612. * header file, IxEthDB.h.
  613. *
  614. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  615. * or an appropriate error message otherwise
  616. */
  617. IX_ETH_DB_PUBLIC
  618. IxEthDBStatus ixEthDBEgressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanSet vlanSet)
  619. {
  620. IX_ETH_DB_CHECK_PORT(portID);
  621. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  622. return ixEthDBVlanTableGet(portID, ixEthDBPortInfo[portID].transmitTaggingInfo, vlanSet);
  623. }
  624. /**
  625. * @brief sends the NPE the updated frame filter and default
  626. * Ingress tagging
  627. *
  628. * @param portID ID of the port
  629. *
  630. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  631. * or an appropriate error message otherwise
  632. *
  633. * @internal
  634. */
  635. IX_ETH_DB_PRIVATE
  636. IxEthDBStatus ixEthDBIngressVlanModeUpdate(IxEthDBPortId portID)
  637. {
  638. PortInfo *portInfo = &ixEthDBPortInfo[portID];
  639. IxNpeMhMessage message;
  640. IX_STATUS result;
  641. FILL_SETRXTAGMODE_MSG(message, portID, portInfo->npeFrameFilter, portInfo->npeTaggingAction);
  642. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  643. return result;
  644. }
  645. /**
  646. * @brief sets the default Ingress tagging behavior
  647. *
  648. * @param portID ID of the port
  649. * @param taggingAction default tagging behavior
  650. *
  651. * Note that this function is documented in the main component
  652. * header file, IxEthDB.h.
  653. *
  654. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  655. * or an appropriate error message otherwise
  656. */
  657. IX_ETH_DB_PUBLIC
  658. IxEthDBStatus ixEthDBIngressVlanTaggingEnabledSet(IxEthDBPortId portID, IxEthDBTaggingAction taggingAction)
  659. {
  660. PortInfo *portInfo;
  661. IX_ETH_DB_CHECK_PORT(portID);
  662. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  663. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  664. portInfo = &ixEthDBPortInfo[portID];
  665. if (taggingAction == IX_ETH_DB_PASS_THROUGH)
  666. {
  667. portInfo->npeTaggingAction = 0x00;
  668. }
  669. else if (taggingAction == IX_ETH_DB_ADD_TAG)
  670. {
  671. portInfo->npeTaggingAction = 0x02;
  672. }
  673. else if (taggingAction == IX_ETH_DB_REMOVE_TAG)
  674. {
  675. portInfo->npeTaggingAction = 0x01;
  676. }
  677. else
  678. {
  679. return IX_ETH_DB_INVALID_ARG;
  680. }
  681. portInfo->taggingAction = taggingAction;
  682. return ixEthDBIngressVlanModeUpdate(portID);
  683. }
  684. /**
  685. * @brief retrieves the default Ingress tagging behavior of a port
  686. *
  687. * @param portID ID of the port
  688. * @param taggingAction location to save the default tagging behavior
  689. *
  690. * Note that this function is documented in the main component
  691. * header file, IxEthDB.h.
  692. *
  693. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  694. * or an appropriate error message otherwise
  695. */
  696. IX_ETH_DB_PUBLIC
  697. IxEthDBStatus ixEthDBIngressVlanTaggingEnabledGet(IxEthDBPortId portID, IxEthDBTaggingAction *taggingAction)
  698. {
  699. IX_ETH_DB_CHECK_PORT(portID);
  700. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  701. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  702. IX_ETH_DB_CHECK_REFERENCE(taggingAction);
  703. *taggingAction = ixEthDBPortInfo[portID].taggingAction;
  704. return IX_ETH_DB_SUCCESS;
  705. }
  706. /**
  707. * @brief sets the Ingress acceptable frame type filter
  708. *
  709. * @param portID ID of the port
  710. * @param frameFilter acceptable frame type filter
  711. *
  712. * Note that this function is documented in the main component
  713. * header file, IxEthDB.h.
  714. *
  715. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  716. * or an appropriate error message otherwise
  717. */
  718. IX_ETH_DB_PUBLIC
  719. IxEthDBStatus ixEthDBAcceptableFrameTypeSet(IxEthDBPortId portID, IxEthDBFrameFilter frameFilter)
  720. {
  721. PortInfo *portInfo;
  722. IxEthDBStatus result = IX_ETH_DB_SUCCESS;
  723. IX_ETH_DB_CHECK_PORT(portID);
  724. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  725. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  726. /* check parameter range
  727. the ORed value of the valid values is 0x7
  728. a value having extra bits is invalid */
  729. if ((frameFilter | 0x7) != 0x7 || frameFilter == 0)
  730. {
  731. return IX_ETH_DB_INVALID_ARG;
  732. }
  733. portInfo = &ixEthDBPortInfo[portID];
  734. portInfo->frameFilter = frameFilter;
  735. portInfo->npeFrameFilter = 0; /* allow all by default */
  736. /* if accepting priority tagged but not all VLAN tagged
  737. set the membership table to contain only VLAN ID 0
  738. hence remove vlans 1-4094 and add VLAN ID 0 */
  739. if (((frameFilter & IX_ETH_DB_PRIORITY_TAGGED_FRAMES) != 0)
  740. && ((frameFilter & IX_ETH_DB_VLAN_TAGGED_FRAMES) == 0))
  741. {
  742. result = ixEthDBPortVlanMembershipRangeChange(portID,
  743. 1, IX_ETH_DB_802_1Q_MAX_VLAN_ID, portInfo->vlanMembership, REMOVE_VLAN);
  744. if (result == IX_ETH_DB_SUCCESS)
  745. {
  746. ixEthDBLocalVlanMembershipChange(0, portInfo->vlanMembership, ADD_VLAN);
  747. result = ixEthDBVlanTableRangeUpdate(portID);
  748. }
  749. }
  750. /* untagged only? */
  751. if (frameFilter == IX_ETH_DB_UNTAGGED_FRAMES)
  752. {
  753. portInfo->npeFrameFilter = 0x01;
  754. }
  755. /* tagged only? */
  756. if ((frameFilter & IX_ETH_DB_UNTAGGED_FRAMES) == 0)
  757. {
  758. portInfo->npeFrameFilter = 0x02;
  759. }
  760. if (result == IX_ETH_DB_SUCCESS)
  761. {
  762. result = ixEthDBIngressVlanModeUpdate(portID);
  763. }
  764. return result;
  765. }
  766. /**
  767. * @brief retrieves the acceptable frame type filter for a port
  768. *
  769. * @param portID ID of the port
  770. * @param frameFilter location to store the frame filter
  771. *
  772. * Note that this function is documented in the main component
  773. * header file, IxEthDB.h.
  774. *
  775. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  776. * or an appropriate error message otherwise
  777. */
  778. IX_ETH_DB_PUBLIC
  779. IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter)
  780. {
  781. IX_ETH_DB_CHECK_PORT(portID);
  782. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  783. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  784. IX_ETH_DB_CHECK_REFERENCE(frameFilter);
  785. *frameFilter = ixEthDBPortInfo[portID].frameFilter;
  786. return IX_ETH_DB_SUCCESS;
  787. }
  788. /**
  789. * @brief sends an NPE the updated configuration related
  790. * to one QoS priority (associated traffic class and AQM mapping)
  791. *
  792. * @param portID ID of the port
  793. * @param classIndex QoS priority (traffic class index)
  794. *
  795. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  796. * or an appropriate error message otherwise
  797. *
  798. * @internal
  799. */
  800. IX_ETH_DB_PUBLIC
  801. IxEthDBStatus ixEthDBUpdateTrafficClass(IxEthDBPortId portID, UINT32 classIndex)
  802. {
  803. IxNpeMhMessage message;
  804. IX_STATUS result;
  805. UINT32 trafficClass = ixEthDBPortInfo[portID].priorityTable[classIndex];
  806. UINT32 aqmQueue = ixEthDBPortInfo[portID].ixEthDBTrafficClassAQMAssignments[trafficClass];
  807. FILL_SETRXQOSENTRY(message, IX_ETH_DB_PORT_ID_TO_NPE_LOGICAL_ID(portID), classIndex, trafficClass, aqmQueue);
  808. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  809. return result;
  810. }
  811. /**
  812. * @brief sets the priority mapping table
  813. *
  814. * @param portID ID of the port
  815. * @param priorityTable new priority mapping table
  816. *
  817. * Note that this function is documented in the main component
  818. * header file, IxEthDB.h.
  819. *
  820. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  821. * or an appropriate error message otherwise
  822. */
  823. IX_ETH_DB_PUBLIC
  824. IxEthDBStatus ixEthDBPriorityMappingTableSet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
  825. {
  826. UINT32 classIndex;
  827. IX_ETH_DB_CHECK_PORT(portID);
  828. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  829. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  830. IX_ETH_DB_CHECK_REFERENCE(priorityTable);
  831. for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
  832. {
  833. /* check range */
  834. if (priorityTable[classIndex] >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
  835. {
  836. return IX_ETH_DB_INVALID_PRIORITY;
  837. }
  838. }
  839. /* set new traffic classes */
  840. for (classIndex = 0 ; classIndex < IX_IEEE802_1Q_QOS_PRIORITY_COUNT ; classIndex++)
  841. {
  842. ixEthDBPortInfo[portID].priorityTable[classIndex] = priorityTable[classIndex];
  843. if (ixEthDBUpdateTrafficClass(portID, classIndex) != IX_ETH_DB_SUCCESS)
  844. {
  845. return IX_ETH_DB_FAIL;
  846. }
  847. }
  848. return IX_ETH_DB_SUCCESS;
  849. }
  850. /**
  851. * @brief retrieves a port's priority mapping table
  852. *
  853. * @param portID ID of the port
  854. * @param priorityTable location to store the priority table
  855. *
  856. * Note that this function is documented in the main component
  857. * header file, IxEthDB.h.
  858. *
  859. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  860. * or an appropriate error message otherwise
  861. */
  862. IX_ETH_DB_PUBLIC
  863. IxEthDBStatus ixEthDBPriorityMappingTableGet(IxEthDBPortId portID, IxEthDBPriorityTable priorityTable)
  864. {
  865. IX_ETH_DB_CHECK_PORT(portID);
  866. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  867. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  868. IX_ETH_DB_CHECK_REFERENCE(priorityTable);
  869. memcpy(priorityTable, ixEthDBPortInfo[portID].priorityTable, sizeof (IxEthDBPriorityTable));
  870. return IX_ETH_DB_SUCCESS;
  871. }
  872. /**
  873. * @brief sets one QoS priority => traffic class mapping
  874. *
  875. * @param portID ID of the port
  876. * @param userPriority QoS (user) priority
  877. * @param trafficClass associated traffic class
  878. *
  879. * Note that this function is documented in the main component
  880. * header file, IxEthDB.h.
  881. *
  882. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  883. * or an appropriate error message otherwise
  884. */
  885. IX_ETH_DB_PUBLIC
  886. IxEthDBStatus ixEthDBPriorityMappingClassSet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority trafficClass)
  887. {
  888. IX_ETH_DB_CHECK_PORT(portID);
  889. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  890. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  891. /* check ranges for userPriority and trafficClass */
  892. if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT || trafficClass >= ixEthDBPortInfo[portID].ixEthDBTrafficClassCount)
  893. {
  894. return IX_ETH_DB_INVALID_PRIORITY;
  895. }
  896. ixEthDBPortInfo[portID].priorityTable[userPriority] = trafficClass;
  897. return ixEthDBUpdateTrafficClass(portID, userPriority);
  898. }
  899. /**
  900. * @brief retrieves one QoS priority => traffic class mapping
  901. *
  902. * @param portID ID of the port
  903. * @param userPriority QoS (user) priority
  904. * @param trafficClass location to store the associated traffic class
  905. *
  906. * Note that this function is documented in the main component
  907. * header file, IxEthDB.h.
  908. *
  909. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  910. * or an appropriate error message otherwise
  911. */
  912. IX_ETH_DB_PUBLIC
  913. IxEthDBStatus ixEthDBPriorityMappingClassGet(IxEthDBPortId portID, IxEthDBPriority userPriority, IxEthDBPriority *trafficClass)
  914. {
  915. IX_ETH_DB_CHECK_PORT(portID);
  916. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  917. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  918. IX_ETH_DB_CHECK_REFERENCE(trafficClass);
  919. /* check userPriority range */
  920. if (userPriority >= IX_IEEE802_1Q_QOS_PRIORITY_COUNT)
  921. {
  922. return IX_ETH_DB_INVALID_PRIORITY;
  923. }
  924. *trafficClass = ixEthDBPortInfo[portID].priorityTable[userPriority];
  925. return IX_ETH_DB_SUCCESS;
  926. }
  927. /**
  928. * @brief enables or disables the source port extraction
  929. * from the VLAN TPID field
  930. *
  931. * @param portID ID of the port
  932. * @param enable true to enable or false to disable
  933. *
  934. * Note that this function is documented in the main component
  935. * header file, IxEthDB.h.
  936. *
  937. * @return IX_ETH_DB_SUCCESS if the operation completed successfully
  938. * or an appropriate error message otherwise
  939. */
  940. IX_ETH_DB_PUBLIC
  941. IxEthDBStatus ixEthDBVlanPortExtractionEnable(IxEthDBPortId portID, BOOL enable)
  942. {
  943. IxNpeMhMessage message;
  944. IX_STATUS result;
  945. IX_ETH_DB_CHECK_PORT(portID);
  946. IX_ETH_DB_CHECK_SINGLE_NPE(portID);
  947. IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
  948. FILL_SETPORTIDEXTRACTIONMODE(message, portID, enable);
  949. IX_ETHDB_SEND_NPE_MSG(IX_ETH_DB_PORT_ID_TO_NPE(portID), message, result);
  950. return result;
  951. }