Realtek RomeDriver Programming Guide V1.1.2 Rome Driver
User Manual: Pdf
Open the PDF directly: View PDF .
Page Count: 145
Download | ![]() |
Open PDF In Browser | View PDF |
Realtek RG RomeDriver Programming Guide Realtek RG Rome Driver Programming Guide Version 1.1.2 (English Version) November 1, 2013 Realtek Semiconductor Corp. No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan Tel: +886-3-578-0211 Fax: +886-3-577-6047 www.realtek.com Realtek confidential documentation 1 Rev 1.1.2 Realtek RG RomeDriver Programming Guide COPYRIGHT ©2012 Realtek Semiconductor Corp. All rights reserved. No part of this document may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form or by any means without the written permission of Realtek Semiconductor Corp. TRADEMARKS Realtek is a trademark of Realtek Semiconductor Corporation. Other names mentioned in this document are trademarks/registered trademarks of their respective owners. DISCLAIMER Realtek provides this document “as is”, without warranty of any kind, neither expressed nor implied, including, but not limited to, the particular purpose. Realtek may make improvements and/or changes in this document or in the product described in this document at any time. This document could include technical inaccuracies or typographical errors. USING THIS DOCUMENT This document is intended for use by the system engineer when integrating with Realtek Software SDK. Though every effort has been made to assure that this document is current and accurate, more information may have become available subsequent to the production of this guide. In that event, please contact your Realtek representative for additional information that may help in the development process. Realtek confidential documentation 2 Rev 1.1.2 Realtek RG RomeDriver Programming Guide REVISION HISTORY Revision Date Description Author 1.0.1 2012/08/27 First Release. Tony 1.0.2 2012/09/12 Modify ACL/VLAN Binding/add WAN Interface exsample. Tony Add “Wireless LAN Hardware Forward” chapter. Add “RTK RG APIs Prototype” chapter. 1.0.3 2012/11/7 Add “MAC/ARP/NAPT” example code Czpinging ACL/QoS API name is changed RTK RG API document renew. 1.0.4 2012/11/8 Add chapter “Checkout Code”,”Configuration”,” Build Code”,”Test by Tony Web UI configuration”,”Test by Diagnostics Shell Command”,” Realtek RG Debug Tools”,” Test Report” 1.0.5 2012/11/9 Update Chariot Throughput Czpinging Change diag shell MAC/ARP/NAPT add seq. 1.0.6 2013/01/01 Modify Some API prototype Tony 1.0.7 2013/03/29 Update RG API prototype & diag shell command Chuck Update Lite RomeDriver/ RomeDriver architechure figures & description English Translation 1.0.8 2013/05/27 Update Gateway basic configuration example Chuck Add new RG APIs & example Add Gateway Advance Configuation examples Update Build Code commands Update diagshell introduction 1.0.9 2013/08/28 Update RG Interfcae related API & CVLAN related issue. Chuck Add RG Qos APIs & example Add Chapter for explain NAPT External Port Collision Prevention mechanism. 1.1.0 2013/09/25 Add GPON performace test report. Tony 1.1.1 2013/10/28 Add RG SFU API. Tony Add RG GPON/EPON API. Update Chapter 5.1.4 Add chapter 6.2.6, 6.2.7, 6.2.8 Update diag shell command 1.1.2 2013/11/1 Add Wifi Throughtput testing result Realtek confidential documentation 3 Chuck Rev 1.1.2 Realtek RG RomeDriver Programming Guide Update Chater 6.1 Update Chapter 6.2.3 Add Chapter 6.2.4 Realtek confidential documentation 4 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Table of Contents 1. Architecture ...........................................................................................14 1.1. RomeDriver Architecture .......................................................................14 1.2. Lite RomeDriver Architecture ................................................................16 2. Realtek RG APIs ...................................................................................17 3. Checkout Code .....................................................................................32 4. Build Code.............................................................................................32 5. NAPT External Port Collsion Prevention ...............................................33 5.1.1. Enable/Disable NAPT External Port Collision Prevention .....................33 5.1.2. API: rtk_rg_naptExtPortGet...................................................................35 5.1.3. API: rtk_rg_naptExtPortFree .................................................................36 5.1.4. Sample Codes for Hooking NAPT External Port Collision Prevention Mechanism in Linux 2.6.30 .........................................................................................36 6. (Lite)RomeDriver Initiation.....................................................................40 6.1. Gateway Basic Conifguration ................................................................41 6.2. Gateway Advanced Conifguration.........................................................48 6.2.1. Port Binding...........................................................................................48 6.2.2. VLAN Binding........................................................................................49 6.2.3. ACL Filter / ACL-Based QoS Remarking ...............................................49 6.2.4. Layer2 packet classify filter and assign streamID .................................52 6.2.5. Rate Limit ..............................................................................................54 6.2.5.1. ACL-Based Share Meter .......................................................................54 6.2.5.2. Egress Port -Based Rate Limit ..............................................................54 6.2.5.3. Ingress Port-Based Rate Limit ..............................................................55 6.2.6. QoS Internal Priority & Egress Queue Decision ....................................55 6.2.7. QoS 1P Remarking ...............................................................................58 6.2.8. QoS DSCP Remarking..........................................................................59 6.2.9. QoS Strict Priority / WFQ.......................................................................60 6.2.9.1. DSCP to Internal Priority .......................................................................61 6.2.9.2. Port to Internal Priority...........................................................................62 6.2.10. L2 per-Port learning count limit .............................................................63 6.2.11. MacFilter ...............................................................................................63 6.2.12. Application-Level-Gateway(ALG) ..........................................................63 6.2.13. Virtual Server ........................................................................................64 6.2.14. DmzHost ...............................................................................................64 6.2.15. UpnpConnection ...................................................................................65 Realtek confidential documentation 5 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 6.2.16. 6.2.17. 6.2.18. 6.2.19. 6.2.20. 7. 8. 8.1. 8.2. 9. 9.1. 9.1.1. 9.1.2. 9.1.3. 9.2. 9.3. 9.3.1. 9.3.2. 9.3.3. 9.3.4. 9.3.5. 9.4. 9.4.1. 9.4.2. 9.4.3. 9.4.4. 10. 11. 11.1. 11.2. 11.3. 11.4. 11.5. 11.6. 11.7. 11.8. 11.9. 11.10. MulticastFlow ........................................................................................65 StormControl .........................................................................................66 PortMirror ..............................................................................................66 Physical Port Ability ...............................................................................67 Denial-of-Service (DoS) ........................................................................67 Wireless LAN Hardware Forward..........................................................68 Test by Web UI configuration ................................................................71 Configure LAN by Web UI .....................................................................72 Configure WAN by Web UI....................................................................73 Test by Diagnostics Shell Command ....................................................73 Diag Shell Introduction ..........................................................................73 Startup DiagShell ..................................................................................73 Command-Line-Completion for Diag Cmd ............................................74 Mapping for RG API & Diag Cmd ..........................................................75 NIC Driver network device name & HW Port Index mapping ................77 Diag Shell for Realtek RG APIs.............................................................77 Initial RG API.........................................................................................77 Initial RG API and register callback function..........................................78 Add LAN Interface.................................................................................79 Add WAN Interface................................................................................79 Set Static WAN Configuration................................................................80 Diag Shell for Realtek RG Runtime API ................................................80 Get RG API Version Info........................................................................80 Add MAC Entry .....................................................................................80 Add ARP Entry ......................................................................................81 Add NAPT Entry ....................................................................................81 Realtek RG Debug Tools ......................................................................81 Test Report ...........................................................................................86 Chariot-LAN to LAN Bridge Mode-TCP Throughput..............................86 Chariot-LAN to WAN NAPT Mode-TCP Throughput .............................87 IXIA-LAN to LAN Bridge Mode-TCP(Packet Size:1518Bytes)...............88 IXIA-LAN to LAN Bridge Mode-TCP(Packet Size:64Bytes)...................89 IXIA-LAN to UTP WAN NAPT Mode-TCP(Packet Size:1518Bytes) ......90 IXIA-LAN to UTP WAN NAPT Mode-TCP(Packet Size:64Bytes)..........90 IXIA-LAN to GPON WAN NAPT Mode-UDP(Packet Size:1518Bytes) ..91 IXIA-GPON WAN to LAN NAPT Mode-UDP(Packet Size:1518Bytes) ..92 IXIA-LAN to GPON WAN NAPT Mode-UDP(Packet Size:64Bytes) ......92 IXIA-GPON WAN to LAN NAPT Mode-UDP(Packet Size:64Bytes) ......93 Realtek confidential documentation 6 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11.11. 11.12. 12. 12.1. 12.2. 12.3. 12.4. 12.5. 12.6. 12.7. 12.8. 12.9. 12.10. 12.11. 12.12. 12.13. 12.14. 12.15. 12.16. 12.17. 12.18. 12.19. 12.20. 12.21. 12.22. 12.23. 12.24. 12.25. 12.26. 12.27. 12.28. 12.29. 12.30. 12.31. 12.32. 12.33. 12.34. 12.35. IXIA(veriwave)-WIFI to WAN Bridge Mode-UDP ...................................94 IXIA(veriwave)-WIFI to WAN NAPT Mode-UDP....................................95 RTK RG APIs Prototype........................................................................96 rtk_rg_driverVersion_get .......................................................................96 rtk_rg_initParam_get .............................................................................96 rtk_rg_initParam_set .............................................................................97 rtk_rg_lanInterface_add ........................................................................97 rtk_rg_wanInterface_add.......................................................................98 rtk_rg_staticInfo_set ..............................................................................98 rtk_rg_dhcpRequest_set .......................................................................99 rtk_rg_dhcpClientInfo_set .....................................................................99 rtk_rg_pppoeClientInfoBeforeDial_set.................................................100 rtk_rg_pppoeClientInfoAfterDial_set ...................................................101 rtk_rg_interface_del.............................................................................101 rtk_rg_intfInfo_find ..............................................................................102 rtk_rg_cvlan_add.................................................................................102 rtk_rg_cvlan_del ..................................................................................103 rtk_rg_vlanBinding_add.......................................................................103 rtk_rg_vlanBinding_del........................................................................104 rtk_rg_vlanBinding_find.......................................................................104 rtk_rg_algServerInLanAppsIpAddr_add ..............................................104 rtk_rg_algServerInLanAppsIpAddr_del ...............................................105 rtk_rg_algApps_set .............................................................................105 rtk_rg_algApps_get .............................................................................105 rtk_rg_dmzHost_set ............................................................................106 rtk_rg_dmzHost_get ............................................................................106 rtk_rg_virtualServer_add .....................................................................106 rtk_rg_virtualServer_del ......................................................................107 rtk_rg_virtualServer_find .....................................................................107 rtk_rg_aclFilterAndQos_add................................................................107 rtk_rg_aclFilterAndQos_del.................................................................110 rtk_rg_aclFilterAndQos_find................................................................110 rtk_rg_macFilter_add ..........................................................................111 rtk_rg_macFilter_del............................................................................111 rtk_rg_macFilter_find...........................................................................111 rtk_rg_urlFilterString_add....................................................................112 rtk_rg_urlFilterString_del .....................................................................112 rtk_rg_urlFilterString_find ....................................................................112 Realtek confidential documentation 7 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.36. 12.37. 12.38. 12.39. 12.40. 12.41. 12.42. 12.43. 12.44. 12.45. 12.46. 12.47. 12.48. 12.49. 12.50. 12.51. 12.52. 12.53. 12.54. 12.55. 12.56. 12.57. 12.58. 12.59. 12.60. 12.61. 12.62. 12.63. 12.64. 12.65. 12.66. 12.67. 12.68. 12.69. 12.70. 12.71. 12.72. 12.73. rtk_rg_upnpConnection_add ...............................................................113 rtk_rg_upnpConnection_del ................................................................113 rtk_rg_upnpConnection_find ...............................................................114 rtk_rg_naptConnection_add ................................................................114 rtk_rg_naptConnection_del .................................................................115 rtk_rg_naptConnection_find ................................................................115 rtk_rg_multicastFlow_add ...................................................................116 rtk_rg_multicastFlow_del.....................................................................116 rtk_rg_multicastFlow_find....................................................................116 rtk_rg_macEntry_add ..........................................................................117 rtk_rg_macEntry_del ...........................................................................117 rtk_rg_macEntry_find ..........................................................................118 rtk_rg_arpEntry_add............................................................................118 rtk_rg_arpEntry_del.............................................................................119 rtk_rg_arpEntry_find............................................................................119 rtk_rg_neighborEntry_add...................................................................119 rtk_rg_neighborEntry_del ....................................................................120 rtk_rg_neighborEntry_find ...................................................................120 rtk_rg_softwareSourceAddrLearningLimit_set ....................................121 rtk_rg_softwareSourceAddrLearningLimit_get ....................................121 rtk_rg_dosPortMaskEnable_set ..........................................................121 rtk_rg_dosPortMaskEnable_get ..........................................................122 rtk_rg_dosType_set ............................................................................122 rtk_rg_dosType_get ............................................................................123 rtk_rg_dosFloodType_set....................................................................123 rtk_rg_dosFloodType_get ...................................................................124 rtk_rg_portMirror_set...........................................................................124 rtk_rg_portMirror_get...........................................................................125 rtk_rg_portMirror_clear........................................................................125 rtk_rg_portEgrBandwidthCtrlRate_set.................................................125 rtk_rg_portIgrBandwidthCtrlRate_set ..................................................125 rtk_rg_portEgrBandwidthCtrlRate_get.................................................126 rtk_rg_portIgrBandwidthCtrlRate_get ..................................................126 rtk_rg_phyPortForceAbility_set ...........................................................126 rtk_rg_phyPortForceAbility_get ...........................................................127 rtk_rg_portMibInfo_get ........................................................................127 rtk_rg_portMibInfo_clear .....................................................................130 rtk_rg_stormControl_add.....................................................................130 Realtek confidential documentation 8 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.74. 12.75. 12.76. 12.77. 12.78. 12.79. 12.80. 12.81. 12.82. 12.83. 12.84. 12.85. 12.86. 12.87. 12.88. 12.89. 12.90. 12.91. 12.92. 12.93. 12.94. 12.95. 12.96. 12.97. 12.98. 12.99. 12.100. 12.101. 12.102. 12.103. 12.104. 12.105. 12.106. 12.107. 12.108. 12.109. 12.110. 12.111. rtk_rg_stormControl_del......................................................................130 rtk_rg_stormControl_find.....................................................................131 rtk_rg_shareMeter_set ........................................................................131 rtk_rg_shareMeter_get ........................................................................131 rtk_rg_qosStrictPriorityOrWeightFairQueue_set .................................132 rtk_rg_qosStrictPriorityOrWeightFairQueue_get .................................132 rtk_rg_qosInternalPriMapToQueueId_set ...........................................133 rtk_rg_qosInternalPriMapToQueueId_get ...........................................133 rtk_rg_qosInternalPriDecisionByWeight_set .......................................134 rtk_rg_qosInternalPriDecisionByWeight_get .......................................134 rtk_rg_qosDscpRemapToInternalPri_set ............................................134 rtk_rg_qosDscpRemapToInternalPri_get ............................................135 rtk_rg_qosPortBasedPriority_set.........................................................135 rtk_rg_qosPortBasedPriority_get ........................................................135 rtk_rg_qosDot1pPriRemapToInternalPri_set.......................................136 rtk_rg_qosDot1pPriRemapToInternalPri_get ......................................136 rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_set .............136 rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_get .............137 rtk_rg_qosDscpRemarkByInternalPri_set ...........................................137 rtk_rg_qosDscpRemarkByInternalPri_get ...........................................138 rtk_rg_qosDscpRemarkByDscp_set ...................................................138 rtk_rg_qosDscpRemarkByDscp_get ...................................................138 rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEnable_set.........139 rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEnable_get.........139 rtk_rg_qosDot1pPriRemarkByInternalPri_set......................................140 rtk_rg_qosDot1pPriRemarkByInternalPri_get .....................................140 rtk_rg_portBasedCVlanId_set .............................................................140 rtk_rg_portBasedCVlanId_get .............................................................141 rtk_rg_portStatus_get..........................................................................141 rtk_rg_naptExtPortGet.........................................................................142 rtk_rg_naptExtPortFree .......................................................................142 rtk_rg_gpon_infoSettings_set..............................................................142 rtk_rg_gpon_infoSettings_get .............................................................142 rtk_rg_gpon_status_get.......................................................................143 rtk_rg_epon_infoSettings_set..............................................................143 rtk_rg_epon_infoSettings_get .............................................................143 rtk_rg_pon_transceiverInfo_get...........................................................144 rtk_rg_classifyEntry_add .....................................................................144 Realtek confidential documentation 9 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.112. 12.113. rtk_rg_classifyEntry_find .....................................................................144 rtk_rg_classifyEntry_del ......................................................................145 Realtek confidential documentation 10 Rev 1.1.2 Realtek RG RomeDriver Programming Guide List of Figures Figure1. Figure2. Figure3. Figure4. Figure5. Figure6. RomeDriver Architecture .......................................................................15 Lite RomeDriver Architecture ................................................................17 Enable NAPT External Port Collision Prevention, step1........................34 Enable NAPT External Port Collision Prevention, step2........................34 Enable NAPT External Port Collision Prevention, step3........................35 Enable NAPT External Port Collision Prevention, step4........................35 Figure7. Figure8. Figure9. Figure10. Figure11. NAPT External Port choosing flow.........................................................36 RomeDriver Initiation Flow Chart ..........................................................40 Internal Priority decision flow chart........................................................56 NIC TX Descriptor Format.....................................................................69 NIC RX Descriptor Format ....................................................................69 Figure12. Figure13. Figure14. Figure15. Figure16. Figure17. Figure18. Figure19. Figure20. Figure21. Figure22. Figure23. Figure24. Figure25. Figure26. Figure27. Figure28. Figure29. Wireless LAN Hardware Forward..........................................................71 Web UI:LAN Interface Setting ...............................................................72 Web UI:Ethernet WAN Interface Setting................................................73 UART: ADSL Main Menu .......................................................................74 DiagShell tips for next keyword .............................................................74 DiagShell command-line-completion .....................................................75 Chariot LAN to LAN TCP connection ....................................................87 Chariot LAN to WAN TCP connection ...................................................88 IXIA LAN to LAN TCP connection(Large Packet) ..................................89 IXIA LAN to LAN TCP connection(Small Packet) ..................................89 IXIA LAN to WAN TCP connection(Large Packet).................................90 IXIA LAN to WAN TCP connection(Small Packet) .................................91 IXIA LAN to GPON WAN UDP connection (Large Packet)....................91 IXIA GPON WAN to LAN UDP connection (Large Packet)....................92 IXIA LAN to GPON WAN UDP connection(Small Packet) .....................93 IXIA GPON WAN to LAN UDP connection(Small Packet) .....................93 IXIA WIFI to WAN(Bridge) UDP connection ..........................................94 IXIA WIFI to WAN(NAPT) UDP connection ...........................................95 Realtek confidential documentation 11 Rev 1.1.2 Realtek RG RomeDriver Programming Guide List of Tables Table1. Table2. Table3. Table4. Table5. Table6. List of pure RG APIs..............................................................................22 List of mapping RG APIs (Mapping from RTK APIs)..............................31 List of RTK RG HGU APIs access Hardware Table...............................32 Example: hook rtk_rg_naptExtPortGet ..................................................38 Example: hook rtk_rg_naptExtPortFree ................................................39 Example: rtk_rg_initParam_set (Default)...............................................41 Table7. Table8. Table9. Table10. Table11. Example: rtk_rg_initParam_set (Customise) .........................................42 Example: rtk_rg_lanInterface_add ........................................................43 Example: rtk_rg_wanInterface_add.......................................................45 Example: rtk_rg_staticInfo_set(for LiteRomeDriver ARP set by USER) 46 Example: rtk_rg_staticInfo_set(for RomeDriver ARP auto learning)......46 Table12. Table13. Table14. Table15. Table16. Table17. Table18. Table19. Table20. Table21. Table22. Table23. Table24. Table25. Table26. Table27. Table28. Table29. Table30. Table31. Table32. Table33. Table34. Table35. Example: rtk_rg_macEntry_add ............................................................47 Example: rtk_rg_arpEntry_add..............................................................47 Example: rtk_rg_naptConnection_add ..................................................48 Example: rtk_rg_wanInterface_add (with Port Binding).........................48 Example: rtk_rg_vlanBinding_add.........................................................49 List of ACL Action Type..........................................................................50 List of ACL QoS Actions ........................................................................50 List of ACL Patterns...............................................................................51 List of ACL fwding type ..........................................................................52 Example: rtk_rg_aclFilterAndQos_add..................................................52 Example: rtk_rg_classifyEntry_add .......................................................53 Example: rtk_rate_shareMeter_set .......................................................54 Example: rtk_rate_portEgrBandwidthCtrlRate_set ................................55 Example: rtk_rate_portIgrBandwidthCtrlRate_set .................................55 The corresponding RG APIs of each kind of priority source. .................56 The QoS internal priority & egress queue decision RG APIs.................56 Example: rtk_rg_qosInternalPriDecisionByWeight_set .........................57 Example: rtk_rg_qosDot1pPriRemapToInternalPri_set .........................57 Example: rtk_rg_qosDscpRemapToInternalPri_set...............................58 Example: rtk_rg_qosInternalPriMapToQueueId_set ..............................58 The QoS 1Q Reamrking RG APIs. ........................................................58 Example: QoS 1P remarking .................................................................59 The QoS DSCP Remarking RG APIs. ...................................................59 Example: QoS DSCP remarking ...........................................................60 Realtek confidential documentation 12 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Table36. Table37. Table38. Table39. Table40. Table41. Table42. Table43. Table44. Table45. Table46. Table47. Table48. Table49. Table50. Table51. Table52. Table53. Table54. Example: rtk_qos_schedulingQueue_set ..............................................61 Example: rtk_rg_qosDscpRemapToInternalPri_set ...............................62 Example: rtk_rg_qosPortBasedPriority_set...........................................62 Example: rtk_l2_portLimitLearningCnt_set............................................63 Example: rtk_rg_macFilter_add ............................................................63 Example: rtk_rg_algApps_set ...............................................................64 Example: rtk_rg_virtualServer_add .......................................................64 Example: rtk_rg_dmzHost_set ..............................................................64 Example: rtk_rg_upnpConnection_add .................................................65 Example: rtk_rg_multicastFlow_add .....................................................65 Example: rtk_rg_stormControl_add.......................................................66 Example: rtk_rg_portMirror_set.............................................................67 Example: rtk_rg_phyPortForceAbility_set .............................................67 Example: rtk_rg_dosPortMaskEnable_set ............................................67 Example: rtk_rg_dosType_set...............................................................68 Example: rtk_rg_dosFloodType_set ......................................................68 NIC RX Descriptor for CPU Tag ............................................................70 List of Diag Command second keywords ..............................................76 List of Diag Command Third keywords..................................................77 Realtek confidential documentation 13 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 1. Architecture There are two architechture provided for Router/Gateway productivities speed up L2/L3/L4 packet transmition. The first architechture is RomeDriver, and the other is Lite-RomeDriver. If the user doesn’t want to adopt hacking OS(Operating System) Protocol Stack, and insert/add APIs in the software flow, then we suggest, the user to use RomeDriver way. On the other hand, if the customer has the capability to hack OS and wants to customize his own software data flow, the Lite-RomeDriver will do the job. 1.1. RomeDriver Architecture Structural wise, RomeDriver is adding the Forwarding Engine on Lite-RomeDriver. Forwarding Engine is a lite Protocal Stack which use to handles Layer2 MAC learning, ARP Entry aging and Napt flow forwarding. Porting RomeDriver just need to configure the informations, which is call from UI or User Application, into RTK RG API. The Data Path will be automatically maintained by Forwarding Engine. Thus, to enable the hardware forwarding application, here is the process: 1. NIC Driver RX Interface:When the hardware can’t process the Packet, all data will be processed by NIC Driver, and enable the Forwarding Enging Input function. 2. NIC Driver TX Interface:NIC TX Interface is to transfer the packet after the Forwarding Engine forward a packet or add the Hardware entry 3. The packet escalates to OS Interface : Forwarding Engine will escalate the packet to OS Protocal Stack when it can not be processed 4. UI or User Application Interface: RomeDriver and LiteRomeDriver provids an 1-to-1 mapping interface for UI and User Application to call RTK RG APIs. The specific interface is used to pass the initial configuration from UI, such as LAN Interface configuration or Static WAN configuration, and dynamic configuration from User Application, such as Gateway IP Address from DHCP or PPPoE to RTK RG APIs. Besides, the callback function will be waked up in the end of RTK RG API process, if the user has registered it. On the other hand, if the user hasn’t registered callback function or RTK RG API executed failed will not wake the callback function up. 5. Callback Function Interface: RTK RG API reserves hook points for registering callback functions. Callback functions is used to synchronize Hardware Tables and Protocal Stack, such as Rouing Table, and call User Application, such as DHCP Client and PPPoE Client. Realtek confidential documentation 14 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Below figure shows the architechure. The thick black frame stands for the above Interfaces, the blue line stands for Data Path, and the red line stands for Control Path. The Data Path is divided into three layers. The lowest layer represents data forwarding by Hardware ASIC, the second layer represents data forwarding by Software Forwarding Engine, and the top layer represents data forwarding by OS Protocol-Stack. The Control Path of Hardware comes from User Space, suach as UI or User Application , or Fowrading Engine. UI or User Applications control Hardware ASIC by 1-to-1 mapping User-Space RTK RG APIs Interface. Figure1. RomeDriver Architecture Realtek confidential documentation 15 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 1.2. Lite RomeDriver Architecture Lite-RomeDriver is a lighter version of RomeDriver without Forwarding Engine for which users have to call Protocal Stack and insert RTK RG API to extract data. The difference is that the Lite-RomeDriver will not maintain NAPT hardware/software related tables dynamic. Therefore, users should keep related NAPT tables, counter, and Aging Mechanism synchronous between Hardware and Protocal Stack by RTK RG APIs. Besides, Layer2 MAC & ARP Entry shoule be maintaind by L2/ARP AutoLearning Module automatically or maintaind by user calling RTK RG APIs to keep Layer2 MAC & ARP synchronous between Hardware and Protocal Stack. If L2/ARP AutoLearning Module is enabled, the Lite RomeDriver Input function should be registered in NIC RX Interface. Realtek confidential documentation 16 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure2. Lite RomeDriver Architecture 2. Realtek RG APIs There are two kinds of RG(Resident Gateway) APIs. One is pure RG APIs and the other is mapping RG APIs. Pure RG APIs are class by applicable features and focus for HGU(Home Gateway Unit) products. Mapping RG APIs are class by HW functions, they’re one-to-one mapping to RTK APIs. (Please refer to RTK APIs Document to see more detail.), and focus for SFU(Single Family Unit) Product. If your product is Router/Gateway then you can call most of pure RG APIs and some mapping RG APIs. else if your product is Switch then you can call most of mapping APIs and some RG APIs. But, you can’t call RTK API directly. The following Table lists all pure RG API according to their capabilities: Category System LAN Interface R L S Function Name ● ● ● rtk_rg_driverVersion_get Get RTK RG Driver version. rtk_rg_initParam_get Get the initial configuration. rtk_rg_initParam_set Set initial parameters & Callback Function. ● ● ● rtk_rg_lanInterface_add Add a LAN Interface. rtk_rg_interface_del Delete a LAN Interface. rtk_rg_intfInfo_find Find a LAN Interface which is added. WAN Interface/ Port Binding ● ● ● rtk_rg_wanInterface_add CVLAN ● ● ● rtk_rg_cvlan_add WAN Type Function Description Add a WAN Interface. rtk_rg_interface_del Delete a WAN Interface. rtk_rg_intfInfo_find Find a WAN Interface which is added. Add an individual C-VLAN. rtk_rg_cvlan_del Delete an individual C-VLAN. rtk_rg_portBasedCVlanId_get Get Port-based VLAN ID. ● ● ○ rtk_rg_staticInfo_set Set WAN Type:STATIC IP information. rtk_rg_dhcpRequest_set Set WAN Type:DHCP request information. rtk_rg_dhcpClientInfo_set Set WAN Type:DHCP IP information. rtk_rg_pppoeClientInfoBefore Set WAN Type:PPPoE dial Realtek confidential documentation 17 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Dial_set information. rtk_rg_pppoeClientInfoAfterDi Set WAN Type:PPPoE IP al_set information. VLAN Binding ALG Virtual Server DMZ UPnP NAPT ● ● ● rtk_rg_vlanBinding_add Insert a VLAN Binding Entry. rtk_rg_vlanBinding_del Delete a VLAN Binding Entry. rtk_rg_vlanBinding_find Finda VLAN Binding Entry which is added. ● ○ ○ rtk_rg_algApps_set Set the starting ALG Appication type. rtk_rg_algApps_get Set the current ALG Appication type. rtk_rg_algServerInLanAppsIp Addr_add Set the Server-in-LAN ALG Server IP Address. rtk_rg_algServerInLanAppsIp Addr_del Get the Server-in-LAN ALG Server IP Address. ● ○ ○ rtk_rg_virtualServer_add Add a Virtual Server Rule. rtk_rg_virtualServer_del Delete a Virtual Server Rule. rtk_rg_virtualServer_find Find a Virtual Server Rule. ● ○ ○ rtk_rg_dmzHost_set Set DMZ Host to assigned WAN Interface. rtk_rg_dmzHost_get Get DMZ Host information from assigned WAN Interface. ● ○ ○ rtk_rg_upnpConnection_add Add an uPnP connection. rtk_rg_upnpConnection_del Delete an uPnP connection. rtk_rg_upnpConnection_find Find an uPnP connection which is added. ○ ● ○ rtk_rg_naptConnection_add Add a NAPT connection. rtk_rg_naptConnection_del Delete a NAPT connection. rtk_rg_naptConnection_find Find a NAPT connection which is added. NAPT External Port ● ○ ○ rtk_rg_naptExtPortFree MAC ○ ● ● rtk_rg_macEntry_add rtk_rg_naptExtPortGet rtk_rg_macEntry_del Realtek confidential documentation 18 For Sync with Linux & RomeDriver. For Sync with Linux & RomeDriver. Add a MAC Entry. Delete a MAC Entry. Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_macEntry_find Multicast ARP Neighbor ACL Filter and QoS Remarking ○ ● ● rtk_rg_multicastFlow_add Find a MAC Entry wich is added. Add a Multicast connection. rtk_rg_multicastFlow_del Delete a Multicast connection. rtk_rg_multicastFlow_find Find a Multicast connection which is added. ○ ● ○ rtk_rg_arpEntry_add Add an ARP Entry. rtk_rg_arpEntry_del Delete an ARP Entry. rtk_rg_arpEntry_find Find an ARP Entry which is added. ○ ● ○ rtk_rg_neighborEntry_add Add an Neighbor Entry rtk_rg_neighborEntry_del Delete an Neighbor Entry rtk_rg_neighborEntry_find Find an Neighbor Entry which is added. ● ● ● rtk_rg_aclFilterAndQos_add rtk_rg_aclFilterAndQos_del Add an ACL Rule(include QoS Remarking). Delete an ACL Rule(include QoS Remarking). rtk_rg_aclFilterAndQos_find Find an ACL Rule which is added. ● ● ● rtk_rg_classifyEntry_add L2 Classification rtk_rg_classifyEntry_del rtk_rg_classifyEntry_find MAC Filter URL Filter ● ● ● rtk_rg_macFilter_add Egress Delete a L2 CF rule. Find a L2 CF rule which is added. Add a MAC Filter Entry. rtk_rg_macFilter_del Delete a MAC Filter Entry. rtk_rg_macFilter_find Find a MAC Filter Entry which is added. ● ○ ○ rtk_rg_urlFilterString_add Add a URLFilter Entry. rtk_rg_urlFilterString_del Delete a URLFilter Entry. rtk_rg_urlFilterString_find Find a URLFilter Entry which is added. StormControl ● ● ● rtk_rg_stormControl_add PortMirror Add a L2 CF rule. Add an StormControl Entry rtk_rg_stormControl_del Delete an StormControl Entry rtk_rg_stormControl_find Find an StormControl Entry which is added. ● ● ● rtk_rg_portMirror_set Set portMirror rtk_rg_portMirror_get Get portMirror which has been set rtk_rg_portMirror_clear Clear portMirror ● ● ● rtk_rg_portEgrBandwidthCtrlR Set Egress Bandwidth Control rate Realtek confidential documentation 19 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Bandwidth Control ate_set rtk_rg_portEgrBandwidthCtrlR Get Egress Bandwidth Control rate ate_get which has been set Ingress Bandwidth Control ● ● ● rtk_rg_portIgrBandwidthCtrlR ate_set Set Ingress Bandwidth Control rate rtk_rg_portIgrBandwidthCtrlR ate_get Get Ingress Bandwidth Control rate which has been set Physical Port ● ● ● rtk_rg_phyPortForceAbility_se Set Physical Port Ability t ShareMeter rtk_rg_phyPortForceAbility_g et Get Physical Port Ability which has been set rtk_rg_portStatus_get Get Physical Port link status. ● ● ● rtk_rg_shareMeter_set rtk_rg_shareMeter_get Set an ShareMeter Entry. Get an ShareMeter Entry which has been set DoS ● ● ● rtk_rg_dosPortMaskEnable_set Enable DosPort rtk_rg_dosPortMaskEnable_ge t Get Enabled DosPort rtk_rg_dosType_set Set a dosType information rtk_rg_dosType_get Get a dosType information which has been set rtk_rg_dosFloodType_set Set a dosFloodType information rtk_rg_dosFloodType_get Get a dosFloodType information which has been set MAC Learning Limit ● ○ ● rtk_rg_softwareSourceAddrLe arningLimit_get Get software per-Port MAC learning limit. rtk_rg_softwareSourceAddrLe arningLimit_set Set software per-Port MAC learning limit. MIB ● ● ● rtk_rg_portMibInfo_clear rtk_rg_portMibInfo_get QoS Internal Priority Decision Clear per-Port MIB info. Get per-Port MIB info. ● ● ● rtk_rg_qosDot1pPriRemapToI nternalPri_get CVLAN-Priority remapping table get rtk_rg_qosDot1pPriRemapToI nternalPri_set CVLAN-Priority remapping table set rtk_rg_qosDscpRemapToInter nalPri_get DSCP remapping table get. rtk_rg_qosDscpRemapToInter DSCP remapping table set Realtek confidential documentation 20 Rev 1.1.2 Realtek RG RomeDriver Programming Guide nalPri_set rtk_rg_qosInternalPriDecision ByWeight_get Get the weight of the 9 kinds of priority decision source. rtk_rg_qosInternalPriDecision ByWeight_set Set the weight of the 9 kinds of priority decision source. rtk_rg_qosPortBasedPriority_g et Get port based priority rtk_rg_qosPortBasedPriority_s et Set port based priority QoS Egress Queue Decision ● ● ● rtk_rg_qosInternalPriMapToQ ueueId_get Get the “Internal priority to Queue” table. rtk_rg_qosInternalPriMapToQ ueueId_set Set the “Internal priority to Queue” table. QoS Remarking ● ● ● rtk_rg_qosDot1pPriRemarkBy InternalPriEgressPortEnable_g et CVLAN-Priority remarking egress port get. rtk_rg_qosDot1pPriRemarkBy InternalPriEgressPortEnable_s et CVLAN-Priority remarking egress port set. rtk_rg_qosDot1pPriRemarkBy InternalPri_get CVLAN-Priority remarking table get rtk_rg_qosDot1pPriRemarkBy InternalPri_set CVLAN-Priority remarking table set rtk_rg_qosDscpRemarkByDsc p_get Get the “DSCP remarking by DSCP” mapping table. rtk_rg_qosDscpRemarkByDsc p_set Set the “DSCP remarking by DSCP” mapping table. rtk_rg_qosDscpRemarkByInter Get the “DSCP remarking by nalPri_get Internal Priority” mapping table. rtk_rg_qosDscpRemarkByInter Set the “DSCP remarking by nalPri_set Internal Priority” mapping table. QoS Scheduling rtk_rg_qosDscpRemarkEgress PortEnableAndSrcSelect_get Get DSCP remarking egress port. rtk_rg_qosDscpRemarkEgress PortEnableAndSrcSelect_set Set DSCP remarking egress port. ● ● ● rtk_rg_qosStrictPriorityOrWei ghtFairQueue_get Realtek confidential documentation 21 Get QoS Scheduling method (WFQ,Strict Priority) Rev 1.1.2 Realtek RG RomeDriver Programming Guide by Queues rtk_rg_qosStrictPriorityOrWei ghtFairQueue_set Set QoS Scheduling method (WFQ,Strict Priority) Table1. List of pure RG APIs PS: In the Above field, “R” stands for RomeDriver API, “L” stands for Lite RomeDriver API, “S” stands for SFU Product used API. The following Table lists all mapping RG APIs: STP rtk_rg_stp_init rtk_rg_stp_mstpState_get rtk_rg_stp_mstpState_set GPON rtk_rg_gpon_activate rtk_rg_gpon_alarmStatus_get rtk_rg_gpon_autoBoh_get rtk_rg_gpon_autoBoh_set rtk_rg_gpon_autoTcont_get rtk_rg_gpon_autoTcont_set rtk_rg_gpon_broadcastPass_get rtk_rg_gpon_broadcastPass_set rtk_rg_gpon_callbackExtMsgGetHandle_reg rtk_rg_gpon_callbackExtMsgSetHandle_reg rtk_rg_gpon_callbackQueryAesKey_reg rtk_rg_gpon_deActivate rtk_rg_gpon_debug_set rtk_rg_gpon_deinitial rtk_rg_gpon_device_deInitialize rtk_rg_gpon_device_initialize rtk_rg_gpon_devInfo_show rtk_rg_gpon_driver_deInitialize rtk_rg_gpon_driver_initialize rtk_rg_gpon_dsFecSts_get rtk_rg_gpon_dsFlow_get rtk_rg_gpon_dsFlow_set rtk_rg_gpon_dsFlow_show rtk_rg_gpon_eqdOffset_get rtk_rg_gpon_eqdOffset_set rtk_rg_gpon_evtHdlAlarm_reg Realtek confidential documentation 22 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_gpon_evtHdlDsFecChange_reg rtk_rg_gpon_evtHdlOmci_reg rtk_rg_gpon_evtHdlPloam_dreg rtk_rg_gpon_evtHdlPloam_reg rtk_rg_gpon_evtHdlStateChange_reg rtk_rg_gpon_evtHdlUsFecChange_reg rtk_rg_gpon_evtHdlUsPloamNrmEmpty_reg rtk_rg_gpon_evtHdlUsPloamUrgEmpty_reg rtk_rg_gpon_extMsg_get rtk_rg_gpon_extMsg_set rtk_rg_gpon_flowCounter_get rtk_rg_gpon_flowCounter_show rtk_rg_gpon_globalCounter_get rtk_rg_gpon_globalCounter_show rtk_rg_gpon_gtc_show rtk_rg_gpon_initial rtk_rg_gpon_isr_entry rtk_rg_gpon_macEntry_add rtk_rg_gpon_macEntry_del rtk_rg_gpon_macEntry_get rtk_rg_gpon_macFilterMode_get rtk_rg_gpon_macFilterMode_set rtk_rg_gpon_macTable_show rtk_rg_gpon_mcForceMode_get rtk_rg_gpon_mcForceMode_set rtk_rg_gpon_multicastAddrCheck_get rtk_rg_gpon_multicastAddrCheck_set rtk_rg_gpon_nonMcastPass_get rtk_rg_gpon_nonMcastPass_set rtk_rg_gpon_omci_rx rtk_rg_gpon_omci_tx rtk_rg_gpon_parameter_get rtk_rg_gpon_parameter_set rtk_rg_gpon_password_get rtk_rg_gpon_password_set rtk_rg_gpon_ploam_send rtk_rg_gpon_ponStatus_get Realtek confidential documentation 23 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_gpon_powerLevel_get rtk_rg_gpon_powerLevel_set rtk_rg_gpon_rdi_get rtk_rg_gpon_rdi_set rtk_rg_gpon_serialNumber_get rtk_rg_gpon_serialNumber_set rtk_rg_gpon_tcontCounter_get rtk_rg_gpon_tcontCounter_show rtk_rg_gpon_tcont_create rtk_rg_gpon_tcont_destroy rtk_rg_gpon_tcont_get rtk_rg_gpon_tcont_show rtk_rg_gpon_txForceIdle_get rtk_rg_gpon_txForceIdle_set rtk_rg_gpon_txForceLaser_get rtk_rg_gpon_txForceLaser_set rtk_rg_gpon_unit_test rtk_rg_gpon_usFlow_get rtk_rg_gpon_usFlow_set rtk_rg_gpon_usFlow_show rtk_rg_gpon_version_get rtk_rg_gpon_version_show EPON rtk_rg_epon_churningKey_get rtk_rg_epon_churningKey_set rtk_rg_epon_dsFecState_get rtk_rg_epon_dsFecState_set rtk_rg_epon_fecState_get rtk_rg_epon_fecState_set rtk_rg_epon_forceLaserState_get rtk_rg_epon_forceLaserState_set rtk_rg_epon_init rtk_rg_epon_intrMask_get rtk_rg_epon_intrMask_set rtk_rg_epon_intr_disableAll rtk_rg_epon_intr_get rtk_rg_epon_laserTime_get rtk_rg_epon_laserTime_set Realtek confidential documentation 24 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_epon_llidEntryNum_get rtk_rg_epon_llid_entry_get rtk_rg_epon_llid_entry_set rtk_rg_epon_losState_get rtk_rg_epon_mibCounter_get rtk_rg_epon_mibGlobal_reset rtk_rg_epon_mibLlidIdx_reset rtk_rg_epon_mpcpTimeoutVal_get rtk_rg_epon_mpcpTimeoutVal_set rtk_rg_epon_opticalPolarity_get rtk_rg_epon_opticalPolarity_set rtk_rg_epon_registerReq_get rtk_rg_epon_registerReq_set rtk_rg_epon_syncTime_get rtk_rg_epon_thresholdReport_get rtk_rg_epon_thresholdReport_set rtk_rg_epon_usFecState_get rtk_rg_epon_usFecState_set PON MAC rtk_rg_ponmac_flow2Queue_get rtk_rg_ponmac_flow2Queue_set rtk_rg_ponmac_init rtk_rg_ponmac_losState_get rtk_rg_ponmac_mode_get rtk_rg_ponmac_mode_set rtk_rg_ponmac_opticalPolarity_get rtk_rg_ponmac_opticalPolarity_set rtk_rg_ponmac_queueDrainOut_set rtk_rg_ponmac_queue_add rtk_rg_ponmac_queue_del rtk_rg_ponmac_queue_get rtk_rg_ponmac_transceiver_get I2C rtk_rg_i2c_clock_get rtk_rg_i2c_clock_set rtk_rg_i2c_eepMirror_get rtk_rg_i2c_eepMirror_read rtk_rg_i2c_eepMirror_set rtk_rg_i2c_eepMirror_write Realtek confidential documentation 25 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_i2c_enable_get rtk_rg_i2c_enable_set rtk_rg_i2c_init rtk_rg_i2c_read rtk_rg_i2c_width_get rtk_rg_i2c_width_set rtk_rg_i2c_write Interrupt rtk_rg_intr_gphyStatus_clear rtk_rg_intr_gphyStatus_get rtk_rg_intr_imr_get rtk_rg_intr_imr_restore rtk_rg_intr_imr_set rtk_rg_intr_ims_clear rtk_rg_intr_ims_get rtk_rg_intr_init rtk_rg_intr_linkdownStatus_clear rtk_rg_intr_linkdownStatus_get rtk_rg_intr_linkupStatus_clear rtk_rg_intr_linkupStatus_get rtk_rg_intr_polarity_get rtk_rg_intr_polarity_set rtk_rg_intr_speedChangeStatus_clear rtk_rg_intr_speedChangeStatus_get Port rtk_rg_port_adminEnable_get rtk_rg_port_adminEnable_set rtk_rg_port_cpuPortId_get rtk_rg_port_enhancedFid_get rtk_rg_port_enhancedFid_set rtk_rg_port_flowctrl_get rtk_rg_port_gigaLiteEnable_get rtk_rg_port_gigaLiteEnable_set rtk_rg_port_greenEnable_get rtk_rg_port_greenEnable_set rtk_rg_port_init rtk_rg_port_isolationCtagPktConfig_get rtk_rg_port_isolationCtagPktConfig_set rtk_rg_port_isolationEntryExt_get Realtek confidential documentation 26 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_port_isolationEntryExt_set rtk_rg_port_isolationEntry_get rtk_rg_port_isolationEntry_set rtk_rg_port_isolationExtL34_get rtk_rg_port_isolationExtL34_set rtk_rg_port_isolationExt_get rtk_rg_port_isolationExt_set rtk_rg_port_isolationIpmcLeaky_get rtk_rg_port_isolationIpmcLeaky_set rtk_rg_port_isolationL34PktConfig_get rtk_rg_port_isolationL34PktConfig_set rtk_rg_port_isolationL34_get rtk_rg_port_isolationL34_set rtk_rg_port_isolationLeaky_get rtk_rg_port_isolationLeaky_set rtk_rg_port_isolationPortLeaky_get rtk_rg_port_isolationPortLeaky_set rtk_rg_port_isolation_get rtk_rg_port_isolation_set rtk_rg_port_link_get rtk_rg_port_macExtMode_get rtk_rg_port_macExtMode_set rtk_rg_port_macExtRgmiiDelay_get rtk_rg_port_macExtRgmiiDelay_set rtk_rg_port_macForceAbilityState_get rtk_rg_port_macForceAbilityState_set rtk_rg_port_macForceAbility_get rtk_rg_port_macForceAbility_set rtk_rg_port_macLocalLoopbackEnable_get rtk_rg_port_macLocalLoopbackEnable_set rtk_rg_port_macRemoteLoopbackEnable_get rtk_rg_port_macRemoteLoopbackEnable_set rtk_rg_port_phyAutoNegoAbility_get rtk_rg_port_phyAutoNegoAbility_set rtk_rg_port_phyAutoNegoEnable_get rtk_rg_port_phyAutoNegoEnable_set rtk_rg_port_phyCrossOverMode_get Realtek confidential documentation 27 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_port_phyCrossOverMode_set rtk_rg_port_phyForceModeAbility_get rtk_rg_port_phyForceModeAbility_set rtk_rg_port_phyMasterSlave_get rtk_rg_port_phyMasterSlave_set rtk_rg_port_phyReg_get rtk_rg_port_phyReg_set rtk_rg_port_phyTestMode_get rtk_rg_port_phyTestMode_set rtk_rg_port_rtctResult_get rtk_rg_port_rtct_start rtk_rg_port_specialCongestStatus_clear rtk_rg_port_specialCongestStatus_get rtk_rg_port_specialCongest_get rtk_rg_port_specialCongest_set rtk_rg_port_speedDuplex_get Rate rtk_rg_rate_egrBandwidthCtrlIncludeIfg_get rtk_rg_rate_egrBandwidthCtrlIncludeIfg_set rtk_rg_rate_egrQueueBwCtrlEnable_get rtk_rg_rate_egrQueueBwCtrlEnable_set rtk_rg_rate_egrQueueBwCtrlMeterIdx_get rtk_rg_rate_egrQueueBwCtrlMeterIdx_set rtk_rg_rate_init rtk_rg_rate_portEgrBandwidthCtrlIncludeIfg_get rtk_rg_rate_portEgrBandwidthCtrlIncludeIfg_set rtk_rg_rate_portEgrBandwidthCtrlRate_get rtk_rg_rate_portEgrBandwidthCtrlRate_set rtk_rg_rate_portIgrBandwidthCtrlIncludeIfg_get rtk_rg_rate_portIgrBandwidthCtrlIncludeIfg_set rtk_rg_rate_portIgrBandwidthCtrlRate_get rtk_rg_rate_portIgrBandwidthCtrlRate_set rtk_rg_rate_shareMeterBucket_get rtk_rg_rate_shareMeterBucket_set rtk_rg_rate_shareMeterExceed_clear rtk_rg_rate_shareMeterExceed_get rtk_rg_rate_shareMeterMode_get rtk_rg_rate_shareMeterMode_set Realtek confidential documentation 28 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_rate_shareMeter_get rtk_rg_rate_shareMeter_set rtk_rg_rate_stormBypass_get rtk_rg_rate_stormBypass_set rtk_rg_rate_stormControlEnable_get rtk_rg_rate_stormControlEnable_set rtk_rg_rate_stormControlMeterIdx_get rtk_rg_rate_stormControlMeterIdx_set rtk_rg_rate_stormControlPortEnable_get rtk_rg_rate_stormControlPortEnable_set RLDP rtk_rg_rldp_config_get rtk_rg_rldp_config_set rtk_rg_rldp_init rtk_rg_rldp_portConfig_get rtk_rg_rldp_portConfig_set rtk_rg_rldp_portStatus_clear rtk_rg_rldp_portStatus_get rtk_rg_rldp_status_get rtk_rg_rlpp_init rtk_rg_rlpp_trapType_get rtk_rg_rlpp_trapType_set Statistics rtk_rg_stat_global_get rtk_rg_stat_global_getAll rtk_rg_stat_global_reset rtk_rg_stat_init rtk_rg_stat_logCtrl_get rtk_rg_stat_logCtrl_set rtk_rg_stat_log_get rtk_rg_stat_log_reset rtk_rg_stat_mibCntMode_get rtk_rg_stat_mibCntMode_set rtk_rg_stat_mibCntTagLen_get rtk_rg_stat_mibCntTagLen_set rtk_rg_stat_mibLatchTimer_get rtk_rg_stat_mibLatchTimer_set rtk_rg_stat_mibSyncMode_get rtk_rg_stat_mibSyncMode_set Realtek confidential documentation 29 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_stat_pktInfo_get rtk_rg_stat_port_get rtk_rg_stat_port_getAll rtk_rg_stat_port_reset rtk_rg_stat_rstCntValue_get rtk_rg_stat_rstCntValue_set Switch rtk_rg_switch_allExtPortMask_set rtk_rg_switch_allPortMask_set rtk_rg_switch_chip_reset rtk_rg_switch_deviceInfo_get rtk_rg_switch_init rtk_rg_switch_logicalPort_get rtk_rg_switch_maxPktLenLinkSpeed_get rtk_rg_switch_maxPktLenLinkSpeed_set rtk_rg_switch_mgmtMacAddr_get rtk_rg_switch_mgmtMacAddr_set rtk_rg_switch_nextPortInMask_get rtk_rg_switch_phyPortId_get rtk_rg_switch_port2PortMask_clear rtk_rg_switch_port2PortMask_set rtk_rg_switch_portIdInMask_check rtk_rg_switch_portMask_Clear rtk_rg_switch_version_get Trap rtk_rg_trap_igmpCtrlPkt2CpuEnable_get rtk_rg_trap_igmpCtrlPkt2CpuEnable_set rtk_rg_trap_init rtk_rg_trap_ipMcastPkt2CpuEnable_get rtk_rg_trap_ipMcastPkt2CpuEnable_set rtk_rg_trap_l2McastPkt2CpuEnable_get rtk_rg_trap_l2McastPkt2CpuEnable_set rtk_rg_trap_mldCtrlPkt2CpuEnable_get rtk_rg_trap_mldCtrlPkt2CpuEnable_set rtk_rg_trap_oamPduAction_get rtk_rg_trap_oamPduAction_set rtk_rg_trap_oamPduPri_get rtk_rg_trap_oamPduPri_set rtk_rg_trap_portIgmpMldCtrlPktAction_get Realtek confidential documentation 30 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_trap_portIgmpMldCtrlPktAction_set rtk_rg_trap_reasonTrapToCpuPriority_get rtk_rg_trap_reasonTrapToCpuPriority_set rtk_rg_trap_rmaAction_get rtk_rg_trap_rmaAction_set rtk_rg_trap_rmaPri_get rtk_rg_trap_rmaPri_set Table2. List of mapping RG APIs (Mapping from RTK APIs) Each pure RG API has access to corresponding Hardware Table as follow: Categor y Function Name rtk_rg_initParam_set LAN Intf L V A N L N N B W I P N A C 2 L R I 3 H B I A P P A C F ● ● ● ● ● ● ● ● ● ● ● ● ● ● rtk_rg_lanInterface_add ● ● ● rtk_rg_interface_del ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● WAN rtk_rg_wanInterface_add Intf/ rtk_rg_interface_del Port Binding WAN Type rtk_rg_staticInfo_set ● ● ● ● ● rtk_rg_dhcpClientInfo_set ● ● ● ● ● rtk_rg_pppoeClientInfoAfter Dial_set ● ● ● ● ● ● VLAN rtk_rg_vlanBinding_add Binding rtk_rg_vlanBinding_del ACL/ Qos Remark ing MAC Filter URL Filter Multicast NAPT ● ● rtk_rg_aclFilterAndQos_add ● ● rtk_rg_aclFilterAndQos_del ● ● rtk_rg_macFilter_add ● rtk_rg_macFilter_del ● rtk_rg_urlFilterString_add ● rtk_rg_urlFilterString_del ● rtk_rg_multicastFlow_add ● rtk_rg_multicastFlow_del ● rtk_rg_multicastFlow_find ● rtk_rg_naptConnection_add Realtek confidential documentation ● 31 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_naptConnection_del MAC ARP Neighbor ● rtk_rg_macEntry_add ● rtk_rg_macEntry_del ● rtk_rg_arpEntry_add ● ● rtk_rg_arpEntry_del ● ● rtk_rg_neighborEntry_add ● ● rtk_rg_neighborEntry_del ● ● Table3. List of RTK RG HGU APIs access Hardware Table PS: Glossary for the above field as below: L2: LUT Table VL: CVLAN Table NI: Network Interface Table L3: Routing Table BI: Binding Table WA: WAN Type Table PP: PPPoE Table CF: Classification Table NA: NAPT Table NB:Neighbor Table AR: ARP Table NH: Next Hop Table IP: Internal/External IP Table AC: ACL Table 3. Checkout Code The developer should Checkout Code from SVN Server: $ mkdir ~/RTK $ cd ~/RTK $ svn co http://dtdinfo.realtek.com.tw/svn/CN/lunar/trunk/develop/uClinux-dist Customers should acquire source code package from Realtek FTP.(172.21.146.57). Please get the FTP account information from our FAE. 4. Build Code Following command shows how to build source code to Image: Read the default configuration setting: $ cd uClinux-dist $ make -f LDLMakefile preconfig2630_DL8696RG_VoIP_demo CONFIG_PRODUCT=luna Make menuconfig. If unknown config shows, just press Enter(which means using default setting). $make -f LDLMakefile menuconfig Compile Kernal & User space code and to make vm.img: Realtek confidential documentation 32 Rev 1.1.2 Realtek RG RomeDriver Programming Guide $make -f LDLMakefile all 5. NAPT External Port Collsion Prevention In Current SDK, Forwarding Engine can not support some advanced flow connection, such as User-defined ALG., Out of RomeDriver NAPT range flows. So, these kind of connection packet will be trapped to Protocal-stack and handled by OS(Operating System). The OS will establish and maintain the connection by its own networking module. While establish TCP/UDP NAPT connetion, no matter forwardingEngine or OS take care of this, it must choose an external port. In cuurent SDK, both forwardingEngine and OS maintains these NAPT flow by Symmetric way, and each of them are independent. For avoiding the confliction of the same external port choosed by forwardingEngine and OS but establish different NAPT flow, we must provide a NAPT External Port Collision Prevention Mechanism in RomeDriver to make sure each side will not choose the same external port. If using the NAPT External Port Collision Prevention Mechanism in RomeDriver, the user has to modify the OS protocol stack. Considering the transplating in different OS, and the maintaince in RomeDriver, here we provide two API in RomeDriver for modifying OS easier. rtk_rg_naptExtPortGet (Please reference to 5.1.2) rtk_rg_naptExtPortFree (Please reference to 5.1.3) 5.1.1. Enable/Disable NAPT External Port Collision Prevention The NAPT External Port Collision Prevention Mechanism can be enabled by compile flag CONFIG_RG_NAPT_PORT_COLLISION_PREVENTION. In Linux, We can enable this feature by menuconfig as following: Step1:Choosing the Kernal Setting configuration & Exit the main menuconfig: Realtek confidential documentation 33 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure3. Enable NAPT External Port Collision Prevention, step1 Step2: Enter to “Device Drivers” Figure4. Enable NAPT External Port Collision Prevention, step2 Realtek confidential documentation 34 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Step3: Enter to “Realtek RG support” Figure5. Enable NAPT External Port Collision Prevention, step3 Step4: Enable “Realtek RG NAPT external port collision prevenction.” Figure6. Enable NAPT External Port Collision Prevention, step4 5.1.2. API: rtk_rg_naptExtPortGet This API maintain an external port databased and check the choosed external port is used by other NAPT connetion or UPNP/Virtual Server or not. If the choosed external port is used, then the API will auto increase the port number and check again until find a legal port number. Following figure shows the external port checking flow. Realtek confidential documentation 35 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure7. NAPT External Port choosing flow. 5.1.3. API: rtk_rg_naptExtPortFree This API is used to free the external port in database. After the free action, the external port can be used in the other flow connetion. 5.1.4. Sample Codes for Hooking NAPT External Port Collision Prevention Mechanism in Linux 2.6.30 Here is an example for hooking the NAPT External Port Collision Prevention Mechanism into Linux Kernal 2.6.30. Before OS netfilter establish the conntrack, the user should call rtk_rg_naptExtPortGet for letting RomeDriver check and maintained all external ports. User should hack Protocal-Stack sample code as following: In Linux 2.6.30: linux-2.6.x/net/ipv4/netfilter/nf_nat_core.c EXPORT_SYMBOL(nf_nat_used_tuple); #if defined(CONFIG_RG_NAPT_PORT_COLLISION_PREVENTION) extern int nf_conntrack_drop(const struct nf_conn *ct); void nf_nat_conntrack_replace(const struct nf_conntrack_tuple *tuple, const struct nf_conn *ignored_conntrack) { struct net *net = nf_ct_net(ignored_conntrack); struct nf_conntrack_tuple_hash *h; struct hlist_nulls_node *n; unsigned int hash; struct nf_conn * ct=NULL; struct nf_conn * tmpct=NULL; unsigned long longest_expires=0; unsigned long begin_jiffies=jiffies; int i; Realtek confidential documentation 36 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rcu_read_lock_bh(); for (i = 0; i < nf_conntrack_htable_size; i++) { /* Disable BHs the entire time since we need to disable them at * least once for the stats anyway. */ hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[i], hnnode) { ct = nf_ct_tuplehash_to_ctrack(h); if(ct && (ct != ignored_conntrack)) { if (!test_bit(IPS_ASSURED_BIT, &ct->status)) { tmpct = ((ct->timeout.expires-(jiffies-begin_jiffies)) > longest_expires)?ct:tmpct; longest_expires = tmpct->timeout.expires; } } } } rcu_read_unlock_bh(); if(tmpct) { printk("Early drop connection: protocol:%d SRC[%d.%d.%d.%d:%d] GW[%d.%d.%d.%d:%d]DST[%d.%d.%d.%d:%d]\n",tmpct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum nf_conntrack_drop(tmpct); } return 0; } EXPORT_SYMBOL(nf_nat_conntrack_replace); #endif /* If we source map this tuple so reply looks like reply_tuple, will * that meet the constraints of range. */ static int in_range(const struct nf_conntrack_tuple *tuple, const struct nf_nat_range *range) ……………… static void get_unique_tuple(struct nf_conntrack_tuple *tuple, const struct nf_conntrack_tuple *orig_tuple, const struct nf_nat_range *range, struct nf_conn *ct, enum nf_nat_manip_type maniptype) { ……………… out: #if defined(CONFIG_RG_NAPT_PORT_COLLISION_PREVENTION) if((maniptype == IP_NAT_MANIP_SRC) //SNAT && ((orig_tuple->dst.protonum==IPPROTO_TCP) ||(orig_tuple->dst.protonum==IPPROTO_UDP))) { extern int32 rtk_rg_naptExtPortGet(int isTcp,uint16 *pPort); extern int32 rtk_rg_naptExtPortFree(int isTcp,uint16 port); Realtek confidential documentation 37 Rev 1.1.2 Realtek RG RomeDriver Programming Guide /* Keep Linux NAT core and RG forwarding engine using separated NAPT external port. */ int i=0; unsigned short *pPort; int isTCP; int ret; isTCP = (tuple->dst.protonum==IPPROTO_TCP)?1:0; pPort = &tuple->src.u.all; while(pPort) { if(i++>65535) break; ret = rtk_rg_naptExtPortGet(isTCP,pPort); if(ret==0) //Port is available { if ((nf_nat_used_tuple(tuple, ct))==0) break; } else if(ret==-1) //NAPT flow full { printk("PS used napt flow full\n"); nf_nat_conntrack_replace(tuple, ct); break; } else { *pPort=((*pPort+1)&0xffff); } } } else //DNAT { //Do nothing! } #endif rcu_read_unlock(); } Table4. Example: hook rtk_rg_naptExtPortGet After OS delete the conntrack, user should call rtk_rg_naptExtPortFree to free the especial external port, and following shows the sample code: In Linux 2.6.30: linux-2.6.x/net/netfilter/nf_conntrack_core.c static void destroy_conntrack(struct nf_conntrack *nfct) { ……………… rcu_read_lock(); l4proto = __nf_ct_l4proto_find(nf_ct_l3num(ct), nf_ct_protonum(ct)); if (l4proto && l4proto->destroy) l4proto->destroy(ct); rcu_read_unlock(); #if defined(CONFIG_RG_NAPT_PORT_COLLISION_PREVENTION) Realtek confidential documentation 38 Rev 1.1.2 Realtek RG RomeDriver Programming Guide extern unsigned int rtk_rg_naptExtPortFree(int isTcp,unsigned short port); if(nf_ct_l3num(ct)==PF_INET) { if (test_bit(IPS_SEEN_REPLY_BIT, &ct->status)) { if(nf_ct_protonum(ct)==IPPROTO_TCP) rtk_rg_naptExtPortFree(1,ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u.all); else if(nf_ct_protonum(ct)==IPPROTO_UDP) rtk_rg_naptExtPortFree(0,ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u.all); } } #endif ……………… nf_conntrack_free(ct); } ……………… EXPORT_SYMBOL_GPL(nf_conntrack_tuple_taken); #if defined(CONFIG_RG_NAPT_PORT_COLLISION_PREVENTION) int nf_conntrack_drop(const struct nf_conn *ct) { del_timer(&ct->timeout); death_by_timeout((unsigned long)ct); return 0; } EXPORT_SYMBOL_GPL(nf_conntrack_drop); #endif #define NF_CT_EVICTION_RANGE 8 Table5. Example: hook rtk_rg_naptExtPortFree Realtek confidential documentation 39 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 6. (Lite)RomeDriver Initiation rtk_rg_initParam_set rtk_rg_lanInterface_set rtk_rg_macFilter_add rtk_rg_algApps_set rtk_rg_wanInterface_add rtk_rg_aclFilterAndQos_add rtk_rg_urlFilterString_add rtk_rg_vlanBinding_add rtk_rg_dmzHost_set rtk_rg_virtualServer_add rtk_rg_staticInfo_set Bridge Mode Static Mode rtk_rg_dhcpRequest_set rtk_rg_pppoeClientInfoBeforeDial_set rtk_rg_dhcpClientInfo_set rtk_rg_pppoeClientInfoAfterDial_set DHCP Mode PPPoE Mode rtk_rg_interface_del(WAN) rtk_rg_macFilter_del rtk_rg_interface_del(LAN) Figure8. RomeDriver Initiation Flow Chart The above figure shows the RomeDriver and Lite RomeDriver initial flow of WAN Type is Bridge Realtek confidential documentation 40 Rev 1.1.2 Realtek RG RomeDriver Programming Guide WAN, Static WAN, DHCP WAN or PPPoE WAN, respectively. The dotted line is for setting advance feature. For basic setting, 3~4 steps is needed for Bridge WAN/Router/Gateway configuration. 1. rtk_rg_initParam_set 2. rtk_rg_lanInterface_add 3. rtk_rg_wanInterface_add 4. rtk_rg_staticInfo_set (for L3/L4) The following description shows the Gateway basic setting process. 6.1. Gateway Basic Conifguration There are 4 steps for setting up basic conversion by RTK RG APIs: Step1-initialize RG Driver parameters: rtk_rg_initParam_set is used to initial the Driver, and set up basic parameter and callback functions. Following code shows the default setting: if(rtk_rg_initParam_set(NULL)) return -1; Table6. Example: rtk_rg_initParam_set (Default) If user wants to control the initialization, the parameter init_param.igmpSnoopingEnable is use to enable/disable the Igmpsnooping, the parameter init_param.macBasedTagDecision is use to enable/disable the MacBasedVlan feature, and init_param. wanPortGponMode is use to configurate the Wan port as PON feature or not.. The rest parameter is use to register callback functions, which implement by user, to each configuration step. The callback functions usually are used to notify user for Hardware add/modify/delete informations and synchronize the information between Hardware and Protocol-Stack. If user wants to modify the parameter should first get the default parameter and set back after modified. Following code shows how to enable Igmpsnooping and disable MacBasedVlan and register a callback function in init parameters for notifing user that the hardware wants to add ARP Entry. int *arpAddByHw_CallBack(rtk_rg_arpEntry_t *arp) { … } … rtk_rg_initParams_t init_param; if(rtk_rg_initParam_get(&init_param)) return -1; init_param.igmpSnoopingEnable=ENABLED; init_param. macBasedTagDecision= DISABLED; Realtek confidential documentation 41 Rev 1.1.2 Realtek RG RomeDriver Programming Guide init_param.arpAddByHwCallBack=arpAddByHw_CallBack; if(rtk_rg_initParam_set(&init_param)) return -1; Table7. Example: rtk_rg_initParam_set (Customise) Following description explain the usage of parameter init_param.macBasedTagDecision: This parameter use to control the Hardware determind VLAN by MAC_BASED or VLAN_BASED. Here is the configuration rules that shoud be followed either in MAC_BASED setting or VLAN_BASED setting : If init_param.macBasedTagDecision=DISABLED (VLAN_BASED): The Hardware DMAC_TO_CVID will be disabled, so the vlan/port binding can not be set while calling rtk_rg_wanInterface_add. And if the added Interfcace, which bring up by rtk_rg_wanInterface_add., is BridgeWan, the VLAN must same as Lan Interface. If init_param.macBasedTagDecision=ENABLED (MAC_BASED): The Hardware DMAC_TO_CVID will be enabled,.However, while calling API rtk_rg_lanInterface_add/ rtk_rg_wanInterface_add/ rtk_rg_cvlan_add, the parameter isIVL can only be set to SVL. Step2-Add LAN Interface: The API rtk_rg_lanInterface_add is used to add LAN Interface. There are two parameters, the first parameter rtk_rg_lanIntfConf_t *lan_info is used to send LAN information to Driver, the second one int *intf_idx is the interface index returns from Driver. Since LAN interface index and WAN interface index are two separate sets of data, therefore, LAN/WAN can use the same API rtk_rg_interface_del as deleting interface. Following code shows how to set up ipv4/ipv6 lan interface, and add Port0~3 and SSID0~3 into LAN Interface. LAN configuration: VID=9, GMAC=00:11:22:33:44:55, LAN Gateway IP/MASK=192.168.1.1/255.255.255.0 , IPv6/MASK_LENGH=2001::1/64,MTU=1500. rtk_rg_lanIntfConf_t lan_info; int lanIdx; memset(&lan_info,0,sizeof(lan_info)); lan_info.ip_version=IPVER_V4V6; lan_info.gmac.octet[0]=0x00; lan_info.gmac.octet[1]=0x11; lan_info.gmac.octet[2]=0x22; lan_info.gmac.octet[3]=0x33; lan_info.gmac.octet[4]=0x44; lan_info.gmac.octet[5]=0x55; lan_info.intf_vlan_id=9; Realtek confidential documentation 42 Rev 1.1.2 Realtek RG RomeDriver Programming Guide lan_info.vlan_based_pri_enable=RTK_RG_DISABLED; lan_info.vlan_based_pri=0; lan_info.ip_addr=0xc0a80101; //192.168.1.1 lan_info.ip_network_mask=0xffffff00; lan_info.ipv6_addr.ipv6_addr[0]=0x20; lan_info.ipv6_addr.ipv6_addr[1]=0x01; lan_info.ipv6_addr.ipv6_addr[15]=0x01; lan_info.ipv6_network_mask_length =64; lan_info.mtu=1500; lan_info.isIVL=0; //0:SVL 1:IVL lan_info.port_mask.portmask= ((1<DMAC > DSCP > NAPT > CVLAN > SVLAN > 1Q > PORT > Realtek confidential documentation 56 Rev 1.1.2 Realtek RG RomeDriver Programming Guide SMAC. rtk_rg_qos_priSelWeight_t weight; memset(&weight,0,sizeof(rtk_rg_qos_priSelWeight_t)); weight.weight_of_portBased=1; weight.weight_of_dot1q=2; weight.weight_of_dscp=12; weight.weight_of_acl=15; weight.weight_of_ lutFwd =13; weight.weight_of_saBaed=0; weight.weight_of_vlanBased=10; weight.weight_of_svlanBased=9; weight.weight_of_l4Based=11; if(rtk_rg_qosInternalPriDecisionByWeight_set (weight)) return -1; Table28. Example: rtk_rg_qosInternalPriDecisionByWeight_set Harware has a C-Priority Remapping Table. When ingress packet has C-tag, the Dot1Q based priority is one-to-one mapping from ingress C-tag priority by this remapping table. The following sample code shows how to remap C-Priority to Internal priority. rtk_rg_qosDot1pPriRemapToInternalPri_set(0,0); rtk_rg_qosDot1pPriRemapToInternalPri_set(1,0); rtk_rg_qosDot1pPriRemapToInternalPri_set(2,1); rtk_rg_qosDot1pPriRemapToInternalPri_set(3,1); rtk_rg_qosDot1pPriRemapToInternalPri_set(4,2); rtk_rg_qosDot1pPriRemapToInternalPri_set(5,2); rtk_rg_qosDot1pPriRemapToInternalPri_set(6,3); rtk_rg_qosDot1pPriRemapToInternalPri_set(7,3); //ingress c-pri 7 -->internal priority 3 Table29. Example: rtk_rg_qosDot1pPriRemapToInternalPri_set Harware has a DSCP Remapping Table. When ingress packet has DSCP, the DSCP based priority is multple-to-one mapping from ingress DSCP priority by this remapping table. The following sample code shows how to remap DSCP to Internal priority. // config internal priority decison by chapter: 6.2.6 ... rtk_rg_qosDot1pPriRemapToInternalPri_set(0,0); rtk_rg_qosDot1pPriRemapToInternalPri_set(1,0); ... Realtek confidential documentation 57 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_qosDscpRemapToInternalPri_set(62,7); rtk_rg_qosDscpRemapToInternalPri_set(63,7); // DSCP 63 --> internal priority 7 Table30. Example: rtk_rg_qosDscpRemapToInternalPri_set Harware has a Internal-Priority to Egress-Queue Remapping Table. The Egress Queue is one-to-one remapping from internal priority. The following sample code shows how to config this remap table. // config internal priority decison by chapter: 6.2.6 ... rtk_rg_qosInternalPriMapToQueueId_set(0,0); rtk_rg_qosInternalPriMapToQueueId_set(1,0); rtk_rg_qosInternalPriMapToQueueId_set(2,1); rtk_rg_qosInternalPriMapToQueueId_set(3,1); rtk_rg_qosInternalPriMapToQueueId_set(4,2); rtk_rg_qosInternalPriMapToQueueId_set(5,2); rtk_rg_qosInternalPriMapToQueueId_set(6,3); rtk_rg_qosInternalPriMapToQueueId_set(7,3); //internal priority 7 --> egress queue 3 Table31. Example: rtk_rg_qosInternalPriMapToQueueId_set 6.2.7. QoS 1P Remarking The egress priority of 1P remarking is refer from internal priority. QoS 1Q Remarking rtk_rg_qosDot1pPriRemarkByInternalPriEgress CVLAN-Priority remarking PortEnable_get egress port get. rtk_rg_qosDot1pPriRemarkByInternalPriEgress CVLAN-Priority remarking PortEnable_set egress port set. rtk_rg_qosDot1pPriRemarkByInternalPri_get CVLAN-Priority remarking table get rtk_rg_qosDot1pPriRemarkByInternalPri_set CVLAN-Priority remarking table set Table32. The QoS 1Q Reamrking RG APIs. The following sample code shows how to remark the priority of egress vlan tag by internal priority. // config internal priority decison by chapter: 6.2.6 ... rtk_rg_qosDot1pPriRemarkByInternalPri_set(0,0); Realtek confidential documentation 58 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_qosDot1pPriRemarkByInternalPri_set(1,0); rtk_rg_qosDot1pPriRemarkByInternalPri_set(2,1); rtk_rg_qosDot1pPriRemarkByInternalPri_set(3,1); rtk_rg_qosDot1pPriRemarkByInternalPri_set(4,2); rtk_rg_qosDot1pPriRemarkByInternalPri_set(5,2); rtk_rg_qosDot1pPriRemarkByInternalPri_set(6,3); rtk_rg_qosDot1pPriRemarkByInternalPri_set(7,3); //internal priority 7 --> egress C-pri 3 rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEnable_set(RTK_RG_MAC_PORT_PON, RTK_RG_ENABLED); // Enable PON port egress 1P remarking. Table33. Example: QoS 1P remarking 6.2.8. QoS DSCP Remarking The egress DSCP is refer from internal priority or ingress DSCP. Users are able to choise one which they need. QoS DSCP Remarking rtk_rg_qosDscpRemarkByDscp_get Get the “DSCP remarking by DSCP” mapping table. rtk_rg_qosDscpRemarkByDscp_set Set the “DSCP remarking by DSCP” mapping table. rtk_rg_qosDscpRemarkByInternalPri_get Get the “DSCP remarking by Internal Priority” mapping table. rtk_rg_qosDscpRemarkByInternalPri_set Set the “DSCP remarking by Internal Priority” mapping table. rtk_rg_qosDscpRemarkEgressPortEnable AndSrcSelect_get Get DSCP remarking egress port. rtk_rg_qosDscpRemarkEgressPortEnable AndSrcSelect_set Set DSCP remarking egress port. Table34. The QoS DSCP Remarking RG APIs. The following sample code shows how to remark egress DSCP by internal priority. // config internal priority decison by chapter: 6.2.6 ... rtk_rg_qosDscpRemarkByInternalPri_set(0,0); rtk_rg_qosDscpRemarkByInternalPri_set(1,8); rtk_rg_qosDscpRemarkByInternalPri_set(2,16); rtk_rg_qosDscpRemarkByInternalPri_set(3,24); Realtek confidential documentation 59 Rev 1.1.2 Realtek RG RomeDriver Programming Guide rtk_rg_qosDscpRemarkByInternalPri_set(4,32); rtk_rg_qosDscpRemarkByInternalPri_set(5,40); rtk_rg_qosDscpRemarkByInternalPri_set(6,48); rtk_rg_qosDscpRemarkByInternalPri_set(7,56); //internal priority 7 --> egress DSCP 56 rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_set( RTK_RG_MAC_PORT_PON, RTK_RG_ENABLED, RTK_RG_DSCP_RMK_SRC_INT_PRI); // Enable PON port egress DSCP remarking by internal priority. Table35. Example: QoS DSCP remarking 6.2.9. QoS Strict Priority / WFQ The RG API: rtk_rg_qosStrictPriorityOrWeightFairQueue_set is used to achieve this kind of requirement. This function has two parameters. The first parameter is Port number(range of 0~6,0~3:LAN Port, 4: PON, 5:RGMII, 6:CPU). The second parameter is per-queue weight of related port. Weight equal 0 represents the Strict Priority. When weight falls in the range of 1~128 represents WFQ Weights. If there is more than one Strict Priority, the higher the queue number has the first priority to be handled. After all Strict Priority Queues are handled, the WFQ Queues then will be handled. Each Port has the capacity for 8 Queues. To prioritize any specific packets into Strict Priority Queue or WFQ, can done from ACL rule by Setting QoS action type- ACL_ACTION_QUEUE_ID_BIT with assigned queue ID and assigning per Port & Queue. Here is the scenery of setting code for Port4~7 on Strict Priority, while Port0~3 to WFQ. Consequently, packets transmit priority will put Queue7 packets as first priority to send out, and then following with the sequencial order of Queue6, Queue5, and Queue4. After all packets in Queue7~4 are exhausted, the Queue3~0 will start to send, and the bandwidth will be in order of 4:3:2:1. In ACL, all TCP packets are assigned to Queue7 with top priority. rtk_rg_aclFilterAndQos_t aclRule; int aclIdx,i; rtk_rg_qos_queue_weights_t q_weight; q_weight.weights[7]=0; //Queue4~7:Strict Priority q_weight.weights[6]=0; q_weight.weights[5]=0; Realtek confidential documentation 60 Rev 1.1.2 Realtek RG RomeDriver Programming Guide q_weight.weights[4]=0; q_weight.weights[3]=4; //Queue3~0 4:3:2:1 q_weight.weights[2]=3; q_weight.weights[1]=2; q_weight.weights[0]=1; for(i=0;i<7;i++) { rtk_rg_qosStrictPriorityOrWeightFairQueue_set (i,&q_weight); } memset(&aclRule,0,sizeof(rtk_rg_aclFilterAndQos_t)); aclRule.filter_fields=INGRESS_L4_TCP_BIT; aclRule.action_type=ACL_ACTION_TYPE_QOS; aclRule.qos_actions=ACL_ACTION_QUEUE_ID_BIT; aclRule.action_queue_id=0x7; if(rtk_rg_aclFilterAndQos_add(&aclRule,&aclIdx)) return -1; Table36. Example: rtk_qos_schedulingQueue_set 6.2.9.1. DSCP to Internal Priority If user wants to limit the qos of DHCP, not only above-mentioned (Sec. QoS Strict Priority / WFQ) configuration needs to set, but also the Internal priority decision & the mapping of dhcp-to-internal priority needs to set. For Example, let dscp10: dscp20: dscp30: dscp40 sending ratio to 1:2:3:4 , we have to use rtk_rg_qosInternalPriDecisionByWeight_set to make the DSCP priority higher while Internal-Priority decision.(DSCP weight=12, just lower than ACL and lutFwd). And then using rtk_rg_qosDscpRemapToInternalPri_set to set dscp10 remapping to Priority0, dscp20 remapping to Priority1, dscp30 remapping to Priority2, and dscp40 remapping to Priority3 int ret; rtk_rg_qos_priSelWeight_t weight; memset(&weight,0,sizeof(rtk_rg_qos_priSelWeight_t)); weight.weight_of_portBased=1; weight.weight_of_dot1q=2; weight.weight_of_dscp=12; weight.weight_of_acl=15; weight.weight_of_ lutFwd =13; weight.weight_of_saBaed=0; weight.weight_of_vlanBased=10; weight.weight_of_svlanBased=9; weight.weight_of_l4Based=11; Realtek confidential documentation 61 Rev 1.1.2 Realtek RG RomeDriver Programming Guide if(rtk_rg_qosInternalPriDecisionByWeight_set (weight)) return -1; if(rtk_rg_qosDscpRemapToInternalPri_set (10,0)) return -1; if(rtk_rg_qosDscpRemapToInternalPri_set (20,1)) return -1; if(rtk_rg_qosDscpRemapToInternalPri_set (30,2)) return -1; if(rtk_rg_qosDscpRemapToInternalPri_set (40,3)) return -1; Table37. Example: rtk_rg_qosDscpRemapToInternalPri_set 6.2.9.2. Port to Internal Priority If user wants to limit the qos of each Port, not only above-mentioned (Sec. QoS Strict Priority / WFQ) configuration needs to set, but also the Internal priority decision & the mapping of port-to-internal priority needs to set. For Example, let packets of Port1: Port2: Port3: Port4 sending ratio to 1:2:3:4 , we have to use rtk_rg_qosInternalPriDecisionByWeight_set to make the port-based priority higher while Internal-Priority decision.(port-based priority just lower than ACL and lutFwd). And then using rtk_rg_qosPortBasedPriority_set to set Port0 mapping to Priority0, Port 2 mapping to Priority1, Port 3 mapping to Priority2, and Port 4 remapping to Priority3. int ret; rtk_rg_qos_priSelWeight_t weight; memset(&weight,0,sizeof(rtk_rg_qos_priSelWeight_t)); weight.weight_of_portBased=12; weight.weight_of_dot1q=2; weight.weight_of_dscp=0; weight.weight_of_acl=15; weight.weight_of_ lutFwd =13; weight.weight_of_saBaed=0; weight.weight_of_vlanBased=10; weight.weight_of_svlanBased=9; weight.weight_of_l4Based=11; if(rtk_rg_qosInternalPriDecisionByWeight_set (weight)) return -1; if(rtk_rg_qosPortBasedPriority_set (RTK_RG_MAC_PORT0,0)) return -1; if(rtk_rg_qosPortBasedPriority_set (RTK_RG_MAC_PORT1,1)) return -1; if(rtk_rg_qosPortBasedPriority_set (RTK_RG_MAC_PORT2,2)) return -1; if(rtk_rg_qosPortBasedPriority_set (RTK_RG_MAC_PORT3,3)) return -1; Table38. Example: rtk_rg_qosPortBasedPriority_set Realtek confidential documentation 62 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 6.2.10. L2 per-Port learning count limit There are 2048 entries available on L2 Table without limitation on auto-learning volume in per-Port in default setting. If user wants to limit the auto-learning on per port should use rtk_l2_portLimitLearningCnt_set. The first parameter is PortNumber, and the second parameter is auto learning volume. If user enter 0 on the second parameter which will disable the auto learning mechanism to that specific Port, and the maximum number to fill in the second parameter should be 2048. if(rtk_l2_portLimitLearningCnt_set(RTK_RG_MAC_PORT0,10)) return -1; Table39. Example: rtk_l2_portLimitLearningCnt_set 6.2.11. MacFilter For saving ACL resources, Macfilter is provided by L2 Tables currently. The following example shows how to drop packet with source mac 00:e0:4c:86:70:99 by rtk_rg_macFilter_add. int macfilterIdx; rtk_rg_macFilterEntry_t macFilterEntry; memset(&macFilterEntry,0,sizeof(rtk_rg_macFilterEntry_t)); macFilterEntry.mac.octet[0]=0x00; macFilterEntry.mac.octet[1]=0xe0; macFilterEntry.mac.octet[2]=0x4c; macFilterEntry.mac.octet[3]=0x86; macFilterEntry.mac.octet[4]=0x70; macFilterEntry.mac.octet[5]=0x99; macFilterEntry.direct=RTK_RG_MACFILTER_FILTER_SRC_MAC_ONLY; if(rtk_rg_macFilter_add(&macFilterEntry,&macfilterIdx)) return -1; Table40. Example: rtk_rg_macFilter_add 6.2.12. Application-Level-Gateway(ALG) Up to now, PPTP/L2TP/FTP are supported in ALG. The following example shows how to enable FTP by rtk_rg_virtualServer_add. rtk_rg_alg_type_t alg_app; alg_app = RTK_RG_ALG_FTP_TCP_BIT | RTK_RG_ALG_FTP_UDP_BIT; if(rtk_rg_algApps_set(alg_app)) Realtek confidential documentation 63 Rev 1.1.2 Realtek RG RomeDriver Programming Guide return -1; Table41. Example: rtk_rg_algApps_set 6.2.13. Virtual Server The following Example shows how to transmit tcp packets from Wan Interface, which wanIdx is 1, and destination port is 1000~1099 to Lan Interfcae Server which IP is 192.168.1.2 and mapping destination port to 2000~2099 by rtk_rg_virtualServer_add. int virtualServerIdx; rtk_rg_virtualServer_t virtual_server; memset(&virtual_server,0,sizeof(rtk_rg_virtualServer_t)); virtual_server.valid=ENABLED; virtual_server.is_tcp=ENABLED; virtual_server.wan_intf_idx=1; virtual_server.gateway_port_start = 1000; virtual_server.local_port_start = 2000; virtual_server.mappingPortRangeCnt = 100; virtual_server.local_ip=0xc0a80102; //192.168.1.2 if(rtk_rg_virtualServer_add(&virtual_server,&virtualServerIdx)) return -1; Table42. Example: rtk_rg_virtualServer_add 6.2.14. DmzHost The following example shows how to enable dmzHost, and transmit all packets from Wan Interface, which wanIdx is 1, to the Lan Interfcae Host which IP is 192.168.1.3 by rtk_rg_dmzHost_set. int wan_intf_idx; rtk_rg_dmzInfo_t dmz_info; memset(&dmz_info,0,sizeof(rtk_rg_dmzInfo_t)); wan_intf_idx = 1; dmz_info.enabled=ENABLED; dmz_info.private_ip=0xc0a80103; //192.168.1.3 if(rtk_rg_dmzHost_set(wan_intf_idx,&dmz_info)) return -1; Table43. Example: rtk_rg_dmzHost_set Realtek confidential documentation 64 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 6.2.15. UpnpConnection The following example shows how to transmit tcp packets from Wan Interface, which wanIdx is 1, destination IP is 192.168.10.4, source port is 3000, and destination port is 3000 to Lan Interfcae Host whoch IP is 192.168.1.4, and Port is 4000. If upnp.limit_remote_ip=DISABLED means don’t care source IP of originally packet. Similarly, upnp.limit_remote_port = DISABLED means don’t care source port of originally packet. int upnpIdx; rtk_rg_upnpConnection_t upnp; memset(&upnp,0,sizeof(rtk_rg_upnpConnection_t)); upnp.valid=ENABLED; upnp.is_tcp=ENABLED; upnp.wan_intf_idx=1; upnp.gateway_port=3000; upnp.local_ip=0xc0a80104; //192.168.1.4 upnp.local_port=4000; upnp.remote_ip=0xc0a80a04; upnp.remote_port=5000; upnp.limit_remote_ip = 100; //192.168.10.4 upnp.limit_remote_port = 100; upnp.type=UPNP_TYPE_PERSIST; upnp.timeout=0; //0:disable auto-delete if(rtk_rg_upnpConnection_add(&upnp,&upnpIdx)) return -1; Table44. Example: rtk_rg_upnpConnection_add 6.2.16. MulticastFlow The following example shows how to let port0, port1 join an multicast flow which IP is 224.1.2.3 by rtk_rg_multicastFlow_add. int flowIdx; rtk_rg_multicastFlow_t mcFlow; memset(&mcFlow,0,sizeof(rtk_rg_multicastFlow_t)); mcFlow.multicast_ipv4_addr = 0xe0010203; //224.1.2.3 mcFlow.isIPv6 = DISABLED; mcFlow.port_mask.portmask = (1< Realtek confidential documentation 72 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 8.2. Configure WAN by Web UI Select WAN item: fill Channel Mode=IPoE, Enable NAPT, IP Protocol=IPv4, Type=Fixed IP, Local IP Address: 192.168.150.116, Remote IP Address=192.168.150.117, Subnet Mask=255.255.255.0. Select [Apply Changes] to reflash the setting and write the configuration on MIB Flash. Figure14. Web UI:Ethernet WAN Interface Setting 9. Test by Diagnostics Shell Command 9.1. Diag Shell Introduction DiagShell is an application in RG RomeDriver for debug and access RG APIs in run time. It provides an interface to typing diag commands to access RG APIs dynamically. Each RG API can mapping to 1~3 diag commands depends to the RG API complexity, and the relationship between RG API and diag command is introduced in Sec. Mapping for RG API & Diag Cmd 9.1.1. Startup DiagShell Turn on the sytem, and log in with account: admin and password: system. Realtek confidential documentation 73 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure15. UART: ADSL Main Menu After login, enter the option 0 to skip ADSL Main Menu. Enter diag for startup diagshell application. 9.1.2. Command-Line-Completion for Diag Cmd DiagShell provides Command-Line-Completion capability by [Tab]. 1. If current keyword is complete, it will give tips for next possible keyword. ←input [tab] Figure16. Realtek confidential documentation DiagShell tips for next keyword 74 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 2. If current keyword is incomplete, it will complete current keyword: ←input [tab] Figure17. DiagShell command-line-completion 9.1.3. Mapping for RG API & Diag Cmd All RG API are related to the diag command with first keyword “rg”. the second keyword indicate the action (such as add, delete, get…etc) of API. And the third keyword indicate the feature of the API (such as Interface, macEntry, ACL…etc ). For complex RG API suct as rtk_rg_XXXX_add( ), DiagShell separate these kind of RG API into two or three diag commands. We use command “rg set XXXX ….” for preparing the parameters of the API, and use command “rg add XXXX entry” for actually call to the rtk_rg_XXXX_add( ). Following table shows all action of the command(Second keyword): add Call to RG API rtk_rg_XXXX_add( ) del Call to RG API rtk_rg_XXXX_del( ) get Call to RG API rtk_rg_XXXX_find( ) init Especial call to RG API rtk_rg_initParam_set( ) set Set the parameters before call to RG API rtk_rg_XXXX_add( ) Realtek confidential documentation 75 Rev 1.1.2 Realtek RG RomeDriver Programming Guide clear Clear the parameters show Show the current setting parameters Table53. List of Diag Command second keywords Following table shows the feature and API mapping of the command(Third keyword): acl-filter rtk_rg_aclFilterAndQos_add/del/find algApps rtk_rg_algApps_set/get arp-entry rtk_rg_arpEntry_add/del /find binding rtk_rg_vlanBinding_add/del/ find cvlan rtk_rg_cvlan_add/del dhcpClientInfo rtk_rg_dhcpClientInfo_set dhcpRequest rtk_rg_dhcpRequest_set dmzHost rtk_rg_dmzHost_set/get dosFloodType rtk_rg_dosFloodType_set/get dosPortMaskEnable rtk_rg_dosPortMaskEnable_set/get dosType rtk_rg_dosType_set/get lan-intf rtk_rg_lanInterface_add mac-entry rtk_rg_macEntry_add/del/find macfilter rtk_rg_macFilter_add/del/find napt-connection rtk_rg_naptConnection_add/del/find neighbor-entry rtk_rg_neighborEntry_add/del/find phyPortForceAbility rtk_rg_phyPortForceAbility_set/get portEgrBandwidthCtrlRate rtk_rg_portEgrBandwidthCtrlRate_set/get portIgrBandwidthCtrlRate rtk_rg_portIgrBandwidthCtrlRate_set/get portMirror rtk_rg_portMirror_set/get pppoeClientInfoAfterDial rtk_rg_pppoeClientInfoAfterDial_set pppoeClientInfoBeforeDial rtk_rg_pppoeClientInfoBeforeDial_set qosDot1pPriRemapToInternalPri rtk_rg_qosDot1pPriRemapToInternalPri_set/get qosDot1pPriRemarkByInternalPri rtk_rg_qosDot1pPriRemarkByInternalPri_set/get qosDot1pPriRemarkByInternalPriEgr essPortEnable rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEna ble_set/get qosDscpRemapToInternalPri rtk_rg_qosDscpRemapToInternalPri_set/get qosDscpRemarkByDscp rtk_rg_qosDscpRemarkByDscp_set/get qosDscpRemarkByInternalPri rtk_rg_qosDscpRemarkByInternalPri_set/get qosDscpRemarkEgressPortEnableAn dSrcSelect rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_ set/get qosInternalPriDecisionByWeight rtk_rg_qosInternalPriDecisionByWeight_set/get Realtek confidential documentation 76 Rev 1.1.2 Realtek RG RomeDriver Programming Guide qosInternalPriMapToQueueId rtk_rg_qosInternalPriMapToQueueId_set/get qosPortBasedPriority rtk_rg_qosPortBasedPriority_set/get qosStrictPriorityOrWeightFairQueue rtk_rg_qosStrictPriorityOrWeightFairQueue_set/get serverInLanAppsIpAddr rtk_rg_algServerInLanAppsIpAddr_add/del shareMeter rtk_rg_shareMeter_set/get softwareSourceAddrLearningLimit rtk_rg_softwareSourceAddrLearningLimit_set/get stormControl rtk_rg_stormControl_add/del/find upnpConnection rtk_rg_upnpConnection_add/del/find url-filter rtk_rg_urlFilterString_add/del/find virtualServer rtk_rg_virtualServer_add/del/find wan-intf rtk_rg_wanInterface_add wan-intf-static-info rtk_rg_staticInfo_set Table54. List of Diag Command Third keywords 9.2. NIC Driver network device name & HW Port Index mapping Lan Port mapping is eth0(PortIdx=0), eth0.2(PortIdx=1), eth0.3(PortIdx=2), eth0.4(PortIdx=3), and nas0(PortIdx-4) is used for PON WAN Port while (PortIdx=5) is used for RGMII WAN Port. # echo 0 eth0 > /proc/rtl8686gmac/dev_port_mapping # echo 1 eth0.2 > /proc/rtl8686gmac/dev_port_mapping # echo 2 eth0.3 > /proc/rtl8686gmac/dev_port_mapping # echo 3 eth0.4 > /proc/rtl8686gmac/dev_port_mapping # echo 4 nas0 > /proc/rtl8686gmac/dev_port_mapping <4:PON, 5:RGMII> 9.3. Diag Shell for Realtek RG APIs Enter diag shell by command diag: 9.3.1. Initial RG API User can use following command for simply resetting all hardware tables. And then configurate Lan/Wan Interfcae or other features of the gateway. However, without callback functions for automatically synchronizing hardware tables and protocol stack, user should configurate the state of protocol stack by himself. The basic commands for configurating LAN/WAN Interface of protocol stack can be referenced by Sec. Set Lan/Wan Configuration of Protocal Stack. RTK.0>rg init Realtek confidential documentation 77 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 9.3.2. Initial RG API and register callback function LiteRomeDriver/RomeDriver reserves some hook points in RTK RG APIs for registering callback functions. Callback functions is used to synchronize Hardware Tables and Protocal Stack, such as sync Rouing Table. Diag Shell supports a set of default callback functions, and following command shows how to register all of them from the start. Besides, IgmpSnooping Module and macBasedTagDecision can be enable/sidable by user-self by following command, too. Enter parameter 1 as enable, and 0 as disable. RTK.0> rg init callback default igmpSnoopingEnable 1 macBasedTagDecision 1 wanPortGponMode 0 User can register his own callback functions without using default callback functions. but need to remember where he stores it in Kernal memory (ex, oxffffffff). Following command shows how to register callback function (The memory address just a sample, it should be assigned based on real environment.): RTK.0>rg set callback arpAddByHwCallBack 0xffffff00 RTK.0>rg set callback arpDelByHwCallBack 0xffffff01 RTK.0>rg set callback bindingAddByHwCallBack 0xffffff02 RTK.0>rg set callback bindingDelByHwCallBack 0xffffff03 RTK.0>rg set callback initByHwCallBack 0xffffff04 RTK.0>rg set callback interfaceAddByHwCallBack 0xffffff05 RTK.0>rg set callback interfaceDelByHwCallBack 0xffffff06 RTK.0>rg set callback macAddByHwCallBack 0xffffff07 RTK.0>rg set callback macDelByHwCallBack 0xffffff08 RTK.0>rg set callback naptAddByHwCallBack 0xffffff09 RTK.0>rg set callback naptDelByHwCallBack 0xffffff0a RTK.0>rg set callback neighborAddByHwCallBack 0xffffff0b RTK.0>rg set callback neighborDelByHwCallBack 0xffffff0c RTK.0>rg set callback pppoeBeforeDiagByHwCallBack 0xffffff0d RTK.0>rg set callback routingAddByHwCallBack 0xffffff0e RTK.0>rg set callback routingDelByHwCallBack 0xffffff0f RTK.0>rg set callback v6RoutingAddByHwCallBack 0xffffff10 RTK.0>rg set callback v6RoutingDelByHwCallBack 0xffffff11 RTK.0>rg init callback igmpSnoopingEnable 1 macBasedTagDecision 1 wanPortGponMode 0 Default callback function is located in memory that can be found by following command: # cat proc/rg/callback Realtek confidential documentation 78 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 9.3.3. Add LAN Interface RTK.0> rg set lan-intf ip-version 2 gateway-mac 00:e0:4c:86:70:01 ip-addr 192.168.1.1 ip-mask 255.255.255.0 ipv6-addr 0::0 ipv6_network_mask_length 0 port-mask 0x5f untag-mask 0x5f intf-vlan_id 9 vlan-based-pri-enable disable mtu 1500 isIVL 0 RTK.0>rg add lan-intf entry add lan-intf[0] success. 9.3.4. Add WAN Interface RTK.0>rg set wan-intf wan-type 0 gateway-mac 00:e0:4c:86:70:02 wan-port 4 port-binding-mask 0x0 egress-vlan-tag-on 0 egress-vlan-id 8 vlan-based-pri-enable disable isIVL 0 RTK.0>rg add wan-intf entry add wan-intf[1] success. Realtek confidential documentation 79 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 9.3.5. Set Static WAN Configuration (1)Using following command will allow Router get gateway_mac_addr found by gateway_ip_addr automatically(Not supported in Lite RomeDriver). RTK.0>rg set wan-intf-static-info ip-version 2 napt_enable 1 ip_addr 192.168.150.116 ip_network_mask 255.255.255.248 ipv4_default_gateway_on 1 gateway_ipv4_addr 192.168.150.117 mtu 1500 gw_mac_auto_learn_for_ipv4 1 gateway_mac_addr_for_ipv4 00:00:00:00:00:00 RTK.0>rg set wan-intf-static-info-ipv6 ipv6_addr 2002::1 ipv6_mask_length 64 ipv6_default_gateway_on 1 gateway_ipv6_addr 2002::2 mtu 1500 gw_mac_auto_learn_for_ipv6 1 gateway_mac_addr_for_ipv6 00:00:00:00:00:00 RTK.0>rg add wan-intf-static-info intf-index 1 <1 is the corresponding value of Add WAN Intf > add static info to interface[1] success. (2) Using following command to Assign gateway_mac_addr manually: RTK.0>rg set wan-intf-static-info ip-version 2 napt_enable 1 ip_addr 192.168.150.116 ip_network_mask 255.255.255.248 ipv4_default_gateway_on 1 gateway_ipv4_addr 192.168.150.117 mtu 1500 gw_mac_auto_learn_for_ipv4 0 gateway_mac_addr_for_ipv4 00:e0:01:02:03:04 RTK.0>rg set wan-intf-static-info-ipv6 ipv6_addr 2002::1 ipv6_mask_length 64 ipv6_default_gateway_on 1 gateway_ipv6_addr 2002::2 mtu 1500 gw_mac_auto_learn_for_ipv6 0 gateway_mac_addr_for_ipv6 00:e0:01:02:03:04 RTK.0>rg add wan-intf-static-info intf-index 1 <1 is the corresponding value of Add WAN Intf > add static info to interface[1] success. 9.4. Diag Shell for Realtek RG Runtime API 9.4.1. Get RG API Version Info RTK.0>rg get version Lunar:1049 Switch:42382 RG:865 User:55269 Once NAPT, ARP Auto learning is enabled, there is no need to command following Diag Shell. 9.4.2. Add MAC Entry RTK.0>rg set mac-entry mac-address 00:e0:01:02:03:44 isIVL 0 fid 0 vlan_id 9 port_idx 1 Realtek confidential documentation 80 Rev 1.1.2 Realtek RG RomeDriver Programming Guide static_entry 1 RTK.0>rg add mac-entry entry add macEntry[44] success. Implying add MAC to MAC Table Index 45. 9.4.3. Add ARP Entry RTK.0>rg set arp-entry macEntryIdx 44 ip_addr 192.168.1.2 static_entry 1 valid 1 RTK.0>rg add arp-entry entry add arpEntry[2] success. Implying add ARP to ARP Table Index 2. 9.4.4. Add NAPT Entry RTK.0>rg set napt-connection is_tcp 1 local_ip 192.168.1.2 remote_ip 10.10.10.10 wan_intf_idx 1 local_port 16811 remote_port 1010 external_port 1000 outbound_pri_valid 0 outbound_priority 0 inbound_pri_valid 0 inbound_priority 0 RTK.0>rg add napt-connection entry add naptConn[320] success. Implying add NAPT to NAPT Table Index 320. 10. Realtek RG Debug Tools If Realtek RG Debug Tools is enabled in Kernel menuconfig, the following debug tools can be used. Each Hardware Table can be dumped by following commands: # cat /proc/dump/netif After LAN/WAN is Set up, two Network Interfaces should be showed. Realtek confidential documentation 81 Rev 1.1.2 Realtek RG RomeDriver Programming Guide # cat /proc/dump/l3 Once LAN/WAN is set up, two Interface Route[0],[1] and one Default Route[7] should be showed. # cat /proc/dump/ip Once LAN/WAN is set up, one set of WAN IP should be set in NAPT, and IP Table Index should refer to Network Interface Table Index. # cat /proc/dump/vlan Realtek confidential documentation 82 Rev 1.1.2 Realtek RG RomeDriver Programming Guide VID1 is all VLAN member port of LAN & WAN. VID2 is all VLAN member port of LAN Interface. VID8 is USER added VLAN member port of WAN Interface. VID9 is USER added VLAN member port of LAN Interface. # cat /proc/dump/arp # cat /proc/dump/nh Realtek confidential documentation 83 Rev 1.1.2 Realtek RG RomeDriver Programming Guide # cat /proc/dump/l2 # cat /proc/dump/napt # cat /proc/dump/pppoe Realtek confidential documentation 84 Rev 1.1.2 Realtek RG RomeDriver Programming Guide # cat /proc/dump/reg # cat /proc/dump/hs Realtek confidential documentation 85 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11. Test Report 11.1. Chariot-LAN to LAN Bridge Mode-TCP Throughput Using High_Performance_Throughput.scr Script, 2 LAN to LAN TCP connections speed is at Realtek confidential documentation 86 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 902Mbps. Because the speed of Chariot related to Testing Computer efficiency, this test result should be treated as reference for LAN to WAN speed and only. Figure18. Chariot LAN to LAN TCP connection 11.2. Chariot-LAN to WAN NAPT Mode-TCP Throughput Using High_Performance_Throughput.scr Script, 2 LAN to WAN TCP connections speed is at 905Mbps. Because the speed of Chariot related to Testing Computer efficiency, this test result should be treated as reference for LAN to LAN speed and only. Realtek confidential documentation 87 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure19. Chariot LAN to WAN TCP connection 11.3. IXIA-LAN to LAN Bridge Mode-TCP(Packet Size:1518Bytes) Data Bit Rate: 986.962Mbps Total Packets/Sec:81486.31fps Realtek confidential documentation 88 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure20. IXIA LAN to LAN TCP connection(Large Packet) 11.4. IXIA-LAN to LAN Bridge Mode-TCP(Packet Size:64Bytes) Data Bit Rate: 761.905Mbps Total Packets/Sec:1488095.2fps Figure21. Realtek confidential documentation IXIA LAN to LAN TCP connection(Small Packet) 89 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11.5. IXIA-LAN to UTP WAN NAPT Mode-TCP(Packet Size:1518Bytes) Data Bit Rate: 986.962Mbps Total Packets/Sec:81486.31fps Figure22. IXIA LAN to WAN TCP connection(Large Packet) 11.6. IXIA-LAN to UTP WAN NAPT Mode-TCP(Packet Size:64Bytes) Data Bit Rate: 761.905Mbps Total Packets/Sec:1488095.2fps Realtek confidential documentation 90 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure23. IXIA LAN to WAN TCP connection(Small Packet) 11.7. IXIA-LAN to GPON WAN NAPT Mode-UDP(Packet Size:1518Bytes) Up-stream Data Bit Rate: 986.996Mbps Total Packets/Sec: 81,274,382ps Figure24. IXIA LAN to GPON WAN UDP connection (Large Packet) Realtek confidential documentation 91 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11.8. IXIA-GPON WAN to LAN NAPT Mode-UDP(Packet Size:1518Bytes) Down-stream Data Bit Rate: 986.996Mbps Total Packets/Sec: 81,274,382ps Figure25. IXIA GPON WAN to LAN UDP connection (Large Packet) 11.9. IXIA-LAN to GPON WAN NAPT Mode-UDP(Packet Size:64Bytes) Up-stream Data Bit Rate: 761.905Mbps Total Packets/Sec: 1,488,095.2ps Realtek confidential documentation 92 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Figure26. IXIA LAN to GPON WAN UDP connection(Small Packet) 11.10. IXIA-GPON WAN to LAN NAPT Mode-UDP(Packet Size:64Bytes) Down-stream Data Bit Rate: 761.905Mbps Total Packets/Sec: 1,488,095.2ps Figure27. IXIA GPON WAN to LAN UDP connection(Small Packet) Realtek confidential documentation 93 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11.11. IXIA(veriwave)-WIFI to WAN Bridge Mode-UDP Veriwave Configuration: Learning Time Achieved Transmit Time Settle Time Aging Time Acceptable Loss Protocol Wifi Configuration: Protocol MCS Rate Channel Width AMPDU DUT Configuration GMAC Ring Size Wifi IC Channel Figure28. Realtek confidential documentation 2 sec 10 sec 2 sec 5 sec 1.00% UDP 802.11n 15 40 MHz on 512 8192ER 11 IXIA WIFI to WAN(Bridge) UDP connection 94 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 11.12. IXIA(veriwave)-WIFI to WAN NAPT Mode-UDP Veriwave Configuration: Learning Time Achieved Transmit Time Settle Time Aging Time Acceptable Loss Protocol 2 sec 10 sec 2 sec 5 sec 1.00% UDP Wifi Configuration: Protocol MCS Rate Channel Width AMPDU 802.11n 15 40 MHz on DUT Configuration GMAC Ring Size Wifi IC Channel 512 8192ER 11 Figure29. Realtek confidential documentation IXIA WIFI to WAN(NAPT) UDP connection 95 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12. RTK RG APIs Prototype 12.1. rtk_rg_driverVersion_get Parameters int32 rtk_rg_driverVersion_get(rtk_rg_VersionString_t *version_string) Get the RG rome driver version number. Defined in: rtk_rg_liteRomeDriver.h *version_string [in] The pointer of version structure. [out] The pointer to the stucture with version string. version_string.version_string - the char string of version, at most 20 characters. Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER the buffer parameter may be NULL 12.2. rtk_rg_initParam_get Parameters Comments int32 rtk_rg_initParam_get(rtk_rg_initParams_t *init_param) Get the initialized call-back functions. Defined in: rtk_rg_liteRomeDriver.h *init_param [in] The instance of rtk_rg_initParams_t. [out] The instance of rtk_rg_initParams_t with saved call igmpSnoopingEnable - control IGMP snooping should on or off. macBasedTagDecision - control tag decision based on MAC should on or off. wanPortGponMode - indicate if the switch configure as GPON mode or not. init_param.arpAddByHwCallBack - this call-back function pointer should be called when ARP entry added. init_param.arpDelByHwCallBack - this call-back function pointer should be called when ARP entry deleted. init_param.macAddByHwCallBack - this call-back function pointer should be called when MAC entry added. init_param.macDelByHwCallBack - this call-back function pointer should be called when MAC entry deleted. init_param.routingAddByHwCallBack - this call-back function pointer should be called when Routing entry added. init_param.routingDelByHwCallBack - this call-back function pointer should be called when Routing entry deleted. init_param.naptAddByHwCallBack - this call-back function pointer should be called when NAPT entry added. init_param.naptDelByHwCallBack - this call-back function pointer should be called when NAPT entry deleted. init_param.bindingAddByHwCallBack - this call-back function pointer should be called when Binding entry added. init_param.bindingDelByHwCallBack - this call-back function pointer should be called when Binding entry added. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INITPM_UNINIT Realtek confidential documentation the buffer parameter may be NULL init parameter structure are all NULL pointers 96 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.3. rtk_rg_initParam_set Parameters int32 rtk_rg_initParam_set(rtk_rg_initParams_t *init_param) Set the initialized call-back functions, and reset all Global variables. Defined in: rtk_rg_liteRomeDriver.h *init_param [in] The instance of rtk_rg_initParams_t with saved call This function should be called before any other RG APIs. Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_VLAN_SET_FAIL The RG module is failed to initialize Set up default CPU VLAN or LAN VLAN failed 12.4. rtk_rg_lanInterface_add Parameters Comments int32 rtk_rg_lanInterface_add(rtk_rg_lanIntfConf_t *lan_info, int *intf_idx) Create one new LAN interface, add related entries into HW tables and Global variables. Defined in: rtk_rg_liteRomeDriver.h *lan_info [in] LAN interface configuration structure. *intf_idx [out] Return the index of new created LAN interface. lan_info.gmac - the gateway MAC address of this LAN interface. lan_info.ip_addr - the IP address of this LAN interface. lan_info.ip_network_mask - the mask decides how many hosts in this LAN. lan_info.port_mask - which ports belong to this LAN. lan_info.untag_mask - which ports in this LAN should be egress untag. lan_info.extport_mask - which extension ports belong to this LAN. lan_info.intf_vlan_id - the default VLAN ID of this LAN. lan_info.vlan_based_pri - indicate what VLAN priority this WAN interface should carry. lan_info.vlan_based_pri_enable - indicate VLAN-based priority enable or not. lan_info.mtu - the maximum transmission unit of this LAN interface. lan_info.isIVL - how to learning layer2 record, IVL or SVL. This function should be called after rtk_rg_initParam_set and before any WAN interface creation. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM the input parameter may be NULL the input parameter contains illegal information or range RT_ERR_RG_NOT_INIT the RG module didn't init RT_ERR_RG_ENTRY_FULL the interface number is beyond predefined limitation RT_ERR_RG_MODIFY_LAN_AT_WA the LAN interface can not add after WAN interface N_EXIST exist RT_ERR_RG_PORT_USED the interface has port overlap with other interface RT_ERR_RG_ARP_FULL ARP table is not available for this new interface RT_ERR_RG_INTF_GET_FAIL RT_ERR_RG_VLAN_SET_FAIL RT_ERR_RG_INTF_SET_FAIL RT_ERR_RG_ROUTE_SET_FAIL Realtek confidential documentation 97 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.5. rtk_rg_wanInterface_add Parameters Comments int32 rtk_rg_wanInterface_add(rtk_rg_wanIntfConf_t *wanintf, int *wan_intf_idx) Add WAN interface. Defined in: rtk_rg_liteRomeDriver.h *wanintf [in] The configuration structure of WAN interface. *wan_intf_idx [out] The created new WAN interface index. wanintf.wan_type - this WAN interface type, can be Bridge mode, DHCP mode, PPPoE mode, etc. wanintf.gmac - the gateway MAC address of this WAN interface. wanintf.wan_port_idx - indicate which port this WAN interface belong to. wanintf.port_binding_mask - indicate which ports and extension ports should be bound to this WAN interface. wanintf.egress_vlan_tag_on - indicate the egress packet should carry VLAN CTAG or not. wanintf.egress_vlan_id - indicate what VLAN ID this WAN interface should carry. wanintf.vlan_based_pri_enable - indicate VLAN-based priority enable or not. wanintf.vlan_based_pri - indicate what VLAN priority this WAN interface should carry. When adding WAN interface except Bridge mode, this function should be called before each sub function like rtk_rg_staticInfo_set, rtk_rg_dhcpClientInfo_set, rtk_rg_pppoeClientInfoBeforeDial_set, and rtk_rg_pppoeClientInfoAfterDial_set. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM the input parameters may be NULL the input parameter contains illegal information or range RT_ERR_RG_NOT_INIT the RG module didn't init RT_ERR_RG_ENTRY_FULL the table is full RT_ERR_RG_DEF_ROUTE_EXIST the default internet WAN is exist RT_ERR_RG_LAN_NOT_EXIST WAN interface should be add after LAN interface created RT_ERR_RG_PON_INVALID for chip A1, the PON port can not be set as WAN port RT_ERR_RG_CHIP_NOT_SUPPORT the function is not support for the chip RT_ERR_RG_UNBIND_BDWAN_SH unbind bridge WAN can't assign VLAN id different OULD_EQUAL_LAN_VLAN than LAN interface RT_ERR_RG_BIND_WITH_UNBIND_ the global switch macBasedTagDecision didn't turn WAN on RT_ERR_RG_PORT_BIND_GET_FAI L RT_ERR_RG_ROUTE_GET_FAIL RT_ERR_RG_INTF_GET_FAIL RT_ERR_RG_INTF_SET_FAIL RT_ERR_RG_VLAN_GET_FAIL RT_ERR_RG_VLAN_SET_FAIL RT_ERR_RG_PPPOE_SET_FAIL RT_ERR_RG_NXP_SET_FAIL RT_ERR_RG_WANTYPE_SET_FAIL RT_ERR_RG_PORT_BIND_SET_FAIL 12.6. rtk_rg_staticInfo_set int32 rtk_rg_staticInfo_set(int wan_intf_idx, rtk_rg_ipStaticInfo_t *static_info) Set static mode information to the indexed WAN interface. Defined in: rtk_rg_liteRomeDriver.h 98 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide Parameters Comments wan_intf_idx [in] The interface index of previous setup for static mode. *static_info [in] The configuration related to static mode. static_info.napt_enable - indicate this WAN interface should turn on napt or not. static_info.ip_addr - the IP address of this WAN interface. static_info.ip_network_mask - the mask decides how many hosts in this WAN. static_info.default_gateway_on - indicate this WAN interface is default internet interface or not. static_info.gateway_ip_addr - indicate which gateway this WAN interface is heading to. static_info.mtu - the maximum transmission unit of this LAN interface. static_info.gw_mac_auto_learn - switch to turn on auto-ARP request for gateway MAC. static_info.gateway_mac_addr - pointer to gateway's mac if the auto_learn switch is off. The interface index should point to a valid WAN interface with matched type. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ENTRY_NOT_EXIST RT_ERR_RG_ARP_FULL RT_ERR_RG_ARP_NOT_FOUND RT_ERR_RG_GW_MAC_NOT_SET RT_ERR_RG_ENTRY_FULL RT_ERR_RG_ROUTE_GET_FAIL RT_ERR_RG_ROUTE_SET_FAIL RT_ERR_RG_EXTIP_GET_FAIL the input parameters may be NULL the input parameter contains illegal information or range the wan interface was not added before ARP table is not available for this new interface the remote gateway is not found or time gateway mac should be set for Lite RomeDriver for chip A1, the PON port can not be set as WAN port the function is not support for the chip unbind bridge WAN can't assign VLAN id different than LAN interface the global switch macBasedTagDecision didn't turn on RT_ERR_RG_EXTIP_SET_FAIL 12.7. rtk_rg_dhcpRequest_set Parameters int32 rtk_rg_dhcpRequest_set(int wan_intf_idx) Set DHCP request for the indexed WAN interface. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] The interface index of previous setup for DHCP mode. None Comments Return Codes RT_ERR_RG_OK 12.8. rtk_rg_dhcpClientInfo_set Parameters int32 rtk_rg_dhcpClientInfo_set(int wan_intf_idx, rtk_rg_ipDhcpClientInfo_t *dhcpClient_info) Set DHCP mode information to the indexed WAN interface. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] The interface index of previous setup for DHCP mode. Realtek confidential documentation 99 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments *dhcpClient_info [in] The configuration related to the interface. dhcpClient_info.hw_info - the static_info sturcture of this DHCP mode WAN interface. dhcpClient_info.status - the status of DHCP mode WAN interface as client, leased or released. The client_info contains the Hardware information which contains static mode settings, and the interface index should point to a WAN interface with matched type. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ENTRY_NOT_EXIST RT_ERR_RG_ARP_FULL RT_ERR_RG_ARP_NOT_FOUND RT_ERR_RG_GW_MAC_NOT_SET RT_ERR_RG_INTF_GET_FAIL RT_ERR_RG_ROUTE_GET_FAIL RT_ERR_RG_ENTRY_FULL RT_ERR_RG_ROUTE_SET_FAIL the input parameters may be NULL the input parameter contains illegal information or range the wan interface was not added before ARP table is not available for this new interface the remote gateway is not found or time gateway mac should be set for Lite RomeDriver for chip A1, the PON port can not be set as WAN port the function is not support for the chip unbind bridge WAN can't assign VLAN id different than LAN interface the global switch macBasedTagDecision didn't turn on RT_ERR_RG_EXTIP_GET_FAIL RT_ERR_RG_EXTIP_SET_FAIL 12.9. rtk_rg_pppoeClientInfoBeforeDial_set Parameters Comments int32 rtk_rg_pppoeClientInfoBeforeDial_set(int wan_intf_idx, rtk_rg_pppoeClientInfoBeforeDial_t *app_info) Set PPPoE mode information to the indexed WAN interface before dial. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] The interface index of previous setup for PPPoE mode. *app_info [in] The configuration related to PPPoE mode. app_info.username - saved user account information for PPPoE server. app_info.password - saved account password for PPPoE server. app_info.auth_type - indicate the PPPoE server use PAP or CHAP. app_info.pppoe_proxy_enable - indicate the proxy of PPPoE server enable or not. app_info.max_pppoe_proxy_num - how many PPPoE proxy at most. app_info.auto_reconnect - indicate that we reconnect automatically no matter what. app_info.dial_on_demond - indicate that we connect only on demand. app_info.idle_timeout_secs - indicate how long we should turn off connection after idle. app_info.stauts - indicate the status of connection. app_info.dialOnDemondCallBack - this function would be called when the interface has traffic flow. app_info.idleTimeOutCallBack - this function would be called when the interface didn't have traffic for indicated timeout period. The required account information is kept and this function should be called before rtk_rg_pppoeClientInfoAfterDial_set. The interface index should point to a WAN interface with matched type. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM Realtek confidential documentation the input parameters may be NULL the input parameter contains illegal information or range 100 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.10. rtk_rg_pppoeClientInfoAfterDial_set Parameters Comments int32 rtk_rg_pppoeClientInfoAfterDial_set(int wan_intf_idx, rtk_rg_pppoeClientInfoAfterDial_t *clientPppoe_info) Set PPPoE mode information to the indexed WAN interface after dial. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] The interface index of previous setup for PPPoE mode. *clientPppoe_info [in] The configuration related to PPPoE mode. clientPppoe_info.hw_info - the static_info sturcture of this PPPoE mode WAN interface. clientPppoe_info.sessionId - stored PPPoE session ID currently used. The client_info contains the Hardware information which contains static mode settings, and the interface index should point to a WAN interface with matched type. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ENTRY_NOT_EXIST RT_ERR_RG_ARP_FULL RT_ERR_RG_ARP_NOT_FOUND RT_ERR_RG_GW_MAC_NOT_SET RT_ERR_RG_ROUTE_GET_FAIL RT_ERR_RG_ENTRY_FULL RT_ERR_RG_ROUTE_SET_FAIL RT_ERR_RG_EXTIP_GET_FAIL the input parameters may be NULL the input parameter contains illegal information or range the wan interface was not added before ARP table is not available for this new interface the remote gateway is not found or time gateway mac should be set for Lite RomeDriver for chip A1, the PON port can not be set as WAN port the function is not support for the chip unbind bridge WAN can't assign VLAN id different than LAN interface the global switch macBasedTagDecision didn't turn on RT_ERR_RG_EXTIP_SET_FAIL 12.11. rtk_rg_interface_del Parameters int32 rtk_rg_interface_del(int lan_or_wan_intf_idx) Delete the indicated interface, may be LAN or WAN interface. Defined in: rtk_rg_liteRomeDriver.h lan_or_wan_intf_idx [in] The index of interface. Before deleting any interface, it should be created first. Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range RT_ERR_RG_MODIFY_LAN_AT_WA LAN interface should not be deleted when WAN N_EXIST interface existed RT_ERR_RG_INTF_GET_FAIL the wan interface was not added before RT_ERR_RG_ROUTE_GET_FAIL ARP table is not available for this new interface RT_ERR_RG_ROUTE_SET_FAIL the remote gateway is not found or time RT_ERR_RG_NXP_GET_FAIL gateway mac should be set for Lite RomeDriver RT_ERR_RG_PPPOE_SET_FAIL for chip A1, the PON port can not be set as WAN port RT_ERR_RG_NXP_SET_FAIL the function is not support for the chip RT_ERR_RG_ROUTE_SET_FAIL unbind bridge WAN can't assign VLAN id different than LAN interface RT_ERR_RG_EXTIP_GET_FAIL the global switch macBasedTagDecision didn't turn on Realtek confidential documentation 101 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_EXTIP_SET_FAIL RT_ERR_RG_WANTYPE_GET_FAIL RT_ERR_RG_WANTYPE_SET_FAIL RT_ERR_RG_INTF_SET_FAIL RT_ERR_RG_PORT_BIND_GET_FAI L RT_ERR_RG_PORT_BIND_SET_FAIL 12.12. rtk_rg_intfInfo_find Parameters Comments int32 rtk_rg_intfInfo_find(rtk_rg_intfInfo_t *intf_info, int *valid_lan_or_wan_intf_idx) Return the information structure of interface, eithor LAN or WAN. Defined in: rtk_rg_liteRomeDriver.h *intf_info [in] An empty buffer for storing the structure. [out] Returned valid interface information structure, eithor LAN or Wint *valid_lan_or_wan_intf_idx [in] The index of interface to find. [out] Return the index of the valid record. intf_info.intf_name - the name of found interface. intf_info.is_wan - indicate this interface is WAN interface or LAN interface. intf_info.lan_intf - if is_wan is 0, this structure contain all information about the LAN interface. intf_info.wan_intf - if is_wan is 1, this structure contain all information about the WAN interface. intf_info.ingress_packet_count - the count of how many packet had passed into this interface. intf_info.ingress_byte_count - the count of how many data had passed into this interface in bytes. intf_info.egress_packet_count - the count of how many packet had passed through this interface out. intf_info.egress_byte_count - the count of how many data had passed through this interface out in bytes. If the input idx interface is not exist, it will auto incress to next index, until return a valid one or meet end. Besides, if the input idx is -1, intf_info.lan_intf.ip_addr or intf_info.lan_intf.ipv6_addr is given, the matching interface information and it's index will be return. Bridge WAN interface could not be found through this mode. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ENTRY_NOT_EXIST the input parameters may be NULL the input parameter contains illegal information or range the wan interface was not added before 12.13. rtk_rg_cvlan_add Parameters int32 rtk_rg_cvlan_add(rtk_rg_cvlan_info_t *cvlan_info) Add customer VLAN setting. Defined in: rtk_rg_liteRomeDriver.h *cvlan_info Realtek confidential documentation 102 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments [in] The VLAN configuration. cvlan_info.vlanId - which VLAN identifier need to create, between 0 and 4095. cvlan_info.isIVL - how to learning layer2 record, by SVL or by IVL setting. cvlan_info.memberPortMask - which port contained in this VLAN identifier. cvlan_info.untagPortMask - which port contained in this VLAN identifier should be untag. cvlan_info.vlan_based_pri_enable - indicate VLAN-based priority enable or not. cvlan_info.vlan_based_pri - indicate what VLAN priority this VLAN should carry. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM RT_ERR_RG_NOT_INIT the input parameters may be NULL the input parameter contains illegal information or range RT_ERR_RG_VLAN_USED_BY_INTE the prefered VLAN ID had been used as interface RFACE VLAN ID RT_ERR_RG_VLAN_USED_BY_VLA the prefered VLAN ID had been used as VLAN NBINDING RT_ERR_RG_CVLAN_CREATED the VLAN ID had been created as customer VLAN before RT_ERR_RG_CVLAN_RESERVED the VLAN ID is reserved for system use RT_ERR_RG_VLAN_SET_FAIL for chip A1, the PON port can not be set as WAN port 12.14. rtk_rg_cvlan_del Parameters Comments int32 rtk_rg_cvlan_del(int cvlan_id) Delete customer VLAN setting. Defined in: rtk_rg_liteRomeDriver.h cvlan_id [in] The VLAN identifier needed to be deleted. Here can not delete VLAN identifier used for interface or VLAN binding. Only the VLAN identifier created by rtk_rg_1qVlan_add can be deleted this way. Return Codes RT_ERR_RG_OK RT_ERR_RG_VLAN_NOT_CREATED the deleting VLAN ID was not added as customer _BY_CVLAN VLAN ID 12.15. rtk_rg_vlanBinding_add Parameters Comments int32 rtk_rg_vlanBinding_add(rtk_rg_vlanBinding_t *vlan_binding_info, int *vlan_binding_idx) Add Port-VLAN binding rule. Defined in: rtk_rg_liteRomeDriver.h *vlan_binding_info [in] The VLAN binding configuration about port index, interface, and VLAN ID *vlan_binding_idx [out] The index of added VLAN binding rule. vlan_binding_idx.port_idx - each VLAN binding rule can only assign one single port or extension port (not CPU port). vlan_binding_idx.ingress_vid - the VLAN ID used to compare for binding. vlan_binding_idx.wan_intf_idx - which WAN interface the matched packet should go. The VLAN-binding rule can add only after the binding WAN interface is created at first. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Realtek confidential documentation the input parameters may be NULL 103 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range RT_ERR_RG_NOT_INIT the RG module is not init RT_ERR_RG_ENTRY_FULL the prefered VLAN ID had been used as VLAN RT_ERR_RG_VLAN_USED_BY_INTE the VLAN id can't used by interface RFACE RT_ERR_RG_VLAN_USED_BY_1QV the VLAN id can't used by 1QVLAN api LAN RT_ERR_RG_BIND_WITH_UNBIND_ the global switch macBasedTagDecision didn't turn WAN on 12.16. rtk_rg_vlanBinding_del Parameters int32 rtk_rg_vlanBinding_del(int vlan_binding_idx) Delete Port-VLAN binding rule. Defined in: rtk_rg_liteRomeDriver.h vlan_binding_idx [in] The index of VLAN binding rule. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_VLAN_BIND_UNINIT the input parameters may be NULL the input parameter contains illegal information or range there is no vlan 12.17. rtk_rg_vlanBinding_find Parameters Comments int32 rtk_rg_vlanBinding_find(rtk_rg_vlanBinding_t *vlan_binding_info, int *valid_idx) Find Port-VLAN binding rule if any. Defined in: rtk_rg_liteRomeDriver.h *vlan_binding_info [in] The binding configuration of port and VLAN ID. *valid_idx [in] The index of the VLAN binding entry. [out] The index of first valid VLAN binding entry. If the input parameter do not point to a valid record, it will continue to look for next valid one until end, and return the valid index by the passed input pointer. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_VLAN_BIND_UNINIT the input parameters may be NULL the input parameter contains illegal information or range there is no vlan 12.18. rtk_rg_algServerInLanAppsIpAddr_add int32 rtk_rg_algServerInLanAppsIpAddr_add(rtk_rg_alg_serverIpMapping_t *srvIpMapping) Add ServerInLan ALG function IP mapping. Defined in: rtk_rg_liteRomeDriver.h Realtek confidential documentation 104 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Parameters Comments *srvIpMapping [in] The mapping of bitmask of ALG ServerInLan functions and server IP address. srvIpMapping.algType - indicate which ALG service should assign to the serverAddress. srvIpMapping.serverAddress - indicate the server IP address. Before call rtk_rg_algApps_set to setup Server In Lan service, this IP mapping should be enter at first, otherwise rtk_rg_algApps_set will return failure. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM the input parameters may be NULL RT_ERR_RG_ALG_SRV_IN_LAN_EX the server ip address had been assigned IST 12.19. rtk_rg_algServerInLanAppsIpAddr_del Parameters int32 rtk_rg_algServerInLanAppsIpAddr_del(rtk_rg_alg_type_t delServerMapping) Delete ServerInLan ALG function IP mapping. Defined in: rtk_rg_liteRomeDriver.h delServerMapping [in] Delete the server IP address mapping. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM the input parameters may be NULL 12.20. rtk_rg_algApps_set Parameters Comments int32 rtk_rg_algApps_set(rtk_rg_alg_type_t alg_app) Set ALG functions by bitmask. Defined in: rtk_rg_liteRomeDriver.h alg_app [in] The bitmask setting for all ALG functions. Althrough the bitmask list all ALG functions here, the implemented functions depend on romeDriver's version. Please refer user document. Return Codes RT_ERR_RG_OK RT_ERR_RG_ALG_SRV_IN_LAN_NO before turn on Server In Lan services, the server ip _IP has to be added by rtk_rg_algServerInLanAppsIpAddr_add 12.21. rtk_rg_algApps_get Parameters Comments int32 rtk_rg_algApps_get(rtk_rg_alg_type_t *alg_app) Get ALG functions by bitmask. Defined in: rtk_rg_liteRomeDriver.h *alg_app [out] Return the bitmask setting for ALG functions. Althrough the bitmask list all ALG functions here, the implemented functions depend on romeDriver's version. Please refer user document. Return Codes RT_ERR_RG_OK Realtek confidential documentation 105 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.22. rtk_rg_dmzHost_set Parameters Comments int32 rtk_rg_dmzHost_set(int wan_intf_idx, rtk_rg_dmzInfo_t *dmz_info) Add DMZ connection rule. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] the DMZ enabled wan interface index. *dmz_info [in] the DMZ setting. dmz_info->enabled - Enable/disable DMZ rule. dmz_info->mac_mapping_enabled - The DMZ rule is using MAC mapping or not. dmz_info->private_ip - The redirected DMZ internal host IP. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range 12.23. rtk_rg_dmzHost_get Parameters Comments int32 rtk_rg_dmzHost_get(int wan_intf_idx, rtk_rg_dmzInfo_t *dmz_info) Get configured DMZ rule. Defined in: rtk_rg_liteRomeDriver.h wan_intf_idx [in] the DMZ enabled wan interface index. *dmz_info [in] the DMZ rule setting. dmz_info->enabled - Enable/disable DMZ rule. dmz_info->mac_mapping_enabled - The DMZ rule is using MAC mapping or not. dmz_info->private_ip - The redirected DMZ internal host IP. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range 12.24. rtk_rg_virtualServer_add int32 rtk_rg_virtualServer_add(rtk_rg_virtualServer_t *virtual_server, int *virtual_server_idx) Add virtual server connection rule. Defined in: rtk_rg_liteRomeDriver.h *virtual_server Parameters [in] the svirtual server data structure. *virtual_server_idx [in] the index of virtual server table. virtual_server.is_tcp - Layer 4 protocol is TCP or not. Comments virtual_server.wan_intf_idx - Wan interface index of server. virtual_server.gateway_port_start - Gateway external port mapping start number. 106 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide virtual_server.local_ip - The translating local IP address. virtual_server.local_port_start - The translating internal port mapping start number. virtual_server.mappingRangeCnt - The port mapping range count. virtual_server.valid - This entry is valid or not. Return Codes RT_ERR_RG_OK RT_ERR_RG_INITPM_UNINIT RT_ERR_RG_ENTRY_FULL the virtual server table uninitialized. the virtual server table is full. 12.25. rtk_rg_virtualServer_del Parameters int32 rtk_rg_virtualServer_del(int virtual_server_idx) Delete one server port connection rule. Defined in: rtk_rg_liteRomeDriver.h virtual_server_idx [in] the index of virtual server entry for deleting. None. Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM illegal server port rule index. 12.26. rtk_rg_virtualServer_find Parameters Comments int32 rtk_rg_virtualServer_find(rtk_rg_virtualServer_t *virtual_server, int *valid_idx) Find entire virtual server table from valid_idx till valid one. Defined in: rtk_rg_liteRomeDriver.h *virtual_server [in] An empty buffer for storing the virtual server entry data structure. [out] The data structure of found virtual sint *valid_idx [in] The index which find from. [out] The existing entry index. virtual_server.is_tcp - Layer 4 protocol is TCP or not. virtual_server.wan_intf_idx - Wan interface index of server. virtual_server.gateway_port_start - Gateway external port mapping start number. virtual_server.local_ip - The translating local IP address. virtual_server.local_port_start - The translating internal port mapping start number. virtual_server.mappingRangeCnt - The port mapping range count. virtual_server.valid - This entry is valid or not. Return Codes RT_ERR_RG_OK RT_ERR_RG_INITPM_UNINIT RT_ERR_RG_SVRPORT_SW_ENTRY _NOT_FOUND the virtual server table uninitialized. can't find entry in virtual server table. 12.27. rtk_rg_aclFilterAndQos_add int32 rtk_rg_aclFilterAndQos_add(rtk_rg_aclFilterAndQos_t *acl_filter, int *acl_filter_idx) 107 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide Parameters Comments Add acl rule. Defined in: rtk_rg_liteRomeDriver.h *acl_filter [in] assign the patterns which need to be filtered, and assign the related action(include drop, permit, Qos, and Trap to CPUint *acl_filter_idx [out] the index of the added acl rule. acl_filter.filter_fields - use to enable the filtered patterns. Each pattern bit should be "or" together. acl_filter.ingress_port_mask - assign the packet ingress physical port pattern(valid when INGRESS_PORT_BIT is enable) acl_filter.ingress_dscp - assign the packet ingress dscp(valid when INGRESS_DSCP_BIT is enable) acl_filter.ingress_intf_idx - assign the packet ingress interface index(valid when INGRESS_INTF_BIT is enable) acl_filter.egress_intf_idx - assign the packet egress interface index(valid when EGRESS_INTF_BIT is enable) acl_filter.ingress_ethertype - assign the packet ingress ethertype pattern(valid when INGRESS_ETHERTYPE_BIT is enable) acl_filter.ingress_ctag_vid - assign the packet ingress vlan id pattern(valid when INGRESS_CTAG_VID_BIT is enable) acl_filter.ingress_ctag_pri - assign the packet ingress vlan priority pattern(valid when INGRESS_CTAG_PRI_BIT is enable) acl_filter.ingress_smac - assign the packet ingress source mac pattern(valid when INGRESS_SMAC_BIT is enable) acl_filter.ingress_dmac - assign the packet ingress destination mac pattern(valid when INGRESS_DMAC_BIT is enable) acl_filter.ingress_src_ipv4_addr_start - assign the packet ingress source ipv4 lower bound(valid when INGRESS_IPV4_SIP_RANGE_BIT is enable) acl_filter.ingress_src_ipv4_addr_end - assign the packet ingress source ipv4 upper bound(valid when INGRESS_IPV4_SIP_RANGE_BIT is enable) acl_filter.ingress_dest_ipv4_addr_start - assign the packet ingress destination ipv4 lower bound(valid when INGRESS_IPV4_DIP_RANGE_BIT is enable) acl_filter.ingress_dest_ipv4_addr_end - assign the packet ingress destination ipv4 upper bound(valid when INGRESS_IPV4_DIP_RANGE_BIT is enable) acl_filter.ingress_src_ipv6_addr_start - assign the packet ingress source ipv6 lower bound(valid when INGRESS_IPV6_SIP_RANGE_BIT is enable) acl_filter.ingress_src_ipv6_addr_end - assign the packet ingress source ipv6 upper bound(valid when INGRESS_IPV6_SIP_RANGE_BIT is enable) acl_filter.ingress_dest_ipv6_addr_start - assign the packet ingress destination ipv6 lower bound(valid when INGRESS_IPV6_DIP_RANGE_BIT is enable) acl_filter.ingress_dest_ipv6_addr_end - assign the packet ingress destination ipv6 upper bound(valid when INGRESS_IPV6_DIP_RANGE_BIT is enable) acl_filter.ingress_src_l4_port_start - assign the packet ingress layer4 source port lower bound(valid when INGRESS_L4_SPORT_RANGE_BIT is enable) acl_filter.ingress_src_l4_port_end - assign the packet ingress layer4 source port upper bound(valid when INGRESS_L4_SPORT_RANGE_BIT is enable) acl_filter.ingress_dest_l4_port_start - assign the packet ingress layer4 destination port lower bound(valid when INGRESS_L4_DPORT_RANGE_BIT is enable) acl_filter.ingress_dest_l4_port_end - assign the packet ingress layer4 destination port upper bound(valid when INGRESS_L4_DPORT_RANGE_BIT is enable) acl_filter.egress_src_ipv4_addr_start - assign the packet egress source ipv4 lower bound(valid when EGRESS_IPV4_SIP_RANGE_BIT is enable) acl_filter.egress_src_ipv4_addr_end - assign the packet egress source ipv4 upper bound(valid when EGRESS_IPV4_SIP_RANGE_BIT is enable) acl_filter.egress_dest_ipv4_addr_start - assign the packet egress destination ipv4 lower Realtek confidential documentation 108 Rev 1.1.2 Realtek RG RomeDriver Programming Guide bound(valid when EGRESS_IPV4_DIP_RANGE_BIT is enable) acl_filter.egress_dest_ipv4_addr_end - assign the packet egress destination ipv4 pattern(upper bound)(valid when EGRESS_IPV4_DIP_RANGE_BIT is enable) acl_filter.egress_src_l4_port_start - assign the packet egress layer4 source port lower bound(valid when EGRESS_L4_SPORT_RANGE_BIT is enable) acl_filter.egress_src_l4_port_end - assign the packet egress layer4 source port upper bound(valid when EGRESS_L4_SPORT_RANGE_BIT is enable) acl_filter.egress_dest_l4_port_start - assign the packet egress layer4 destination port lower bound(valid when EGRESS_L4_DPORT_RANGE_BIT is enable) acl_filter.egress_dest_l4_port_end - assign the packet egress layer4 destination port upper bound(valid when EGRESS_L4_DPORT_RANGE_BIT is enable) acl_filter.action_type - assign the action to the packets which satisfy the assgned patterns acl_filter.qos_actions - assign the qos action. Each action bit should be "or" together (triggered while action_type==ACL_ACTION_TYPE_QOS) acl_filter.action_dot1p_remarking_pri - assign the vlan priority value for remarking(vlaid when while ACL_ACTION_1P_REMARKING_BIT is enable) acl_filter.action_ip_precedence_remarking_pri - assign the ip precedence value for remarking(vlaid when ACL_ACTION_IP_PRECEDENCE_REMARKING_BIT is enable) acl_filter.action_dscp_remarking_pri - assign the dscp value for remarking(vlaid when ACL_ACTION_DSCP_REMARKING_BIT is enable) acl_filter.action_queue_id - assign the qid(vlaid when ACL_ACTION_QUEUE_ID_BIT is enable) acl_filter.action_share_meter - assign the sharemeter(vlaid when ACL_ACTION_SHARE_METER_BIT is enable) Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ACL_CF_FIELD_CONF LICT RT_ERR_RG_ACL_CF_FLOW_DIREC TION_ERROR RT_ERR_RG_ACL_ENTRY_FULL RT_ERR_RG_ACL_ENTRY_ACCESS _FAILED RT_ERR_RG_ACL_IPTABLE_FULL the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameters may be NULL the input parameter contains illegal information or range acl_filter assigned some conflict patterns the assigned ingress interface and egress interface are not upstream or downstream the hardware ACL asic entry is full access the hardware ACL asic entry failed the hardware asic ACL IP_RANGE_TABLE entry is full RT_ERR_RG_ACL_IPTABLE_ACCES access the hardware asic ACL IP_RANGE_TABLE S_FAILED entry failed RT_ERR_RG_ACL_PORTTABLE_FU the hardware asic ACL PORT_RANGE_TABLE LL entry is full RT_ERR_RG_ACL_PORTTABLE_AC access the hardware ACL asic CESS_FAILED PORT_RANGE_TABLE entry failed RT_ERR_RG_CF_ENTRY_FULL the hardware Classification asic entry is full RT_ERR_RG_CF_ENTRY_ACCESS_F access the hardware Classification asic entry failed AILED RT_ERR_RG_CF_IPTABLE_FULL the hardware Classification asic IP_RANGE_TABLE entry is full RT_ERR_RG_CF_IPTABLE_ACCESS access the hardware Classification asic _FAILED IP_RANGE_TABLE entry failed RT_ERR_RG_CF_PORTTABLE_FULL the hardware Classification PORT_RANGE_TABLE asic entry is full RT_ERR_RG_CF_PORTTABLE_ACC access the hardware Classification asic ESS_FAILED PORT_RANGE_TABLE entry failed RT_ERR_RG_CF_DSCPTABLE_FULL the hardware Classification DSCP_REMARKING_TABLE asic entry is full RT_ERR_RG_CF_DSCPTABLE_ACC access the hardware Classification asic ESS_FAILED DSCP_REMARKING_TABLE entry failed RT_ERR_RG_ACL_SW_ENTRY_FUL the software ACL entry is full Realtek confidential documentation 109 Rev 1.1.2 Realtek RG RomeDriver Programming Guide L RT_ERR_RG_ACL_SW_ENTRY_ACC access the software ACL entry failed ESS_FAILED 12.28. rtk_rg_aclFilterAndQos_del Parameters int32 rtk_rg_aclFilterAndQos_del(int acl_filter_idx) Delete acl rule. Defined in: rtk_rg_liteRomeDriver.h acl_filter_idx [in] the index of the acl rule which need to be delete None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ACL_ENTRY_ACCESS _FAILED RT_ERR_RG_ACL_IPTABLE_ACCES S_FAILED RT_ERR_RG_ACL_PORTTABLE_AC CESS_FAILED RT_ERR_RG_CF_ENTRY_ACCESS_F AILED RT_ERR_RG_CF_IPTABLE_ACCESS _FAILED RT_ERR_RG_CF_PORTTABLE_ACC ESS_FAILED RT_ERR_RG_CF_DSCPTABLE_ACC ESS_FAILED RT_ERR_RG_ACL_SW_ENTRY_ACC ESS_FAILED the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameter contains illegal information or range access the hardware ACL asic entry failed access the hardware asic ACL IP_RANGE_TABLE entry failed access the hardware ACL asic PORT_RANGE_TABLE entry failed access the hardware Classification asic entry failed access the hardware Classification asic IP_RANGE_TABLE entry failed access the hardware Classification asic PORT_RANGE_TABLE entry failed access the hardware Classification asic DSCP_REMARKING_TABLE entry failed access the software ACL entry failed 12.29. rtk_rg_aclFilterAndQos_find Parameters Comments int32 rtk_rg_aclFilterAndQos_find(rtk_rg_aclFilterAndQos_t *acl_filter, int *valid_idx) fine acl rule. Defined in: rtk_rg_liteRomeDriver.h *acl_filter the index of the acl rule which start to search *valid_idx [out] the acl rule which be found this API search the software acl entry start from acl_filter_idx, and find the first exist acl entry. If all entry after the acl_filter_idx are empty, it will return RT_ERR_RG_ACL_SW_ENTRY_NOT_FOUND Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT the rg has not been init. (rtk_rg_initParam_set() should be called first) RT_ERR_RG_NULL_POINTER the input parameters may be NULL RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range RT_ERR_RG_ACL_SW_ENTRY_ACC access the software ACL entry failed ESS_FAILED Realtek confidential documentation 110 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_ACL_SW_ENTRY_NOT _FOUND can not find the assigned ACL entry 12.30. rtk_rg_macFilter_add Parameters int32 rtk_rg_macFilter_add(rtk_rg_macFilterEntry_t *macFilterEntry, int *mac_filter_idx) add mac filter rule Defined in: rtk_rg_liteRomeDriver.h *macFilterEntry [in] the mac address which need to be add to mac filter rule. *mac_filter_idx [in] the mac address which shouuld be filter in SMAC, DMAC, or BOTH. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameters may be NULL the input parameter contains illegal information or range 12.31. rtk_rg_macFilter_del Parameters int32 rtk_rg_macFilter_del(int mac_filter_idx) delete mac filter rule Defined in: rtk_rg_liteRomeDriver.h mac_filter_idx [in] the index of the mac filter rule which need to be deleted. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameter contains illegal information or range 12.32. rtk_rg_macFilter_find Parameters int32 rtk_rg_macFilter_find(rtk_rg_macFilterEntry_t *macFilterEntry, int *valid_idx) find mac filter rule Defined in: rtk_rg_liteRomeDriver.h *macFilterEntry [out] the mac address which be found. *valid_idx [out] filter for SMAC, DMAC, or BOTH. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER Realtek confidential documentation the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameters may be NULL 111 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_INVALID_PARAM the input parameter contains illegal information or range 12.33. rtk_rg_urlFilterString_add Parameters Comments int32 rtk_rg_urlFilterString_add(rtk_rg_urlFilterString_t *filter, int *url_idx) add url filter rule Defined in: rtk_rg_liteRomeDriver.h *filter [in] the url rule which need to be added to url filter rule. *url_idx [out] the index of added url filter rule. filter.url_filter_string - the string which need to be filtered in url string.(ex: in url "http://www.sample.com/explain", "www.sample.com" is the url string) filter.path_filter_string - the string which need to be filtered in url path string.(ex: in url "http://www.sample.com/explain", "/explain" is the url path string) filter.path_exactly_match - the urlFilter will execute even the path_filter_string is part of url path string while path_exactly_match is 0. Else, the path_filter_string must exactly match the url path string to trigger urlFilter execution. filter.wan_intf - the index of the wan interface which should limited by this urlFilter. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameters may be NULL the input parameter contains illegal information or range 12.34. rtk_rg_urlFilterString_del Parameters int32 rtk_rg_urlFilterString_del(int url_idx) delete url filter rule Defined in: rtk_rg_liteRomeDriver.h url_idx [in] the index of the url filter rule which need to be deleted. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameter contains illegal information or range 12.35. rtk_rg_urlFilterString_find Parameters int32 rtk_rg_urlFilterString_find(rtk_rg_urlFilterString_t *filter, int *valid_idx) find url filter rule Defined in: rtk_rg_liteRomeDriver.h *filter [out] the url filter rule which be found. Realtek confidential documentation 112 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments *valid_idx [in] the index fo url filter rule which start to search. [out] the index of found url filter rule. filter.url_filter_string - the string which need to be filtered in url string.(ex: in url "http://www.sample.com/explain", "www.sample.com" is the url string) filter.path_filter_string - the string which need to be filtered in url path string.(ex: in url "http://www.sample.com/explain", "/explain" is the url path string) filter.path_exactly_match - the urlFilter will execute even the path_filter_string is part of url path string while path_exactly_match is 0. Else, the path_filter_string must exactly match the url path string to trigger urlFilter execution. filter.wan_intf - the index of the wan interface which should be limited by this urlFilter. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM the rg has not been init. (rtk_rg_initParam_set() should be called first) the input parameters may be NULL the input parameter contains illegal information or range 12.36. rtk_rg_upnpConnection_add Parameters Comments int32 rtk_rg_upnpConnection_add(rtk_rg_upnpConnection_t *upnp, int *upnp_idx) Add UPNP connection rule. Defined in: rtk_rg_liteRomeDriver.h *upnp [in] the UPNP connection data structure. *upnp_idx [in] the index of UPNP table. upnp.is_tcp - Layer 4 protocol is TCP or not. upnp.valid - The UNPN mapping is valid or not. upnp.wan_intf_idx - Wan interface index. upnp.gateway_port - Gateway external port number. upnp.local_ip - Internal ip address. upnp.local_port - Internal port number. upnp.limit_remote_ip - The Restricted remote IP address. upnp.limit_remote_port - The Restricted remote port number. upnp.remote_ip - Remote IP address. upnp.type - One shot or persist. upnp.timeout - timeout value for auto-delete. Set 0 to disable auto-delete. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INITPM_UNINIT RT_ERR_RG_ENTRY_FULL the rg has not been init. (rtk_rg_initParam_set() should be called first) the UPNP table uninitialized. the UPNP mapping table is full. 12.37. rtk_rg_upnpConnection_del Parameters Comments int32 rtk_rg_upnpConnection_del(int upnp_idx) Delete UPNP connection rule. Defined in: rtk_rg_liteRomeDriver.h upnp_idx [in] the index of UPNP table entry to be deleted. None. Realtek confidential documentation 113 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM illegal UPNP rule index. 12.38. rtk_rg_upnpConnection_find Parameters Comments int32 rtk_rg_upnpConnection_find(rtk_rg_upnpConnection_t *upnp, int *valid_idx) Find entire UPNP mapping table from upnp_idx till valid one. Defined in: rtk_rg_liteRomeDriver.h *upnp [in] An empty buffer for storing the UPNP mapping entry data structure. [out] The data structure of found UPNP mappinint *valid_idx [in] The index which find from. [out] The existing entry index. upnp.is_tcp - Layer 4 protocol is TCP or not. upnp.valid - The UNPN mapping is valid or not. upnp.wan_intf_idx - Wan interface index. upnp.gateway_port - Gateway external port number. upnp.local_ip - Internal ip address. upnp.local_port - Internal port number. upnp.limit_remote_ip - The Restricted remote IP address. upnp.limit_remote_port - The Restricted remote port number. upnp.remote_ip - Remote IP address. upnp.type - One shot or persist. upnp.timeout - timeout value for auto-delete. Set 0 to disable auto-delete. The condition fields will be ignore while it was set to zero. Return Codes RT_ERR_RG_OK RT_ERR_RG_INITPM_UNINIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_UPNP_SW_ENTRY_NO T_FOUND the UPNP table uninitialized. the input parameters may be NULL can't find entry in UPNP mapping table. 12.39. rtk_rg_naptConnection_add Parameters Comments int32 rtk_rg_naptConnection_add(rtk_rg_naptEntry_t *naptFlow, int *flow_idx) Add NAPT connection flow. Defined in: rtk_rg_liteRomeDriver.h *naptFlow [in] the NAPT connection flow data structure. *flow_idx [out] the NAPT flow index. naptFlow.is_tcp - Layer 4 protocol is TCP or not. naptFlow.local_ip - Internal IP address. naptFlow.remote_ip - Remote IP address. naptFlow.wan_intf_idx - Wan interface index. naptFlow.local_port - Internal port number. naptFlow.remote_port - Remote port number. naptFlow.external_port - Gateway external port number. naptFlow.pri_valid - NAPT priority remarking enable. naptFlow.priority - NAPT priority remarking value. Return Codes RT_ERR_RG_OK Realtek confidential documentation 114 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM RT_ERR_RG_EXTIP_GET_FAIL RT_ERR_RG_NAPT_FLOW_DUPLIC ATE RT_ERR_RG_NAPTR_OVERFLOW RT_ERR_RG_NAPT_OVERFLOW RT_ERR_RG_NAPTR_SET_FAIL RT_ERR_RG_NAPT_SET_FAIL system is not initiated. illegal NAPT connection flow index. illegal wan_intf_idx. duplicate NAPT flow. NAPTR table collision. NAPT table collision. write to NAPTR table failed. write to NAPT table failed. 12.40. rtk_rg_naptConnection_del Parameters int32 rtk_rg_naptConnection_del(int flow_idx) Delete NAPT connection flow. Defined in: rtk_rg_liteRomeDriver.h flow_idx [in] The index of NAPT connection flow table. None. Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT system is not initiated. RT_ERR_RG_INVALID_PARAM illegal NAPT connection flow index. RT_ERR_RG_NAPT_SW_ENTRY_NO the NAPT entry can not be found. T_FOUND RT_ERR_RG_NAPTR_SET_FAIL write to NAPTR table failed. RT_ERR_RG_NAPT_SET_FAIL write to NAPT table failed. 12.41. rtk_rg_naptConnection_find Parameters Comments int32 rtk_rg_naptConnection_find(rtk_rg_naptInfo_t *naptInfo, int *valid_idx) Find entire NAPT table from index valid_idx till valid one. Defined in: rtk_rg_liteRomeDriver.h *naptInfo [in] An empty buffer for storing the NAPT entry data structure. [out] The data structure of found NAPT entry. *valid_idx [in] The index which find from. [out] The existing entry index. naptInfo.is_tcp - Layer 4 protocol is TCP or not. naptInfo.local_ip - Internal IP address. naptInfo.remote_ip - Remote IP address. naptInfo.wan_intf_idx - Wan interface index. naptInfo.local_port - Internal port number. naptInfo.remote_port - Remote port number. naptInfo.external_port - Gateway external port number. naptInfo.pri_valid - NAPT priority remarking enable. naptInfo.priority - NAPT priority remarking value. naptInfo.idleSecs - NAPT flow idle seconds. naptInfo.state - NAPT connection state, 0:INVALID 1:SYN_RECV 2:SYN_ACK_RECV 3:CONNECTED 4:FIN_RECV 5:RST_RECV Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT Realtek confidential documentation system is not initiated. 115 Rev 1.1.2 Realtek RG RomeDriver Programming Guide RT_ERR_RG_INVALID_PARAM illegal NAPT connection flow index. RT_ERR_RG_NAPT_SW_ENTRY_NO the NAPT entry can not be found. T_FOUND 12.42. rtk_rg_multicastFlow_add Parameters Comments int32 rtk_rg_multicastFlow_add(rtk_rg_multicastFlow_t *mcFlow, int *flow_idx) Add a Multicast flow entry into ASIC. Defined in: rtk_rg_liteRomeDriver.h *mcFlow [in] Multicast flow entry content structure. *flow_idx [out] Returned Multicast flow index. mcFlow.multicast_ipv4_addr - The destination IP address of packet, it must be class D address. mcFlow.port_mask - This MC packet will forward to those MAC ports. mcFlow.ext_port_mask - This MC packet will forward to those Extension ports. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM RT_ERR_RG_ENTRY_FULL RT_ERR_FAILED RT_ERR_NOT_INIT RT_ERR_IPV4_ADDRESS RT_ERR_VLAN_VID RT_ERR_NULL_POINTER RT_ERR_INPUT Success System is not initiated. The params is not accpeted. The MC entry is full. failed The module is not initial Invalid IPv4 address invalid vlan id input parameter may be null pointer invalid input parameter access the software ACL entry failed 12.43. rtk_rg_multicastFlow_del Parameters int32 rtk_rg_multicastFlow_del(int flow_idx) Delete an Multicast flow ASIC entry. Defined in: rtk_rg_liteRomeDriver.h flow_idx [in] The Multicast flow entry index for deleting. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_ENTRY_NOT_EXIST RT_ERR_FAILED RT_ERR_L2_EMPTY_ENTRY RT_ERR_INPUT RT_ERR_L2_HASH_KEY RT_ERR_L2_EMPTY_ENTRY Success system is not initiated. the index out of range. the index is not exist. failed Empty LUT entry. Invalid input parameters. invalid L2 Hash key the entry is empty(invalid) 12.44. rtk_rg_multicastFlow_find int32 rtk_rg_multicastFlow_find(rtk_rg_multicastFlow_t *mcFlow, int *valid_idx) 116 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide Parameters Find an exist Multicast flow ASIC entry. Defined in: rtk_rg_liteRomeDriver.h *mcFlow [in] An empty buffer for storing the structure. [out] An exist entry structure which index is valid_idx. *valid_idx [in] The index which find from. [out] The exist entry index. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_NO_MORE_ENTRY_FO UND RT_ERR_FAILED RT_ERR_L2_EMPTY_ENTRY RT_ERR_INPUT Success system is not initiated. the index out of range. no more exist entry is found. failed Empty LUT entry. Invalid input parameters. 12.45. rtk_rg_macEntry_add Parameters Comments int32 rtk_rg_macEntry_add(rtk_rg_macEntry_t *macEntry, int *entry_idx) Add a MAC Entry into ASIC Defined in: rtk_rg_liteRomeDriver.h *macEntry [in] MAC entry content structure. *entry_idx [out] this MAC entry index. macEntry.mac - The MAC address. macEntry.isIVL - The MAC is for IVL or SVL. macEntry.fid - The fid, only used in SVL. macEntry.vlan_id - The VLAN id. macEntry.port_idx - The port index,0~5 for phy. port, 6 for CPU port, 7~11 for ext. port. macEntry.arp_used - The entry is used for NAT/NAPT. macEntry.static_entry - The MAC is static or not. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT Success system is not initiated. 12.46. rtk_rg_macEntry_del Parameters int32 rtk_rg_macEntry_del(int entry_idx) Delete an ASIC MAC Entry. Defined in: rtk_rg_liteRomeDriver.h entry_idx [in] The MAC entry index for deleting. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_ENTRY_NOT_EXIST Realtek confidential documentation Success system is not initiated. the index out of range. the index is not exist. 117 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.47. rtk_rg_macEntry_find Parameters Comments int32 rtk_rg_macEntry_find(rtk_rg_macEntry_t *macEntry, int *valid_idx) Find an exist ASIC MAC Entry. Defined in: rtk_rg_liteRomeDriver.h *macEntry [in] An empty buffer for storing the MAC entry data structure. [out] The data structure of found MAC entry. *valid_idx [in] The index which find from. [out] The existing entry index. macEntry.mac - The MAC address. macEntry.isIVL - The MAC is for IVL or SVL. macEntry.fid - The fid, only used in SVL. macEntry.vlan_id - The VLAN id. macEntry.port_idx - The port index,0~5 for phy. port, 6 for CPU port, 7~11 for ext. port. macEntry.arp_used - The entry is used for NAT/NAPT. macEntry.static_entry - The MAC is static or not. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_NO_MORE_ENTRY_FO UND RT_ERR_RG_NULL_POINTER Success system is not initiated. the index out of range. no more exist entry is found. Input parameter is NULL pointer. 12.48. rtk_rg_arpEntry_add Parameters Comments int32 rtk_rg_arpEntry_add(rtk_rg_arpEntry_t *arpEntry, int *arp_entry_idx) Add an ARP Entry into ASIC Defined in: rtk_rg_liteRomeDriver.h *arpEntry [in] Fill rtk_rg_arpEntry_t each fields for adding. *arp_entry_idx [out] Return ARP entry index. arpEntry.macEntryIdx - this MAC entry index of this ARP entry. arpEntry.ipv4Addr - the IPv4 IP address of this ARP entry. arpEntry.static_entry - this entry is static ARP, and it will never age out. If the arpEntry.static_entry is set. The MAC entry must set static, too. Return Codes RT_ERR_RG_OK Success system is not initiated. the input parameter contains illegal information. L2 entry not found. Realtek confidential documentation 118 RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM RT_ERR_RG_L2_ENTRY_NOT_FOU ND Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.49. rtk_rg_arpEntry_del Parameters int32 rtk_rg_arpEntry_del(int arp_entry_idx) Delete an ASIC ARP Entry. Defined in: rtk_rg_liteRomeDriver.h arp_entry_idx [out] The ARP entry index for deleting. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_ENTRY_NOT_EXIST Success system is not initiated. the index out of range. the index is not exist. 12.50. rtk_rg_arpEntry_find Parameters Comments int32 rtk_rg_arpEntry_find(rtk_rg_arpInfo_t *arpInfo, int *arp_valid_idx) Find the entire ASIC ARP table from index arp_valid_idx till valid one. Defined in: rtk_rg_liteRomeDriver.h *arpInfo [in] An empty buffer for storing the ARP entry data structure. [out] The data structure of found ARP entry. *arp_valid_idx [in] The index which find from. [out] The existing entry index. arpInfo.arpEntry - The ARP entry data structure. arpInfo.valid - The ARP entry is valid or not. arpEntry.idleSecs - The ARP entry idle time in seconds. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_NO_MORE_ENTRY_FO UND Success system is not initiated. input buffer pointer is NULL. the index out of range no more exist entry is found. 12.51. rtk_rg_neighborEntry_add Parameters Comments int32 rtk_rg_neighborEntry_add(rtk_rg_neighborEntry_t *neighborEntry, int *neighbor_idx) Add an Neighbor Entry into ASIC Defined in: rtk_rg_liteRomeDriver.h *neighborEntry [in] Fill rtk_rg_neighborEntry_t each fields for adding. *neighbor_idx [out] Return Neighbor entry index. neighborEntry.l2Idx - this MAC entry index of this Neighbor entry. neighborEntry.matchRouteIdx - the routing entry idx that match the ip address. Realtek confidential documentation 119 Rev 1.1.2 Realtek RG RomeDriver Programming Guide neighborEntry.interfaceId - the 64 bits interface identifier of this IPv6 address. neighborEntry.staticEntry - this entry is static ARP, and it will never age out. neighborEntry.valid - this entry is valid. If the neighborEntry.static_entry is set. The MAC entry must set static, too. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INVALID_PARAM RT_ERR_RG_L2_ENTRY_NOT_FOU ND RT_ERR_RG_NEIGHBOR_FULL Success system is not initiated. the input parameter contains illegal information. L2 entry not found. neighbor table is full 12.52. rtk_rg_neighborEntry_del Parameters int32 rtk_rg_neighborEntry_del(int neighbor_idx) Delete an ASIC Neighbor Entry. Defined in: rtk_rg_liteRomeDriver.h neighbor_idx [out] The Neighbor entry index for deleting. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_ENTRY_NOT_EXIST Success system is not initiated. the index out of range. the index is not exist. 12.53. rtk_rg_neighborEntry_find Parameters Comments int32 rtk_rg_neighborEntry_find(rtk_rg_neighborInfo_t *neighborInfo, int *neighbor_valid_idx) Find the entire ASIC Neighbor table from index neighbor_valid_idx till valid one. Defined in: rtk_rg_liteRomeDriver.h *neighborInfo [in] An empty buffer for storing the Neighbor entry data structure. [out] The data structure of found Neighbor entry.int *neighbor_valid_idx [in] The index which find from. [out] The existing entry index. neighborInfo.arpEntry - The Neighbor entry data structure. neighborInfo.idleSecs - The Neighbor entry idle time in seconds. Return Codes RT_ERR_RG_OK RT_ERR_RG_NOT_INIT RT_ERR_RG_NULL_POINTER RT_ERR_RG_INDEX_OUT_OF_RAN GE RT_ERR_RG_NO_MORE_ENTRY_FO UND RT_ERR_RG_NEIGHBOR_NOT_FOU ND Realtek confidential documentation Success system is not initiated. input buffer pointer is NULL. the index out of range no more exist entry is found. the indicated neighbor ifid is not found. 120 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.54. rtk_rg_softwareSourceAddrLearningLimit_ set Parameters Comments int32 rtk_rg_softwareSourceAddrLearningLimit_set(rtk_rg_saLearningLimitInfo_t sa_learnLimit_info, rtk_rg_port_idx_t port_idx) Set source address learning limit and action when using software learning. Defined in: rtk_rg_liteRomeDriver.h sa_learnLimit_info [in] The information entered for the dedicated port. port_idx [in] The port number to set source address learning information. sa_learnLimit_info.learningLimitNumber - the maximum number can be learned in the port. sa_learnLimit_info.action - what to do if a packet is exceed the learning limit. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success system is not initiated. 12.55. rtk_rg_softwareSourceAddrLearningLimit_ get Parameters int32 rtk_rg_softwareSourceAddrLearningLimit_get(rtk_rg_saLearningLimitInfo_t *sa_learnLimit_info, rtk_rg_port_idx_t port_idx) Get source address learning limit and action when using software learning by port number. Defined in: rtk_rg_liteRomeDriver.h *sa_learnLimit_info [out] The information contained of the dedicated port. port_idx [in] The port number to get source address learning information. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success system is not initiated. 12.56. rtk_rg_dosPortMaskEnable_set Parameters int32 rtk_rg_dosPortMaskEnable_set(rtk_rg_mac_portmask_t dos_port_mask) Enable/Disable denial of service security port. Defined in: rtk_rg_liteRomeDriver.h dos_port_mask [in] Security MAC port mask. None Comments Return Codes RT_ERR_RG_OK Success Realtek confidential documentation 121 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.57. rtk_rg_dosPortMaskEnable_get Parameters int32 rtk_rg_dosPortMaskEnable_get(rtk_rg_mac_portmask_t *dos_port_mask) Get denial of service port security port state. Defined in: rtk_rg_liteRomeDriver.h *dos_port_mask [out] Security MAC port mask. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input port mask pointer is NULL. 12.58. rtk_rg_dosType_set Parameters Comments int32 rtk_rg_dosType_set(rtk_rg_dos_type_t dos_type, int dos_enabled, rtk_rg_dos_action_t dos_action) Set denial of service type function. Defined in: rtk_rg_liteRomeDriver.h dos_type [in] Port security type. dos_enabled [in] Port security function enabled/disabled. dos_action [in] Port security action. dos_type.RTK_RG_DAEQSA_DENY - packets while SMAC is the same as DMAC. dos_type.RTK_RG_LAND_DENY - packets while SIP is the same as DIP(support IPv4 only). dos_type.RTK_RG_BLAT_DENY - packets while the TCP/UDP SPORT is the same as DPORT destination TCP/UDP port. dos_type.RTK_RG_SYNFIN_DENY - TCP packets while SYN and FIN bits are set. dos_type.RTK_RG_XMA_DENY - TCP packets while sequence number is zero and FIN,URG,PSH bits are set. dos_type.RTK_RG_NULLSCAN_DENY TCP packets while sequence number is zero and all contorl bits are zeros. dos_type.RTK_RG_SYN_SPORTL1024_DENY - TCP SYN packets with source port less than 1024. dos_type.RTK_RG_TCPHDR_MIN_CHECK - the length of a TCP header carried in an unfragmented IP(IPv4 and IPv6) datagram or the first fragment of a fragmented IP(IPv4) datagram is less than MIN_TCP_Header_Size(20 bytes). dos_type.RTK_RG_TCP_FRAG_OFF_MIN_CHECK - the Frangment_Offset=1 in anyfragment of a fragmented IP datagram carrying part of TCP data. dos_type.RTK_RG_ICMP_FRAG_PKTS_DENY - ICMPv4/ICMPv6 data unit carried in a fragmented IP datagram. dos_type.RTK_RG_POD_DENY - IP packet size > 65535 bytes, ((IP offset *8) + (IP length) ¡V (IPIHL*4))>65535. dos_type.RTK_RG_UDPDOMB_DENY - UDP length > IP payload length. dos_type.RTK_RG_SYNWITHDATA_DENY - 1. IP length > IP header + TCP header length while SYN flag is set 1. 2. IP More Fragment and Offset > 0 while SYN is set to 1. dos_action.RTK_RG_DOS_ACTION_DROP - Drop packet while hit DoS criteria. dos_action.RTK_RG_DOS_ACTION_TRAP - Trap packet to CPU while hit DoS criteria. Return Codes RT_ERR_RG_OK Success the input parameter contains illegal information. Realtek confidential documentation 122 RT_ERR_RG_INVALID_PARAM Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.59. rtk_rg_dosType_get Parameters Comments int32 rtk_rg_dosType_get(rtk_rg_dos_type_t dos_type, int *dos_enabled, rtk_rg_dos_action_t *dos_action) Get denial of service type function. Defined in: rtk_rg_liteRomeDriver.h dos_type [in] Port security type. *dos_enabled [out] Port security function enabled/disabled. *dos_action [out] Port security action. dos_type.RTK_RG_DAEQSA_DENY - packets while SMAC is the same as DMAC. dos_type.RTK_RG_LAND_DENY - packets while SIP is the same as DIP(support IPv4 only). dos_type.RTK_RG_BLAT_DENY - packets while the TCP/UDP SPORT is the same as DPORT destination TCP/UDP port. dos_type.RTK_RG_SYNFIN_DENY - TCP packets while SYN and FIN bits are set. dos_type.RTK_RG_XMA_DENY - TCP packets while sequence number is zero and FIN,URG,PSH bits are set. dos_type.RTK_RG_NULLSCAN_DENY TCP packets while sequence number is zero and all contorl bits are zeros. dos_type.RTK_RG_SYN_SPORTL1024_DENY - TCP SYN packets with source port less than 1024. dos_type.RTK_RG_TCPHDR_MIN_CHECK - the length of a TCP header carried in an unfragmented IP(IPv4 and IPv6) datagram or the first fragment of a fragmented IP(IPv4) datagram is less than MIN_TCP_Header_Size(20 bytes). dos_type.RTK_RG_TCP_FRAG_OFF_MIN_CHECK - the Frangment_Offset=1 in anyfragment of a fragmented IP datagram carrying part of TCP data. dos_type.RTK_RG_ICMP_FRAG_PKTS_DENY - ICMPv4/ICMPv6 data unit carried in a fragmented IP datagram. dos_type.RTK_RG_POD_DENY - IP packet size > 65535 bytes, ((IP offset *8) + (IP length) ¡V (IPIHL*4))>65535. dos_type.RTK_RG_UDPDOMB_DENY - UDP length > IP payload length. dos_type.RTK_RG_SYNWITHDATA_DENY - 1. IP length > IP header + TCP header length while SYN flag is set 1. 2. IP More Fragment and Offset > 0 while SYN is set to 1. dos_action.RTK_RG_DOS_ACTION_DROP - Drop packet while hit DoS criteria. dos_action.RTK_RG_DOS_ACTION_TRAP - Trap packet to CPU while hit DoS criteria. Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input port mask pointer is NULL. 12.60. rtk_rg_dosFloodType_set Parameters Comments int32 rtk_rg_dosFloodType_set(rtk_rg_dos_type_t dos_type, int dos_enabled, rtk_rg_dos_action_t dos_action, int dos_threshold) Set denial of service flooding attack protection function. Defined in: rtk_rg_liteRomeDriver.h dos_type [in] Port security type. dos_enabled [in] Port security function enabled/disabled. dos_action [in] Port security action. dos_threshold [in] System dos_type.RTK_RG_SYNFLOOD_DENY - Receiving TCP SYN packet number is over Realtek confidential documentation 123 Rev 1.1.2 Realtek RG RomeDriver Programming Guide threshold. dos_type.RTK_RG_FINFLOOD_DENY - Receiving TCP FIN packet number is over threshold. dos_type.RTK_RG_ICMPFLOOD_DENY - Receiving ICMP packet number is over threshold. dos_action.RTK_RG_DOS_ACTION_DROP - Drop packet while hit DoS criteria. dos_action.RTK_RG_DOS_ACTION_TRAP - Trap packet to CPU while hit DoS criteria. dos_threshold - Allowable SYN/FIN/ICMP packet frame rate. The forwarding rate is dos_threshold*1k packets per second. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success the input parameter contains illegal information. 12.61. rtk_rg_dosFloodType_get Parameters Comments int32 rtk_rg_dosFloodType_get(rtk_rg_dos_type_t dos_type, int *dos_enabled, rtk_rg_dos_action_t *dos_action, int *dos_threshold) Get denial of service port security setting. Defined in: rtk_rg_liteRomeDriver.h dos_type [in] Port security type. *dos_enabled [out] Port security function enabled/disabled. *dos_action [out] Port security action. *dos_threshold [out] System dos_type.RTK_RG_SYNFLOOD_DENY - Receiving TCP SYN packet number is over threshold. dos_type.RTK_RG_FINFLOOD_DENY - Receiving TCP FIN packet number is over threshold. dos_type.RTK_RG_ICMPFLOOD_DENY - Receiving ICMP packet number is over threshold. dos_action.RTK_RG_DOS_ACTION_DROP - Drop packet while hit DoS criteria. dos_action.RTK_RG_DOS_ACTION_TRAP - Trap packet to CPU while hit DoS criteria. dos_threshold - Allowable SYN/FIN/ICMP packet frame rate. The forwarding rate is dos_threshold*1k packets per second. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM RT_ERR_RG_NULL_POINTER Success the input parameter contains illegal information. input port mask pointer is NULL. 12.62. rtk_rg_portMirror_set Parameters int32 rtk_rg_portMirror_set(rtk_rg_portMirrorInfo_t portMirrorInfo) Enable portMirror for monitor Tx/Rx packet. Defined in: rtk_rg_liteRomeDriver.h portMirrorInfo [in] assign monitor port None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM RT_ERR_RG_NULL_POINTER Realtek confidential documentation Success the input parameter contains illegal information. input port mask pointer is NULL. 124 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.63. rtk_rg_portMirror_get Parameters int32 rtk_rg_portMirror_get(rtk_rg_portMirrorInfo_t *portMirrorInfo) Get portMirror for monitor Tx/Rx packet information. Defined in: rtk_rg_liteRomeDriver.h *portMirrorInfo [out] assigned monitor port None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input port mask pointer is NULL. 12.64. rtk_rg_portMirror_clear Parameters int32 rtk_rg_portMirror_clear( void) clear port mirror setting Defined in: rtk_rg_liteRomeDriver.h void None Comments Return Codes RT_ERR_RG_OK Success 12.65. rtk_rg_portEgrBandwidthCtrlRate_set Parameters Comments int32 rtk_rg_portEgrBandwidthCtrlRate_set(rtk_rg_mac_port_idx_t port, uint32 rate) Set egress rate limitation for physical port. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned rate limit port rate [in] assigned rate, unit Kbps (1) The rate unit is 1 kbps and the range is from 8k to 1048568k. (2) The granularity of rate is 8 kbps (3) rate set 0, means unlimit Return Codes RT_ERR_RG_OK Success 12.66. rtk_rg_portIgrBandwidthCtrlRate_set Parameters int32 rtk_rg_portIgrBandwidthCtrlRate_set(rtk_rg_mac_port_idx_t port, uint32 rate) Set ingress rate limitation for physical port. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned rate limit port Realtek confidential documentation 125 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments rate [in] assigned rate, unit Kbps (1) The rate unit is 1 kbps and the range is from 8k to 1048568k. (2) The granularity of rate is 8 kbps (3) rate set 0, means unlimit Return Codes RT_ERR_RG_OK Success 12.67. rtk_rg_portEgrBandwidthCtrlRate_get Parameters int32 rtk_rg_portEgrBandwidthCtrlRate_get(rtk_rg_mac_port_idx_t port, uint32 *rate) Get egress rate limitation of physical port. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned rate limit port *rate [out] assigned rate, unit Kbps None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input rate pointer is NULL. 12.68. rtk_rg_portIgrBandwidthCtrlRate_get Parameters int32 rtk_rg_portIgrBandwidthCtrlRate_get(rtk_rg_mac_port_idx_t port, uint32 *rate) Get ingress rate limitation of physical port. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned rate limit port *rate [out] assigned rate, unit Kbps None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input rate pointer is NULL. 12.69. rtk_rg_phyPortForceAbility_set Parameters int32 rtk_rg_phyPortForceAbility_set(rtk_rg_mac_port_idx_t port, rtk_rg_phyPortAbilityInfo_t ability) Force Set physical port status & ability. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned physical port ability [in] ENABLED:force link None Comments Return Codes RT_ERR_RG_OK Success Realtek confidential documentation 126 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.70. rtk_rg_phyPortForceAbility_get Parameters int32 rtk_rg_phyPortForceAbility_get(rtk_rg_mac_port_idx_t port, rtk_rg_phyPortAbilityInfo_t *ability) Get physical port status & ability. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned physical port *ability [out] ENABLED:force link None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success input ability pointer is NULL. 12.71. rtk_rg_portMibInfo_get Parameters Comments int32 rtk_rg_portMibInfo_get(rtk_rg_mac_port_idx_t port, rtk_rg_port_mib_info_t *mibInfo) Get physical port mib data. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned physical port *mibInfo [out] Enabled/Disabled Force assigned phyPort ability mibInfo->ifInOctets - The total number of octets received on the interface¡A including framing characters. mibInfo->ifInUcastPkts - The number of packets, delivered by this sub-layer to a higher (sub-)layer, which were not addressed to a multicast or broadcast address at this sub-layer. mibInfo->ifInMulticastPkts - The number of packets¡A delivered by this sub-layer to a higher (sub-)layer¡A which were addressed to a multicast address at this sub-layer. For a MAC layer protocol¡A this includes both Group and Functional addresses. mibInfo->ifInBroadcastPkts - The number of packets¡A delivered by this sub-layer to a higher (sub-)layer¡A which were addressed to a broadcast address at this sub-layer. mibInfo->ifInDiscards - The number of inbound packets which were chosen to be discarded even though no errors had been detected to prevent their being transmitted. One possible reason for discarding such a packet could be to free up buffer space. mibInfo->ifOutOctets - The total number of octets transmitted out of the interface¡A including framing characters. mibInfo->ifOutDiscards - The number of outbound packets which were chosen to be discarded even though no errors had been detected to prevent their being transmitted. One possible reason for discarding such a packet could be to free up buffer space. mibInfo->ifOutUcastPkts - The total number of packets that higher-level protocols requested be transmitted, and which were not addressed to a multicast or broadcast address at this sub-layer, including those that were discarded or not sent. mibInfo->ifOutMulticastPkts - The total number of packets that higher-level protocols requested be transmitted, and which were addressed to a multicast address at this sub-layer, including those that were discarded or not sent. mibInfo->ifOutBrocastPkts - The total number of packets that higher-level protocols requested be transmitted, and which were addressed to a broadcast address at this sub-layer, including those that were discarded or not sent. mibInfo->dot1dBasePortDelayExceededDiscards - The number of transmitted frames that were discarded due to the maximum bridge transit delay being exceeded. mibInfo->dot1dTpPortInDiscards - Count of valid frames received which were Realtek confidential documentation 127 Rev 1.1.2 Realtek RG RomeDriver Programming Guide discarded (i.e., filtered) by the Forwarding Process. mibInfo->dot1dTpHcPortInDiscards - The total number of Forwarding Database entries¡A which have been or would have been learnt¡A but have been discarded due to lack of space to store them in the Forwarding Database. mibInfo->dot3InPauseFrames - A count of MAC Control frames received on this interface with an opcode indicating the PAUSE operation. mibInfo->dot3OutPauseFrames - A count of MAC control frames transmitted on this interface with an opcode indicating the PAUSE operation. mibInfo->dot3StatsAligmentErrors - The total number of bits of a received frame is not divisible by eight. mibInfo->dot3StatsFCSErrors - The number of received frame that frame check sequence error. mibInfo->dot3StatsSingleCollisionFrames - A count of frames that are involved in a single collision¡A and are subsequently transmitted successfully. mibInfo->dot3StatsMultipleCollisionFrames - A count of frames that are involved in more than one collision and are subsequently transmitted successfully. mibInfo->dot3StatsDeferredTransmissions - A count of frames for which the first transmission attempt on a particular interface is delayed because the medium is busy. mibInfo->dot3StatsLateCollisions - The number of times that a collision is detected on a particular interface later than one slotTime into the transmission of a packet. mibInfo->dot3StatsExcessiveCollisions - A count of frames for which transmission on a particular interface fails due to excessive collisions. mibInfo->dot3StatsFrameTooLongs RX_etherStatsOversizePkt - RX_etherStatsPkts1519toMaxOctets. mibInfo->dot3StatsSymbolErrors - Number of data symbol errors. mibInfo->dot3ControlInUnknownOpcodes - A count of MAC Control frames received on this interface that contain an opcode that is not supported by this device. mibInfo->etherStatsDropEvents - Number of received packets dropped due to lack of resource. mibInfo->etherStatsOctets - ifInOctets(bad+good) + ifOutOctets(bad+good). mibInfo->etherStatsBcastPkts - The total number of packets that were directed to the broadcast address. Note that this does not include multicast packets. mibInfo->etherStatsMcastPkts - The total number of packets that were directed to a multicast address. Note that this number does not include packets directed to the broadcast address. mibInfo->etherStatsUndersizePkts - The total number of packets that were less than 64 octets long (excluding framing bits, but including FCS octets) and were otherwise well formed. mibInfo->etherStatsOversizePkts - Number of valid packets whose size are more than 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsFragments - Number of invalid (FCS error / alignment error) packets whose size are less than 64 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsJabbers - Number of invalid (FCS error / alignment error) packets whose size are more than 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsCollisions - The best estimate of the total number of collisions on this Ethernet segment. mibInfo->etherStatsCRCAlignErrors The total number of packets that had a length (excluding framing bits, but including FCS octets) of between 64 and 1518 octets, inclusive, but had either a bad Frame Check Sequence (FCS) with an integral number of mibInfo->etherStatsPkts64Octets - Number of all packets whose size are exactly 64 bytes¡Aincluding MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsPkts65to127Octets - Number of all packets whose size are between 65 ~ 127 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsPkts128to255Octets - Number of all packets whose size are between 128 ~ 255 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsPkts256to511Octets - Number of all packets whose size are between 256 ~ 511 bytes¡A including FCS¡A excluding MAC header¡A preamble and SFD. mibInfo->etherStatsPkts512to1023Octets - Number of all packets whose size are between 512 ~ 1023 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsPkts1024to1518Octets - Number of all packets whose size are between 1024 ~ 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxOctets - ifOutOctets. mibInfo->etherStatsTxUndersizePkts - The total number of packets transmitted that were less than 64 octets long (excluding framing bits, but including FCS octets) and were otherwise well formed. mibInfo->etherStatsTxOversizePkts Number of transmitted valid packets whose size are more than 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts64Octets - Number Realtek confidential documentation 128 Rev 1.1.2 Realtek RG RomeDriver Programming Guide of all transmitted packets whose size are exactly 64 bytes¡Aincluding MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts65to127Octets - Number of all transmitted packets whose size are between 65 ~ 127 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts128to255Octets - Number of all transmitted packets whose size are between 128 ~ 255 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts256to511Octets - Number of all transmitted packets whose size are between 256 ~ 511 bytes¡A including FCS¡A excluding MAC header¡A preamble and SFD. mibInfo->etherStatsTxPkts512to1023Octets - Number of all transmitted packets whose size are between 512 ~ 1023 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts1024to1518Octets - - Number of all transmitted packets whose size are between 1024 ~ 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxPkts1519toMaxOctets - The total number of packets (including bad packets) transmitted that were between 1519 and Max octets in length inclusive (excluding framing bits but including FCS octets). mibInfo->etherStatsTxBcastPkts - The total number of good packets transmitted that were directed to the broadcast address. Note that this does not include multicast packets. mibInfo->etherStatsTxMcastPkts - The total number of good packets transmitted that were directed to a multicast address. Note that this number does not include packets directed to the broadcast address. mibInfo->etherStatsTxFragments - Number of transmitted invalid (FCS error / alignment error) packets whose size are less than 64 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxJabbers - Number of transmitted invalid (FCS error / alignment error) packets whose size are more than 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsTxCRCAlignErrors - The total number of packets transmitted that had a length (excluding framing bits, but including FCS octets) of between 64 and 1518 octets, inclusive, but had either a bad Frame Check Sequence (FCS) with an integ mibInfo->etherStatsRxUndersizePkts - The total number of packets received that were less than 64 octets long (excluding framing bits, but including FCS octets) and were otherwise well formed. mibInfo->etherStatsRxUndersizeDropPkts - The total number of packets received that were less than 64 octets long (excluding framing bits, but including FCS octets) and were otherwise well formed. mibInfo->etherStatsRxOversizePkts - Number of received valid packets whose size are more than 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts64Octets - Number of all received packets whose size are exactly 64 bytes¡Aincluding MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts65to127Octets - Number of all received packets whose size are between 65 ~ 127 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts128to255Octets - Number of all received packets whose size are between 128 ~ 255 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts256to511Octets - Number of all received packets whose size are between 256 ~ 511 bytes¡A including FCS¡A excluding MAC header¡A preamble and SFD. mibInfo->etherStatsRxPkts512to1023Octets - Number of all received packets whose size are between 512 ~ 1023 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts1024to1518Octets - Number of all received packets whose size are between 1024 ~ 1518 bytes¡A including MAC header and FCS¡A excluding preamble and SFD. mibInfo->etherStatsRxPkts1519toMaxOctets - The total number of packets (including bad packets) received that were between 1519 and Max octets in length inclusive (excluding framing bits but including FCS octets). mibInfo->inOampduPkts - Number of received OAMPDUs. mibInfo->outOampduPkts - A count of OAMPDUs transmitted on this interface. Return Codes RT_ERR_RG_OK Success input ability pointer is NULL. the input parameter contains illegal information. Realtek confidential documentation 129 RT_ERR_RG_NULL_POINTER RT_ERR_RG_INVALID_PARAM Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.72. rtk_rg_portMibInfo_clear Parameters int32 rtk_rg_portMibInfo_clear(rtk_rg_mac_port_idx_t port) Clear physical port mib data. Defined in: rtk_rg_liteRomeDriver.h port [in] assigned physical port None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success the input parameter contains illegal information. 12.73. rtk_rg_stormControl_add Parameters int32 rtk_rg_stormControl_add(rtk_rg_stormControlInfo_t *stormInfo, int *stormInfo_idx) Add stormControl. Defined in: rtk_rg_liteRomeDriver.h *stormInfo [in] enable stormCtrol *stormInfo_idx [in] assigned port None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_NULL_POINTER parameter is null. RT_ERR_RG_INVALID_PARAM parameters value is out of range. RT_ERR_RG_STORMCONTROL_EN same stormInfo has been set before . TRY_HAS_BEEN_SET RT_ERR_RG_STORMCONTROL_TYP add stormType full(ASIC support at most 4 different E_FULL types) 12.74. rtk_rg_stormControl_del Parameters int32 rtk_rg_stormControl_del(int stormInfo_idx) Delete stormControl. Defined in: rtk_rg_liteRomeDriver.h stormInfo_idx [out] The index of stormInfo which should be delete. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Realtek confidential documentation Success parameters value is out of range. 130 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.75. rtk_rg_stormControl_find Parameters int32 rtk_rg_stormControl_find(rtk_rg_stormControlInfo_t *stormInfo, int *stormInfo_idx) Find stormInfo index. Defined in: rtk_rg_liteRomeDriver.h *stormInfo [in] assigned compare port *stormInfo_idx [in] assigned compare stormType None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_NULL_POINTER parameter is null. RT_ERR_RG_INVALID_PARAM parameters value is out of range. RT_ERR_RG_STORMCONTROL_EN TRY_NOT_FOUND assigned stormInfo not found 12.76. rtk_rg_shareMeter_set Parameters Comments int32 rtk_rg_shareMeter_set(uint32 index, uint32 rate, rtk_rg_enable_t ifgInclude) Set shareMeter rate. Defined in: rtk_rg_liteRomeDriver.h index [in] shared meter index rate [in] rate of share meter ifgInclude [in] include IFG or not, ENABLE:include DISABLE:exclude The API can set shared meter rate and ifg include for each meter. The rate unit is 1 kbps and the range is from 8k to 1048568k. The granularity of rate is 8 kbps. The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble. Return Codes RT_ERR_RG_OK Success 12.77. rtk_rg_shareMeter_get int32 rtk_rg_shareMeter_get(uint32 index, uint32 *pRate, rtk_rg_enable_t *pIfgInclude) Get shareMeter rate. Defined in: rtk_rg_liteRomeDriver.h index Parameters [in] shared meter index *pRate [out] pointer of rate of share meter *pIfgInclude [out] include IFG or not, ENABLE:include DISABLE:exclude The API can get shared meter rate and ifg include for each meter. The rate unit is 1 kbps and Comments 131 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide the granularity of rate is 8 kbps. The ifg_include parameter is used for rate calculation with/without inter-frame-gap and preamble Return Codes RT_ERR_RG_OK Success 12.78. rtk_rg_qosStrictPriorityOrWeightFairQueu e_set Parameters Comments int32 rtk_rg_qosStrictPriorityOrWeightFairQueue_set(rtk_rg_mac_port_idx_t port_idx, rtk_rg_qos_queue_weights_t q_weight) Set the scheduling types and weights of queues on specific port in egress scheduling. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] The port index q_weight [in] The array of weights for WRR/WFQ queue (valid:1~128, 0 for STRICT_PRIORITY queue) The types of queue are: WFQ_WRR_PRIORITY or STRICT_PRIORITY. If the weight is 0 then the type is STRICT_PRIORITY, else the type is WFQ_WRR_PRIORITY. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_FAILED parameters value is out of range. 12.79. rtk_rg_qosStrictPriorityOrWeightFairQueu e_get Parameters Comments int32 rtk_rg_qosStrictPriorityOrWeightFairQueue_get(rtk_rg_mac_port_idx_t port_idx, rtk_rg_qos_queue_weights_t *pQ_weight) Get the scheduling types and weights of queues on specific port in egress scheduling. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] The port index. *pQ_weight [in] Pointer to the array of weights for WRR/WFQ queue (valid:1~128, 0 for STRICT_PRIORITY queue) The types of queue are: WFQ_WRR_PRIORITY or STRICT_PRIORITY. If the weight is 0 then the type is STRICT_PRIORITY, else the type is WFQ_WRR_PRIORITY. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. RT_ERR_RG_FAILED assigned stormInfo not found Realtek confidential documentation 132 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.80. rtk_rg_qosInternalPriMapToQueueId_set Parameters Comments int32 rtk_rg_qosInternalPriMapToQueueId_set(int int_pri, int queue_id) Set the entry of internal priority to QID mapping table. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal priority queue_id [in] Mapping queue Id. Below is an example of internal priority to QID mapping table. - Priority 0 1 2 3 4 5 6 7 ==================== - queue 0 0 1 1 2 2 3 3 -for table index 0 pPri2qid[0] = 0 internal priority 0 map to queue 0 pPri2qid[1] = 0 internal priority 1 map to queue 0 pPri2qid[2] = 1 internal priority 2 map to queue 1 pPri2qid[3] = 1 internal priority 3 map to queue 1 pPri2qid[4] = 2 internal priority 4 map to queue 2 pPri2qid[5] = 2 internal priority 5 map to queue 2 pPri2qid[6] = 3 internal priority 6 map to queue 3 pPri2qid[7] = 3 internal priority 7 map to queue 3 Return Codes RT_ERR_RG_INVALID_PARAM RT_ERR_OK Success ok 12.81. rtk_rg_qosInternalPriMapToQueueId_get Parameters int32 rtk_rg_qosInternalPriMapToQueueId_get(int int_pri, int *pQueue_id) Get the entry of internal priority to QID mapping table. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal priority *pQueue_id [out] Pointer to mapping queue Id. None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. Realtek confidential documentation 133 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.82. rtk_rg_qosInternalPriDecisionByWeight_s et Parameters int32 rtk_rg_qosInternalPriDecisionByWeight_set(rtk_rg_qos_priSelWeight_t weightOfPriSel) Set weight of each priority assignment. Defined in: rtk_rg_liteRomeDriver.h weightOfPriSel [in] weight of each priority assignment None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.83. rtk_rg_qosInternalPriDecisionByWeight_g et Parameters int32 rtk_rg_qosInternalPriDecisionByWeight_get(rtk_rg_qos_priSelWeight_t *pWeightOfPriSel) Get weight of each priority assignment. Defined in: rtk_rg_liteRomeDriver.h *pWeightOfPriSel [out] weight of each priority assignment None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success parameter is null. 12.84. rtk_rg_qosDscpRemapToInternalPri_set Parameters int32 rtk_rg_qosDscpRemapToInternalPri_set(uint32 dscp, uint32 int_pri) Set remapped internal priority of DSCP. Defined in: rtk_rg_liteRomeDriver.h dscp [in] DSCP int_pri [in] internal priority Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Realtek confidential documentation Success parameter is null. 134 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.85. rtk_rg_qosDscpRemapToInternalPri_get Parameters int32 rtk_rg_qosDscpRemapToInternalPri_get(uint32 dscp, uint32 *pInt_pri) Get remapped internal priority of DSCP. Defined in: rtk_rg_liteRomeDriver.h dscp [in] DSCP *pInt_pri [out] internal priority Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. 12.86. rtk_rg_qosPortBasedPriority_set Parameters int32 rtk_rg_qosPortBasedPriority_set(rtk_rg_mac_port_idx_t port_idx, uint32 int_pri) Set internal priority of one port. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] Port index, including extension port. int_pri [in] Priorities assigment for specific port. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.87. rtk_rg_qosPortBasedPriority_get Parameters int32 rtk_rg_qosPortBasedPriority_get(rtk_rg_mac_port_idx_t port_idx, uint32 *pInt_pri) Get internal priority of one port. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] Port index, including extension port. *pInt_pri [out] Priorities assigment for specific port. None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. Realtek confidential documentation 135 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.88. rtk_rg_qosDot1pPriRemapToInternalPri_se t Parameters int32 rtk_rg_qosDot1pPriRemapToInternalPri_set(uint32 dot1p, uint32 int_pri) Set remapped internal priority of 802.1p priority. Defined in: rtk_rg_liteRomeDriver.h dot1p [in] 802.1p priority int_pri [in] internal priority Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.89. rtk_rg_qosDot1pPriRemapToInternalPri_ge t Parameters int32 rtk_rg_qosDot1pPriRemapToInternalPri_get(uint32 dot1p, uint32 *pInt_pri) Get remapped internal priority of 802.1p priority. Defined in: rtk_rg_liteRomeDriver.h dot1p [in] 802.1p priority *pInt_pri [out] internal priority Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. 12.90. rtk_rg_qosDscpRemarkEgressPortEnable AndSrcSelect_set Parameters int32 rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_set(rtk_rg_mac_port_idx_t rmk_port, rtk_rg_enable_t rmk_enable, rtk_rg_qos_dscpRmkSrc_t rmk_src_select) Set remark DSCP enable/disable port. Defined in: rtk_rg_liteRomeDriver.h rmk_port [in] Enable/Dsiable DSCP remarking port rmk_enable [in] Enable/Disable DSCP remark Realtek confidential documentation 136 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments rmk_src_select [in] DSCP remarking source rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.91. rtk_rg_qosDscpRemarkEgressPortEnable AndSrcSelect_get Parameters Comments int32 rtk_rg_qosDscpRemarkEgressPortEnableAndSrcSelect_get(rtk_rg_mac_port_idx_t rmk_port, rtk_rg_enable_t *pRmk_enable, rtk_rg_qos_dscpRmkSrc_t *pRmk_src_select) Get remark DSCP enable/disable port and remarking source. Defined in: rtk_rg_liteRomeDriver.h rmk_port [in] DSCP remarking port *pRmk_enable [in] Pointer to DSCP remarking port enabled/disabled *pRmk_src_select [in] Pointer to DSCP remarking source rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. RT_ERR_RG_FAILED assigned stormInfo not found 12.92. rtk_rg_qosDscpRemarkByInternalPri_set Parameters Comments int32 rtk_rg_qosDscpRemarkByInternalPri_set(int int_pri, int rmk_dscp) Set Internal priority/User priority to DSCP remarking mapping. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal/User priority rmk_dscp [in] DSCP remarking value rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Realtek confidential documentation Success parameter is null. 137 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.93. rtk_rg_qosDscpRemarkByInternalPri_get Parameters Comments int32 rtk_rg_qosDscpRemarkByInternalPri_get(int int_pri, int *pRmk_dscp) Get Internal priority/User priority to DSCP remarking mapping. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal/User priority *pRmk_dscp [out] Pointer to remarking DSCP rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. 12.94. rtk_rg_qosDscpRemarkByDscp_set Parameters Comments int32 rtk_rg_qosDscpRemarkByDscp_set(int dscp, int rmk_dscp) Set DSCP to DSCP remarking mapping. Defined in: rtk_rg_liteRomeDriver.h dscp [in] DSCP source rmk_dscp [in] DSCP remarking value rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.95. rtk_rg_qosDscpRemarkByDscp_get int32 rtk_rg_qosDscpRemarkByDscp_get(int dscp, int *pRmk_dscp) Get DSCP to DSCP remarking mapping. Defined in: rtk_rg_liteRomeDriver.h dscp Parameters [in] DSCP source *pRmk_dscp [out] Pointer to DSCP remarking value rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as Comments DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP 138 Realtek confidential documentation Rev 1.1.2 Realtek RG RomeDriver Programming Guide Using DSCP as DSCP remarking source. Success Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. 12.96. rtk_rg_qosDot1pPriRemarkByInternalPriE gressPortEnable_set Parameters Comments int32 rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEnable_set(rtk_rg_mac_port_idx_t rmk_port, rtk_rg_enable_t rmk_enable) Set remark 802.1p priority port. Defined in: rtk_rg_liteRomeDriver.h rmk_port [in] Enable/Dsiable 802.1p remarking port. rmk_enable [in] Enable/Disable 1p remark. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.97. rtk_rg_qosDot1pPriRemarkByInternalPriE gressPortEnable_get Parameters Comments int32 rtk_rg_qosDot1pPriRemarkByInternalPriEgressPortEnable_get(rtk_rg_mac_port_idx_t rmk_port, rtk_rg_enable_t *pRmk_enable) Get remark 802.1p priority port. Defined in: rtk_rg_liteRomeDriver.h rmk_port [out] Pointer to 802.1p remarking port. *pRmk_enable [in] Enable/Disable 1p remark. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. Realtek confidential documentation 139 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.98. rtk_rg_qosDot1pPriRemarkByInternalPri_s et Parameters Comments int32 rtk_rg_qosDot1pPriRemarkByInternalPri_set(int int_pri, int rmk_dot1p) Set Internal priority to 802.1p remarking mapping. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal priority rmk_dot1p [in] 802.1p priority remarking value rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK RT_ERR_RG_INVALID_PARAM Success parameter is null. 12.99. rtk_rg_qosDot1pPriRemarkByInternalPri_g et Parameters Comments int32 rtk_rg_qosDot1pPriRemarkByInternalPri_get(int int_pri, int *pRmk_dot1p) Get Internal priority to 802.1p remarking mapping. Defined in: rtk_rg_liteRomeDriver.h int_pri [in] Internal priority *pRmk_dot1p [out] Pointer to 802.1p priority remarking value rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER parameters value is out of range. 12.100. rtk_rg_portBasedCVlanId_set Parameters int32 rtk_rg_portBasedCVlanId_set(rtk_rg_mac_port_idx_t port_idx, int pvid) Set port vlan ID. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] Port index pvid [in] Wished port vlan id. Realtek confidential documentation 140 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Comments rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_ENTRY_NOT_EXIST VlanID not exist 12.101. rtk_rg_portBasedCVlanId_get Parameters Comments int32 rtk_rg_portBasedCVlanId_get(rtk_rg_mac_port_idx_t port_idx, int *pPvid) Get port vlan ID. Defined in: rtk_rg_liteRomeDriver.h port_idx [in] Port index *pPvid [in] Pointer to port vlan id. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER VlanID not exist 12.102. rtk_rg_portStatus_get Parameters Comments int32 rtk_rg_portStatus_get(rtk_rg_mac_port_idx_t port, rtk_rg_portStatusInfo_t *portInfo) Get port linkup status. Defined in: rtk_rg_liteRomeDriver.h port [in] Port index *portInfo [out] port linkup information. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_INT_PRI - Using internal priority as DSCP remarking source. rtk_rg_qos_dscpRmkSrc_t.RTK_RG_DSCP_RMK_SRC_DSCP Using DSCP as DSCP remarking source. Return Codes RT_ERR_RG_OK Success RT_ERR_RG_INVALID_PARAM parameter is null. RT_ERR_RG_NULL_POINTER VlanID not exist Realtek confidential documentation 141 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.103. rtk_rg_naptExtPortGet Parameters int32 rtk_rg_naptExtPortGet(int isTcp, uint16 *pPort) Find a usable external port. Defined in: rtk_rg_liteRomeDriver.h isTcp [in] TCP or UDP *pPort [out] Pointer to a specific wish port Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER Success parameter is null. 12.104. rtk_rg_naptExtPortFree Parameters int32 rtk_rg_naptExtPortFree(int isTcp, uint16 port) Free external port. Defined in: rtk_rg_liteRomeDriver.h isTcp [in] TCP or UDP port [out] L4 port number Apollo only support group 0 Comments Return Codes RT_ERR_RG_OK Success 12.105. rtk_rg_gpon_infoSettings_set Parameters int32 rtk_rg_gpon_infoSettings_set(rtk_rg_gpon_infoSettings_t gpon_info) Set GPON MAC informations. Defined in: rtk_rg_liteRomeDriver.h gpon_info [in] MAC serialNumber, password, and LOID. None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_GPON_SET_INFO_FAIL parameter is null. ED 12.106. rtk_rg_gpon_infoSettings_get int32 rtk_rg_gpon_infoSettings_get(rtk_rg_gpon_infoSettings_t *gpon_info) Get GPON MAC informations. Defined in: rtk_rg_liteRomeDriver.h Realtek confidential documentation 142 Rev 1.1.2 Realtek RG RomeDriver Programming Guide Parameters *gpon_info [out] None MAC serialNumber, password, and LOID. Comments Success Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_GPON_GET_INFO_FAI LED input gpon_info is NULL. VlanID not exist 12.107. rtk_rg_gpon_status_get Parameters int32 rtk_rg_gpon_status_get(rtk_rg_gpon_status_t *gpon_status) Get GPON ONU status. Defined in: rtk_rg_liteRomeDriver.h *gpon_status [out] FSM status. None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_NULL_POINTER input gpon_status is NULL. RT_ERR_RG_GPON_GET_STATUS_F VlanID not exist AILED 12.108. rtk_rg_epon_infoSettings_set Parameters int32 rtk_rg_epon_infoSettings_set(int llid_idx, rtk_rg_epon_infoSettings_t epon_info) Set EPON MAC informations. Defined in: rtk_rg_liteRomeDriver.h llid_idx [in] LLID index want to set. epon_info [in] LLID MAC mappings, and LOID. None Comments Return Codes RT_ERR_RG_OK Success RT_ERR_RG_GPON_SET_INFO_FAIL input gpon_status is NULL. ED 12.109. rtk_rg_epon_infoSettings_get Parameters int32 rtk_rg_epon_infoSettings_get(int llid_idx, rtk_rg_epon_infoSettings_t *epon_info) Get EPON MAC informations. Defined in: rtk_rg_liteRomeDriver.h llid_idx [in] LLID index want to get. *epon_info [out] LLID MAC mappings, and LOID. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_EPON_GET_INFO_FAI Realtek confidential documentation Success input epon_info is NULL. VlanID not exist 143 Rev 1.1.2 Realtek RG RomeDriver Programming Guide LED 12.110. rtk_rg_pon_transceiverInfo_get Parameters int32 rtk_rg_pon_transceiverInfo_get(rtk_rg_transceiverType_t type, rtk_rg_transceiverBuf_t *transc_info) Get PON transceiver informations. Defined in: rtk_rg_liteRomeDriver.h type [in] parameter type want to get. *transc_info [out] parameter data. None Comments Return Codes RT_ERR_RG_OK RT_ERR_RG_NULL_POINTER RT_ERR_RG_PON_GET_INFO_FAIL ED Success input transc_info is NULL. VlanID not exist 12.111. rtk_rg_classifyEntry_add Parameters int32 rtk_rg_classifyEntry_add(rtk_rg_classifyEntry_t *classifyFilter) Add an classification entry to ASIC Defined in: rtk_rg_liteRomeDriver.h *classifyFilter The classification configuration that this function will add comparison rule None. Comments Return Codes RT_ERR_OK RT_ERR_FAILED RT_ERR_NULL_POINTER RT_ERR_INPUT ok failed Pointer classifyFilter point to NULL. Invalid input parameters. 12.112. rtk_rg_classifyEntry_find Parameters int32 rtk_rg_classifyEntry_find(int index, rtk_rg_classifyEntry_t *classifyFilter) Get an classification entry from ASIC Defined in: rtk_rg_liteRomeDriver.h index The Index of classification entry *classifyFilter The classification configuration None. Comments Return Codes RT_ERR_OK RT_ERR_FAILED RT_ERR_NULL_POINTER RT_ERR_INPUT Realtek confidential documentation ok failed Pointer pClassifyCfg point to NULL. Invalid input parameters. 144 Rev 1.1.2 Realtek RG RomeDriver Programming Guide 12.113. rtk_rg_classifyEntry_del Parameters int32 rtk_rg_classifyEntry_del(int index) Delete an classification configuration from ASIC Defined in: rtk_rg_liteRomeDriver.h index index of classification entry. None. Comments Return Codes RT_ERR_OK RT_ERR_FAILED RT_ERR_ENTRY_INDEX Realtek confidential documentation ok failed Invalid classification index . 145 Rev 1.1.2
Source Exif Data:
File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.3 Linearized : Yes Create Date : 2013:11:01 17:36:36+08:00 Modify Date : 2013:11:01 17:36:36+08:00 Page Count : 145 Creation Date : 2013:11:01 09:36:36Z Mod Date : 2013:11:01 09:36:36Z Producer : Acrobat Distiller 5.0 (Windows) Author : tysu Metadata Date : 2013:11:01 09:36:36Z Creator : tysu Title : Realtek RomeDriver Programming Guide v1.1.2.docEXIF Metadata provided by EXIF.tools